Oracle interMedia Audio, Image, and Video User's Guide and Reference
Release 8.1.7

Part Number A85336-01

Library

Product

Contents

Index

Go to previous page Go to next page

4
ORDAudio Reference Information

Oracle interMedia contains information about the ORDAudio type:

The examples in this chapter assume that the test audio table TAUD has been created and filled with data. This table was created using the SQL statements described in Section 4.3.1.


Note:

If you manipulate the audio data itself (by either directly modifying the BLOB or changing the external source), then you must ensure that the object attributes stay synchronized and the update time is modified; otherwise, the object attributes will not match the audio data. 


Methods invoked at the ORDSource level that are handed off to the source plug-in for processing have ctx(RAW(4000)) as the first argument. Before calling any of these methods for the first time, the client must allocate the ctx structure, initialize it to NULL, and invoke the openSource( ) method. At this point, the source plug-in can initialize context for this client. When processing is complete, the client should invoke the closeSource( ) method.

Methods invoked from a source plug-in call have the first argument as ctx (RAW(4000)).

Methods invoked at the ORDAudio level that are handed off to the format plug-in for processing have ctx (RAW(4000)) as the first argument. Before calling any of these methods for the first time, the client must allocate the ctx structure and initialize it to NULL.


Note:

In the current release, not all source or format plug-ins will use the ctx argument, but if you code as previously described, your application should work with any current or future source or format plug-in. 


4.1 Object Types

Oracle interMedia describes the ORDAudio object type, which supports the storage and management of audio data.


ORDAudio Object Type

The ORDAudio object type supports the storage and management of audio data. This object type is defined as follows:

CREATE OR REPLACE TYPE ORDAudio
AS OBJECT
(
  -- ATTRIBUTES 
description         VARCHAR2(4000),
source              ORDSource,
format              VARCHAR2(31),
mimeType            VARCHAR2(4000),
comments            CLOB, 
  -- AUDIO RELATED ATTRIBUTES 
encoding            VARCHAR2(256),
numberOfChannels    INTEGER,
samplingRate        INTEGER,
sampleSize          INTEGER,
compressionType     VARCHAR2(4000),
audioDuration       INTEGER,

  -- METHODS 
-- CONSTRUCTORS
--
STATIC FUNCTION init( ) RETURN ORDAudio,
STATIC FUNCTION init(srcType     IN VARCHAR2,
                     srcLocation IN VARCHAR2,
                     srcName     IN VARCHAR2) RETURN ORDAudio,
-- Methods associated with the date attribute
MEMBER FUNCTION getUpdateTime RETURN DATE,
PRAGMA RESTRICT_REFERENCES(getUpdateTime, WNDS, WNPS, RNDS, RNPS),
MEMBER PROCEDURE setUpdateTime(current_time DATE),
-- Methods associated with the description attribute
MEMBER PROCEDURE setDescription(user_description IN VARCHAR2),
MEMBER FUNCTION getDescription RETURN VARCHAR2,
PRAGMA RESTRICT_REFERENCES(getDescription, WNDS, WNPS, RNDS, RNPS),

-- Methods associated with the mimeType attribute
MEMBER PROCEDURE setMimeType(mime IN VARCHAR2),
MEMBER FUNCTION getMimeType RETURN VARCHAR2,
PRAGMA RESTRICT_REFERENCES(getMimeType, WNDS, WNPS, RNDS, RNPS),

-- Methods associated with the source attribute
MEMBER FUNCTION processSourceCommand(
                                     ctx       IN OUT RAW,
                                     cmd       IN VARCHAR2,
                                     arguments IN VARCHAR2,
                                     result    OUT RAW)
                RETURN RAW,

MEMBER FUNCTION  isLocal RETURN BOOLEAN,
PRAGMA RESTRICT_REFERENCES(isLocal, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE  setLocal,
MEMBER PROCEDURE  clearLocal,

MEMBER PROCEDURE setSource(
                           source_type     IN VARCHAR2,
                           source_location IN VARCHAR2,
                           source_name     IN VARCHAR2),
MEMBER FUNCTION getSource RETURN VARCHAR2,
PRAGMA RESTRICT_REFERENCES(getSource, WNDS, WNPS, RNDS, RNPS),

MEMBER FUNCTION getSourceType RETURN VARCHAR2,
PRAGMA RESTRICT_REFERENCES(getSourceType, WNDS, WNPS, RNDS, RNPS),

MEMBER FUNCTION getSourceLocation RETURN VARCHAR2,
PRAGMA RESTRICT_REFERENCES(getSourceLocation, WNDS, WNPS, RNDS, RNPS),

MEMBER FUNCTION getSourceName RETURN VARCHAR2,
PRAGMA RESTRICT_REFERENCES(getSourceName, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE import(ctx IN OUT RAW),
MEMBER PROCEDURE importFrom(
                            ctx             IN OUT RAW,
                            source_type     IN VARCHAR2,
                            source_location IN VARCHAR2, 
                            source_name     IN VARCHAR2),
MEMBER PROCEDURE export(
                        ctx             IN OUT RAW,
                        source_type     IN VARCHAR2,
                        source_location IN VARCHAR2,
                        source_name     IN VARCHAR2),
MEMBER FUNCTION getContentLength(ctx IN OUT RAW) RETURN INTEGER,
PRAGMA RESTRICT_REFERENCES(getContentLength, WNDS, WNPS, RNDS, RNPS),

MEMBER FUNCTION getContentInLob(
                                ctx      IN OUT RAW,
                                dest_lob IN OUT NOCOPY BLOB,
                                mimeType OUT VARCHAR2,
                                format   OUT VARCHAR2),

MEMBER FUNCTION getContent RETURN BLOB,
PRAGMA RESTRICT_REFERENCES(getContent, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE deleteContent,

MEMBER FUNCTION getBFILE RETURN BFILE,
PRAGMA RESTRICT_REFERENCES(getBFILE, WNDS, WNPS, RNDS, RNPS),

-- Methods associated with file operations on the source
MEMBER FUNCTION openSource(userArg IN RAW, ctx OUT RAW) RETURN INTEGER,
MEMBER FUNCTION closeSource(ctx IN OUT RAW) RETURN INTEGER,
MEMBER FUNCTION trimSource(ctx     IN OUT RAW,
                           newlen  IN INTEGER) RETURN INTEGER,
MEMBER PROCEDURE readFromSource(
                                ctx      IN OUT RAW,
                                startPos IN INTEGER,
                                numBytes IN OUT INTEGER,
                                buffer   OUT RAW), 
MEMBER PROCEDURE writeToSource(
                               ctx      IN OUT RAW,
                               startPos IN INTEGER,
                               numBytes IN OUT INTEGER,
                               buffer   IN RAW), 

-- Methods associated with the comments attribute
MEMBER PROCEDURE appendToComments(amount IN BINARY_INTEGER, 
                                  buffer IN VARCHAR2), 
MEMBER PROCEDURE writeToComments(offset IN INTEGER, 
                                 amount IN BINARY_INTEGER, 
                                 buffer IN VARCHAR2), 
MEMBER FUNCTION readFromComments(offset IN INTEGER, 
                                 amount IN BINARY_INTEGER := 32767) 
                RETURN VARCHAR2, 
PRAGMA RESTRICT_REFERENCES(readFromComments, WNDS, WNPS, RNDS, RNPS), 

MEMBER FUNCTION locateInComments(pattern    IN VARCHAR2, 
                                 offset     IN INTEGER := 1, 
                                 occurrence IN INTEGER := 1) 
                 RETURN INTEGER, 
MEMBER PROCEDURE trimComments(newlen IN INTEGER), 
MEMBER PROCEDURE eraseFromComments(amount IN OUT NOCOPY INTEGER, 
                                   offset IN INTEGER := 1), 
MEMBER PROCEDURE deleteComments, 
MEMBER PROCEDURE loadCommentsFromFile(fileobj  IN BFILE, 
                                      amount   IN INTEGER, 
                                      from_loc IN INTEGER := 1, 
                                      to_loc   IN INTEGER := 1), 
MEMBER PROCEDURE copyCommentsOut(dest     IN OUT NOCOPY CLOB, 
                                 amount   IN INTEGER, 
                                 from_loc IN INTEGER := 1, 
                                 to_loc   IN INTEGER := 1), 
MEMBER FUNCTION compareComments(
                   compare_with_lob        IN CLOB, 
                   amount                  IN INTEGER := 4294967295,
                   starting_pos_in_comment IN INTEGER := 1, 
                   starting_pos_in_compare IN INTEGER := 1) 
                RETURN INTEGER,
PRAGMA RESTRICT_REFERENCES(compareComments, WNDS, WNPS, RNDS, RNPS),

MEMBER FUNCTION getCommentLength RETURN INTEGER,
PRAGMA RESTRICT_REFERENCES(getCommentLength, WNDS, WNPS, RNDS, RNPS),

-- Methods associated with audio attributes accessors
MEMBER PROCEDURE setFormat(knownformat IN VARCHAR2),
MEMBER FUNCTION getFormat RETURN VARCHAR2,
PRAGMA RESTRICT_REFERENCES(getFormat, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE setEncoding(knownEncoding IN VARCHAR2),
MEMBER FUNCTION getEncoding RETURN VARCHAR2,
PRAGMA RESTRICT_REFERENCES(getEncoding, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE setNumberOfChannels(knownNumberOfChannels IN INTEGER),
MEMBER FUNCTION getNumberOfChannels RETURN INTEGER,
PRAGMA RESTRICT_REFERENCES(getNumberOfChannels, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE setSamplingRate(knownSamplingRate IN INTEGER),
MEMBER FUNCTION getSamplingRate RETURN INTEGER,
PRAGMA RESTRICT_REFERENCES(getSamplingRate, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE setSampleSize(knownSampleSize IN INTEGER),
MEMBER FUNCTION getSampleSize RETURN INTEGER,
PRAGMA RESTRICT_REFERENCES(getSampleSize, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE setCompressionType(knownCompressionType IN VARCHAR2),
MEMBER FUNCTION getCompressionType RETURN VARCHAR2,
PRAGMA RESTRICT_REFERENCES(getCompressionType, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE setAudioDuration(knownAudioDuration IN INTEGER),
MEMBER FUNCTION getAudioDuration RETURN INTEGER,
PRAGMA RESTRICT_REFERENCES(getAudioDuration, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE setKnownAttributes(
                                    knownFormat IN VARCHAR2,
                                    knownEncoding IN VARCHAR2,
                                    knownNumberOfChannels IN INTEGER,
                                    knownSamplingRate IN INTEGER,
                                    knownSampleSize IN INTEGER,
                                    knownCompressionType IN VARCHAR2,
                                    knownAudioDuration IN INTEGER),

-- Methods associated with setting all the properties
MEMBER PROCEDURE setProperties(ctx IN OUT RAW),
MEMBER PROCEDURE setProperties(ctx         IN OUT RAW,
                               setComments IN BOOLEAN),
MEMBER FUNCTION checkProperties(ctx IN OUT RAW) RETURN BOOLEAN,

MEMBER FUNCTION getAttribute(
                             ctx  IN OUT RAW,
                             name IN VARCHAR2) RETURN VARCHAR2,

MEMBER PROCEDURE getAllAttributes(
                                  ctx        IN OUT RAW, 
                                  attributes IN OUT NOCOPY CLOB), 

-- Methods associated with audio processing
MEMBER FUNCTION processAudioCommand(
                                    ctx       IN OUT RAW, 
                                    cmd       IN VARCHAR2, 
                                    arguments IN VARCHAR2, 
                                    result    OUT RAW)
                RETURN RAW
);

where:

4.2 Constructors

This section describes the constructor functions.

The interMedia audio constructor functions are as follows:


init( ) Method

Format

init( ) RETURN ORDAudio;

Description

Allows for easy initialization of instances of the ORDAudio object type.

Parameters

None.

Pragmas

None.

Exceptions

None.

Usage Notes

This static method initializes all the ORDAudio attributes to NULL with the following exceptions:

You should begin using the init( ) method as soon as possible to allow you to more easily initialize the ORDAudio object type, especially if the ORDAudio type evolves and attributes are added in a future release. INSERT statements left unchanged using the default constructor (which initializes each object attribute), will fail under these circumstances.

Examples

Initialize the ORDAudio object attributes:

DECLARE
  myAudio ORDSYS.ORDAudio;
BEGIN
  myAudio := ORDSYS.ORDAudio.init( );
INSERT INTO taud VALUES (myAudio);
END;
/

init(srcType,srcLocation,srcName) Method

Format

init(srcType IN VARCHAR2,

srcLocation IN VARCHAR2,

srcName IN VARCHAR2)

RETURN ORDAudio;

Description

Allows for easy initialization of instances of the ORDAudio object type.

Parameters

srcType

The source type of the audio data.

srcLocation

The source location of the audio data.

srcName

The source name of the audio data.

Pragmas

None.

Exceptions

None.

Usage Notes

This static method initializes all the ORDAudio attributes to NULL with the following exceptions:

You should begin using the init( ) method as soon as possible to allow you to more easily initialize the ORDAudio object type, especially if the ORDAudio type evolves and attributes are added in a future release. INSERT statements left unchanged using the default constructor (which initializes each object attribute), will fail under these circumstances.

Examples

Initialize the ORDAudio object attributes:

DECLARE
  myAudio ORDSYS.ORDAudio;
BEGIN
  myAudio := ORDSYS.ORDAudio.init('FILE','AUDDIR','audio1.au');
INSERT INTO taud VALUES (myAudio);
END;
/























4.3 Methods

This section presents reference information on the Oracle interMedia methods used for audio data manipulation. These methods are described in the following groupings:

ORDAudio Methods Associated with the updateTime Attribute

ORDAudio Methods Associated with the description Attribute

ORDAudio Methods Associated with mimeType Attribute

ORDAudio Methods Associated with the source Attribute

ORDAudio Methods Associated with File Operations

ORDAudio Methods Associated with the comments Attribute


Note:

The comments attribute is populated by setProperties( ) when the setComments parameter is TRUE and by the Oracle interMedia Annotator utility. Oracle recommends that you not write to this attribute directly.  


ORDAudio Methods Associated with Audio Attributes Accessors

ORDAudio Methods Associated with Processing Audio Data

For more information on object types and methods, see Oracle8i Concepts.

4.3.1 Example Table Definitions

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

TAUD Table Definition

CREATE TABLE TAUD(n NUMBER, aud ORDSYS.ORDAUDIO)
storage (initial 100K next 100K pctincrease 0);

INSERT INTO TAUD VALUES(1, ORDSYS.ORDAudio.init());
INSERT INTO TAUD VALUES(2, ORDSYS.ORDAudio.init());

4.3.2 ORDAudio Methods Associated with the updateTime Attribute

This section presents reference information on the ORDAudio methods associated with the updateTime attribute.


getUpdateTime Method

Format

getUpdateTime RETURN DATE;

Description

Returns the time when the object was last updated.

Parameters

None.

Usage Notes

None.

Pragmas

PRAGMA RESTRICT_REFERENCES(getUpdateTime, WNDS,
WNPS, RNDS, RNPS)

Exceptions

None.

Examples

Get the updated time of some audio data:

DECLARE
 obj ORDSYS.ORDAudio;
BEGIN
 SELECT aud INTO obj FROM TAUD WHERE N = 1 ;
 DBMS_OUTPUT.PUT_LINE(TO_CHAR(obj.getUpdateTime,'MM-DD-YYYY HH24:MI:SS'));
  EXCEPTION
        WHEN ORDSYS.ORDAudioExceptions.METHOD_NOT_SUPPORTED THEN
        DBMS_OUTPUT.PUT_LINE('Source not specified');
END;
/


setUpdateTime( ) Method

Format

setUpdateTime(current_time DATE);

Description

Sets the time when the audio data was last updated. Use this method whenever you modify the audio data. The methods setDescription( ), setMimeType( ), setSource( ), import( ), importFrom( ), export( ), deleteContent, and all set audio accessors call this method implicitly.

Parameters

current_time

The timestamp to be stored. Defaults to SYSDATE.

Usage Notes

You must invoke this method whenever you modify the audio data.

Pragmas

None.

Exceptions

None.

Examples

Set the updated time of some audio data:

DECLARE
 obj ORDSYS.ORDAudio;
BEGIN
 SELECT aud INTO obj FROM TAUD WHERE N = 1;
 obj.setUpdateTime(SYSDATE);
 UPDATE TAUD SET aud=obj WHERE N = 1;
 COMMIT;
END;
/

4.3.3 ORDAudio Methods Associated with the description Attribute

This section presents reference information on the ORDAudio methods associated with the description attribute.


setDescription( ) Method

Format

setDescription (user_description IN VARCHAR2);

Description

Sets the description of the audio data.

Parameters

user_description

The description of the audio data.

Usage Notes

Each audio object may need a description to help some client applications. For example, a Web-based client can show a list of audio descriptions from which a user can select one to access the audio data.

Web-access components and other client components provided with Oracle interMedia make use of this description attribute to present audio data to users.

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

None.

Examples

Set the description attribute for some audio data:

DECLARE
  obj ORDSYS.ORDAudio;
BEGIN
  SELECT aud INTO obj FROM TAUD  WHERE N=1 FOR UPDATE;
  DBMS_OUTPUT.PUT_LINE('writing title');
  DBMS_OUTPUT.PUT_LINE('-------------');
  obj.setDescription('audio1.wav');
  DBMS_OUTPUT.PUT_LINE(obj.getDescription);
  UPDATE TAUD SET aud=obj WHERE N=1;
  COMMIT;
END;
/


getDescription Method

Format

getDescription RETURN VARCHAR2;

Description

Returns the description of the audio data.

Parameters

None.

Usage Notes

None.

Pragmas

PRAGMA RESTRICT_REFERENCES(getDescription, WNDS, WNPS, RNDS, RNPS)

Exceptions

DESCRIPTION_IS_NOT_SET

This exception is raised if you call the getDescription( ) method and the description is not set.

Examples

See the example in the setDescription( ) Method.



4.3.4 ORDAudio Methods Associated with the mimeType Attribute

This section presents reference information on the ORDAudio methods associated with the mimeType attribute.


setMimeType( ) Method

Format

setMimeType(mime IN VARCHAR2);

Description

Allows you to set the MIME type of the audio data.

Parameters

mime

The MIME type.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Call the setMimeType( ) method to set the MIME type if the source is a file or BLOB.

The MIME type is extracted from the HTTP header on import for HTTP sources.

Pragmas

None.

Exceptions

INVALID_MIME_TYPE

This exception is raised if you call the setMimeType( ) method and the value for mimeType is NULL.

Examples

Set the MIME type for some stored audio data:

DECLARE
  obj ORDSYS.ORDAudio;
BEGIN
  SELECT aud INTO obj FROM TAUD  WHERE N=1 FOR UPDATE;
  DBMS_OUTPUT.PUT_LINE('writing mimetype');
  DBMS_OUTPUT.PUT_LINE('----------------');
  obj.setMimeType('audio/basic');
  DBMS_OUTPUT.PUT_LINE(obj.getMimeType);
  UPDATE TAUD SET aud=obj WHERE N=1;
  COMMIT;
END;
/

getMimeType Method

Format

getMimeType RETURN VARCHAR2;

Description

Returns the MIME type for the audio data.

Parameters

None.

Usage Notes

If the source is an HTTP server, the MIME type information is read from the HTTP header information. If the source is a file or BLOB, you must call the setMimeType( ) method and set the MIME type.

Pragmas

PRAGMA RESTRICT_REFERENCES(getMimeType, WNDS, WNPS, RNDS, RNPS)

Exceptions

None.

Examples

See the example in the setMimeType( ) Method.


4.3.5 ORDAudio Methods Associated with the source Attribute

This section presents reference information on the ORDAudio methods associated with the source attribute.


processSourceCommand( ) Method

Format

processSourceCommand(

ctx IN OUT RAW,

cmd IN VARCHAR2,

arguments IN VARCHAR2,

result OUT RAW)

RETURN RAW;

Description

Allows you to send any command and its arguments to the source plug-in. This method is available only for user-defined source plug-ins.

Parameters

ctx

The source plug-in context information. This must be allocated. You must call the openSource( ) method; see the introduction to this chapter for more information.

cmd

Any command recognized by the source plug-in.

arguments

The arguments of the command.

result

The result of calling this method returned by the source plug-in.

Usage Notes

Use this method to send any command and its respective arguments to the source plug-in. Commands are not interpreted; they are just taken and passed through to be processed.

Pragmas

None.

Exceptions

ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION

This exception is raised if you call the processSourceCommand( ) method and the value of srcType is NULL.

ORDSourceExceptions.METHOD_NOT_SUPPORTED

This exception is raised if you call the processSourceCommand( ) method and this method is not supported by the source plug-in being used.

ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION

This exception is raised if you call the processSourceCommand( ) method within a source plug-in when any other exception is raised.

See Appendix H for more information about these exceptions.

Examples

Process some commands:

DECLARE
  obj ORDSYS.ORDAudio;
  res RAW(4000);
  result RAW(4000);
  command VARCHAR(4000);
  argList VARCHAR(4000);
  ctx RAW(4000) :=NULL;
BEGIN
select aud into obj from TAUD where N =1 for UPDATE;
-- assign command
-- assign argList
res := obj.processSourceCommand (ctx, command, argList, result);
UPDATE TAUD SET aud=obj WHERE N=1 ;
COMMIT;
  EXCEPTION
        WHEN ORDSYS.ORDSourceExceptions.METHOD_NOT_SUPPORTED THEN
         DBMS_OUTPUT.put_line('Source METHOD_NOT_SUPPORTED caught');
        WHEN ORDSYS.ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION THEN
         DBMS_OUTPUT.put_line('SOURCE PLUGIN EXCEPTION caught');
        WHEN ORDSYS.ORDAudioExceptions.METHOD_NOT_SUPPORTED THEN
         DBMS_OUTPUT.put_line('AUDIO METHOD_NOT_SUPPORTED EXCEPTION caught');
        WHEN ORDSYS.ORDAudioExceptions.AUDIO_PLUGIN_EXCEPTION THEN
         DBMS_OUTPUT.put_line('AUDIO PLUGIN EXCEPTION caught');
        WHEN OTHERS THEN
         DBMS_OUTPUT.PUT_LINE('EXCEPTION caught');
END;
/


isLocal Method

Format

isLocal RETURN BOOLEAN;

Description

Returns TRUE if the data is stored locally in a BLOB or FALSE if the data is stored externally.

Parameters

None.

Usage Notes

If the local attribute is set to 1 or NULL, this method returns TRUE, otherwise this method returns FALSE.

Pragmas

PRAGMA RESTRICT_REFERENCES(getLocal, WNDS, WNPS, RNDS, RNPS)

Exceptions

None.

Examples

Determine whether or not the data is local:

DECLARE
 obj ORDSYS.ORDAudio;
BEGIN
 SELECT s INTO obj FROM TAUD WHERE N = 1 ;
 if(obj.isLocal = TRUE)  then
    DBMS_OUTPUT.put_line('local is set true');
 else
    DBMS_OUTPUT.put_line('local is set false');
 end if;
END;
/

setLocal Method

Format

setLocal;

Description

Sets the local attribute to indicate that the data is stored internally in a BLOB. When local is set, audio methods look for audio data in the source.localData attribute.

Parameters

None.

Usage Notes

This method sets the local attribute to 1 meaning the data is stored locally in localData.

Pragmas

None.

Exceptions

None.

Examples

Set the flag to local for the data:

DECLARE
 obj ORDSYS.ORDAudio;
BEGIN
 SELECT s INTO obj FROM TAUD WHERE N = 1 FOR UPDATE;
 obj.setLocal;
 UPDATE TAUD SET s=obj WHERE N = 1;
 COMMIT;
END;
/

clearLocal Method

Format

clearLocal;

Description

Resets the local flag to indicate that the data is stored externally. When the local flag is set to clear, audio methods look for audio data using the srcLocation, srcName, and srcType attributes.

Parameters

None.

Usage Notes

This method sets the local attribute to a 0, meaning the data is stored externally or outside of Oracle8i.

Pragmas

None.

Exceptions

None.

Examples

Clear the value of the local flag for the data:

DECLARE
 obj ORDSYS.ORDAudio;
BEGIN
 SELECT s INTO obj FROM TAUD WHERE N = 1 FOR UPDATE;
 obj.clearLocal;
 UPDATE TAUD SET s=obj WHERE N = 1;
 COMMIT;
END;
/

setSource( ) Method

Format

setSource(

source_type IN VARCHAR2,

source_location IN VARCHAR2,

source_name IN VARCHAR2);

Description

Sets or alters information about the external source of the audio data.

Parameters

source_type

The source type of the external data. See the "ORDSource Object Type" definition in Chapter 7 for more information.

source_location

The source location of the external data. See the "ORDSource Object Type" definition in Chapter 7 for more information.

source_name

The source name of the external data. See the "ORDSource Object Type" definition in Chapter 7 for more information.

Usage Notes

Users can use this method to set the audio data source to a new BFILE or URL.

You must ensure that the directory exists or is created before you use this method.

Calling this method implicitly calls the setUpdateTime( ) method and the clearLocal method.

Pragmas

None.

Exceptions

None.

Examples

Set the source of the audio data:

DECLARE
  obj ORDSYS.ORDAudio;
BEGIN
  SELECT aud INTO obj FROM TAUD  WHERE N=1 FOR UPDATE;
  DBMS_OUTPUT.PUT_LINE('setting and getting source');
  DBMS_OUTPUT.PUT_LINE('--------------------------');
  obj.setSource('FILE','AUDIODIR','audio.au');
  DBMS_OUTPUT.PUT_LINE(obj.getSource);
  UPDATE TAUD SET aud=obj WHERE N=1;
  COMMIT;
END;
/


getSource Method

Format

getSource RETURN VARCHAR2;

Description

Returns information about the external location of the audio data in URL format.

Parameters

None.

Usage Notes

Possible return values are:

Pragmas

PRAGMA RESTRICT_REFERENCES(getSource, WNDS, WNPS, RNDS, RNPS)

Exceptions

None.

Examples

See the example in the setSource( ) Method.



getSourceType Method

Format

getSourceType RETURN VARCHAR2;

Description

Returns a string containing the type of the external audio data source.

Parameters

None.

Usage Notes

Returns a VARCHAR2 string containing the type of the external audio data source, for example 'FILE'.

Pragmas

PRAGMA RESTRICT_REFERENCES(getSourceType, WNDS, WNPS, RNDS, RNPS)

Exceptions

None.

Examples

Get the source type information about an audio data source:

DECLARE
  obj ORDSYS.ORDAudio;
BEGIN
  SELECT aud INTO obj FROM TAUD  WHERE N=1 FOR UPDATE;
  DBMS_OUTPUT.PUT_LINE('setting and getting source');
  DBMS_OUTPUT.PUT_LINE('--------------------------');
  -- set source to a file
  obj.setSource('FILE','AUDIODIR','testaud.dat');
  -- get source information
  DBMS_OUTPUT.put_line(obj.getSource);
  DBMS_OUTPUT.put_line(obj.getSourceType);
  DBMS_OUTPUT.put_line(obj.getSourceLocation);
  DBMS_OUTPUT.put_line(obj.getSourceName);
  UPDATE TAUD SET aud=obj WHERE N=1;
  COMMIT;
  EXCEPTION
        WHEN ORDSYS.ORDAudioExceptions.METHOD_NOT_SUPPORTED THEN
        DBMS_OUTPUT.PUT_LINE('Source not specified');
END;
/


getSourceLocation Method

Format

getSourceLocation RETURN VARCHAR2;

Description

Returns a string containing the value of the external audio data source location.

Parameters

None.

Usage Notes

This method returns a VARCHAR2 string containing the value of the external audio data location, for example 'BFILEDIR'.

Pragmas

PRAGMA RESTRICT_REFERENCES(getSourceLocation, WNDS,
WNPS, RNDS, RNPS)

Exceptions

ORDSourceExceptions.INCOMPLETE_SOURCE_LOCATION

This exception is raised if you call the getSourceLocation method and the value of srcLocation is NULL.

Examples

See the example in the getSourceType Method.



getSourceName Method

Format

getSourceName RETURN VARCHAR2;

Description

Returns a string containing of the name of the audio external data source.

Parameters

None.

Usage Notes

This method returns a VARCHAR2 string containing the name of the external data source, for example 'testaud.dat'.

Pragmas

PRAGMA RESTRICT_REFERENCES(getSourceName, WNDS,
WNPS, RNDS, RNPS)

Exceptions

ORDSourceExceptions.INCOMPLETE_SOURCE_NAME

This exception is raised if you call the getSourceName method and the value of srcName is NULL.

Examples

See the example in the getSourceType Method.



import( ) Method

Format

import(ctx IN OUT RAW);

Description

Transfers audio data from an external audio data source to a local source (localData) within an Oracle database.

Parameters

ctx

The source plug-in context information.This must be allocated. You must call the openSource( ) method; see the introduction to this chapter for more information.

Usage Notes

Use the setSource( ) method to set the external source type, location, and name prior to calling the import( ) method.

You must ensure that the directory exists or is created before you use this method.

After importing data from an external audio data source to a local source (within an Oracle database), the source information remains unchanged (that is, pointing to the source from where the data was imported).

Invoking this method implicitly calls the setUpdateTime( ) and setLocal methods.

Pragmas

None.

Exceptions

ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION

This exception is raised if you call the import( ) method and the value of srcType is NULL.

ORDSourceExceptions.NULL_SOURCE

This exception is raised if you call the import( ) method and the value of dlob is NULL.

ORDSourceExceptionsMETHOD_NOT_SUPPORTED

This exception is raised if you call the import( ) method and the import( ) method is not supported by the source plug-in being used.

ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION

This exception is raised if you call the import( ) method within a source plug-in when any other exception is raised.

See Appendix H for more information about these exceptions.

Examples

Import audio data from an external audio data source into the local source:

DECLARE
  obj ORDSYS.ORDAudio;
  ctx RAW(4000) :=NULL;
BEGIN
  SELECT aud INTO obj FROM TAUD  WHERE N=1 FOR UPDATE;
  DBMS_OUTPUT.PUT_LINE('setting and getting source');
  DBMS_OUTPUT.PUT_LINE('--------------------------');
  -- set source to a file
  obj.setSource('FILE','AUDIODIR','testaud.dat');
  -- get source information
  DBMS_OUTPUT.PUT_LINE(obj.getSource);
  -- import data
  obj.import(ctx);
  -- check size
  DBMS_OUTPUT.PUT_LINE(TO_CHAR(obj.getContentLength(ctx)));
  DBMS_OUTPUT.PUT_LINE(obj.getSource);
  DBMS_OUTPUT.PUT_LINE('deleting contents');
  DBMS_OUTPUT.PUT_LINE('-----------------');
  obj.deleteContent;
  DBMS_OUTPUT.PUT_LINE(TO_CHAR(obj.getContentLength(ctx)));
  UPDATE TAUD SET aud=obj WHERE N=1;
  COMMIT;
END;
/

importFrom( ) Method

Format

importFrom(ctx IN OUT RAW,

source_type IN VARCHAR2,

source_location IN VARCHAR2,

source_name IN VARCHAR2);

Description

Transfers audio data from the specified external audio data source to a local source (localData) within an Oracle database.

Parameters

ctx

The source plug-in context information. This must be allocated. You must call the openSource( ) method; see the introduction to this chapter for more information.

source_type

The source type of the audio data.

source_location

The location from where the audio data is to be imported.

source_name

The name of the audio data.

Usage Notes

This method is similar to the import( ) method except the source information is specified as parameters to the method instead of separately.

You must ensure that the directory exists or is created before you use this method.

After importing data from an external audio data source to a local source (within an Oracle database), the source information (that is, pointing to the source from where the data was imported) is set to the input values.

Invoking this method implicitly calls the setUpdateTime( ) and setLocal methods.

Pragmas

None.

Exceptions

ORDSourceExceptions.NULL_SOURCE

This exception is raised if you call the importFrom( ) method and the value of dlob is NULL.

ORDSourceExceptionsMETHOD_NOT_SUPPORTED

This exception is raised if you call the importFrom( ) method and this method is not supported by the source plug-in being used.

ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION

This exception is raised if you call the importFrom( ) method within a source plug-in when any other exception is raised.

See Appendix H for more information about these exceptions.

Examples

Import audio data from the specified external data source into the local source:

DECLARE
  obj ORDSYS.ORDAudio;
  ctx RAW(4000) :=NULL;
BEGIN
  SELECT aud INTO obj FROM TAUD  WHERE N=1 FOR UPDATE;
  DBMS_OUTPUT.PUT_LINE('setting and getting source');
  DBMS_OUTPUT.PUT_LINE('--------------------------');
  -- set source to a file
  -- import data
  obj.importFrom(ctx,'FILE','AUDIODIR','testaud.dat');
  -- check size
  DBMS_OUTPUT.PUT_LINE(TO_CHAR(obj.getContentLength(ctx)));
  DBMS_OUTPUT.PUT_LINE(obj.getSource);
  DBMS_OUTPUT.PUT_LINE('deleting contents');
  DBMS_OUTPUT.PUT_LINE('-----------------');
  obj.deleteContent;
  DBMS_OUTPUT.PUT_LINE(TO_CHAR(obj.getContentLength(ctx)));
  DBMS_OUTPUT.PUT_LINE(TO_CHAR(DBMS_LOB.GETLENGTH(obj.getContent)));
  UPDATE TAUD SET aud=obj WHERE N=1;
  COMMIT;
  EXCEPTION
        WHEN ORDSYS.ORDAudioExceptions.METHOD_NOT_SUPPORTED THEN
        DBMS_OUTPUT.PUT_LINE('Source not specified');
END;
/

export( ) Method

Format

export(

ctx IN OUT RAW,

source_type IN VARCHAR2,

source_location IN VARCHAR2,

source_name IN VARCHAR2);

Description

Copies audio data from a local source (localData) within an Oracle database to an external audio data source.


Note:

The export( ) method natively supports only sources of source type FILE. User-defined sources may support the export( ) method. 


Parameters

ctx

The source plug-in context information.

source_type

The source type of the location to where the data is to be exported.

source_location

The location where the audio data is to be exported.

source_name

The name of the audio object to where the data is to be exported.

Usage Notes

After exporting audio data, all audio attributes remain unchanged and srcType, srcLocation, and srcName are updated with input values. After calling the export( ) method, you can call the clearLocal( ) method to indicate the data is stored outside the database and call the deleteContent( ) method if you want to delete the content of the local data.

This method is also available for user-defined sources that can support the export method.

The only server-side native support for the export method is for the srcType FILE.

The export( ) method for a source type of FILE is similar to a file copy operation in that the original data stored in the BLOB is not touched other than for reading purposes.

The export( ) method is not an exact mirror operation to the import( ) method in that the clearLocal( ) method is not automatically called to indicate the data is stored outside the database, whereas the import( ) method automatically calls the setLocal( ) method.

Call the deleteContent( ) method after calling the export( ) method to delete the content from the database if you no longer intend to manage the multimedia data within the database.

The export( ) method writes only to a directory object that the user has privilege to access. That is, you can access a directory that you have created using the SQL CREATE DIRECTORY statement, or one to which you have been granted READ access. To execute the CREATE DIRECTORY statement, you must have the CREATE ANY DIRECTORY privilege. In addition, you must use the DBMS_JAVA.GRANT_PERMISSION call to specify which files can be written.

For example, the following grants the user, MEDIAUSER, the permission to write to the file named filename.dat:

CALL DBMS_JAVA.GRANT_PERMISSION(
        'MEDIAUSER',
        'java.io.FilePermission',
        '/actual/server/directory/path/filename.dat',
        'write');

See the security and performance section in the Oracle8i Java Developer's Guide for more information.

Invoking this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION

This exception is raised if you call the export( ) method and the value of srcType is NULL.

ORDSourceExceptions.METHOD_NOT_SUPPORTED

This exception is raised if you call the export( ) method and this method is not supported by the source plug-in being used.

ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION

This exception is raised if you call the export( ) method within a source plug-in when any other exception is raised.

See Appendix H for more information about these exceptions.

Examples

Export data from a local source to an external data source:

DECLARE
  obj ORDSYS.ORDAudio;
  ctx RAW(4000) :=NULL;
BEGIN
   SELECT aud INTO obj FROM taud   WHERE N = 1;
   obj.export(ctx,'FILE','AUDIODIR','testaud.dat');
  EXCEPTION
  WHEN ORDSYS.ORDSourceExceptions.METHOD_NOT_SUPPORTED THEN
   DBMS_OUTPUT.put_line('Source METHOD_NOT_SUPPORTED caught');
  WHEN ORDSYS.ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION THEN
   DBMS_OUTPUT.put_line('SOURCE PLUGIN EXCEPTION caught');
  WHEN OTHERS THEN
   DBMS_OUTPUT.put_line('OTHER EXCEPTION caught');
END;
/

getContentLength( ) Method

Format

getContentLength(ctx IN OUT RAW) RETURN INTEGER;

Description

Returns the length of the audio data content stored in the source.

Parameters

ctx

The source plug-in context information.

Usage Notes

This method is not supported for all source types. For example, HTTP type sources do not support this method. If you want to implement this call for HTTP type sources, you must define your own modified HTTP source type and implement this method on it.

Pragmas

PRAGMA RESTRICT_REFERENCES(getContentLength, WNDS,
WNPS, RNDS, RNPS)

Exceptions

ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION

This exception is raised if you call the getContentLength( ) method and the value of srcType is NULL and data is not stored locally in the BLOB.

ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION

This exception is raised if you call the getContentLength( ) method within a source plug-in when any other exception is raised.

See Appendix H for more information about these exceptions.

Examples

See the example in the import( ) Method.


getContentInLob( ) Method

Format

getContentInLob(

ctx IN OUT RAW,

dest_lob IN OUT NOCOPY BLOB,

mimeType OUT VARCHAR2,

format OUT VARCHAR2)

Description

Transfers data from a data source into the specified BLOB. The BLOB can be another BLOB, not the one for the object.

Parameters

ctx

The source plug-in context information.

dest_lob

The LOB in which to receive data.

mimeType

The MIME type of the data; this may or may not be returned.

format

The format of the data; this may or may not be returned.

Usage Notes

None.

Pragmas

None.

Exceptions

ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION

This exception is raised if you call the getContentInLob( ) method and the value of srcType is NULL.

ORDSourceExceptions.METHOD_NOT_SUPPORTED

This exception is raised if you call the getContentInLob( ) method and this method is not supported by the source plug-in being used.

ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION

This exception is raised if you call the getContentInLob( ) method within a source plug-in when any other exception is raised.

See Appendix H for more information about these exceptions.

Examples

Get data from a data source and put it into the specified BLOB:

DECLARE
 obj ORDSYS.ORDAudio;
 tempBLob BLOB;
 mimeType VARCHAR2(4000);
 format VARCHAR2(4000);
 ctx RAW(4000) :=NULL;
BEGIN
 SELECT aud INTO obj FROM TAUD WHERE N = 1 ;
 if(obj.isLocal) then
   DBMS_OUTPUT.put_line('local is true');
 end if;
 DBMS_LOB.CREATETEMPORARY(tempBLob, true, 10);
 obj.getContentInLob(ctx,tempBLob, mimeType,format);
 -- process tempBLob
 DBMS_OUTPUT.PUT_LINE(TO_CHAR(DBMS_LOB.getLength(tempBLob)));
 EXCEPTION
  WHEN ORDSYS.ORDAudioExceptions.METHOD_NOT_SUPPORTED THEN
   DBMS_OUTPUT.put_line('ORDAudioExceptions.METHOD_NOT_SUPPORTED caught');
  WHEN OTHERS THEN
   DBMS_OUTPUT.put_line('EXCEPTION caught');
END;
/


getContent Method

Format

getContent RETURN BLOB;

Description

Returns a handle to the local BLOB storage, that is the BLOB within the ORDAudio object.

Parameters

None.

Usage Notes

None.

Pragmas

PRAGMA RESTRICT_REFERENCES(getContent, WNDS, WNPS, RNDS, RNPS)

Exceptions

None.

Examples

A client accesses audio data:

DECLARE
  obj ORDSYS.ORDAudio;
BEGIN
  SELECT aud INTO obj FROM TAUD  WHERE N=1 ;
  DBMS_OUTPUT.PUT_LINE('--------------------------');
  DBMS_OUTPUT.put_line(TO_CHAR(DBMS_LOB.getLength(obj.getContent)));
  EXCEPTION
        WHEN ORDSYS.ORDAudioExceptions.METHOD_NOT_SUPPORTED THEN
        DBMS_OUTPUT.PUT_LINE('Source not specified');
END;
/

deleteContent Method

Format

deleteContent;

Description

Deletes the local data from the current local source (localData).

Parameters

None.

Usage Notes

This method can be called after you export the data from the local source to an external audio data source and you no longer need this data in the local source.

Call this method when you want to update the object with a new object.

Pragmas

None.

Exceptions

None.

Examples

See the example in the import( ) Method.



getBFILE Method

Format

getBFILE RETURN BFILE;

Description

Returns the LOB locator of the BFILE containing the audio clip.

Parameters

None.

Usage Notes

This method constructs and returns a BFILE using the stored source.srcLocation and source.srcName attribute information. The source.srcLocation attribute must contain a defined directory object. The source.srcName attribute must be a valid file name.

Pragmas

PRAGMA RESTRICT_REFERENCES(getBFILE, WNDS, WNPS, RNDS, RNPS)

Exceptions

If the source.srcType attribute value is NULL, calling this method raises an INCOMPLETE_SOURCE_INFORMATION exception.

If the value of srcType is other than FILE, then calling this method raises an INVALID_SOURCE_TYPE exception.

Examples

Return the BFILE for the stored source directory and file name attributes:

DECLARE
    Audio ORDSYS.ORDAudio;
    audiobfile BFILE;
BEGIN
    SELECT audioclip INTO Audio FROM emp
      WHERE ename = 'John Doe';
    -- get the audio BFILE
    audiobfile := Audio.getBFILE;
END;

4.3.6 ORDAudio Methods Associated with File-Like Operations

This section presents reference information on the ORDAudio methods associated with file-like operations on a data source. You can use the following methods specifically to manipulate audio data.


openSource( ) Method

Format

openSource(userArg IN RAW, ctx OUT RAW) RETURN INTEGER;

Description

Opens a data source.

Parameters

userArg

The user argument. This may be used by user-defined source plug-ins.

ctx

The source plug-in context information. This must be allocated. You must call the openSource( ) method; see the introduction to this chapter for more information.

Usage Notes

The return INTEGER is 0 (zero) for success and >0 (for example, 1) for failure. The exact number and the meaning for that number is plug-in defined. For example, for the file plug-in, 1 might mean "File not found," 2 might mean "No such directory," and so forth.

Pragmas

None.

Exceptions

ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION

This exception is raised if you call the openSource( ) method and the value for srcType is NULL and data is not local.

ORDSourceExceptions.METHOD_NOT_SUPPORTED

This exception is raised if you call the openSource( ) method and this method is not supported by the source plug-in being used.

ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION

This exception is raised if you call the openSource( ) method within a source plug-in when any other exception is raised.

See Appendix H for more information about these exceptions.

Examples

Open an external data source:

DECLARE
  obj ORDSYS.ORDAudio;
  res INTEGER;
  ctx RAW(4000) :=NULL;
  userArg RAW(4000);
BEGIN
  select aud into obj from TAUD where N =1 for UPDATE;
  res := obj.openSource(userArg, ctx);
  UPDATE TAUD SET aud=obj WHERE N=1 ;
  COMMIT;
  EXCEPTION
   WHEN ORDSYS.ORDSourceExceptions.METHOD_NOT_SUPPORTED THEN
    DBMS_OUTPUT.put_line('ORDSourceExceptions.METHOD_NOT_SUPPORTED caught');
   WHEN OTHERS THEN
    DBMS_OUTPUT.put_line('EXCEPTION caught');
END;
/


closeSource( ) Method

Format

closeSource(ctx IN OUT RAW) RETURN INTEGER;

Description

Closes a data source.

Parameters

ctx

The source plug-in context information. You must call the openSource( ) method; see the introduction to this chapter for more information.

Usage Notes

The return INTEGER is 0 (zero) for success and >0 (for example, 1) for failure. The exact number and the meaning for that number is plug-in defined. For example, for the file plug-in, 1 might mean "File not found," 2 might mean "No such directory," and so forth.

Pragmas

None.

Exceptions

ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION

This exception is raised if you call the closeSource( ) method and the value for srcType is NULL and data is not local.

ORDSourceExceptions.METHOD_NOT_SUPPORTED

This exception is raised if you call the closeSource( ) method and this method is not supported by the source plug-in being used.

ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION

This exception is raised if you call the closeSource( ) method within a source plug-in when any other exception is raised.

See Appendix H for more information about these exceptions.

Examples

Close an external data source:

DECLARE
  obj ORDSYS.ORDAudio;
  res INTEGER;
  ctx RAW(4000) :=NULL;
BEGIN
  select aud into obj from TAUD where N =2 for UPDATE;
  res := obj.closeSource(ctx);
  UPDATE TAUD SET aud=obj WHERE N=2 ;
  COMMIT;
  EXCEPTION
   WHEN ORDSYS.ORDSourceExceptions.METHOD_NOT_SUPPORTED THEN
    DBMS_OUTPUT.put_line('ORDSourceExceptions.METHOD_NOT_SUPPORTED caught');
   WHEN OTHERS THEN
    DBMS_OUTPUT.put_line('EXCEPTION caught');
END;
/


trimSource( ) Method

Format

trim(ctx IN OUT RAW,

newlen IN INTEGER) RETURN INTEGER;

Description

Trims a data source.

Parameters

ctx

The source plug-in context information. This must be allocated. You must call the openSource( ) method; see the introduction to this chapter for more information.

newlen

The trimmed new length.

Usage Notes

The return INTEGER is 0 (zero) for success and >0 (for example, 1) for failure. The exact number and the meaning for that number is plug-in defined. For example, for the file plug-in, 1 might mean "File not found," 2 might mean "No such directory," and so forth.

Pragmas

None.

Exceptions

ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION

This exception is raised if you call the trimSource( ) method and the value for srcType is NULL and data is not local.

ORDSourceExceptions.METHOD_NOT_SUPPORTED

This exception is raised if you call the trimSource( ) method and this method is not supported by the source plug-in being used.

ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION

This exception is raised if you call the trimSource( ) method within a source plug-in when any other exception is raised.

See Appendix H for more information about these exceptions.

Examples

Trim an external data source:

DECLARE
  obj ORDSYS.ORDAudio;
  res INTEGER;
  ctx RAW(4000) :=NULL;
BEGIN
  select aud into obj from TAUD where N =1 for UPDATE;
  res := obj.trimSource(ctx,0);
  UPDATE TAUD SET aud=obj WHERE N=1 ;
  COMMIT;
  EXCEPTION
   WHEN ORDSYS.ORDSourceExceptions.METHOD_NOT_SUPPORTED THEN
    DBMS_OUTPUT.put_line('ORDSourceExceptions.METHOD_NOT_SUPPORTED caught');
   WHEN OTHERS THEN
    DBMS_OUTPUT.put_line('EXCEPTION caught');
END;
/


readFromSource( ) Method

Format

readFromSource(

ctx IN OUT RAW,

startPos IN INTEGER,

numBytes IN OUT INTEGER,

buffer OUT RAW);

Description

Allows you to read a buffer of n bytes from a source beginning at a start position.

Parameters

ctx

The source plug-in context information. This must be allocated. You must call the openSource( ) method; see the introduction to this chapter for more information.

startPos

The start position in the data source.

numBytes

The number of bytes to be read from the data source.

buffer

The buffer into which the data will be read.

Usage Notes

This method is not supported for HTTP sources.

To successfully read HTTP source types, the entire URL source must be requested to be read. If you want to implement a read method for an HTTP source type, you must provide your own implementation for this method in the modified source plug-in for the HTTP source type.

Pragmas

None.

Exceptions

ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION

This exception is raised if you call the readFromSource( ) method and the value of srcType is NULL and data is not local.

ORDSourceExceptions.NULL_SOURCE

This exception is raised if you call the readFromSource( ) method and the data is local but localData is NULL.

ORDSourceExceptions.METHOD_NOT_SUPPORTED

This exception is raised if you call the readFromSource( ) method and this method is not supported by the source plug-in being used.

ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION

This exception is raised if you call the readFromSource( ) method within a source plug-in when any other exception is raised.

See Appendix H for more information about these exceptions.

Examples

Read a buffer from the source:

DECLARE
  obj ORDSYS.ORDAudio;
  buffer RAW(4000);
  i INTEGER;
  ctx RAW(4000) :=NULL;
BEGIN
  i := 20;
  select aud into obj from TAUD where N =1 ;
  obj.readFromSource(ctx,1,i,buffer);
  DBMS_OUTPUT.PUT_LINE(TO_CHAR(obj.getContentLength(ctx)));
  EXCEPTION
   WHEN ORDSYS.ORDSourceExceptions.METHOD_NOT_SUPPORTED THEN
    DBMS_OUTPUT.put_line('ORDSourceExceptions.METHOD_NOT_SUPPORTED caught');
   WHEN OTHERS THEN
    DBMS_OUTPUT.put_line('EXCEPTION caught');
END;
/

writeToSource( ) Method

Format

writeToSource(

ctx IN OUT RAW,

startPos IN INTEGER,

numBytes IN OUT INTEGER,

buffer IN RAW);

Description

Allows you to write a buffer of n bytes to a source beginning at a start position.

Parameters

ctx

The source plug-in context information. This must be allocated. You must call the openSource( ) method; see the introduction to this chapter for more information.

startPos

The start position in the source to where the buffer should be copied.

numBytes

The number of bytes to be written to the source.

buffer

The buffer of data to be written.

Usage Notes

This method assumes that the writable source allows you to write n number of bytes starting at a random byte location. The FILE and HTTP source types are not writable sources and do not support this method. This method will work if data is stored in a local BLOB or is accessible through a user-defined source plug-in.

Pragmas

None.

Exceptions

ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION

This exception is raised if you call the writeToSource( ) method and the value of srcType is NULL and data is not local.

ORDSourceExceptions.NULL_SOURCE

This exception is raised if you call the writeToSource( ) method and the data is local but localData is NULL.

ORDSourceExceptions.METHOD_NOT_SUPPORTED

This exception is raised if you call the writeToSource( ) method and this method is not supported by the source plug-in being used.

ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION

This exception is raised if you call the writeToSource( ) method within a source plug-in when any other exception is raised.

See Appendix H for more information about these exceptions.

Examples

Write a buffer to the source:

DECLARE
  obj ORDSYS.ORDAudio;
  n INTEGER := 6;
  ctx RAW(4000) :=NULL;
BEGIN
  select aud into obj from TAUD where N =1 for update;
  obj.writeToSource(ctx,1,n,UTL_RAW.CAST_TO_RAW('helloP'));
  DBMS_OUTPUT.PUT_LINE(TO_CHAR(obj.getContentLength(ctx)));
  update  TAUD set aud = obj where  N =1 ;
  COMMIT;
  EXCEPTION
   WHEN ORDSYS.ORDSourceExceptions.METHOD_NOT_SUPPORTED THEN
    DBMS_OUTPUT.put_line('ORDSourceExceptions.METHOD_NOT_SUPPORTED caught');
   WHEN OTHERS THEN
    DBMS_OUTPUT.put_line('EXCEPTION caught');
END;
/

4.3.7 ORDAudio Methods Associated with the comments Attribute

This section presents reference information on the ORDAudio methods associated with the comments attribute.


Note:

The comments attribute is populated by setProperties( ) when the setComments parameter is TRUE and by the Oracle interMedia Annotator utility. Oracle recommends that you not write to this attribute directly.  



appendToComments( ) Method

Format

appendToComments(amount IN BINARY_INTEGER,

buffer IN VARCHAR2);

Description

Appends a specified buffer and amount of comment data to the end of the comments attribute of the audio object.

Parameters

amount

The amount of comment data to be appended.

buffer

The buffer of comment data to be appended.

Usage Notes

None.

Pragmas

None.

Exceptions

The exceptions-raised behavior for this method is similar to that of the DBMS_LOB functions and procedures. See the DBMS_LOB package description in the Oracle8i Supplied PL/SQL Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Examples

Append comment information to the comments attribute of the audio object:

DECLARE
  obj ORDSYS.ORDAudio;
  i INTEGER;
  j INTEGER;
BEGIN
  SELECT aud INTO obj FROM TAUD  WHERE N=1 FOR UPDATE;
  obj.deleteComments;
  obj.writeToComments(1,18,'This is a Comments');
  obj.appendToComments(18,'This is a Comments');
  -- check comments
  DBMS_OUTPUT.PUT_LINE(obj.readFromComments(1,obj.getCommentLength));
  DBMS_OUTPUT.PUT_LINE(obj.locateInComments('Comments',1));
  obj.trimComments(18);
  DBMS_OUTPUT.PUT_LINE(obj.readFromComments(1,18));
  i := 8;
  j := 9;
  obj.eraseFromComments(i,j);
  DBMS_OUTPUT.PUT_LINE(obj.readFromComments(1,10));
  obj.deleteComments;
  DBMS_OUTPUT.PUT_LINE(obj.readFromComments(1,10));
  UPDATE TAUD SET aud=obj WHERE N=1;
  COMMIT;
  EXCEPTION
        WHEN ORDSYS.ORDAudioExceptions.METHOD_NOT_SUPPORTED THEN  
        DBMS_OUTPUT.PUT_LINE('Source not specified');
END;
/

writeToComments( ) Method

Format

writeToComments(offset IN INTEGER,

amount IN BINARY_INTEGER,

buffer IN VARCHAR2);

Description

Writes a specified amount of comment buffer data to the comments attribute of the audio object beginning at the specified offset.

Parameters

offset

The starting offset position in comments where comments data is to be written.

amount

The amount of comment data to be written.

buffer

The buffer of comment data to be written.

Usage Notes

None.

Pragmas

None.

Exceptions

The exceptions-raised behavior for this method is similar to that of the DBMS_LOB functions and procedures. See the DBMS_LOB package description in the Oracle8i Supplied PL/SQL Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Examples

See the example in the appendToComments( ) Method.


readFromComments( ) Method

Format

readFromComments(offset IN INTEGER,

amount IN BINARY_INTEGER :=32767)

RETURN VARCHAR2;

Description

Reads a specified amount of comment data from the comments attribute of the audio object beginning at a specified offset.

Parameters

offset

The starting offset position in comments from where comments data is to be read.

amount

The amount of comment data to be read.

Usage Notes

None.

Pragmas

PRAGMA RESTRICT_REFERENCES(readFromComments, WNDS,
WNPS, RNDS, RNPS)

Exceptions

The exceptions-raised behavior for this method is similar to that of the DBMS_LOB functions and procedures. See the DBMS_LOB package description in the Oracle8i Supplied PL/SQL Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Examples

See the example in the appendToComments( ) Method.


locateInComments( ) Method

Format

locateInComments(pattern IN VARCHAR2,

offset IN INTEGER := 1,

occurrence IN INTEGER := 1)

RETURN INTEGER;

Description

Matches and locates the nth occurrence of the specified pattern of character data in the comments attribute of the audio object beginning at a specified offset.

Parameters

pattern

The pattern of comment data for which to search.

offset

The starting offset position in comments where the search for a match should begin.

occurrence

The nth occurrence in the comments where the pattern of comment data was found.

Usage Notes

None.

Pragmas

None.

Exceptions

The exceptions-raised behavior for this method is similar to that of the DBMS_LOB functions and procedures. See the DBMS_LOB package description in the Oracle8i Supplied PL/SQL Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Examples

See the example in the appendToComments( ) Method.


trimComments( ) Method

Format

trimComments(newlen IN INTEGER);

Description

Trims the length of comments of the audio object to the specified new length.

Parameters

newlen

The new length to which the comments are to be trimmed.

Usage Notes

None.

Pragmas

None.

Exceptions

The exceptions-raised behavior for this method is similar to that of the DBMS_LOB functions and procedures. See the DBMS_LOB package description in the Oracle8i Supplied PL/SQL Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Examples

See the example in the appendToComments( ) Method.



eraseFromComments( ) Method

Format

eraseFromComments(amount IN OUT NOCOPY INTEGER,

offset IN INTEGER := 1);

Description

Erases a specified amount of comment data from the comments attribute of the audio object beginning at a specified offset.

Parameters

amount

The amount of comment data to be erased.

offset

The starting offset position in comments where comments data is to be erased.

Usage Notes

None.

Pragmas

None.

Exceptions

The exceptions-raised behavior for this method is similar to that of the DBMS_LOB functions and procedures. See the DBMS_LOB package description in the Oracle8i Supplied PL/SQL Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Examples

See the example in the appendToComments( ) Method.



deleteComments Method

Format

deleteComments;

Description

Deletes the comments attribute of the audio object.

Parameters

None.

Usage Notes

None.

Pragmas

None.

Exceptions

The exceptions-raised behavior for this method is similar to that of the DBMS_LOB functions and procedures. See the DBMS_LOB package description in the Oracle8i Supplied PL/SQL Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Examples

See the example in the appendToComments( ) Method.



loadCommentsFromFile( ) Method

Format

loadCommentsFromFile(fileobj IN BFILE,

amount IN INTEGER,

from_loc IN INTEGER := 1,

to_loc IN INTEGER := 1);

Description

Loads a specified amount of comment data from a BFILE into the comments attribute of the audio object beginning at a specified offset.

Parameters

fileobj

The file object to be loaded.

amount

The amount of comment data to be loaded from the BFILE.

from_loc

The location from which to load comments from the BFILE.

to_loc

The location to which to load comments.

Usage Notes

None.

Pragmas

None.

Exceptions

The exceptions-raised behavior for this method is similar to that of the DBMS_LOB functions and procedures. See the DBMS_LOB package description in the Oracle8i Supplied PL/SQL Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Examples

Load comment information from a BFILE into the comments of the audio data:

DECLARE
  file_handle BFILE;
  obj ORDSYS.ORDAudio;
  isopen BINARY_INTEGER;
  amount INTEGER;
BEGIN
  SELECT aud INTO obj FROM TAUD  WHERE N=1 FOR UPDATE;
  file_handle := BFILENAME(obj.getSourceLocation, obj.getSourceName);
     isopen := DBMS_LOB.FILEISOPEN(file_handle);
     IF isopen = 0 THEN
       dbms_output.put_line('File Not Open');
       DBMS_LOB.FILEOPEN(file_handle, DBMS_LOB.FILE_READONLY);
     END IF;
     dbms_output.put_line('File is now Open');
     isopen := DBMS_LOB.FILEISOPEN(file_handle);
     IF isopen <> 0 THEN
       amount := DBMS_LOB.GETLENGTH(file_handle);
     END IF;
     obj.deleteComments;
     obj.loadCommentsFromFile(file_handle, 18, 1, 18);
     DBMS_OUTPUT.put_line(TO_CHAR(obj.getCommentLength));
  UPDATE TAUD SET aud=obj WHERE N=1;
  COMMIT;
END;
/

copyCommentsOut( ) Method

Format

copyCommentsOut(dest IN OUT NOCOPY CLOB,

amount IN INTEGER,

from_loc IN INTEGER := 1,

to_loc IN INTEGER := 1);

Description

Copies a specified amount of audio object comments attribute into the given CLOB.

Parameters

dest

The destination to which the comments are to be copied.

amount

The amount of comments to be copied.

from_loc

The location from which to copy comments.

to_loc

The location to which to copy comments.

Usage Notes

None.

Pragmas

None.

Exceptions

The exceptions-raised behavior for this method is similar to that of the DBMS_LOB functions and procedures. See the DBMS_LOB package description in the Oracle8i Supplied PL/SQL Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Examples

Copy comments of the audio data to the given CLOB:

DECLARE
  obj ORDSYS.ORDAudio;
  obj1 ORDSYS.ORDAudio;
BEGIN
  SELECT aud INTO obj1 FROM TAUD  WHERE N=2 FOR UPDATE;
  SELECT aud INTO obj FROM TAUD  WHERE N=1;
  obj.copyCommentsOut(obj1.comments,obj.getCommentLength,1,10);
  DBMS_OUTPUT.put_line(obj1.getCommentLength);
  DBMS_OUTPUT.put_line(obj.getCommentLength);
  UPDATE TAUD SET aud=obj1 WHERE N=2;
  COMMIT;
  EXCEPTION
        WHEN ORDSYS.ORDAudioExceptions.METHOD_NOT_SUPPORTED THEN
        DBMS_OUTPUT.PUT_LINE('Source not specified');
END;
/

compareComments( ) Method

Format

compareComments(compare_with_lob IN CLOB,

amount IN INTEGER := 4294967295,

starting_pos_in_comment IN INTEGER := 1,

starting_pos_in_compare IN INTEGER := 1)

RETURN INTEGER;

Description

Compares a specified amount of comments of audio data with comments of the other CLOB provided.

Parameters

compare_with_lob

The comparison comments.

amount

The amount of comments of audio data to compare with the comparison comments.

starting_pos_in_comment

The starting position in the comments attribute of the audio object.

starting_pos_in_compare

The starting position in the comparison comments.

Usage Notes

None.

Pragmas

PRAGMA RESTRICT_REFERENCES(compareComments, WNDS,
WNPS, RNDS, RNPS)

Exceptions

The exceptions-raised behavior for this method is similar to that of the DBMS_LOB functions and procedures. See the DBMS_LOB package description in the Oracle8i Supplied PL/SQL Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Examples

Compare comments of the audio data with comments of another CLOB:

DECLARE
  file_handle BFILE;
  obj ORDSYS.ORDAudio;
  obj1 ORDSYS.ORDAudio;
BEGIN
  SELECT aud INTO obj FROM TAUD  WHERE N=2 ;
  SELECT aud INTO obj1 FROM TAUD  WHERE N=1;
  DBMS_OUTPUT.put_line('comparison output');
  DBMS_OUTPUT.put_line(obj.compareComments(obj1.comments,obj.getCommentLength,1,18));
  EXCEPTION
        WHEN ORDSYS.ORDAudioExceptions.METHOD_NOT_SUPPORTED THEN
        DBMS_OUTPUT.PUT_LINE('Source not specified');
END;
/

getCommentLength( ) Method

Format

getCommentLength RETURN INTEGER;

Description

Returns the length of the comments attribute of the audio object.

Parameters

None.

Usage Notes

None.

Pragmas

PRAGMA RESTRICT_REFERENCES(getCommentLength, WNDS,
WNPS, RNDS, RNPS)

Exceptions

The exceptions-raised behavior for this method is similar to that of the DBMS_LOB functions and procedures. See the DBMS_LOB package description in the Oracle8i Supplied PL/SQL Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Examples

See the example in the compareComments( ) Method.


4.3.8 ORDAudio Methods Associated with Audio Attributes Accessors

This section presents reference information on the ORDAudio methods associated with the audio attributes accessors.


setFormat( ) Method

Format

setFormat(knownFormat IN VARCHAR2);

Description

Sets the format attribute of the audio object.

Parameters

knownFormat

The known format of the audio data to be set in the audio object.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

NULL_INPUT_VALUE

This exception is raised if you call the setFormat( ) method and the value for the knownFormat parameter is NULL.

Examples

Set the format for some audio data:

DECLARE
  obj ORDSYS.ORDAudio;
BEGIN
  select aud into obj from TAUD where N =1 for update;
  obj.setFormat('AUFF');
  obj.setEncoding('MULAW');
  obj.setNumberOfChannels(1);
  obj.setSamplingRate(8);
  obj.setSampleSize(8);
  obj.setCompressionType('8BITMONOAUDIO');
  obj.setAudioDuration(16);
  DBMS_OUTPUT.put_line('format: ' || obj.getformat);
  DBMS_OUTPUT.put_line('encoding: ' || obj.getEncoding);
  DBMS_OUTPUT.put_line('numberOfChannels: ' || TO_CHAR(obj.getNumberOfChannels));
  DBMS_OUTPUT.put_line('samplingRate: ' || TO_CHAR(obj.getSamplingRate));
  DBMS_OUTPUT.put_line('sampleSize: ' || TO_CHAR(obj.getSampleSize));
  DBMS_OUTPUT.put_line('compressionType : ' || obj.getCompressionType);
  DBMS_OUTPUT.put_line('audioDuration: ' || TO_CHAR(obj.getAudioDuration));
  COMMIT;
  EXCEPTION
   WHEN ORDSYS.ORDAudioExceptions.METHOD_NOT_SUPPORTED THEN
    DBMS_OUTPUT.put_line('ORDSourceExceptions.METHOD_NOT_SUPPORTED caught');
   WHEN OTHERS THEN
    DBMS_OUTPUT.put_line('EXCEPTION caught');
END;
/


getFormat Method

Format

getFormat RETURN VARCHAR2;

Description

Returns the value of the format attribute of the audio object.

Parameters

None.

Usage Notes

None.

Pragmas

PRAGMA RESTRICT_REFERENCES(getFormat, WNDS, WNPS, RNDS, RNPS)

Exceptions

AUDIO_FORMAT_IS_NULL

This exception is raised if you call the getFormat( ) method and the value for format is NULL.

Examples

See the example in the setFormat( ) Method.



setEncoding( ) Method

Format

setEncoding(knownEncoding IN VARCHAR2);

Description

Sets the value of the encoding attribute of the audio object.

Parameters

knownEncoding

A known encoding type.

Usage Notes

The value of encoding always matches that of the compressionType value because in many audio formats, encoding and compression type are tightly integrated. See Appendix A for more information.

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

NULL_INPUT_VALUE

This exception is raised if you call the setEncoding( ) method and the value for the knownEncoding parameter is NULL.

Examples

See the example in the setFormat( ) Method.


getEncoding Method

Format

getEncoding RETURN VARCHAR2;

Description

Returns the value of the encoding attribute of the audio object.

Parameters

None.

Usage Notes

None.

Pragmas

PRAGMA RESTRICT_REFERENCES(getEncoding, WNDS, WNPS, RNDS, RNPS)

Exceptions

None.

Examples

See the example in the setFormat( ) Method.


setNumberOfChannels( ) Method

Format

setNumberOfChannels(knownNumberOfChannels IN INTEGER);

Description

Sets the value of the numberOfChannels attribute for the audio object.

Parameters

knownNumberOfChannels

A known number of channels.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

NULL_INPUT_VALUE

This exception is raised if you call the setNumberOfChannels( ) method and the value for the knownNumberOfChannels parameter is NULL.

Examples

See the example in the setFormat( ) Method.


getNumberOfChannels Method

Format

getNumberOfChannels RETURN INTEGER;

Description

Returns the value of the numberOfChannels attribute of the audio object.

Parameters

None.

Usage Notes

None.

Pragmas

PRAGMA RESTRICT_REFERENCES(getNumberOfChannels, WNDS,
WNPS, RNDS, RNPS)

Exceptions

None.

Examples

See the example in the setFormat( ) Method.


setSamplingRate( ) Method

Format

setSamplingRate(knownSamplingRate IN INTEGER);

Description

Sets the value of the samplingRate attribute of the audio object. The unit is Hz.

Parameters

knownSamplingRate

A known sampling rate.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

NULL_INPUT_VALUE

This exception is raised if you call the setSamplingRate( ) method and the value for the knownSamplingRate parameter is NULL.

Examples

See the example in the setFormat( ) Method.


getSamplingRate Method

Format

getSamplingRate IN INTEGER;

Description

Returns the value of the samplingRate attribute of the audio object. The unit is Hz.

Parameters

None.

Usage Notes

None.

Pragmas

PRAGMA RESTRICT_REFERENCES(getSamplingRate, WNDS,
WNPS, RNDS, RNPS)

Exceptions

None.

Examples

See the example in the setFormat( ) Method.




setSampleSize( ) Method

Format

setSampleSize(knownSampleSize IN INTEGER);

Description

Sets the value of the sampleSize attribute of the audio object.

Parameters

knownSampleSize

A known sample size.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

NULL_INPUT_VALUE

This exception is raised if you call the setSampleSize( ) method and the value for the knownSampleSize parameter is NULL.

Examples

See the example in the setFormat( ) Method.


getSampleSize Method

Format

getSampleSize RETURN INTEGER;

Description

Returns the value of the sampleSize attribute of the audio object.

Parameters

None.

Usage Notes

None.

Pragmas

PRAGMA RESTRICT_REFERENCES(getSampleSize, WNDS, WNPS, RNDS, RNPS)

Exceptions

None.

Examples

See the example in the setFormat( ) Method.


setCompressionType( ) Method

Format

setCompressionType(knownCompressionType IN VARCHAR2);

Description

Sets the value of the compressionType attribute of the audio object.

Parameters

knownCompressionType

A known compression type.

Usage Notes

The value of the compressionType always matches that of the encoding value because in many audio formats, encoding and compression type are tightly integrated. See Appendix A for more information.

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

NULL_INPUT_VALUE

This exception is raised if you call the setCompressionType( ) method and the value for the knownCompressionType parameter is NULL.

Examples

See the example in the setFormat( ) Method.


getCompressionType Method

Format

getCompressionType RETURN VARCHAR2;

Description

Returns the value of the compressionType attribute of the audio object.

Parameters

None.

Usage Notes

None.

Pragmas

PRAGMA RESTRICT_REFERENCES(getCompressionType, WNDS,
WNPS, RNDS, RNPS)

Exceptions

None.

Examples

See the example in the setFormat( ) Method.


setAudioDuration( ) Method

Format

setAudioDuration(knownAudioDuration IN INTEGER);

Description

Sets the value of the audioDuration attribute of the audio object.

Parameters

knownAudioDuration

A known audio duration.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

NULL_INPUT_VALUE

This exception is raised if you call the setAudioDuration( ) method and the value for the knownAudioDuration parameter is NULL.

Examples

See the example in the setFormat( ) Method.


getAudioDuration Method

Format

getAudioDuration RETURN INTEGER;

Description

Returns the value of the audioDuration attribute of the audio object.

Parameters

None.

Usage Notes

None.

Pragmas

PRAGMA RESTRICT_REFERENCES(getAudioDuration, WNDS,
WNPS, RNDS, RNPS)

Exceptions

None.

Examples

See the example in the setFormat( ) Method.


setKnownAttributes( ) Method

Format

setKnownAttributes(

knownFormat IN VARCHAR2,

knownEncoding IN VARCHAR2,

knownNumberOfChannels IN INTEGER,

knownSamplingRate IN INTEGER,

knownSamleSize IN INTEGER,

knownCompressionType IN VARCHAR2,

knownAudioDuration IN INTEGER);

Description

Sets the known audio attributes for the audio object.

Parameters

knownFormat

The known format.

knownEncoding

The known encoding type.

knownNumberOfChannels

The known number of channels.

knownSamplingRate

The known sampling rate.

knownSampleSize

The known sample size.

knownCompressionType

The known compression type.

knownAudioDuration

The known audio duration.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

None.

Examples

Set the known attributes for the audio data.

DECLARE
  obj ORDSYS.ORDAudio;
BEGIN
  select aud into obj from TAUD where N =1 for update;
  obj.setKnownAttributes('AUFF','MULAW', 1, 8, 8, '8BITMONOAUDIO',16);
  DBMS_OUTPUT.put_line('format: ' || obj.getformat);
  DBMS_OUTPUT.put_line('encoding: ' || obj.getEncoding);
  DBMS_OUTPUT.put_line('numberOfChannels: ' || TO_CHAR(obj.getNumberOfChannels));
  DBMS_OUTPUT.put_line('samplingRate: ' || TO_CHAR(obj.getSamplingRate));
  DBMS_OUTPUT.put_line('sampleSize: ' || TO_CHAR(obj.getSampleSize));
  DBMS_OUTPUT.put_line('compressionType : ' || obj.getCompressionType);
  DBMS_OUTPUT.put_line('audioDuration: ' || TO_CHAR(obj.getAudioDuration));
  COMMIT;
  EXCEPTION
   WHEN ORDSYS.ORDAudioExceptions.METHOD_NOT_SUPPORTED THEN
    DBMS_OUTPUT.put_line('ORDAudioExceptions.METHOD_NOT_SUPPORTED caught');
   WHEN OTHERS THEN
    DBMS_OUTPUT.put_line('EXCEPTION caught');
END;
/


setProperties( ) Method

Format

setProperties(ctx IN OUT RAW);

Description

Reads the audio data to get the values of the object attributes and then stores them in the object attributes. This method sets the properties for the following attributes of the audio data: format, encoding type, number of channels, sampling rate, and sample size.

Parameters

ctx

The format plug-in context information.

Usage Notes

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

If the format is set to NULL, then the setProperties( ) method uses the default format plug-in; otherwise, it uses the plug-in specified by the format.

Pragmas

None.

Exceptions

AUDIO_PLUGIN_EXCEPTION

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

Examples

Set the property information for known audio attributes:

DECLARE
  obj ORDSYS.ORDAudio;
  ctx RAW(4000) :=NULL;
BEGIN
  select aud into obj from TAUD where N =1 for update;
  obj.setProperties(ctx);
  --DBMS_OUTPUT.put_line('format: ' || obj.getformat);
  DBMS_OUTPUT.put_line('encoding: ' || obj.getEncoding);
  DBMS_OUTPUT.put_line('numberOfChannels: ' || TO_CHAR(obj.getNumberOfChannels));
  DBMS_OUTPUT.put_line('samplingRate: ' || TO_CHAR(obj.getSamplingRate));
  DBMS_OUTPUT.put_line('sampleSize: ' || TO_CHAR(obj.getSampleSize));
  update  TAUD set aud = obj where  N =1 ;
  COMMIT;
  EXCEPTION
   WHEN ORDSYS.ORDAudioExceptions.METHOD_NOT_SUPPORTED THEN
    DBMS_OUTPUT.put_line('ORDAudioExceptions.METHOD_NOT_SUPPORTED caught');
   WHEN OTHERS THEN
    DBMS_OUTPUT.put_line('EXCEPTION caught');
END;
/


setProperties( ) Method (XML)

Format

setProperties(ctx IN OUT RAW,

setComments IN BOOLEAN);

Description

Reads the audio data to get the values of the object attributes and then stores them in the object attributes. This method sets the properties for the following attributes of the audio data: format, encoding type, number of channels, sampling rate, and sample size. It populates the comments field of the object with a rich set of format and application properties in XML form if the value of the setComments parameter is TRUE.

Parameters

ctx

The format plug-in context information.

setComments

If the value is TRUE, then the comments field of the object is populated with a rich set of format and application properties of the audio object in XML form, identical to what is provided by the interMedia Annotator utility; otherwise, if the value is FALSE, the comments field of the object remains unpopulated. The default value is FALSE.

Usage Notes

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

If the format is set to NULL, then the setProperties( ) method uses the default format plug-in; otherwise, it uses the plug-in specified by the format.

Pragmas

None.

Exceptions

AUDIO_PLUGIN_EXCEPTION

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

Examples

Set the property information for known audio attributes:

DECLARE
  obj ORDSYS.ORDAudio;
  ctx RAW(4000) :=NULL;
BEGIN
  select aud into obj from TAUD where N =1 for update;
  obj.setProperties(ctx,0);
  --DBMS_OUTPUT.put_line('format: ' || obj.getformat);
  DBMS_OUTPUT.put_line('encoding: ' || obj.getEncoding);
  DBMS_OUTPUT.put_line('numberOfChannels: ' || TO_CHAR(obj.getNumberOfChannels));
  DBMS_OUTPUT.put_line('samplingRate: ' || TO_CHAR(obj.getSamplingRate));
  DBMS_OUTPUT.put_line('sampleSize: ' || TO_CHAR(obj.getSampleSize));
  update  TAUD set aud = obj where  N =1 ;
  COMMIT;
  EXCEPTION
   WHEN ORDSYS.ORDAudioExceptions.METHOD_NOT_SUPPORTED THEN
    DBMS_OUTPUT.put_line('ORDAudioExceptions.METHOD_NOT_SUPPORTED caught');
   WHEN OTHERS THEN
    DBMS_OUTPUT.put_line('EXCEPTION caught');
END;
/


checkProperties( ) Method

Format

checkProperties(ctx IN OUT RAW) RETURN BOOLEAN;

Description

Checks the properties of the stored audio data, including the following audio attributes: sample size, sample rate, number of channels, format, and encoding type.

Parameters

ctx

The format plug-in context information.

Usage Notes

If the format is set to NULL, then the checkProperties( ) method uses the default format plug-in; otherwise, it uses the plug-in specified by the format.

The checkProperties( ) method does not check the MIME type because a file can have multiple correct MIME types and this is not well defined.

Pragmas

None.

Exceptions

AUDIO_PLUGIN_EXCEPTION

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

Examples

Check property information for known audio attributes:

DECLARE
  obj ORDSYS.ORDAudio;
  ctx RAW(4000) :=NULL;
BEGIN
  select aud into obj from TAUD where N =1 for update;
  if( obj.checkProperties(ctx) =  TRUE ) then
  DBMS_OUTPUT.put_line('true');
  else
  DBMS_OUTPUT.put_line('false');
  end if;
  EXCEPTION
   WHEN ORDSYS.ORDAudioExceptions.AUDIO_PLUGIN_EXCEPTION THEN
    DBMS_OUTPUT.put_line('ORDAudioExceptions.AUDIO_PLUGIN_EXCEPTION caught');
   WHEN OTHERS THEN
    DBMS_OUTPUT.put_line('EXCEPTION caught');
END;
/


getAttribute( ) Method

Format

getAttribute(

ctx IN OUT RAW,

name IN VARCHAR2)

RETURN VARCHAR2;

Description

Returns the value of the requested attribute from audio data for user-defined formats only.

Parameters

ctx

The format plug-in context information.

name

The name of the attribute.

Usage Notes

The audio data attributes are available from the header of the formatted audio data.

If the format is set to NULL, then the getAttribute( ) method uses the default format plug-in; otherwise, it uses your user-defined format plug-in.

Audio data attribute information can be extracted from the audio data itself. You can extend support to a format not understood by the ORDAudio object by implementing an ORDPLUGINS.ORDX_<format>_AUDIO package that supports that format. See Section 2.3.13 for more information.

Pragmas

None.

Exceptions

AUDIO_PLUGIN_EXCEPTION

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

Examples

Return information for the specified audio attribute for audio data stored in the database:

DECLARE
  obj ORDSYS.ORDAudio;
  res VARCHAR2(4000);
  ctx RAW(4000) :=NULL;
BEGIN
  SELECT aud INTO obj FROM TAUD  WHERE N=1;
  DBMS_OUTPUT.PUT_LINE('getting audio sample size');
  DBMS_OUTPUT.PUT_LINE('---------------------');
  res := obj.getAttribute(ctx,'sample_size');
  EXCEPTION
        WHEN ORDSYS.ORDSourceExceptions.METHOD_NOT_SUPPORTED THEN
         DBMS_OUTPUT.put_line('Source METHOD_NOT_SUPPORTED caught');
        WHEN ORDSYS.ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION THEN
         DBMS_OUTPUT.put_line('SOURCE PLUGIN EXCEPTION caught');
        WHEN ORDSYS.ORDAudioExceptions.METHOD_NOT_SUPPORTED THEN
         DBMS_OUTPUT.put_line('AUDIO METHOD_NOT_SUPPORTED EXCEPTION caught');
        WHEN ORDSYS.ORDAudioExceptions.AUDIO_PLUGIN_EXCEPTION THEN
         DBMS_OUTPUT.put_line('AUDIO PLUGIN EXCEPTION caught');
        WHEN OTHERS THEN
         DBMS_OUTPUT.PUT_LINE('EXCEPTION caught');
END;
/

getAllAttributes( ) Method

Format

getAllAttributes(

ctx IN OUT RAW,

attributes IN OUT NOCOPY CLOB);

Description

Returns a formatted string for convenient client access. For natively supported formats, the string includes the following list of audio data attributes separated by a comma (','): fileFormat, mimeType, encoding, numberOfChannels, samplingRate, sampleSize, compressionType, and audioDuration. For user-defined formats, the string is defined by the format plug-in.

Parameters

ctx

The format plug-in context information.

attributes

The attributes.

Usage Notes

These audio data attributes are available from the header of the formatted audio data.

If the format is set to NULL, then the getAllAttributes( ) method uses the default format plug-in; otherwise, it uses the plug-in specified by the format.

Audio data attribute information can be extracted from the audio data itself. You can extend support to a format that is not understood by the ORDAudio object by implementing an ORDPLUGINS.ORDX_<format>_AUDIO package that supports this format. See Section 2.3.13 for more information.

Pragmas

None.

Exceptions

AUDIO_PLUGIN_EXCEPTION

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

Examples

Return all audio attributes for audio data stored in the database:

DECLARE
  obj ORDSYS.ORDAudio;
  tempLob   CLOB;
  ctx RAW(4000) :=NULL;
BEGIN
  SELECT aud INTO obj FROM TAUD  WHERE N=1;
  DBMS_OUTPUT.PUT_LINE('getting comma separated list of all attribs');
  DBMS_OUTPUT.PUT_LINE('-------------------------------------------');
  DBMS_LOB.CREATETEMPORARY(tempLob, FALSE, DBMS_LOB.CALL);
  obj.getAllAttributes(ctx,tempLob);
  DBMS_OUTPUT.put_line(DBMS_LOB.substr(tempLob, DBMS_LOB.getLength(tempLob) , 1));
  EXCEPTION
  WHEN ORDSYS.ORDAudioExceptions.AUDIO_PLUGIN_EXCEPTION THEN
  DBMS_OUTPUT.PUT_LINE('ORDAudioExceptions.AUDIO_PLUGIN_EXCEPTION caught');
END;
/

4.3.9 ORDAudio Methods Associated with Processing Audio Data

This section presents reference information on the ORDAudio methods associated with processing audio data.


processAudioCommand( ) Method

Format

processAudioCommand(

ctx IN OUT RAW,

cmd IN VARCHAR2,

arguments IN VARCHAR2,

result OUT RAW)

RETURN RAW;

Description

Allows you to send a command and related arguments to the format plug-in for processing.


Note:

This method is supported only for user-defined format plug-ins. 


Parameters

ctx

The format plug-in context information.

cmd

Any command recognized by the format plug-in.

arguments

The arguments of the command.

result

The result of calling this function returned by the format plug-in.

Usage Notes

Use this method to send any audio commands and their respective arguments to the format plug-in. Commands are not interpreted; they are taken and passed through to a format plug-in to be processed.

If the format is set to NULL, then the processAudioCommand( ) method uses the default format plug-in; otherwise, it uses your user-defined format plug-in.

You can extend support to a format that is not understood by the ORDAudio object by preparing an ORDPLUGINS.ORDX_<format>_AUDIO package that supports that format. See Section 2.3.13 for more information.

Pragmas

None.

Exceptions

AUDIO_PLUGIN_EXCEPTION

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

Examples

Process a set of commands:

DECLARE
  obj ORDSYS.ORDAudio;
  res RAW(4000);
  result RAW(4000);
  command VARCHAR(4000);
  argList VARCHAR(4000);
  ctx RAW(4000) :=NULL;
BEGIN
  select aud into obj from TAUD where N =1 for UPDATE;
  -- assign command
  -- assign argList
  res := obj.processAudioCommand (ctx, command, argList, result);
  UPDATE TAUD SET aud=obj WHERE N=1 ;
  COMMIT;
  EXCEPTION
        WHEN ORDSYS.ORDSourceExceptions.METHOD_NOT_SUPPORTED THEN
         DBMS_OUTPUT.put_line('Source METHOD_NOT_SUPPORTED caught');
        WHEN ORDSYS.ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION THEN
         DBMS_OUTPUT.put_line('SOURCE PLUGIN EXCEPTION caught');
        WHEN ORDSYS.ORDAudioExceptions.METHOD_NOT_SUPPORTED THEN
         DBMS_OUTPUT.put_line('AUDIO METHOD_NOT_SUPPORTED EXCEPTION caught');
        WHEN ORDSYS.ORDAudioExceptions.AUDIO_PLUGIN_EXCEPTION THEN
         DBMS_OUTPUT.put_line('AUDIO PLUGIN EXCEPTION caught');
        WHEN OTHERS THEN
         DBMS_OUTPUT.put_line('EXCEPTION caught');
END;
/

4.4 Packages or PL/SQL Plug-ins

This section presents reference information on the packages or PL/SQL plug-ins provided. Table 4-1 describes the PL/SQL plug-in packages provided in the ORDPLUGINS schema.

Table 4-1 PL/SQL Plug-ins Provided in the ORDPLUGINS Schema
PL/SQL Plug-in Packages  Audio Format  MIME Type 

ORDPLUGINS.ORDX_DEFAULT_AUDIO 

<format> 

Dependent on file format  

ORDPLUGINS.ORDX_AUFF_AUDIO 

AUFF 

audio/basic 

ORDPLUGINS.ORDX_AIFF_AUDIO 

AIFF 

audio/x-aiff 

ORDPLUGINS.ORDX_AIFC_AUDIO 

AIFC 

audio/x-aiff 

ORDPLUGINS.ORDX_WAVE_AUDIO 

WAVE 

audio/x-wave 

ORDPLUGINS.ORDX_MPGA_AUDIO 

MPGA 

audio/mpeg 

Section 4.4.1 describes the ORDPLUGINS.ORDX_DEFAULT_AUDIO package, the methods supported, and the level of support. Note that the methods supported and the level of support for the other PL/SQL plug-in packages described in Table 4-1 are identical for all plug-in packages, therefore, refer to Section 4.4.1.

4.4.1 ORDPLUGINS.ORDX_DEFAULT_AUDIO Package

Use the following provided ORDPLUGINS.ORDX_DEFAULT_AUDIO package as a guide in developing your own ORDPLUGINS.ORDX_<format>_AUDIO audio format package. This package sets the mimeType field in the setProperties( ) method with a MIME type value that is dependent on the file format.

CREATE OR REPLACE PACKAGE ORDX_DEFAULT_AUDIO
authid current_user
AS 
--AUDIO ATTRIBUTES ACCESSORS
--Deprecated Functions Deprecated in Release 8.1.6 Begin Here 
FUNCTION getFormat(ctx IN OUT RAW, obj IN ORDSYS.ORDAudio)
                RETURN VARCHAR2;
FUNCTION getEncoding(ctx IN OUT RAW, obj IN ORDSYS.ORDAudio)
                RETURN VARCHAR2;
FUNCTION getNumberOfChannels(ctx IN OUT RAW, obj IN ORDSYS.ORDAudio)
                RETURN INTEGER;
FUNCTION getSamplingRate(ctx IN OUT RAW, obj IN ORDSYS.ORDAudio)
                RETURN INTEGER;
FUNCTION getSampleSize(ctx IN OUT RAW, obj IN ORDSYS.ORDAudio)
                RETURN INTEGER;
FUNCTION getCompressionType(ctx IN OUT RAW, obj IN ORDSYS.ORDAudio)
                RETURN VARCHAR2;
FUNCTION getAudioDuration(ctx IN OUT RAW, obj IN ORDSYS.ORDAudio)
                RETURN INTEGER;
--Deprecated Functions Deprecated in Release 8.1.6 End Here 

PROCEDURE setProperties(ctx IN OUT RAW, 
                        obj IN OUT NOCOPY ORDSYS.ORDAudio,
                        setComments IN NUMBER := 0);
FUNCTION checkProperties(ctx IN OUT RAW, obj IN OUT ORDSYS.ORDAudio)
RETURN NUMBER; FUNCTION getAttribute(ctx IN OUT RAW, obj IN ORDSYS.ORDAudio, name IN VARCHAR2) RETURN VARCHAR2; PROCEDURE getAllAttributes(ctx IN OUT RAW, obj IN ORDSYS.ORDAudio, attributes IN OUT NOCOPY CLOB); --AUDIO PROCESSING METHODS FUNCTION processCommand(ctx IN OUT RAW, obj IN OUT NOCOPY ORDSYS.ORDAudio, cmd IN VARCHAR2, arguments IN VARHAR2, result OUT RAW) RETURN RAW; PRAGMA RESTRICT_REFERENCES(getFormat, WNDS, WNPS, RNDS, RNPS); PRAGMA RESTRICT_REFERENCES(getEncoding, WNDS, WNPS, RNDS, RNPS); PRAGMA RESTRICT_REFERENCES(getNumberOfChennels, WNDS, WNPS, RNDS, RNPS); PRAGMA RESTRICT_REFERENCES(getSamplingRate, WNDS, WNPS, RNDS, RNPS); PRAGMA RESTRICT_REFERENCES(getSampleSize, WNDS, WNPS, RNDS, RNPS); PRAGMA RESTRICT_REFERENCES(getCompressionType, WNDS, WNPS, RNDS, RNPS); PRAGMA RESTRICT_REFERENCES(getAttribute, WNDS, WNPS, RNDS, RNPS); PRAGMA RESTRICT_REFERENCES(getAudioDuration, WNDS, WNPS, RNDS, RNPS); END; /

Table 4-2 shows the methods supported in the
ORDPLUGINS.ORDX_DEFAULT_AUDIO package and the exceptions raised if you call a method that is not supported.

Table 4-2 Methods Supported in the ORDPLUGINS.ORDX_DEFAULT_AUDIO Package 
Name of Method  Level of Support 

getFormat 

Supported; if the source is local, get the attribute and return the file format, but if the source is NULL, raise an
ORDSYS.ORDSourceExceptions.EMPTY_SOURCE exception;
otherwise, if the source is external, raise an
ORDSYS.ORDAudioExceptions.LOCAL_DATA_SOURCE_REQUIRED exception. 

getEncoding 

Supported; if the source is local, get the attribute and return the encoding, but if the source is NULL, raise an
ORDSYS.ORDSourceExceptions.EMPTY_SOURCE exception;
otherwise, if the source is external, raise an
ORDSYS.ORDAudioExceptions.LOCAL_DATA_SOURCE_REQUIRED exception. 

getNumberOfChannels 

Supported; if the source is local, get the attribute and return the number of channels, but if the source is NULL, raise an
ORDSYS.ORDSourceExceptions.EMPTY_SOURCE exception;
otherwise, if the source is external, raise an
ORDSYS.ORDAudioExceptions.LOCAL_DATA_SOURCE_REQUIRED exception. 

getSamplingRate 

Supported; if the source is local, get the attribute and return the sampling rate, but if the source is NULL, raise an
ORDSYS.ORDSourceExceptions.EMPTY_SOURCE exception;
otherwise, if the source is external, raise an
ORDSYS.ORDAudioExceptions.LOCAL_DATA_SOURCE_REQUIRED exception. 

getSampleSize 

Supported; if the source is local, get the attribute and return the sample size, but if the source is NULL, raise an
ORDSYS.ORDSourceExceptions.EMPTY_SOURCE exception;
otherwise, if the source is external, raise an
ORDSYS.ORDAudioExceptions.LOCAL_DATA_SOURCE_REQUIRED exception. 

getCompressionType 

Supported; if the source is local, get the attribute and return the compression type, but if the source is NULL, raise an
ORDSYS.ORDSourceExceptions.EMPTY_SOURCE exception;
otherwise, if the source is external, raise an
ORDSYS.ORDAudioExceptions.LOCAL_DATA_SOURCE_REQUIRED exception. 

getAudioDuration 

Supported; if the source is local, get the attribute and return the audio duration, but if the source is NULL, raise an
ORDSYS.ORDSourceExceptions.EMPTY_SOURCE exception;
otherwise, if the source is external, raise an
ORDSYS.ORDAudioExceptions.LOCAL_DATA_SOURCE_REQUIRED exception. 

setProperties 

Supported; if the source is local, process the local data and set the properties, but if the source is NULL, raise an
ORDSYS.ORDSourceExceptions.EMPTY_SOURCE exception; if the source is a BFILE, then process the BFILE and set the properties; if the source is neither local nor a BFILE, get the media content into a temporary LOB, process the data, and set the properties.  

checkProperties 

Supported; if the source is local, process the local data and check the properties, but if the source is NULL, raise an
ORDSYS.ORDSourceExceptions.EMPTY_SOURCE exception; if the source is a BFILE, then process the BFILE and check the properties; if the source is neither local nor a BFILE, get the media content into a temporary LOB, process the data, and check the properties. 

getAttribute 

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and AUDIO_PLUGIN_EXCEPTION. 

getAllAttributes 

Supported; if the source is local, get the attributes and return them, but if the source is NULL, raise an ORDSYS.ORDSourceExceptions.EMPTY_SOURCE exception; otherwise, if the source is external, raise an
ORDSYS.ORDAudioExceptions.LOCAL_DATA_SOURCE_REQUIRED exception. 

processCommand 

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and AUDIO_PLUGIN_EXCEPTION. 

4.4.2 Extending interMedia to Support a New Audio Data Format

Extending interMedia to support a new audio data format consists of four steps:

  1. Design your new audio data format.

  2. Implement your new audio data format and name it, for example, ORDX_MY_AUDIO.SQL.

  3. Install your new ORDX_MY_AUDIO.SQL plug-in in the ORDPLUGINS schema.

  4. Grant EXECUTE privileges on your new plug-in, for example, ORDX_MY_AUDIO.SQL plug-in, to PUBLIC.

Section 2.1.12 briefly describes how to extend interMedia to support a new audio data format and describes the interface. A package body listing is provided in Example 4-1 to assist you in this operation. Add your variables to the places that say "--Your variables go here" and add your code to the places that say "--Your code goes here".

See Section F.1 for more information on installing your own audio format plug-in and running the sample scripts provided.

Example 4-1 Show the Package Body for Extending Support to a New Audio
Data Format

CREATE OR REPLACE PACKAGE BODY ORDX_MY_AUDIO
AS
  --AUDIO ATTRIBUTES ACCESSORS
  FUNCTION  getFormat(ctx IN OUT RAW, obj IN ORDSYS.ORDAudio)
  RETURN VARCHAR2
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  FUNCTION  getEncoding(ctx IN OUT RAW, obj IN ORDSYS.ORDAudio)
  RETURN VARCHAR2
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  FUNCTION  getNumberOfChannels(ctx IN OUT RAW, obj IN ORDSYS.ORDAudio)
  RETURN INTEGER
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  FUNCTION  getSamplingRate(ctx IN OUT RAW, obj IN ORDSYS.ORDAudio)
  RETURN INTEGER
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  FUNCTION  getSampleSize(ctx IN OUT RAW, obj IN ORDSYS.ORDAudio)
  RETURN INTEGER
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  FUNCTION  getCompressionType(ctx IN OUT RAW, obj IN ORDSYS.ORDAudio)
  RETURN VARCHAR2
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  FUNCTION  getAudioDuration(ctx IN OUT RAW,
                             obj IN ORDSYS.ORDAudio)
  RETURN INTEGER
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  PROCEDURE setProperties(ctx IN OUT RAW,
                          obj IN OUT NOCOPY ORDSYS.ORDAudio,
                          setComments IN NUMBER :=0)
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  FUNCTION checkProperties(ctx IN OUT RAW, obj IN OUT ORDSYS.ORDAudio)
  RETURN NUMBER
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  FUNCTION  getAttribute(ctx IN OUT RAW,
                         obj IN ORDSYS.ORDAudio,
                         name IN VARCHAR2)
  RETURN VARCHAR2
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  PROCEDURE getAllAttributes(ctx IN OUT RAW,
                             obj IN ORDSYS.ORDAudio,
                             attributes IN OUT NOCOPY CLOB)
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  -- AUDIO PROCESSING METHODS
  FUNCTION  processCommand(
                                 ctx       IN OUT RAW,
                                 obj       IN OUT NOCOPY ORDSYS.ORDAudio,
                                 cmd       IN VARCHAR2,
                                 arguments IN VARCHAR2,
                                 result    OUT RAW)
  RETURN RAW
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
END;
/
show errors;


Go to previous page Go to next page
Oracle
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index