Skip Headers

Oracle® interMedia Reference
10g Release 1 (10.1)

Part Number B10829-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

Static Methods Unique to the ORDAudio Object Type Relational Interface

This section presents reference information on the interMedia static methods unique to the ORDAudio relational interface.

The relational interface adds interMedia support to audio data stored in BLOBs and BFILEs rather than in the ORDAudio object type. The following interface is defined in the ordaspec.sql file:

.
.
.
  -- Static Methods for the relational interface
  STATIC PROCEDURE export(ctx             IN OUT RAW,
                          local_data      IN BLOB,
                          source_type     IN VARCHAR2,
                          source_location IN VARCHAR2,
                          source_name     IN VARCHAR2),
  --
  STATIC PROCEDURE importFrom(ctx             IN OUT RAW,
                              local_data      IN OUT NOCOPY BLOB,
                              source_type     IN VARCHAR2,
                              source_location IN VARCHAR2,
                              source_name     IN VARCHAR2),
  --
  STATIC PROCEDURE importFrom(ctx             IN OUT RAW,
                              local_data      IN OUT NOCOPY BLOB,
                              source_type     IN VARCHAR2,
                              source_location IN VARCHAR2,
                              source_name     IN VARCHAR2,
                              format          OUT VARCHAR2,
                              mime_type       OUT VARCHAR2),
  --
  STATIC PROCEDURE getProperties(ctx            IN OUT RAW,
                                 audioBlob      IN BLOB,
                                 attributes     IN OUT NOCOPY CLOB,
                                 format         IN VARCHAR2),
  --
  STATIC PROCEDURE getProperties(ctx              IN OUT RAW,
                                 audioBlob        IN BLOB,
                                 attributes       IN OUT NOCOPY CLOB,
                                 mimeType         OUT VARCHAR2,
                                 format           IN OUT VARCHAR2,
                                 encoding         OUT VARCHAR2,
                                 numberOfChannels OUT INTEGER,
                                 samplingRate     OUT INTEGER,
                                 sampleSize       OUT INTEGER,
                                 compressionType  OUT VARCHAR2,
                                 audioDuration    OUT INTEGER),
  --
  STATIC PROCEDURE getProperties(ctx            IN OUT RAW,
                                 audioBfile     IN OUT NOCOPY BFILE,
                                 attributes     IN OUT NOCOPY CLOB,
                                 format         IN VARCHAR2),
  --
  STATIC PROCEDURE getProperties(ctx              IN OUT RAW,
                                 audioBfile       IN OUT NOCOPY BFILE,
                                 attributes       IN OUT NOCOPY CLOB,
                                 mimeType         OUT VARCHAR2,
                                 format           IN OUT VARCHAR2,
                                 encoding         OUT VARCHAR2,
                                 numberOfChannels OUT INTEGER,
                                 samplingRate     OUT INTEGER,
                                 sampleSize       OUT INTEGER,
                                 compressionType  OUT VARCHAR2,
                                 audioDuration    OUT INTEGER),
.
.
.

Example Audio Table Definition

The methods described in this section show examples based on a test audio table TAUD. Refer to the TAUD table definition that follows when reading through the examples:


TAUD Table Definition
CREATE TABLE taud(n                NUMBER, 
                  aud              BLOB,
                  attributes       CLOB,
                  mimetype         VARCHAR2(4000),
                  format           VARCHAR2(31),
                  encoding         VARCHAR2(256),
                  numberofchannels INTEGER,
                  samplingrate     INTEGER,
                  samplesize       INTEGER,
                  compressiontype  VARCHAR2(4000),
                  audioduration    INTEGER)
STORAGE (INITIAL 100K NEXT 100K PCTINCREASE 0);

INSERT INTO taud VALUES(1,EMPTY_BLOB(),EMPTY_CLOB(), NULL, NULL, NULL, NULL,
   NULL, NULL, NULL, NULL);
