Oracle interMedia User's Guide and Reference
Release 9.0.1

Part Number A88786-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to next page

9
ORDVideo Reference Information

Oracle interMedia contains the following information about the ORDVideo type:

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


Note:

If you manipulate the video 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 video 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 ORDVideo 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. 


You should use any of the individual set methods to set the value of the attribute for an object for formats not natively supported; otherwise, for formats natively supported, use the setProperties( ) method to populate the attributes of the object.

9.1 Object Types

Oracle interMedia describes the ORDVideo object type, which supports the storage and management of video data.


ORDVideo Object Type

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

CREATE OR REPLACE TYPE ORDVideo
AS OBJECT
(
  -- ATTRIBUTES 
description         VARCHAR2(4000),
source              ORDSource,
format              VARCHAR2(31),
mimeType            VARCHAR2(4000),
comments            CLOB, 
  -- VIDEO RELATED ATTRIBUTES 
width               INTEGER,
height              INTEGER,
frameResolution     INTEGER,
frameRate           INTEGER,
videoDuration       INTEGER,
numberOfFrames      INTEGER,
compressionType     VARCHAR2(4000),
numberOfColors      INTEGER,
bitRate             INTEGER,

  -- METHODS
-- CONSTRUCTORS
--
STATIC FUNCTION init( ) RETURN ORDVideo,
STATIC FUNCTION init(srcType     IN VARCHAR2,
                     srcLocation IN VARCHAR2,
                     srcName     IN VARCHAR2) RETURN ORDVideo,
-- 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 PROCEDURE 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 video attributes accessors
MEMBER PROCEDURE setFormat(knownformat IN VARCHAR2),
MEMBER FUNCTION getFormat RETURN VARCHAR2,
PRAGMA RESTRICT_REFERENCES(getFormat, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE setFrameSize(knownWidth IN INTEGER, knownHeight IN INTEGER),
MEMBER PROCEDURE getFrameSize(retWidth OUT INTEGER, retHeight OUT INTEGER),
PRAGMA RESTRICT_REFERENCES(getFrameSize, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE setFrameResolution(knownFrameResolution IN INTEGER),
MEMBER FUNCTION getFrameResolution RETURN INTEGER,
PRAGMA RESTRICT_REFERENCES(getFrameResolution, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE setFrameRate(knownFrameRate IN INTEGER),
MEMBER FUNCTION getFrameRate RETURN INTEGER,
PRAGMA RESTRICT_REFERENCES(getFrameRate, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE setVideoDuration(knownVideoDuration IN INTEGER),
MEMBER FUNCTION getVideoDuration RETURN INTEGER,
PRAGMA RESTRICT_REFERENCES(getVideoDuration, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE setNumberOfFrames(knownNumberOfFrames IN INTEGER),
MEMBER FUNCTION getNumberOfFrames RETURN INTEGER,
PRAGMA RESTRICT_REFERENCES(getNumberOfFrames, 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 setNumberOfColors(knownNumberOfColors IN INTEGER),
MEMBER FUNCTION getNumberOfColors RETURN INTEGER,
PRAGMA RESTRICT_REFERENCES(getNumberOfColors, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE setBitRate(knownBitRate IN INTEGER),
MEMBER FUNCTION getBitRate RETURN INTEGER,
PRAGMA RESTRICT_REFERENCES(getBitRate, WNDS, WNPS, RNDS, RNPS),

MEMBER PROCEDURE setKnownAttributes(
                                    knownFormat IN VARCHAR2,
                                    knownWidth IN INTEGER,
                                    knownHeight IN INTEGER,
                                    knownFrameResolution IN INTEGER,
                                    knownFrameRate IN INTEGER,
                                    knownVideoDuration IN INTEGER
                                    knownNumberOfFrames IN INTEGER,
                                    knownCompressionType IN VARCHAR2,
                                    knownNumberOfColors IN INTEGER,
                                    knownBitRate IN INTEGER),

-- Methods associated with setting all the properties
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 video processing
MEMBER FUNCTION processVideoCommand(
                                    ctx       IN OUT RAW,
                                    cmd       IN VARCHAR2,
                                    arguments IN VARCHAR2,
                                    result    OUT RAW)
                    RETURN RAW
);

where:

9.2 Constructors

This section describes the constructor functions.

The interMedia constructor functions are as follows:


init( )

Format

init( ) RETURN ORDVideo;

Description

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

Parameters

None.

Pragmas

None.

Exceptions

None.

Usage Notes

This static method initializes all the ORDVideo 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 ORDVideo object type, especially if the ORDVideo 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 ORDVideo object attributes:

BEGIN
  INSERT INTO tvid VALUES (ORDSYS.ORDVideo.init( ));
END;
/

init(srcType,srcLocation,srcName)

Format

init(srcType IN VARCHAR2,

srcLocation IN VARCHAR2,

srcName IN VARCHAR2)

RETURN ORDVideo;

Description

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

Parameters

srcType

The source type of the video data.

srcLocation

The source location of the video data.

srcName

The source name of the video data.

Pragmas

None.

Exceptions

None.

Usage Notes

This static method initializes all the ORDVideo 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 ORDVideo object type, especially if the ORDVideo 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 ORDVideo object attributes:

BEGIN
  INSERT INTO tvid VALUES (ORDSYS.ORDVideo.init('file','VIDDIR','video1.rm'));
END;
/

9.3 Methods

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

ORDVideo Methods Associated with the updateTime Attribute

ORDVideo Methods Associated with the description Attribute

ORDVideo Methods Associated with mimeType Attribute

ORDVideo Methods Associated with the source Attribute

ORDVideo Methods Associated with File Operations

ORDVideo Methods Associated with Video Attributes Accessors

ORDVideo Methods Associated with Processing Video Data

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

9.3.1 Example Table Definitions

The methods described in this reference chapter show examples based on a test video table TVID. Refer to the TVID table definition that follows when reading through the examples:

TVID Table Definition

CREATE TABLE TVID(n NUMBER, vid ORDSYS.ORDVideo)
storage (initial 100K next 100K pctincrease 0);

INSERT INTO TVID VALUES(1, ORDSYS.ORDVideo.init());
INSERT INTO TVID VALUES(2, ORDSYS.ORDVideo.init());

checkProperties( )

Format

checkProperties(ctx IN OUT RAW) RETURN BOOLEAN;

Description

Checks all the properties of the stored video data, including the following video attributes: format, frame size, frame resolution, frame rate, video duration, number of frames, compression type, number of colors, and bit rate.

Parameters

ctx

The format plug-in context information.

Usage Notes

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

VIDEO_PLUGIN_EXCEPTION

This exception is raised if you call the checkProperties( ) method and the video plug-in raises an exception when calling this method.

Examples

Check property information for known video attributes:

DECLARE
  obj ORDSYS.ORDVideo;
  ctx RAW(4000) :=NULL;
BEGIN
  select vid into obj from TVID where N =1 ;
  if (obj.checkProperties(ctx)) then
  DBMS_OUTPUT.put_line('check Properties returned true');
else
  DBMS_OUTPUT.put_line('check Properties returned false');
  end if;
  EXCEPTION
    WHEN OTHERS THEN
     DBMS_OUTPUT.put_line('exception raised');
END;
/


getAllAttributes( )

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 (,): width, height, format, frameResolution, frameRate, videoDuration, numberOfFrames, compressionType, numberOfColors, and bitRate. 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 video data attributes are available from the header of the formatted video data.

Video data attribute information can be extracted from the video data itself. You can extend support to a video format that is not understood by the ORDVideo object by implementing an ORDPLUGINS.ORDX_<format>_VIDEO package that supports that format. See Section 3.4.13 for more information.

Pragmas

None.

Exceptions

METHOD_NOT_SUPPORTED

This exception is raised if you call the getAllAttributes( ) method and the video plug-in raises an exception when calling this method.

Examples

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

DECLARE
  obj ORDSYS.ORDVideo;
  tempLob   CLOB;
  ctx RAW(4000) :=NULL;
BEGIN

  SELECT vid INTO obj FROM TVID  WHERE N=1;
  DBMS_OUTPUT.PUT_LINE('getting comma separated list of all attributes');
  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.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.ORDVideoExceptions.METHOD_NOT_SUPPORTED THEN
   DBMS_OUTPUT.put_line('VIDEO METHOD_NOT_SUPPORTED EXCEPTION caught');
  WHEN ORDSYS.ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION THEN
   DBMS_OUTPUT.put_line('VIDEO PLUGIN EXCEPTION caught');
  WHEN OTHERS THEN
   DBMS_OUTPUT.put_line('EXCEPTION CAUGHT');
END;
/

getAttribute( )

Format

getAttribute(

ctx IN OUT RAW,

name IN VARCHAR2)

RETURN VARCHAR2;

Description

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

Parameters

ctx

The format plug-in context information.

name

The name of the attribute.

Usage Notes

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

Pragmas

None.

Exceptions

VIDEO_PLUGIN_EXCEPTION

This exception is raised if you call the getAttribute( ) method and the video plug-in raises an exception when calling this method.

Examples

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

DECLARE
  obj ORDSYS.ORDVideo;
  res VARCHAR2(4000);
  ctx RAW(4000) :=NULL;
BEGIN
  SELECT vid INTO obj FROM TVID  WHERE N=1;
  DBMS_OUTPUT.PUT_LINE('getting video duration');
  DBMS_OUTPUT.PUT_LINE('---------------------');
  res := obj.getAttribute(ctx,'video_duration');
  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.ORDVideoExceptions.METHOD_NOT_SUPPORTED THEN
         DBMS_OUTPUT.put_line('VIDEO METHOD_NOT_SUPPORTED EXCEPTION caught');
        WHEN ORDSYS.ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION THEN
         DBMS_OUTPUT.put_line('VIDEO PLUGIN EXCEPTION caught');
        WHEN OTHERS THEN
         DBMS_OUTPUT.PUT_LINE('EXCEPTION caught');
END;
/


getBitRate

Format

getBitRate RETURN INTEGER;

Description

Returns the value of the bitRate attribute of the video object.

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

None.

Examples

Return the object attribute value of the bitRate attribute of the video object:

DECLARE
  obj ORDSYS.ORDVideo;
  res INTEGER;
BEGIN
  SELECT vid INTO obj FROM TVID  WHERE N=1 ;
  res := obj.getBitRate();
  DBMS_OUTPUT.put_line('bit rate : ' || res );
END;
/
 

getCompressionType

Format

getCompressionType RETURN VARCHAR2;

Description

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

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

None.

Examples

Return the object attribute value of the compressionType attribute of the video object:

DECLARE
  obj ORDSYS.ORDVideo;
  res VARCHAR2(4000);
BEGIN
  SELECT vid INTO obj FROM TVID  WHERE N=1 ;
  res := obj.getCompressionType();
  DBMS_OUTPUT.put_line('compression type: ' ||res);
END;
/

getContentInLob( )

Format

getContentInLob(

ctx IN OUT RAW,

dest_lob IN OUT NOCOPY BLOB,

mimeType OUT VARCHAR2,

format OUT VARCHAR2);

Description

Copies data from a data source into the specified BLOB. The BLOB must not be the BLOB in source.localData.

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 and 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 into the specified BLOB on the local source:

DECLARE
  obj ORDSYS.ORDVideo;
  tempBLob BLOB;
  mimeType VARCHAR2(4000);
  format VARCHAR2(4000);
  ctx RAW(4000) :=NULL;
BEGIN
 SELECT vid INTO obj FROM TVID 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);
 DBMS_OUTPUT.PUT_LINE(TO_CHAR(DBMS_LOB.getLength(tempBLob)));
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;
/



getContentLength( )

Format

getContentLength(ctx IN OUT RAW) RETURN INTEGER;

Description

Returns the length of the video 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.INCOM-PLETE_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 this exception.

Examples

See the example in "import( )".


getDescription

Format

getDescription RETURN VARCHAR2;

Description

Returns the description of the video 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 setDescription( ).



getFormat

Format

getFormat RETURN VARCHAR2;

Description

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

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

VIDEO_FORMAT_IS_NULL

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

Examples

Set the format and then get it for some stored video data:

DECLARE
  obj ORDSYS.ORDVideo;
BEGIN
  SELECT vid INTO obj FROM TVID  WHERE N=1 FOR UPDATE;
  DBMS_OUTPUT.PUT_LINE('writing format');
  DBMS_OUTPUT.PUT_LINE('--------------');
  obj.setFormat('avi');
  DBMS_OUTPUT.PUT_LINE(obj.getFormat());
  UPDATE TVID SET vid=obj WHERE N=1;
  COMMIT;
END;
/


getFrameRate

Format

getFrameRate RETURN INTEGER;

Description

Returns the value of the frameRate attribute of the video object.

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

None.

Examples

Return the object attribute value of the frame rate for video data stored in the database:

DECLARE
  obj ORDSYS.ORDVideo;
  res INTEGER;
BEGIN
  SELECT vid INTO obj FROM TVID  WHERE N=1 ;
  res := obj.getFrameRate();
  DBMS_OUTPUT.put_line('frame rate : ' ||res);
END;
/


getFrameResolution

Format

getFrameResolution RETURN INTEGER;

Description

Returns the value of the frameResolution attribute of the video object.

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

None.

Examples

Return the value of the frame resolution for the video data:

DECLARE
  obj ORDSYS.ORDVideo;
  res INTEGER;
BEGIN
  SELECT vid INTO obj FROM TVID  WHERE N=1 ;
  res := obj.getFrameResolution();
  DBMS_OUTPUT.put_line('resolution : ' ||res);
END;
/


getFrameSize( )

Format

getFrameSize(

retWidth OUT INTEGER,

retHeight OUT INTEGER);

Description

Returns the value of the height and width attributes of the video object.

Parameters

retWidth

The frame width in pixels.

retHeight

The frame height in pixels.

Usage Notes

None.

Pragmas

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

Exceptions

None.

Examples

Return the frame size for video data:

DECLARE
  obj ORDSYS.ORDVideo;
  width INTEGER;
  height INTEGER;
BEGIN
  SELECT vid INTO obj FROM TVID  WHERE N=1 ;
  obj.getFrameSize(width, height);
  DBMS_OUTPUT.put_line('width :' || width);
  DBMS_OUTPUT.put_line('height :' || height);
END;
/


getNumberOfColors

Format

getNumberOfColors RETURN INTEGER;

Description

Returns the value of the numberOfColors attribute of the video object.

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

None.

Examples

Return the object attribute value of the numberOfColors attribute of the video object:

DECLARE
  obj ORDSYS.ORDVideo;
  res INTEGER;
BEGIN
  SELECT vid INTO obj FROM TVID  WHERE N=1 ;
  res := obj.getNumberOfColors();
  DBMS_OUTPUT.put_line('number of colors: ' ||res);
END;
/


getNumberOfFrames

Format

getNumberOfFrames RETURN INTEGER;

Description

Returns the value of the numberOfFrames attribute of the video object.

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

None.

Examples

Return the object attribute value of the total number of frames in the video data:

DECLARE
  obj ORDSYS.ORDVideo;
  res INTEGER;
BEGIN
  SELECT vid INTO obj FROM TVID  WHERE N=1 ;
  res := obj.getNumberOfFrames();
  DBMS_OUTPUT.put_line('number of frames : ' ||res);
END;
/


getVideoDuration

Format

getVideoDuration RETURN INTEGER;

Description

Returns the value of the videoDuration attribute of the video object.

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

None.

Examples

Return the total time to play the video data:

DECLARE
  obj ORDSYS.ORDVideo;
  res INTEGER;
BEGIN
  SELECT vid INTO obj FROM TVID  WHERE N=1 ;
  res := obj.getVideoDuration();
  DBMS_OUTPUT.put_line('video duration : ' ||res);
END;
/

import( )

Format

import(ctx IN OUT RAW);

Description

Transfers video data from an external video 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 import.

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

After importing data from an external video 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.

ORDSourceExceptions.METHOD_NOT_SUPPORTED

This exception is raised if you call the import( ) 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 import( ) method within a source plug-in when any other exception is raised.

See Appendix H for more information about these exceptions.

Examples

Import video data by first setting the source and then importing it:

DECLARE
  obj ORDSYS.ORDVideo;
  ctx RAW(4000) :=NULL;
BEGIN
  SELECT vid INTO obj FROM TVID  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','VIDEODIR','testvid.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 TVID SET vid=obj WHERE N=1;
  COMMIT;
END;
/


importFrom( )

Format

importFrom(ctx IN OUT RAW,

source_type IN VARCHAR2,

source_location IN VARCHAR2,

source_name IN VARCHAR2);

Description

Transfers video data from the specified external video 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 video data.

source_location

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

source_name

The name of the video 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 for srcType 'file'.

After importing data from an external video 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 exception

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

ORDSourceExceptions.METHOD_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 video data from the specified external data source into the local source:

DECLARE
  obj ORDSYS.ORDVideo;
  ctx RAW(4000) :=NULL;
BEGIN
  SELECT vid INTO obj FROM TVID  WHERE N=1 FOR UPDATE;
  DBMS_OUTPUT.PUT_LINE('setting and getting source');
  DBMS_OUTPUT.PUT_LINE('--------------------------');
  -- import data
  obj.importFrom(ctx,'file','VIDEODIR','MV1.AVI');
  -- check size
  DBMS_OUTPUT.PUT_LINE(TO_CHAR(obj.getContentLength(ctx)));
  DBMS_OUTPUT.PUT_LINE(TO_CHAR(DBMS_LOB.GETLENGTH(obj.getContent)));
  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 TVID SET vid=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.ORDVideoExceptions.METHOD_NOT_SUPPORTED THEN
         DBMS_OUTPUT.put_line('VIDEO METHOD_NOT_SUPPORTED EXCEPTION caught');
        WHEN ORDSYS.ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION THEN
         DBMS_OUTPUT.put_line('VIDEO PLUGIN EXCEPTION caught');
        WHEN OTHERS THEN
         DBMS_OUTPUT.PUT_LINE('EXCEPTION Caught');
END;
/


processVideoCommand( )

Format

processVideoCommand(

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 video 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 processVideoCommand( ) 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 ORDVideo object by preparing an ORDPLUGINS.ORDX_<format>_VIDEO package that supports that format. See Section 3.4.13 for more information.

Pragmas

None.

Exceptions

METHOD_NOT_SUPPORTED or VIDEO_PLUGIN_EXCEPTION

Either exception is raised if you call the ProcessVideoCommand( ) method and the video plug-in raises an exception when calling this method.

Examples

Process a set of commands:

DECLARE
  obj ORDSYS.ORDVideo;
  res RAW(4000);
  result RAW(4000);
  command VARCHAR(4000);
  argList VARCHAR(4000);
  ctx RAW(4000) :=NULL;
BEGIN
select vid into obj from TVID where N =1 for UPDATE;
-- assign command
-- assign argList
res := obj.processVideoCommand(ctx, command, argList, result);
UPDATE TVID SET vid=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.ORDVideoExceptions.METHOD_NOT_SUPPORTED THEN
         DBMS_OUTPUT.put_line('VIDEO METHOD_NOT_SUPPORTED EXCEPTION caught');
        WHEN ORDSYS.ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION THEN
         DBMS_OUTPUT.put_line('VIDEO PLUGIN EXCEPTION caught');
        WHEN OTHERS THEN
         DBMS_OUTPUT.put_line('EXCEPTION caught');
END;
/

setBitRate( )

Format

setBitRate(knownBitRate IN INTEGER);

Description

Sets the value of the bitRate attribute of the video object.

Parameters

knownBitRate

The bit 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 setBitRate( ) method and the value for the knownBitRate parameter is NULL.

Examples

See the example in "setFrameSize( )".


setCompressionType( )

Format

setCompressionType(knownCompressionType IN VARCHAR2);

Description

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

Parameters

knownCompressionType

A known compression type.

Usage Notes

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 "setFrameSize( )".


setDescription( )

Format

setDescription (user_description IN VARCHAR2);

Description

Sets the description of the video data.

Parameters

user_description

The description of the video data.

Usage Notes

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

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

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

None.

Examples

Set the description attribute for some video data:

DECLARE
  obj ORDSYS.ORDVideo;
BEGIN
  SELECT vid INTO obj FROM TVID  WHERE N=1 FOR UPDATE;
  DBMS_OUTPUT.PUT_LINE('writing description');
  DBMS_OUTPUT.PUT_LINE('-------------');
  obj.setDescription('video1');
  DBMS_OUTPUT.PUT_LINE(obj.getDescription());
  UPDATE TVID SET vid=obj WHERE N=1;
  COMMIT;
END;
/

setFormat( )

Format

setFormat(knownFormat IN VARCHAR2);

Description

Sets the format attribute of the video object.

Parameters

knownFormat

The known format of the video data to be set in the video 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 stored video data:

DECLARE
  obj ORDSYS.ORDVideo;
BEGIN
  SELECT vid INTO obj FROM TVID  WHERE N=1 FOR UPDATE;
  DBMS_OUTPUT.PUT_LINE('writing format');
  DBMS_OUTPUT.PUT_LINE('--------------');
  obj.setFormat('avi');
  DBMS_OUTPUT.PUT_LINE(obj.getFormat);
  UPDATE TVID SET vid=obj WHERE N=1;
  COMMIT;
  EXCEPTION
    WHEN ORDSYS.ORDVideoExceptions.NULL_INPUT_VALUE THEN
      DBMS_OUTPUT.put_line('ORDVideoExceptions.NULL_INPUT_VALUE caught');
    WHEN OTHERS THEN
      DBMS_OUTPUT.put_line('EXCEPTION caught');
END;
/


setFrameRate( )

Format

setFrameRate(knownFrameRate IN INTEGER);

Description

Sets the value of the frameRate attribute of the video object.

Parameters

knownFrameRate

The frame 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 setFrameRate( ) method and the value for the knownFrameRate parameter is NULL.

Examples

See the example in "setFrameSize( )".


setFrameResolution( )

Format

setFrameResolution(knownFrameResolution IN INTEGER);

Description

Sets the value of the frameResolution attribute of the video object.

Parameters

knownFrameResolution

The known frame resolution in pixels per inch.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

NULL_INPUT_VALUE

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

Examples

See the example in "setFrameSize( )".


setFrameSize( )

Format

setFrameSize(

knownWidth IN INTEGER,

knownHeight IN INTEGER);

Description

Sets the value of the height and width attributes of the video object.

Parameters

knownWidth

The frame width in pixels.

knownHeight

The frame height in pixels.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

NULL_INPUT_VALUE

This exception is raised if you call the setFrameSize( ) method and the value for either the knownWidth or knownHeight parameter is NULL.

Examples

Set the frame size for video data:

DECLARE
  obj ORDSYS.ORDVideo;
BEGIN
  select vid into obj from TVID where N =1 for update;
  obj.setFrameSize(1,2);
  obj.setFrameResolution(4);
  obj.setFrameRate(5);
  obj.setVideoDuration(20);
  obj.setNumberOfFrames(8);
  obj.setCompressionType('Cinepak');
  obj.setBitRate(1500);
  obj.setNumberOfColors(256);
  update TVID set vid = obj where N = 1;
  COMMIT;
END;
/


setKnownAttributes( )

Format

setKnownAttributes(

knownFormat IN VARCHAR2,

knownWidth IN INTEGER,

knownHeight IN INTEGER,

knownFrameResolution IN INTEGER,

knownFrameRate IN INTEGER,

knownVideoDuration IN INTEGER,

knownNumberOfFrames IN INTEGER,

knownCompressionType IN VARCHAR2,

knownNumberOfColors IN INTEGER,

knownBitRate IN INTEGER);

Description

Sets the known video attributes for the video data.

Parameters

knownFormat

The known format.

knownWidth

The known width.

knownHeight

The known height.

knownFrameResolution

The known frame resolution.

knownFrameRate

The known frame rate.

knownVideoDuration

The known video duration.

knownNumberOfFrames

The known number of frames.

knownCompressionType

The known compression type.

knownNumberOfColors

The known number of colors.

knownBitRate

The known bit rate.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

None.

Examples

Set the property information for all known attributes for video data:

DECLARE
  obj ORDSYS.ORDVideo;
  width integer;
  height integer;
BEGIN
 select vid into obj from TVID where N =1 for update;
 obj.setKnownAttributes('MOOV',1,2,4,5,20,8,'Cinepak', 256, 1500);
 obj.getFrameSize(width, height);
 DBMS_OUTPUT.put_line('width: '  || TO_CHAR(width));
 DBMS_OUTPUT.put_line('height: ' || TO_CHAR(height));
 DBMS_OUTPUT.put_line('format: ' || obj.getFormat());
 DBMS_OUTPUT.put_line('frame resolution: ' ||TO_CHAR(obj.getFrameResolution()));
 DBMS_OUTPUT.put_line('frame rate: ' || TO_CHAR(obj.getFrameRate()));
 DBMS_OUTPUT.put_line('video duration: ' || TO_CHAR(obj.getVideoDuration()));
 DBMS_OUTPUT.put_line('number of frames: ' || TO_CHAR(obj.getNumberOfFrames()));
 DBMS_OUTPUT.put_line('compression type: ' || obj.getCompressionType());
 DBMS_OUTPUT.put_line('bite rate: ' || TO_CHAR(obj.getBitRate()));
 DBMS_OUTPUT.put_line('number of colors: ' || TO_CHAR(obj.getNumberOfColors()));
 update TVID set vid = obj where N = 1;
 COMMIT;
END;
/
 

setNumberOfColors( )

Format

setNumberOfColors(knownNumberOfColors RETURN INTEGER);

Description

Sets the value of the numberOfColors attribute of the video object.

Parameters

knownNumberOfColors

A known number of colors.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

NULL_INPUT_VALUE

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

Examples

See the example in "setFrameSize( )".


setNumberOfFrames( )

Format

setNumberOfFrames(knownNumberOfFrames RETURN INTEGER);

Description

Sets the value of the numberOfFrames attribute of the video object.

Parameters

knownNumberOfFrames

A known number of frames.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

NULL_INPUT_VALUE

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

Examples

See the example in "setFrameSize( )".


setProperties( )

Format

setProperties(ctx IN OUT RAW,

setComments IN BOOLEAN);

Description

Reads the video data to get the values of the object attributes and then stores them in the object. For the known attributes that ORDVideo understands, it sets the properties for these attributes, which include: format, frame size, frame resolution, frame rate, video duration, number of frames, compression type, number of colors, and bit rate. 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 video 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 your user-defined format plug-in.

Pragmas

None.

Exceptions

VIDEO_PLUGIN_EXCEPTION

This exception is raised if you call the setProperties( ) method and the video plug-in raises an exception when calling this method.

Examples

Set the property information for known video attributes:

DECLARE
  obj ORDSYS.ORDVideo;
  ctx RAW(4000) :=NULL;
BEGIN
  select vid into obj from TVID where N =1 for update;
  obj.setProperties(ctx,FALSE);
  update TVID set vid = obj where N = 1;
  COMMIT;
  EXCEPTION
    WHEN OTHERS THEN
     DBMS_OUTPUT.put_line('exception raised');
END;
/


setVideoDuration( )

Format

setVideoDuration(knownVideoDuration RETURN INTEGER);

Description

Sets the value of the videoDuration attribute of the video object.

Parameters

knownVideoDuration

A known video 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 setVideoDuration( ) method and the value for the knownVideoDuration parameter is NULL.

Examples

See the example in "setFrameSize( )".

9.4 Packages or PL/SQL Plug-ins

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

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

ORDPLUGINS.ORDX_DEFAULT_VIDEO 

<format> 

Dependent on file format  

ORDPLUGINS.ORDX_AVI_VIDEO 

AVI 

video/x-msvideo 

ORDPLUGINS.ORDX_MOOV_VIDEO 

MOOV 

video/quicktime 

ORDPLUGINS.ORDX_RMFF_VIDEO 

RMFF 

audio/x-pn-realaudio 

Section 9.4.1 describes the ORDPLUGINS.ORDX_DEFAULT_VIDEO 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 9-1 are identical for all plug-in packages, therefore, refer to Section 9.4.1.

9.4.1 ORDPLUGINS.ORDX_DEFAULT_VIDEO Package

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

CREATE OR REPLACE PACKAGE ORDX_DEFAULT_VIDEO
authid current_user
AS
--VIDEO ATTRIBUTES ACCESSORS
FUNCTION  getFormat(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo) 
          RETURN VARCHAR2;
FUNCTION  getAttribute(ctx IN OUT RAW,
                       obj IN ORDSYS.ORDVideo,
                       name IN VARCHAR2) 
          RETURN VARCHAR2;
PROCEDURE getFrameSize(ctx IN OUT RAW,
                       obj IN ORDSYS.ORDVideo,
                       width OUT INTEGER,
                       height OUT INTEGER);
FUNCTION  getFrameResolution(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo) 
            RETURN INTEGER;
FUNCTION  getFrameRate(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo) 
          RETURN INTEGER;
FUNCTION  getVideoDuration(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo) 
          RETURN INTEGER;
FUNCTION  getNumberOfFrames(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo) 
          RETURN INTEGER;
FUNCTION  getCompressionType(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo)
          RETURN VARCHAR2;
FUNCTION  getNumberOfColors(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo) 
          RETURN INTEGER;
FUNCTION  getBitRate(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo) 
          RETURN INTEGER;
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;
PRAGMA RESTRICT_REFERENCES(getFormat, WNDS, WNPS, RNDS, RNPS);
PRAGMA RESTRICT_REFERENCES(getAttribute, WNDS, WNPS, RNDS, RNPS);
PRAGMA RESTRICT_REFERENCES(getFrameSize, WNDS, WNPS, RNDS, RNPS);
PRAGMA RESTRICT_REFERENCES(getFrameResolution, WNDS, WNPS, RNDS, RNPS);
PRAGMA RESTRICT_REFERENCES(getFrameRate, WNDS, WNPS, RNDS, RNPS);
PRAGMA RESTRICT_REFERENCES(getVideoDuration, WNDS, WNPS, RNDS, RNPS);
PRAGMA RESTRICT_REFERENCES(getNumberOfFrames, WNDS, WNPS, RNDS, RNPS);
PRAGMA RESTRICT_REFERENCES(getCompressionType, WNDS, WNPS, RNDS, RNPS);
PRAGMA RESTRICT_REFERENCES(getNumberOfColors, WNDS, WNPS, RNDS, RNPS);
PRAGMA RESTRICT_REFERENCES(getBitRate, WNDS, WNPS, RNDS, RNPS);

END;
/

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

Table 9-2 Methods Supported in the ORDPLUGINS.ORDX_DEFAULT_VIDEO 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. 

getAttribute 

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION 

getFrameSize 

Supported; if the source is local, get the attribute and return the frame 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. 

getFrameResolution 

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION 

getFrameRate 

Supported; if the source is local, get the attribute and return the frame 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. 

getVideoDuration 

Supported; if the source is local, get the attribute and return the video 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. 

getNumberOfFrames 

Supported; if the source is local, get the attribute and return the number of frames, 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. 

getNumberOfColors 

Supported; if the source is local, get the attribute and return the number of colors, 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. 

getBitRate 

Supported; if the source is local, get the attribute and return the bit 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. 

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

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 VIDEO_PLUGIN_EXCEPTION 

9.4.2 Extending interMedia to Support a New Video Data Format

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

  1. Design your new video data format.
  2. Implement your new video data format and name it, for example, ORDX_MY_VIDEO.SQL.
  3. Install your new ORDX_MY_VIDEO.SQL plug-in in the ORDPLUGINS schema.
  4. Grant EXECUTE privileges on your new plug-in, for example, ORDX_MY_VIDEO.SQL plug-in, to PUBLIC.

Section 3.4.12 briefly describes how to extend interMedia to support a new video data format and describes the interface. A package body listing is provided in Example 9-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.4 for more information on installing your own video format plug-in and running the sample scripts provided.

Example 9-1 Show the Package Body for Extending Support to a New Video
Data Format

CREATE OR REPLACE PACKAGE BODY ORDX_MY_VIDEO
AS
  --VIDEO ATTRIBUTES ACCESSORS
  FUNCTION  getFormat(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo)
  RETURN VARCHAR2
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  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 getFrameSize(ctx IN OUT RAW,
                         obj IN ORDSYS.ORDVideo,
                         width OUT INTEGER,
                         height OUT INTEGER)
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  FUNCTION  getFrameResolution(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo)
  RETURN INTEGER
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  FUNCTION  getFrameRate(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo)
  RETURN INTEGER
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  FUNCTION  getVideoDuration(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo)
  RETURN INTEGER
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  FUNCTION  getNumberOfFrames(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo)
  RETURN INTEGER
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  FUNCTION  getCompressionType(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo)
  RETURN VARCHAR2
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  FUNCTION  getNumberOfColors(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo)
  RETURN INTEGER
  IS
--Your variables go here
  BEGIN
--Your code goes here
  END;
  FUNCTION  getBitRate(ctx IN OUT RAW, obj IN ORDSYS.ORDVideo)
  RETURN INTEGER
  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
  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;

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

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback