B Extending Oracle Multimedia

This appendix describes various methods for extending the Oracle Multimedia object types.

Note:

The ability to extend Oracle Multimedia object types to support new source types and new format types is deprecated in the current release, and may be desupported in a future release. Oracle recommends that you stop using deprecated features as soon as possible.

Oracle Multimedia object types can be extended to support:

  • Other external sources of media data not currently supported

  • Other media data formats not currently supported

  • Media (audio and video) data processing

For each unique external media data source or each unique ORDAudio, ORDDoc, or ORDVideo data format you want to support, you must:

  1. Design your new data source or new ORDAudio, ORDDoc, or ORDVideo data format.

  2. Implement your new data source or new ORDAudio, ORDDoc, or ORDVideo data format.

  3. Install your new source package into the ORDPLUGINS schema.

  4. Grant EXECUTE privileges on your new source package to PUBLIC.

This appendix includes these sections:

B.1 Supporting Other External Sources

You can extend the Oracle Multimedia object types to support new external data sources by implementing a new source package.

To implement your new data source, you must implement the required interfaces in the ORDX_<srcType>_SOURCE package in the ORDPLUGINS schema (where <srcType> represents the name of the new external source type). Use the package body example described in "Extending Oracle Multimedia to Support a New Data Source" as a template to create the package body. Then, set the source type parameter in the setSourceInformation( ) call to the appropriate source value to indicate to the ORDAudio, ORDImage, ORDDoc, or ORDVideo object that package ORDPLUGINS.ORDX_<srcType>_SOURCE should be used. Use the ORDPLUGINS.ORDX_FILE_SOURCE and ORDPLUGINS.ORDX_HTTP_SOURCE packages as guides when you extend support to other external audio, image, video, or other heterogeneous media data sources.

The following subsection presents reference information about predefined and user-defined packages:

B.1.1 External Source Packages

Name your PL/SQL package as ORDX_<name>_<module_name>, where the <module_name> is SOURCE for ORDSource. Use the ORDPLUGINS.ORDX_FILE_SOURCE and ORDPLUGINS.ORDX_HTTP_SOURCE packages as a guide in developing your new source type package.

For example, the FILE source type package described in "ORDPLUGINS.ORDX_FILE_SOURCE Package" is named ORDX_FILE_SOURCE and the HTTP source type package described in "ORDPLUGINS.ORDX_HTTP_SOURCE Package" is named ORDX_HTTP_SOURCE, and <name> is the source type. Both source type names, FILE and HTTP, are reserved to Oracle.

The following subsections provide examples and more information about extending the supported external sources of audio, image, video, or other heterogeneous media data:

B.1.1.1 ORDPLUGINS.ORDX_FILE_SOURCE Package

The ORDPLUGINS.ORDX_FILE_SOURCE package provides support for multimedia stored in the local file system external to the database.

The ORDPLUGINS.ORDX_FILE_SOURCE package is defined as follows:

CREATE OR REPLACE PACKAGE ORDX_FILE_SOURCE AS
  -- functions/procedures
  FUNCTION processCommand(obj     IN OUT NOCOPY ORDSYS.ORDSource,
                          ctx     IN OUT RAW,
                          cmd     IN VARCHAR2,
                          arglist IN VARCHAR2,
                          result  OUT RAW)
           RETURN RAW;
  PROCEDURE import(obj      IN OUT NOCOPY ORDSYS.ORDSource,
                   ctx      IN OUT RAW,
                   mimetype OUT VARCHAR2,
                   format   OUT VARCHAR2);
  PROCEDURE import(obj      IN OUT NOCOPY ORDSYS.ORDSource,
                   ctx      IN OUT RAW,
                   dlob     IN OUT NOCOPY BLOB,
                   mimetype OUT VARCHAR2,
                   format   OUT VARCHAR2);
  PROCEDURE importFrom(obj      IN OUT NOCOPY ORDSYS.ORDSource,
                       ctx      IN OUT RAW,
                       mimetype OUT VARCHAR2,
                       format   OUT VARCHAR2,
                       loc      IN VARCHAR2,
                       name     IN VARCHAR2);
  PROCEDURE importFrom(obj      IN OUT NOCOPY ORDSYS.ORDSource,
                       ctx      IN OUT RAW,
                       dlob     IN OUT NOCOPY BLOB,
                       mimetype OUT VARCHAR2,
                       format   OUT VARCHAR2,
                       loc      IN VARCHAR2,
                       name     IN VARCHAR2);
  PROCEDURE export(obj  IN OUT NOCOPY ORDSYS.ORDSource,
                   ctx  IN OUT RAW,
                   slob IN OUT NOCOPY BLOB,
                   loc  IN VARCHAR2,
                   name IN VARCHAR2);
  FUNCTION  getContentLength(obj  IN ORDSYS.ORDSource,
                             ctx  IN OUT RAW),
            RETURN INTEGER;
  PRAGMA RESTRICT_REFERENCES(getContentLength, WNDS, WNPS, RNDS, RNPS);
  FUNCTION  getSourceAddress(obj  IN ORDSYS.ORDSource,
                             ctx  IN OUT RAW,
                             userData IN VARCHAR2)
            RETURN VARCHAR2;
  PRAGMA RESTRICT_REFERENCES(getSourceAddress, WNDS, WNPS, RNDS, RNPS);
  
  FUNCTION open(obj IN OUT NOCOPY ORDSYS.ORDSource, 
           userArg IN RAW, 
           ctx OUT RAW) RETURN INTEGER;
  FUNCTION close(obj IN OUT NOCOPY ORDSYS.ORDSource, ctx IN OUT RAW) 
         RETURN INTEGER;
  FUNCTION trim(obj IN OUT NOCOPY ORDSYS.ORDSource, 
                ctx IN OUT RAW,
                newlen IN INTEGER) RETURN INTEGER;
PROCEDURE read(obj     IN OUT NOCOPY ORDSYS.ORDSource,
               ctx      IN OUT RAW,
               startPos IN INTEGER,
               numBytes IN OUT INTEGER,
               buffer   OUT RAW);
PROCEDURE write(obj      IN OUT NOCOPY ORDSYS.ORDSource,
                ctx      IN OUT RAW,
                startPos IN INTEGER,
                numBytes IN OUT INTEGER,
                buffer   OUT RAW);
END ORDX_FILE_SOURCE;
/

Table B-1 shows the methods that are supported in the ORDX_FILE_SOURCE package and the exception that is raised if you call a method that is not supported.

Table B-1 Methods Supported in the ORDPLUGINS.ORDX_FILE_SOURCE Package

Name of Method Level of Support

processCommand

Not supported - raises exception: METHOD_NOT_SUPPORTED

import

Supported

import

Supported

importFrom

Supported

importFrom

Supported

export

Supported

getContentLength

Supported

getSourceAddress

Supported

open

Supported

close

Supported

trim

Not supported - raises exception: METHOD_NOT_SUPPORTED

read

Supported

write

Not supported - raises exception: METHOD_NOT_SUPPORTED

B.1.1.2 ORDPLUGINS.ORDX_HTTP_SOURCE Package

The ORDPLUGINS.ORDX_HTTP_SOURCE package provides support for multimedia stored in any HTTP server and accessed through a URL.

The ORDPLUGINS.ORDX_HTTP_SOURCE package is defined as follows:

CREATE OR REPLACE PACKAGE ORDX_HTTP_SOURCE AS
  -- functions/procedures
  FUNCTION processCommand(obj     IN OUT NOCOPY ORDSYS.ORDSource,
                          ctx     IN OUT RAW,
                          cmd     IN VARCHAR2,
                          arglist IN VARCHAR2,
                          result  OUT RAW)
           RETURN RAW;
  PROCEDURE import(obj      IN OUT NOCOPY ORDSYS.ORDSource,
                   ctx      IN OUT RAW,
                   mimetype OUT VARCHAR2,
                   format   OUT VARCHAR2);
  PROCEDURE import(obj      IN OUT NOCOPY ORDSYS.ORDSource,
                   ctx      IN OUT RAW,
                   dlob     IN OUT NOCOPY BLOB,
                   mimetype OUT VARCHAR2,
                   format   OUT VARCHAR2);
  PROCEDURE importFrom(obj      IN OUT NOCOPY ORDSYS.ORDSource,
                       ctx      IN OUT RAW,
                       mimetype OUT VARCHAR2,
                       format   OUT VARCHAR2,
                       loc      IN VARCHAR2,
                       name     IN VARCHAR2);
  PROCEDURE importFrom(obj      IN OUT NOCOPY ORDSYS.ORDSource,
                       ctx      IN OUT RAW,
                       dlob     IN OUT NOCOPY BLOB,
                       mimetype OUT VARCHAR2,
                       format   OUT VARCHAR2,
                       loc      IN VARCHAR2,
                       name     IN VARCHAR2);
  PROCEDURE export(obj  IN OUT NOCOPY ORDSYS.ORDSource,
                   ctx  IN OUT RAW,
                   dlob IN OUT NOCOPY BLOB,
                   loc  IN VARCHAR2,
                   name IN VARCHAR2);
  FUNCTION  getContentLength(obj  IN ORDSYS.ORDSource,
                             ctx  IN OUT RAW)
            RETURN INTEGER;
  PRAGMA RESTRICT_REFERENCES(getContentLength, WNDS, WNPS, RNDS, RNPS, TRUST);
  FUNCTION  getSourceAddress(obj  IN ORDSYS.ORDSource,
                             ctx  IN OUT RAW,
                             userData IN VARCHAR2) 
            RETURN VARCHAR2;
  PRAGMA RESTRICT_REFERENCES(getSourceAddress, WNDS, WNPS, RNDS, RNPS);
  FUNCTION open(obj IN OUT NOCOPY ORDSYS.ORDSource, userArg IN RAW,
           ctx OUT RAW) RETURN INTEGER;
  FUNCTION close(obj IN OUT NOCOPY ORDSYS.ORDSource, ctx IN OUT RAW) 
           RETURN INTEGER;
  FUNCTION trim(obj IN OUT NOCOPY ORDSYS.ORDSource, 
           ctx IN OUT RAW,
           newlen IN INTEGER) RETURN INTEGER;
  PROCEDURE read(obj      IN OUT NOCOPY ORDSYS.ORDSource,
                 ctx      IN OUT RAW,
                 startPos IN INTEGER,
                 numBytes IN OUT INTEGER,
                 buffer   OUT RAW);
  PROCEDURE write(obj      IN OUT NOCOPY ORDSYS.ORDSource,
                  ctx      IN OUT RAW,
                  startPos IN INTEGER,
                  numBytes IN OUT INTEGER,
                  buffer   OUT RAW);
END ORDX_HTTP_SOURCE;
/

Table B-2 shows the methods that are supported in the ORDX_HTTP_SOURCE package and the exception that is raised if you call a method that is not supported.

Table B-2 Methods Supported in the ORDPLUGINS.ORDX_HTTP_SOURCE Package

Name of Method Level of Support

processCommand

Not supported - raises exception: METHOD_NOT_SUPPORTED

import

Supported

import

Supported

importFrom

Supported

importFrom

Supported

export

Not supported - raises exception: METHOD_NOT_SUPPORTED

getContentLength

Supported

getSourceAddress

Supported

open

Supported

close

Supported

trim

Not supported - raises exception: METHOD_NOT_SUPPORTED

read

Not supported - raises exception: METHOD_NOT_SUPPORTED

write

Not supported - raises exception: METHOD_NOT_SUPPORTED

B.1.1.3 Extending Oracle Multimedia to Support a New Data Source

Extending Oracle Multimedia to support a new data source requires a series of tasks.

Follow these steps to extend Oracle Multimedia to support a new data source:

  1. Design your new data source.
  2. Implement your new data source and name it, for example, ORDX_MY_SOURCE.SQL.
  3. Install your new ORDX_MY_SOURCE.SQL package into the ORDPLUGINS schema.
  4. Grant EXECUTE privileges on your new package, for example, ORDX_MY_SOURCE.SQL, to PUBLIC.
  5. Set the srctype to my to cause your package to be invoked.

Example B-1 Package Body for Extending Support to a New Data Source