INSERT INTO taud VALUES(2,EMPTY_BLOB(),EMPTY_CLOB(), NULL, NULL, NULL, NULL,
   NULL, NULL, NULL, NULL);
COMMIT;

getProperties( ) for BLOBs

Format

getProperties(ctx IN OUT RAW,

audioBlob IN BLOB,

attributes IN OUT NOCOPY CLOB,

format IN VARCHAR2);

Description

Reads the audio BLOB data to get the values of the media attributes for supported formats, and then stores them in the input CLOB. This method populates the CLOB with an extensive set of format and application properties in XML form.

Parameters

ctx

The format plug-in context information.

audioBlob

The audio data represented as a BLOB.

attributes

The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the audio BLOB data in XML form.

format

The format of the audio data. If a non-NULL value is specified for this parameter, then the format plug-in for this format type is invoked; otherwise, the default plug-in is used.

Usage Notes

None.

Pragmas

None.

Exceptions

ORDAudioExceptions.AUDIO_PLUGIN_EXCEPTION

This exception is raised if you call the getProperties( ) method and the audio plug-in raises an exception.

ORDSourceExceptions.EMPTY_SOURCE

This exception is raised when the value of the source.local attribute is 1 or 0 (TRUE), but the value of the source.localData attribute is NULL.

Examples

Get the property information for known audio attributes:

DECLARE
  aud_attrib CLOB;
  ctx RAW(64) :=NULL;
  aud_data BLOB;
  aud_format VARCHAR2(160) := NULL;
BEGIN
  SELECT aud, attributes INTO aud_data, aud_attrib FROM taud WHERE N =1 FOR UPDATE;
  ORDSYS.ORDAudio.getProperties(ctx,aud_data,aud_attrib,aud_format);
  DBMS_OUTPUT.put_line('Size of XML Annotations: ' || 
                  TO_CHAR(DBMS_LOB.GETLENGTH(aud_attrib)));
  UPDATE taud SET attributes=aud_attrib WHERE N=1;
  COMMIT;
EXCEPTION
  WHEN OTHERS THEN
  RAISE;
END;
/

getProperties( ) (all attributes) for BLOBs

Format

getProperties(ctx IN OUT RAW,

audioBlob IN BLOB,

attributes IN OUT NOCOPY CLOB,

mimeType OUT VARCHAR2,

format IN OUT VARCHAR2

encoding OUT VARCHAR2,

numberOfChannels OUT INTEGER,

samplingRate OUT INTEGER,

sampleSize OUT INTEGER,

compressionType OUT VARCHAR2,

audioDuration OUT INTEGER);

Description

Reads the audio BLOB data to get the values of the media attributes for supported formats, and then stores them in the input CLOB and returns them as explicit parameters. This method gets the properties for the following attributes of the audio data: duration, MIME type, compression type, format, encoding type, number of channels, sampling rate, and sample size. It populates the CLOB with an extensive set of format and application properties in XML form.

Parameters

ctx

The format plug-in context information.

audioBlob

The audio data represented as a BLOB.

attributes

The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the audio BLOB data in XML form.

mimeType

The MIME type of the audio data.

format

The format of the audio data. If a non-NULL value is specified, then the format plug-in for this format type is invoked. If not specified, the derived format value is returned.

encoding

The encoding type of the audio data.

numberOfChannels

The number of channels in the audio data.

samplingRate

The sampling rate in samples per second at which the audio data was recorded.

sampleSize

The sample width or number of samples of audio in the data.

compressionType

The compression type of the audio data.

audioDuration

The total time required to play the audio data.

Usage Notes

If a property cannot be extracted from the media source, then the respective parameter is set to NULL.

Pragmas

None.

Exceptions

ORDAudioExceptions.AUDIO_PLUGIN_EXCEPTION

This exception is raised if you call the getProperties( ) method and the audio plug-in raises an exception.

ORDSourceExceptions.EMPTY_SOURCE

This exception is raised when the value of the source.local attribute is 1 or 0 (TRUE), but the value of the source.localData attribute is NULL.

Examples

Get the property information for known audio attributes:

DECLARE
  aud_attrib        CLOB;
  ctx               RAW(64) := NULL;
  aud_data          BLOB;
  mimeType          VARCHAR2(80);
  format            VARCHAR2(32) := NULL;
  encoding          VARCHAR2(160);
  numberOfChannels  NUMBER;
  samplingRate      NUMBER;
  sampleSize        NUMBER;
  compressionType   VARCHAR2(160);
  audioDuration     NUMBER;
BEGIN
  SELECT aud, attributes, mimetype, format, encoding, numberofchannels, samplingrate,
    samplesize, compressiontype, audioduration INTO aud_data, aud_attrib, mimeType,
    format, encoding, numberOfChannels, samplingRate, sampleSize, compressionType,
    audioDuration FROM taud WHERE N = 1 FOR UPDATE;

  ORDSYS.ORDAudio.getProperties(ctx, aud_data, aud_attrib, mimeType, format, encoding, 
              numberOfChannels, samplingRate, sampleSize, compressionType, audioDuration);

  DBMS_OUTPUT.put_line('Size of XML Annotations ' ||
                   TO_CHAR(DBMS_LOB.GETLENGTH(aud_attrib)));
  DBMS_OUTPUT.put_line('mimeType: ' || mimeType );
  DBMS_OUTPUT.put_line('format: ' || format );
  DBMS_OUTPUT.put_line('encoding: ' || encoding );
  DBMS_OUTPUT.put_line('numberOfChannels: ' || numberOfChannels );
  DBMS_OUTPUT.put_line('samplingRate: ' || samplingRate );
  DBMS_OUTPUT.put_line('sampleSize: ' || sampleSize );
  DBMS_OUTPUT.put_line('compressionType: ' || compressionType );
  DBMS_OUTPUT.put_line('audioDuration: ' || audioDuration );
  UPDATE taud SET 
               aud=aud_data, 
               attributes=aud_attrib, 
               mimetype=mimeType,
               format=format, 
               encoding=encoding, 
               numberofchannels=numberOfChannels, 
               samplingrate=samplingRate, 
               samplesize=sampleSize, 
               compressiontype=compressionType, 
               audioduration=audioDuration 
             WHERE n=1;
  COMMIT;
EXCEPTION
  WHEN OTHERS THEN
  RAISE;
END;
/


getProperties( ) for BFILEs

Format

getProperties(ctx IN OUT RAW,

audioBfile IN OUT NOCOPY BFILE,

attributes IN OUT NOCOPY CLOB,

format IN VARCHAR2);

Description

Reads the audio BFILE data to get the values of the media attributes for supported formats, and then stores them in the input CLOB. This method populates the CLOB with an extensive set of format and application properties in XML form.

Parameters

ctx

The format plug-in context information.

audioBfile

The audio data represented as a BFILE.

attributes

The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the audio BFILE data in XML form.

format

The format of the audio data. If a non-NULL value is specified for this parameter, then the format plug-in for this format type is invoked.

Usage Notes

None.

Pragmas

None.

Exceptions

ORDAudioExceptions.AUDIO_PLUGIN_EXCEPTION

This exception is raised if you call the getProperties( ) method and the audio plug-in raises an exception.

ORDSourceExceptions.EMPTY_SOURCE

This exception is raised when the value of the source.local attribute is 1 or 0 (TRUE), but the value of the source.localData attribute is NULL.

Examples

Get the property information for known audio attributes:

DECLARE
  aud_attrib CLOB;
  ctx RAW(64) :=NULL;
  aud_data BFILE := BFILENAME('AUDIODIR','testaud.dat');
  aud_format VARCHAR2(160) := NULL;
BEGIN
  DBMS_LOB.CREATETEMPORARY(aud_attrib, FALSE, DBMS_LOB.CALL);
  ORDSYS.ORDAudio.getProperties(ctx, aud_data, aud_attrib, aud_format);

  DBMS_OUTPUT.put_line('Size of XML Annotations ' ||
                   TO_CHAR(DBMS_LOB.GETLENGTH(aud_attrib)));