CREATE OR REPLACE PACKAGE BODY ORDX_MY_SOURCE
AS
  -- functions/procedures
  FUNCTION processCommand(
                    obj  IN OUT NOCOPY ORDSYS.ORDSource,
                    ctx  IN OUT RAW,
                    cmd  IN VARCHAR2,
                    arglist IN VARCHAR2,
                    result OUT RAW)
  RETURN RAW
  IS
   --Your variables go here.
  BEGIN
  --Your code goes here.
  END processCommand;
  PROCEDURE import( obj  IN OUT NOCOPY ORDSYS.ORDSource,
                    ctx  IN OUT RAW,
                    mimetype OUT VARCHAR2,
                    format   OUT VARCHAR2)
  IS
  --Your variables go here.
  BEGIN
  --Your code goes here.
  END import;
  PROCEDURE import( obj  IN OUT NOCOPY ORDSYS.ORDSource,
                    ctx  IN OUT RAW,
                    dlob IN OUT NOCOPY BLOB,
                    mimetype OUT VARCHAR2,
                    format   OUT VARCHAR2)
  IS
  --Your variables go here.
  BEGIN
  --Your code goes here.
  END import;
  PROCEDURE importFrom( obj      IN OUT NOCOPY ORDSYS.ORDSource,
                        ctx      IN OUT RAW,
                        mimetype OUT VARCHAR2,
                        format   OUT VARCHAR2,
                        loc      IN VARCHAR2,
                        name     IN VARCHAR2)
  IS
  --Your variables go here.
  BEGIN
  --Your code goes here.
  END importFrom;
  PROCEDURE importFrom( obj      IN OUT NOCOPY ORDSYS.ORDSource,
                        ctx      IN OUT RAW,
                        dlob     IN OUT NOCOPY BLOB,
                        mimetype OUT VARCHAR2,
                        format   OUT VARCHAR2,
                        loc      IN VARCHAR2,
                        name     IN VARCHAR2)
  IS
  --Your variables go here.
  BEGIN
  --Your code goes here.
  END importFrom;
  PROCEDURE export( obj  IN OUT NOCOPY ORDSYS.ORDSource,
                    ctx  IN OUT RAW,
                    slob IN OUT NOCOPY BLOB,
                    loc  IN VARCHAR2,
                    name IN VARCHAR2)
  IS
  --Your variables go here.
  BEGIN
  --Your code goes here.
  END export;
  
  FUNCTION  getContentLength( obj  IN ORDSYS.ORDSource,
                              ctx  IN OUT RAW)
  RETURN INTEGER
  IS
  --Your variables go here.
  BEGIN
  --Your code goes here.
  END getContentLength;
  FUNCTION  getSourceAddress(obj  IN ORDSYS.ORDSource,
                             ctx  IN OUT RAW,
                             userData IN VARCHAR2)
  RETURN VARCHAR2
  IS
  --Your variables go here.
  BEGIN
  --Your code goes here.
  END getSourceAddress;
  FUNCTION open(obj IN OUT NOCOPY ORDSYS.ORDSource, userArg IN RAW, ctx OUT RAW)
  RETURN INTEGER
  IS
  --Your variables go here.
  BEGIN
  --Your code goes here.
  END open;
  FUNCTION close(obj IN OUT NOCOPY ORDSYS.ORDSource, ctx IN OUT RAW)
  RETURN INTEGER
  IS
  --Your variables go here.
  BEGIN
  --Your code goes here.
  END close;
  FUNCTION trim(obj    IN OUT NOCOPY ORDSYS.ORDSource,
                       ctx    IN OUT RAW,
                       newlen IN INTEGER)
  RETURN INTEGER
  IS
  --Your variables go here.
  BEGIN
  --Your code goes here.
  END trim;
  PROCEDURE read(obj      IN OUT NOCOPY ORDSYS.ORDSource,
                 ctx      IN OUT RAW,
                 startPos IN INTEGER,
                 numBytes IN OUT INTEGER,
                 buffer   OUT RAW)
  IS
  --Your variables go here.
  BEGIN
  --Your code goes here.
  END read;
  PROCEDURE write(obj      IN OUT NOCOPY ORDSYS.ORDSource,
                  ctx      IN OUT RAW,
                  startPos IN INTEGER,
                  numBytes IN OUT INTEGER,
                  buffer   OUT RAW)
  IS
  --Your variables go here.
  BEGIN
  --Your code goes here.
  END write;
END ORDX_MY_SOURCE;
/
show errors;

A package body listing is provided in Example B-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".

B.2 Supporting Other Media Data Formats

You can extend support for the ORDAudio, ORDDoc, and ORDVideo object types to include new media data formats by defining new format packages.