EXCEPTION
  WHEN OTHERS THEN
  RAISE;
END;
/


getProperties( ) (all attributes) for BFILEs

Format

getProperties(ctx IN OUT RAW,

audioBfile IN OUT NOCOPY BFILE,

attributes IN OUT NOCOPY CLOB,

mimeType OUT VARCHAR2,

format IN OUT VARCHAR2

encoding OUT VARCHAR2,

numberOfChannels OUT INTEGER,

samplingRate OUT INTEGER,

sampleSize OUT INTEGER,

compressionType OUT VARCHAR2,

audioDuration OUT INTEGER);

Description

Reads the audio BFILE data to get the values of the media attributes for supported formats, and then stores them in the input CLOB and returns them as explicit parameters. This method gets the properties for the following attributes of the audio data: duration, MIME type, compression type, format, encoding type, number of channels, sampling rate, and sample size. It populates the CLOB with an extensive set of format and application properties in XML form.

Parameters

ctx

The format plug-in context information.

audioBfile

The audio data represented as a BFILE.

attributes

The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the audio BFILE data in XML form.

mimeType

The MIME type of the audio data.

format

The format of the audio data. If a non-NULL value is specified, then the format plug-in for this format type is invoked. If not specified, the default plug-in is used and the derived format value is returned.

encoding

The encoding type of the audio data.

numberOfChannels

The number of channels in the audio data.

samplingRate

The sampling rate in samples per second at which the audio data was recorded.

sampleSize

The sample width or number of samples of audio in the data.

compressionType

The compression type of the audio data.

audioDuration

The total time required to play the audio data.

Usage Notes

If a property cannot be extracted from the media source, then the respective parameter is set to NULL.

Pragmas

None.

Exceptions

ORDAudioExceptions.AUDIO_PLUGIN_EXCEPTION

This exception is raised if you call the getProperties( ) method and the audio plug-in raises an exception.

ORDSourceExceptions.EMPTY_SOURCE

This exception is raised when the value of the source.local attribute is 1 or 0 (TRUE), but the value of the source.localData attribute is NULL.

Examples

Get the property information for known audio attributes:

DECLARE
  aud_attrib        CLOB;
  ctx               RAW(64) :=NULL;
  data              BFILE := BFILENAME('AUDIODIR','testaud.dat');
  mimeType          VARCHAR2(80);
  format            VARCHAR2(32) := NULL;
  encoding          VARCHAR2(160);
  numberOfChannels  NUMBER;
  samplingRate      NUMBER;
  sampleSize        NUMBER;
  compressionType   VARCHAR2(160);
  audioDuration     NUMBER;
BEGIN
  DBMS_LOB.CREATETEMPORARY(aud_attrib, FALSE, DBMS_LOB.CALL);

  ORDSYS.ORDAudio.getProperties(ctx, data, aud_attrib, mimeType, format, encoding, 
              numberOfChannels, samplingRate, sampleSize, compressionType,
 audioDuration);

  DBMS_OUTPUT.put_line('Size of XML Annotations ' ||
                   TO_CHAR(DBMS_LOB.GETLENGTH(aud_attrib)));
  DBMS_OUTPUT.put_line('mimeType: ' || mimeType );
  DBMS_OUTPUT.put_line('format: ' || format );
  DBMS_OUTPUT.put_line('encoding: ' || encoding );
  DBMS_OUTPUT.put_line('numberOfChannels: ' || numberOfChannels );
  DBMS_OUTPUT.put_line('samplingRate: ' || samplingRate );
  DBMS_OUTPUT.put_line('sampleSize: ' || sampleSize );
  DBMS_OUTPUT.put_line('compressionType: ' || compressionType );
  DBMS_OUTPUT.put_line('audioDuration: ' || audioDuration );
EXCEPTION
  WHEN OTHERS THEN
  RAISE;
END;
/