To implement your new ORDAudio, ORDDoc, or ORDVideo data format, you must implement the required interfaces in the ORDPLUGINS.ORDX_<format>_<media> package in the ORDPLUGINS schema (where <format> represents the name of the new audio or video, or other heterogeneous media data format and <media> represents the type of media ("AUDIO" or "VIDEO", or "DOC"). Use the ORDPLUGINS.ORDX_DEFAULT_<media> package as a guide when you extend support to other audio or video data formats or other heterogeneous media data formats. Use the package body examples described in "Extending Oracle Multimedia to Support a New Audio Data Format", "Extending Oracle Multimedia to Support a New ORDDoc Data Format", and "Extending Oracle Multimedia to Support a New Video Data Format" as templates to create the audio or video, or other heterogeneous media data package body, respectively. Then, set the new format parameter in the setFormat( ) call to the appropriate format value to indicate to the ORDAudio, ORDDoc, or ORDVideo object that the package ORDPLUGINS.ORDX_<format>_<media> must be used for method invocation.

The following subsections describe how to extend Oracle Multimedia to support other data formats:

B.2.1 Supporting Other ORDAudio Data Formats

The following subsections describe how to extend ORDAudio to support other data formats:

B.2.1.1 ORDPLUGINS.ORDX_DEFAULT_AUDIO Package

Use the 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.

The ORDPLUGINS.ORDX_DEFAULT_AUDIO package is defined as follows:

CREATE OR REPLACE PACKAGE ORDX_DEFAULT_AUDIO
authid current_user
AS 
--AUDIO ATTRIBUTES ACCESSORS

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;

END;
/

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

Table B-3 Methods Supported in the ORDPLUGINS.ORDX_DEFAULT_AUDIO Package

Name of Method Level of Support

setProperties

Supported; if the source is local, extract attributes from 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 extract attributes from the BFILE and set the properties; if the source is neither local nor a BFILE, get the media content into a temporary LOB, extract attributes from the data, and set the properties.

checkProperties

Supported; if the source is local, extract the attributes from the local data and compare them with the attribute values of the object, but if the source is NULL, raise an ORDSYS.ORDSourceExceptions.EMPTY_SOURCE exception; if the source is a BFILE, extract the attributes from the BFILE and compare them with the attribute values of the object; if the source is neither local nor a BFILE, get the media content into a temporary LOB, extract the attributes from the media content and compare them with the attribute values of the object.

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.

B.2.1.2 Extending Oracle Multimedia to Support a New Audio Data Format

Extending Oracle Multimedia to support a new audio data format requires a series of tasks.

Follow these steps to extend Oracle Multimedia to support a new audio data format:

  1. Design your new audio data format.

    1. To support a new audio data format, implement the required interfaces in the ORDX_<format>_AUDIO package in the ORDPLUGINS schema (where <format> represents the name of the new audio data format). Use the package body example in Example B-2 as a template to create the audio package body.

    2. Then, set the new format parameter in the setFormat( ) call to the appropriate format value to indicate to the audio object that package ORDPLUGINS.ORDX_<format>_AUDIO should be called.

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

  3. Install your new ORDX_MY_AUDIO.SQL package into the ORDPLUGINS schema.

  4. Grant EXECUTE privileges on your new package, for example, ORDX_MY_AUDIO, to PUBLIC.

  5. In an application, set the format attribute to my to cause your package to be invoked.

A package body listing is provided in Example B-2 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".

Example B-2 Package Body for Extending Support to a New Audio Data Format

CREATE OR REPLACE PACKAGE BODY ORDX_MY_AUDIO
AS
  --AUDIO ATTRIBUTES ACCESSORS
  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;

B.2.2 Supporting Other ORDDoc Data Formats

The following subsections describe how to extend ORDDoc to support other data formats:

B.2.2.1 ORDPLUGINS.ORDX_DEFAULT_DOC Package

Use the ORDPLUGINS.ORDX_DEFAULT_DOC package as a guide in developing your own ORDPLUGINS.ORDX_<format>_DOC media format package.

The ORDPLUGINS.ORDX_DEFAULT_DOC package is defined as follows:

CREATE OR REPLACE PACKAGE ORDX_DEFAULT_DOC
authid current_user
AS 

PROCEDURE setProperties(ctx IN OUT RAW, 
                        obj IN OUT NOCOPY ORDSYS.ORDDoc,
                        setComments IN NUMBER := 0);

END;
/

Table B-4 shows the method that is supported in the ORDPLUGINS.ORDX_DEFAULT_DOC package and the exception that is raised if the source is NULL.

Table B-4 Method Supported in the ORDPLUGINS.ORDX_DEFAULT_DOC Package

Name of Method Level of Support

setProperties

Supported; if the source is local, extract attributes from 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 extract attributes from the BFILE and set the properties; if the source is neither local nor a BFILE, get the media content into a temporary LOB, extract attributes from the data, and set the properties.

B.2.2.2 Extending Oracle Multimedia to Support a New ORDDoc Data Format

Extending Oracle Multimedia to support a new media data format requires a series of tasks.

Follow these steps to extend Oracle Multimedia to support a new ORDDoc data format:

  1. Design your new media data format.

    1. To support a new media data format, implement the required interfaces in the ORDX_<format>_DOC package in the ORDPLUGINS schema (where <format> represents the name of the new media data format). Use the package body example in Example B-3 as a template to create the package body.

    2. Then, set the new format parameter in the setFormat( ) call to the appropriate format value to indicate to the media object that package ORDPLUGINS.ORDX_<format>_DOC should be called.

  2. Implement your new media data format and name it, for example, ORDX_MY_DOC.SQL.

  3. Install your new ORDX_MY_DOC.SQL package into the ORDPLUGINS schema.

  4. Grant EXECUTE privileges on your new package, for example, ORDX_MY_DOC, to PUBLIC.

  5. In an application, set the format to my to cause your package to be invoked.

A package body listing is provided in Example B-3 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".

Example B-3 Package Body for Extending Support to a New ORDDoc Data Format

CREATE OR REPLACE PACKAGE BODY ORDX_MY_DOC
AS
  --DOCUMENT ATTRIBUTES ACCESSORS
  PROCEDURE setProperties(ctx IN OUT RAW,
                          obj IN OUT NOCOPY ORDSYS.ORDDoc,
                          setComments IN NUMBER :=0)
  IS
--Your variables go here.
  BEGIN
--Your code goes here.
  END;
END;
/
show errors;

B.2.3 Supporting Other Video Data Formats

The following subsections describe how to extend ORDVideo to support other data formats:

B.2.3.1 ORDPLUGINS.ORDX_DEFAULT_VIDEO Package

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

The ORDPLUGINS.ORDX_DEFAULT_VIDEO package is defined as follows:

CREATE OR REPLACE PACKAGE ORDX_DEFAULT_VIDEO
authid current_user
AS
--VIDEO ATTRIBUTES ACCESSORS
FUNCTION  getAttribute(ctx IN OUT RAW,
                       obj IN ORDSYS.ORDVideo,
                       name IN VARCHAR2) 
          RETURN VARCHAR2;
PROCEDURE setProperties(ctx IN OUT RAW, 
                        obj IN OUT NOCOPY ORDSYS.ORDVideo,
                        setComments IN NUMBER := 0);
FUNCTION checkProperties(ctx IN OUT RAW,obj IN ORDSYS.ORDVideo) RETURN NUMBER;

-- must return name=value; name=value; ...  pairs
PROCEDURE getAllAttributes(ctx IN OUT RAW,
                           obj IN ORDSYS.ORDVideo,
                           attributes IN OUT NOCOPY CLOB);
-- VIDEO PROCESSING METHODS
FUNCTION  processCommand(
                         ctx       IN OUT RAW,
                         obj       IN OUT NOCOPY ORDSYS.ORDVideo,
                         cmd       IN VARCHAR2,
                         arguments IN VARCHAR2,
                         result    OUT RAW)
         RETURN RAW;

END;
/

Table B-5 shows the methods that are supported in the ORDPLUGINS.ORDX_DEFAULT_VIDEO package and the exceptions that are raised if you call a method that is not supported.

Table B-5 Methods Supported in the ORDPLUGINS.ORDX_DEFAULT_VIDEO Package

Name of Method Level of Support

getAttribute

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION

setProperties

Supported; if the source is local, extract attributes from 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 extract attributes from the BFILE and set the properties; if the source is neither local nor a BFILE, get the media content into a temporary LOB, extract attributes from the data, and set the properties.

checkProperties

Supported; if the source is local, extract attributes from the local data and compare them with the attribute values of the object, but if the source is NULL, raise an ORDSYS.ORDSourceExceptions.EMPTY_SOURCE exception; if the source is a BFILE, then extract attributes from the BFILE data and compare them with the attribute values of the object; if the source is neither local nor a BFILE, get the media content into a temporary LOB, extract attributes from the media content and compare them with the attribute values of the object.

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.ORDVideoExceptions.LOCAL_DATA_SOURCE_REQUIRED exception.

processCommand

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION

B.2.3.2 Extending Oracle Multimedia to Support a New Video Data Format

Extending Oracle Multimedia to support a new video data format requires a series of tasks.

Follow these steps to extend Oracle Multimedia to support a new video data format:

  1. Design your new video data format.

    1. To support a new video data format, implement the required interfaces in the ORDX_<format>_VIDEO package in the ORDPLUGINS schema (where <format> represents the name of the new video data format). Use the package body example in Example B-4 as a template to create the video package body.

    2. Then, set the new format parameter in the setFormat( ) call to the appropriate format value to indicate to the video object that package ORDPLUGINS.ORDX_<format>_VIDEO should be called.

  2. Implement your new video data format and name it, for example, ORDX_MY_VIDEO.SQL.

  3. Install your new ORDX_MY_VIDEO.SQL package into the ORDPLUGINS schema.

  4. Grant EXECUTE privileges on your new package, for example, ORDX_MY_VIDEO, to PUBLIC.

  5. In an application, set the video format to my to cause your package to be invoked.

A package body listing is provided in Example B-4 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".

Example B-4 Package Body for Extending Support to a New Video Data Format

CREATE OR REPLACE PACKAGE BODY ORDX_MY_VIDEO
AS
  --VIDEO ATTRIBUTES ACCESSORS
  FUNCTION  getAttribute(ctx IN OUT RAW,
                         obj IN ORDSYS.ORDVideo,
                         name IN VARCHAR2)
  RETURN VARCHAR2
  IS
--Your variables go here.
  BEGIN
--Your code goes here.
  END;
  PROCEDURE setProperties(ctx IN OUT RAW, 
          obj IN OUT NOCOPY ORDSYS.ORDVideo,
          setComments IN NUMBER :=0)
  IS
--Your variables go here.
  BEGIN
--Your code goes here.
  END;
  FUNCTION checkProperties(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo) RETURN NUMBER
  IS
--Your variables go here.
  BEGIN
--Your code goes here.
  END;
  PROCEDURE getAllAttributes(ctx IN OUT RAW,
                             obj IN ORDSYS.ORDVideo,
                             attributes IN OUT NOCOPY CLOB)
  IS
--Your variables go here.
  BEGIN
--Your code goes here.
  END;
  -- VIDEO PROCESSING METHODS
  FUNCTION  processCommand(
                                 ctx       IN OUT RAW,
                                 obj       IN OUT NOCOPY ORDSYS.ORDVideo,
                                 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;

B.2.4 Supporting Other Image Data Formats

Oracle Multimedia supports certain other image formats through the setProperties( ) method for foreign images.

This method enables other image formats to be recognized by writing the values supplied to the setProperties( ) method for foreign images to the existing ORDImage data attributes.

See Also:

The setProperties( ) for foreign images method in Oracle Multimedia Reference for more information, and to determine the type of images that are supported this way

B.3 Supporting Media Data Processing

You can extend support for the Oracle Multimedia audio and video object types to include audio and video data processing.

Oracle Multimedia allows the audio and video object types to be extended to support the processing of audio and video data, as described in the following subsections:

B.3.1 Supporting Audio Data Processing

Audio data processing is the passing of an audio processing command and a set of arguments to a format package for processing.

To support audio data processing, use the processAudioCommand( ) method. This method is available only for user-defined formats.

See Also:

The processAudioCommand( ) method in Oracle Multimedia Reference for a description

B.3.2 Supporting Video Data Processing

Video data processing is the passing of a command and a set of arguments to a format package for processing.

To support video data processing, use the processVideoCommand( ) method. This method is only available for user-defined formats.

See Also:

The processVideoCommand( ) method in Oracle Multimedia Reference for a description