Oracle8i interMedia Audio, Image, and Video User's Guide and Reference
Release 8.1.5

A67299-01

Library

Product

Contents

Index

Prev Next

5
ORDVideo Reference Information

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


5.1 Object Types

Oracle8i 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

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



-- 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 the video attributes accessors

MEMBER PROCEDURE setFormat(knownformat IN VARCHAR2),

MEMBER FUNCTION getFormat RETURN VARCHAR2,

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

MEMBER FUNCTION getFormat(ctx IN OUT RAW) RETURN VARCHAR2,



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 getFrameSize(

                              ctx IN OUT RAW,

                              retWidth OUT INTEGER,

                              retHeight OUT INTEGER),



MEMBER PROCEDURE setFrameResolution(knownFrameResolution IN INTEGER),

MEMBER FUNCTION getFrameResolution RETURN INTEGER,

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

MEMBER FUNCTION getFrameResolution(ctx IN OUT RAW) RETURN INTEGER,



MEMBER PROCEDURE setFrameRate(knownFrameRate IN INTEGER),

MEMBER FUNCTION getFrameRate RETURN INTEGER,

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

MEMBER FUNCTION getFrameRate(ctx IN OUT RAW) RETURN INTEGER,



MEMBER PROCEDURE setVideoDuration(knownVideoDuration IN INTEGER),

MEMBER FUNCTION getVideoDuration RETURN INTEGER,

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

MEMBER FUNCTION getVideoDuration(ctx IN OUT RAW) RETURN INTEGER,



MEMBER PROCEDURE setNumberOfFrames(knownNumberOfFrames IN INTEGER),

MEMBER FUNCTION getNumberOfFrames RETURN INTEGER,

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

MEMBER FUNCTION getNumberOfFrames(ctx IN OUT RAW) RETURN INTEGER,



MEMBER PROCEDURE setCompressionType(knownCompressionType IN VARCHAR2),

MEMBER FUNCTION getCompressionType RETURN VARCHAR2,

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

MEMBER FUNCTION getCompressionType(ctx IN OUT RAW) RETURN VARCHAR2,



MEMBER PROCEDURE setNumberOfColors(knownNumberOfColors IN INTEGER),

MEMBER FUNCTION getNumberOfColors RETURN INTEGER,

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

MEMBER FUNCTION getNumberOfColors(ctx IN OUT RAW) RETURN INTEGER,



MEMBER PROCEDURE setBitRate(knownBitRate IN INTEGER),

MEMBER FUNCTION getBitRate RETURN INTEGER,

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

MEMBER FUNCTION getBitRate(ctx IN OUT RAW) RETURN INTEGER,



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),

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:

5.2 Methods

This section presents reference information on the Oracle8i 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 title Attribute

ORDVideo Methods Associated with mimeType Attribute

ORDVideo Methods Associated with the source Attribute

ORDAudio Methods Associated with File Operations

ORDVideo Methods Associated with the comments Attribute

ORDVideo Methods Associated with Video Attributes Accessors

The following methods are supported only by user-defined format plug-ins:

ORDVideo Methods Associated with Processing Video Data

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

5.2.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 in Section 5.2.2 through Section 5.2.9:

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(

                          NULL,

        ORDSYS.ORDSOURCE(EMPTY_BLOB(), NULL, NULL, NULL, SYSDATE, NULL),

                          NULL,

                          NULL,

                          EMPTY_CLOB(),0,0,0,0,0,0,0,0,0)

                     );

INSERT INTO TVID VALUES(2, ORDSYS.ORDVideo(

                          NULL,

                          ORDSYS.ORDSOURCE(EMPTY_BLOB(), NULL, NULL, NULL, 

SYSDATE,NULL),

                          NULL,

                          NULL,

                          EMPTY_CLOB(),0,0,0,0,0,0,0,0,0)

                     );

5.2.2 ORDVideo Methods Associated with the updateTime Attribute

This section presents reference information on the ORDVideo 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

none

Pragmas

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

Exception

none

Example

Get the updated time of some video data:


DECLARE

 obj ORDSYS.ORDVideo;

BEGIN

 SELECT TVID INTO obj FROM TVID WHERE N = 1 ;

 DBMS_OUTPUT.PUT_LINE(TO_CHAR(obj.getUpdateTime,'MM-DD-YYYY HH24:MI:SS'));

END;

/


setUpdateTime( ) Method

Format


setUpdateTime(current_time DATE);

Description

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

Parameters

current_time

The timestamp to be stored. Default is SYSDATE.

Usage

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

Pragmas

none

Exception

none

Example

See also the example in the getUpdateTime Method.

Set the updated time of some video data:


DECLARE

 obj ORDSYS.ORDVideo;

BEGIN

 SELECT vid INTO obj FROM TVID WHERE N = 1;

 obj.setUpdateTime(SYSDATE);

 UPDATE TVID SET vid=obj WHERE N = 1;

 COMMIT;

END;

5.2.3 ORDVideo Methods Associated with the description Attribute

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


setDescription( ) Method

Format


setDescription (user_description IN VARCHAR2);

Description

Sets the description of the video data.

Parameters

user_description

The description of the video data.

Usage

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 Oracle8i interMedia make use of this description attribute to present video data to users.

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

none

Exception

none

Example

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;

/




getDescription Method

Format


getDescription RETURN VARCHAR2;

Description

Returns the description of the video data.

Parameters

none

Usage

none

Pragmas

Pragma RESTRICT_REFERENCES(getTitle, WNDS, WNPS, RNDS, RNPS)

Exception

If you call the setDescription method and the description is not set, a DESCRIPTION_IS_NOT_SET exception is raised.

Example

See the example in the setDescription( ) Method.




5.2.4 ORDVideo Methods Associated with the mimeType Attribute

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


setMimeType( ) Method

Format


setMimeType(mime IN VARCHAR2);

Description

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

Parameters

mime

The MIME type.

Usage

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

Exception

If you call the setMimeType( ) method and the value for MIME type is NULL, an INVALID_MIME_TYPE exception is raised.

Example

Set the MIME type 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 mimetype');

  DBMS_OUTPUT.PUT_LINE('----------------');

  obj.setMimeType('video/avi');

  DBMS_OUTPUT.PUT_LINE(obj.getMimeType);

  UPDATE TVID SET vid=obj WHERE N=1;

  COMMIT;

END;

/


getMimeType Method

Format


getMimeType RETURN VARCHAR2;

Description

Returns the MIME type for the video data.

Parameters

none

Usage

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 to set the MIME type.

Pragmas

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

Exception

none

Example

See the example in the setMimeType( ) Method.




5.2.5 ORDVideo Methods Associated with the source Attribute

This section presents reference information on the ORDVideo 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 function returned by the source plug-in.

Usage

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

Pragmas

none

Exception

If the value of srcType is NULL, then calling this method raises an ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION exception.

If the processSourceCommand( ) method is not supported by the source plug-in being used, an ORDSourceExceptions.METHOD_NOT_SUPPORTED exception is raised.

Calling this method within a source plug-in when any other exception is raised, raises an ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION exception.

See Appendix H for more information about these exceptions.

Example

Process some 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.processSourceCommand (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;

/




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

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

Pragmas

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

Exception

none

Example

Determine whether or not the data is local:


DECLARE

 obj ORDSYS.ORDVideo;

BEGIN

 SELECT vid INTO obj FROM TVID WHERE N = 1 FOR UPDATE;

 if(obj.isLocal) then

   DBMS_OUTPUT.put_line('local is true');

 else

   DBMS_OUTPUT.put_line('local is false');

 endif;

END;

/


setLocal Method

Format


setLocal;

Description

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

Parameters

none

Usage

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

Pragmas

none

Exception

none

Example

Set the flag to local for the data:


DECLARE

 obj ORDSYS.ORDVideo;

BEGIN

 SELECT s INTO obj FROM TVID WHERE N = 1 FOR UPDATE;

 obj.setLocal;

 UPDATE TVID 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, video methods look for video data using the srcLocation, srcName, and srcType attributes.

Parameters

none

Usage

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

Pragmas

none

Exception

none

Example

Clear the value of the local flag for the data:


DECLARE

 obj ORDSYS.ORDVideo;

BEGIN

 SELECT s INTO obj FROM TVID WHERE N = 1 FOR UPDATE;

 obj.clearLocal;

 UPDATE TVID 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 video data.

Parameters

source_type

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

source_location

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

source_name

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

Usage

Users can use this method to set the video 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.

Pragmas

none

Exception

none

Example

Change the source to the exported file prior to exporting the video data:


DECLARE

  obj ORDSYS.ORDVideo;

BEGIN

  SELECT vid INTO obj FROM TVID  WHERE N=1 FOR UPDATE;

  DBMS_OUTPUT.PUT_LINE('setting and getting source');

  DBMS_OUTPUT.PUT_LINE('--------------------------');

  obj.setSource('LOCAL','VIDEODIR','video.dat');

  DBMS_OUTPUT.PUT_LINE(obj.getSource);

  UPDATE TVID SET vid=obj WHERE N=1;

  COMMIT;

END;

/




getSource Method

Format


getSource RETURN VARCHAR2;

Description

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

Parameters

none

Usage

Possible return values are:

Pragmas

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

Exception

none

Example

See the example in the setSource( ) Method.





getSourceType Method

Format


getSourceType RETURN VARCHAR2;

Description

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

Parameters

none

Usage

This method returns a VARCHAR2 string containing the type of the external video data source, for example 'FILE'.

Pragmas

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

Exception

none

Example

Get the source type information about a video data source:


DECLARE

  obj ORDSYS.ORDVideo;

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','MV1.AVI');

  -- 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 TVID SET vid=obj WHERE N=1;

  COMMIT;

  EXCEPTION

        WHEN ORDSYS.ORDVideoExceptions.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 video data source location.

Parameters

none

Usage

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

Pragmas

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

Exception

If the value of srcLocation is NULL, then calling this method raises an ORDSourceExceptions.INCOMPLETE_SOURCE_LOCATION exception.

Example

See the example in the getSourceType Method.





getSourceName Method

Format


getSourceName RETURN VARCHAR2;

Description

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

Parameters

none

Usage

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

Pragmas

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

Exception

If the value of srcName is NULL, then calling this method raises an ORDSourceExceptions.INCOMPLETE_SOURCE_NAME exception.

Example

See the example in the getSourceType Method.





import( ) Method

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

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.

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

Exception

If the value of srcType is NULL, then calling this method raises an ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION exception.

If the value of dlob is NULL, then calling this method raises an ORDSourceExceptions.NULL_SOURCE exception.

If the import( ) method is not supported by the source plug-in being used, an ORDSourceExceptions.METHOD_NOT_SUPPORTED exception is raised.

Calling this method within a source plug-in when any other exception is raised, raises an ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION exception.

See Appendix H for more information about these exceptions.

Example

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( ) Method

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

This method is similar to the import( ) method except the source information is specified within 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 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

Exception

If the value of dlob is NULL, then calling this method raises an ORDSourceExceptions.NULL_SOURCE exception.

If the importFrom( ) method is not supported by the source plug-in being used, an ORDSourceExceptions.METHOD_NOT_SUPPORTED exception is raised.

Calling this method within a source plug-in when any other exception is raised, raises an ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION exception.

See Appendix H for more information about these exceptions.

Example

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;

/




export( ) Method

Format


export(

       ctx             IN OUT RAW,

       source_type     IN VARCHAR2,

       source_location IN VARCHAR2,

       source_name     IN VARCHAR2); 

Description

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

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 to where the video data is to be exported.

source_name

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

Usage

After exporting video data, all video attributes remain unchanged and srcType, srcLocation, and srcName are updated with input values. After calling the export method, you can call the deleteContent method to delete the content of the local data.

There is no server-side native support for the export method; this method is available for user-defined sources that can support the export method.

Pragmas

none

Exception

If the value of srcType is NULL, then calling this method raises an ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION exception.

If the export( ) method is not supported by the source plug-in being used, an ORDSourceExceptions.METHOD_NOT_SUPPORTED exception is raised.

Calling this method within a source plug-in when any other exception is raised, raises an ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION exception.

See Appendix H for more information about these exceptions.

Example

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


DECLARE

  obj ORDSYS.ORDVideo;

  ctx RAW(4000) :=NULL;

BEGIN

   SELECT vid INTO obj FROM TVID   WHERE N =1;

   obj.export(ctx,'FILE','VIDEODIR','x.mov');

  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('OTHER EXCEPTION caught');

END;

/




getContentLength( ) Method

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

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)

Exception

If the value of srcType is NULL and data is not stored locally in the
BLOB, then calling this method raises an exception,
ORDSourceExceptions.INCOM-PLETE_SOURCE_INFORMATION.

Calling this method within a source plug-in when any other exception is raised, raises an ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION exception.

See Appendix H for more information about this exception.

Example

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

none

Pragmas

none

Exception

If the value of srcType is NULL, then calling this method raises an ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION exception.

If the getContentInLob( ) method is not supported by the source plug-in being used, an ORDSourceExceptions.METHOD_NOT_SUPPORTED exception is raised.

Calling this method within a source plug-in when any other exception is raised, raises an ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION exception.

See Appendix H for more information about these exceptions.

Example

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);

 -- process tempBLob

 DBMS_OUTPUT.PUT_LINE(TO_CHAR(DBMS_LOB.getLength(tempBLob)));

EXCEPTION

WHEN ORDSYS.ORDVideoExceptions.METHOD_NOT_SUPPORTED THEN

DBMS_OUTPUT.put_line('ORDVideoExceptions.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 ORDVideo object.

Parameters

none

Usage

none

Pragmas

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

Exception

none

Example

A client accesses video data to be put on a Web-based player:


DECLARE

  obj ORDSYS.ORDVideo;

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;

/




deleteContent Method

Format


deleteContent;

Description

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

Parameters

none

Usage

This method can be called after you export the data from the local source to an external video 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

Exception

none

Example

See the example in the import( ) Method.




5.2.6 ORDVideo Methods Associated with File-Like Operations

This section presents reference information on the ORDVideo methods associated with file-like operations on a data source. You can use the methods in this section specifically to manipulate video 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

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

Exception

If the value for srcType is NULL and the data is not local, then calling this method raises an ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION exception.

If the openSource( ) method is not supported by the source plug-in being used, an ORDSourceExceptions.METHOD_NOT_SUPPORTED exception is raised.

Calling this method within a source plug-in when any other exception is raised, raises an ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION exception.

See Appendix H for more information about these exceptions.

Example

Open a local data source:


DECLARE

  obj ORDSYS.ORDVideo;

  res INTEGER;

  ctx RAW(4000) :=NULL;

  userArg RAW(4000);

BEGIN

  select vid into obj from TVID where N =1 for UPDATE;

  res := obj.openSource(userArg, ctx);

  UPDATE TVID SET vid =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

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

Exception

If the value for srcType is NULL and the data is not local, then calling this method raises an ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION exception.

If the closeSource( ) method is not supported by the source plug-in being used, an ORDSourceExceptions.METHOD_NOT_SUPPORTED exception is raised.

Calling this method within a source plug-in when any other exception is raised, raises an ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION exception.

See Appendix H for more information about these exceptions.

Example

Close an external BFILE data source:


DECLARE

  obj ORDSYS.ORDVideo;

  res INTEGER;

  ctx RAW(4000) :=NULL;

BEGIN

  select vid into obj from TVID where N =2 for UPDATE;

  obj.source.clearLocal;

  res := obj.closeSource(ctx);

  UPDATE TVID SET vid=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 RAW;

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

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

Exception

If the value for srcType is NULL and the data is not local, then calling this method raises an ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION exception.

If the trimSource( ) method is not supported by the source plug-in being used, an ORDSourceExceptions.METHOD_NOT_SUPPORTED exception is raised.

Calling this method within a source plug-in when any other exception is raised, raises an ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION exception.

See Appendix H for more information about these exceptions.

Example

Trim a local data source:


DECLARE

  obj ORDSYS.ORDVideo;

  res INTEGER;

  ctx RAW(4000) :=NULL;

BEGIN

  select vid into obj from TVID where N =1 for UPDATE;

  res := obj.trimSource(ctx,0);

  UPDATE TVID SET vid=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

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 HTTP source type.

Pragmas

none

Exception

If the value of srcType is NULL and the data is not local, then calling this method raises an ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION exception.

If the data is local but the value of localData is NULL, then calling this method raises an ORDSourceExceptions.NULL_SOURCE exception.

If the readFromSource( ) method is not supported by the source plug-in being used, an ORDSourceExceptions.METHOD_NOT_SUPPORTED exception is raised.

Calling this method within a source plug-in when any other exception is raised, raises an ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION exception.

See Appendix H for more information about these exceptions.

Example

Read a buffer from the source:


DECLARE

  obj ORDSYS.ORDVideo;

  buffer RAW(4000);

  i INTEGER;

  ctx RAW(4000) :=NULL;

BEGIN

i := 20;

select vid into obj from TVID 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

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

Exception

If the value of srcType is NULL and the data is not local, then calling this method raises an ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION exception.

If the data is local but the localData value is NULL, then calling this method raises an ORDSourceExceptions.NULL_SOURCE exception.

If the writeToSource( ) method is not supported by the source plug-in being used, an ORDSourceExceptions.METHOD_NOT_SUPPORTED exception is raised.

Calling this method within a source plug-in when any other exception is raised, raises an ORDSourceExceptions.SOURCE_PLUGIN_EXCEPTION exception.

See Appendix H for more information about these exceptions.

Example

Write a buffer to the source:


DECLARE

  obj ORDSYS.ORDVideo;

  n INTEGER := 6;

  ctx RAW(4000) :=NULL;

BEGIN

  select vid into obj from TVID 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 TVID set vid - 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;

/

5.2.7 ORDVideo Methods Associated with the comments Attribute

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


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

Parameters

amount

The amount of comment data to be appended.

buffer

The buffer of comment data to be appended.

Usage

none

Pragmas

none

Exception

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 Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Example

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


DECLARE

  obj ORDSYS.ORDVideo;

  i INTEGER;

  j INTEGER;

BEGIN

  SELECT vid INTO obj FROM TVID  WHERE N=1 FOR UPDATE;

  obj.writeToComments(1,18,'This is a Comments');

  obj.appendToComments(18,'This is a 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;

  UPDATE TVID SET vid=obj WHERE N=1;

  COMMIT;

  EXCEPTION

        WHEN ORDSYS.ORDVideoExceptions.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 video 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

none

Pragmas

none

Exception

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 Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Example

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

none

Pragmas

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

Exception

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 Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Example

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

none

Pragmas

none

Exception

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 Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Example

See the example in the appendToComments( ) Method.


trimComments( ) Method

Format


trimComments(newlen IN INTEGER);

Description

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

Parameters

newlen

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

Usage

none

Pragmas

none

Exception

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 Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Example

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

none

Pragmas

none

Exception

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 Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Example

See the example in the appendToComments( ) Method.





deleteComments( ) Method

Format


deleteComments;

Description

Deletes the comments attribute of the video object.

Parameters

none

Usage

none

Pragmas

none

Exception

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 Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Example

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

none

Pragmas

none

Exception

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 Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Example

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


DECLARE

  file_handle BFILE;

  obj ORDSYS.ORDVideo;

  isopen BINARY_INTEGER;

  amount INTEGER;

BEGIN

  SELECT vid INTO obj FROM TVID  WHERE N=1 FOR UPDATE;

  --file_handle := BFILENAME(obj.getSourceLocation, obj.getSourceName);

  file_handle := BFILENAME('VIDEODIR', 'testvid.dat');

     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.loadCommentsFromFile(file_handle, 18, 1, 18);

     dbms_output.put_line(obj.getCommentLength);

  UPDATE TVID SET vid=obj WHERE N=1;

  COMMIT;

  EXCEPTION

        WHEN ORDSYS.ORDVideoExceptions.METHOD_NOT_SUPPORTED THEN

         DBMS_OUTPUT.PUT_LINE('Source not specified');

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 video object comments attribute into the given CLOB.

Parameters

dest

The destination to which the comments are to be copied.

amount

The amount of comments data to be copied.

from_loc

The location from which to copy the comments.

to_loc

The location to which to copy the comments.

Usage

none

Pragmas

none

Exception

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 Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Example

Copy comments of the video data to the given CLOB:


DECLARE

  file_handle BFILE;

  obj ORDSYS.ORDVideo;

  obj1 ORDSYS.ORDVideo;

BEGIN

  SELECT vid INTO obj1 FROM TVID  WHERE N=2 FOR UPDATE;

  SELECT vid INTO obj FROM TVID  WHERE N=1;

  obj.copyCommentsOut(obj1.comments,obj.getCommentLength,1,10);

  DBMS_OUTPUT.put_line(obj1.getCommentLength);

  DBMS_OUTPUT.put_line(obj.getCommentLength);

  UPDATE TVID SET vid=obj1 WHERE N=2;

  COMMIT;

  EXCEPTION

        WHEN ORDSYS.ORDVideoExceptions.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 video data with comments of the other CLOB provided.

Parameters

compare_with_lob

The comparison comments.

amount

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

starting_pos_in_comment

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

starting_pos_in_compare

The starting position in the comparison comments.

Usage

none

Pragmas

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

Exception

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 Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Example

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


DECLARE

  file_handle BFILE;

  obj ORDSYS.ORDVideo;

  obj1 ORDSYS.ORDVideo;

BEGIN

  SELECT vid INTO obj FROM TVID  WHERE N=2 ;

  SELECT vid INTO obj1 FROM TVID  WHERE N=1;

  DBMS_OUTPUT.put_line('comparison output');

  DBMS_OUTPUT.put_line(obj.compareComments(obj1.comments,obj.getCommentLength,

  1,18));

  EXCEPTION

        WHEN ORDSYS.ORDVideoExceptions.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 video object.

Parameters

none

Usage

none

Pragmas

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

Exception

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 Packages Reference manual for a list of exceptions that can be raised for the DBMS_LOB functions and procedures.

Example

See the example in the compareComments( ) Method.




5.2.8 ORDVideo Methods Associated with Video Attributes Accessors

This section presents reference information on the ORDVideo methods associated with the video attributes accessors.


setFormat( ) Method

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

Usage

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

none

Exception

If the value for the knownFormat parameter is NULL, then calling this method raises a NULL_INPUT_VALUE exception.

Example

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;

END;

/


getFormat Method

Format


getFormat RETURN VARCHAR2;

Description

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

Parameters

none

Usage

none

Pragmas

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

Exception

If the value for format is NULL, then calling this method raises a VIDEO_FORMAT_IS_NULL exception.

Example

See the example in the setFormat( ) Method.





getFormat( ) Method

Format


getFormat(ctx IN OUT RAW) RETURN VARCHAR2;

Description

Calls the format plug-in to read the format embedded in the stored video data.

Parameters

ctx

The format plug-in context information.

Usage

If the format found in the object is NULL, then the getFormat( ) method uses the default format plug-in to read the video data to determine the format; otherwise, it uses your user-defined format plug-in.

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

Pragmas

none

Exception

If the video plug-in raises an exception when calling this method, then the getFormat( ) method raises a VIDEO_PLUGIN_EXCEPTION exception.

Example

Return the file format 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 FOR UPDATE;

  res := obj.getFormat(ctx);

  DBMS_OUTPUT.put_line(res );

  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('method not supported');

END;

/




setFrameSize( ) Method

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

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

none

Exception

If the value for either the knownWidth or knownHeight parameters is NULL, then calling this method raises a NULL_INPUT_VALUE exception.

Example

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;

/




getFrameSize( ) Method

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

none

Pragmas

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

Exception

none

Example

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;

/




getFrameSize( ) Method

Format


getFrameSize(

             ctx    IN OUT RAW,

             width  OUT INTEGER,

             height OUT INTEGER); 

Description

Calls the format plug-in to read the frame size embedded in the stored video data.

Parameters

ctx

The format plug-in context information.

width

The frame width in pixels.

height

The frame height in pixels.

Usage

The video frame size information is available from the header of the formatted video data.

If the format found in the object is NULL, then the getFrameSize( ) method uses the default format plug-in to read the video data to determine the frame size; otherwise, it uses your user-defined format plug-in.

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

Pragmas

none

Exception

If the video plug-in raises an exception when calling this method, then it raises a VIDEO_PLUGIN_EXCEPTION exception.

Example

Call the format plug-in to read the actual frame size embedded in the stored video data:


DECLARE

  obj ORDSYS.ORDVideo;

  width VARCHAR2(4000);

  height VARCHAR2(4000);

  ctx RAW(4000) :=NULL;

BEGIN

  SELECT vid INTO obj FROM TVID  WHERE N=1 FOR UPDATE;

  obj.getFrameSize(ctx,width, height);

  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('method not supported');

END;

/




setFrameResolution( ) Method

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

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

none

Exception

If the value for the knownFrameResolution parameter is NULL, then calling this method raises a NULL_INPUT_VALUE exception.

Example

See the example in the setFrameSize( ) Method.


getFrameResolution Method

Format


getFrameResolution RETURN INTEGER;

Description

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

Parameters

none

Usage

none

Pragmas

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

Exception

none

Example

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;

/




getFrameResolution( ) Method

Format


getFrameResolution(ctx IN OUT RAW) RETURN INTEGER;

Description

Calls the format plug-in to read the frame resolution embedded in the stored video data.

Parameters

ctx

The format plug-in context information.

Usage

The video frame resolution information is available from the header of the formatted video data.

If the format found in the object is NULL, then the getFrameResolution( ) method uses the default format plug-in to read the video data to determine the frame resolution; otherwise, it uses your user-defined format plug-in.

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

Pragmas

none

Exception

If the video plug-in raises an exception when calling this method, then it raises a VIDEO_PLUGIN_EXCEPTION exception.

Example

Call the format plug-in to read the actual frame resolution embedded in the stored video data:


DECLARE

  obj ORDSYS.ORDVideo;

  res INTEGER;

  ctx RAW(4000) :=NULL;

BEGIN

  SELECT vid INTO obj FROM TVID  WHERE N=1 FOR UPDATE;

  res := obj.getFrameResolution(ctx);

  DBMS_OUTPUT.put_line(res );

  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('method not supported');

END;

/




setFrameRate( ) Method

Format


setFrameRate(knownFrameRate IN INTEGER);

Description

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

Parameters

knownFrameRate

The frame rate.

Usage

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

none

Exception

If the value for the knownFrameRate parameter is NULL, then calling this method raises a NULL_INPUT_VALUE exception.

Example

See the example in the setFrameSize( ) Method.


getFrameRate Method

Format


getFrameRate RETURN INTEGER;

Description

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

Parameters

none

Usage

none

Pragmas

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

Exception

none

Example

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;

/




getFrameRate( ) Method

Format


getFrameRate(ctx IN OUT RAW) RETURN INTEGER;

Description

Calls the format plug-in to read the frame rate embedded in the stored video data.

Parameters

ctx

The format plug-in context information.

Usage

The video frame rate information is available from the header of the formatted video data.

If the format found in the object is NULL, then the getFrameRate( ) method uses the default format plug-in to read the video data to determine the frame rate; otherwise, it uses your user-defined format plug-in.

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

Pragmas

none

Exception

If the video plug-in raises an exception when calling this method, then it raises a VIDEO_PLUGIN_EXCEPTION exception.

Example

Call the format plug-in to read the actual frame rate embedded in the stored audio data:


DECLARE

  obj ORDSYS.ORDVideo;

  res INTEGER;

  ctx RAW(4000) :=NULL;

BEGIN

  SELECT vid INTO obj FROM TVID  WHERE N=1 FOR UPDATE;

  res := obj.getFrameRate(ctx);

  DBMS_OUTPUT.put_line(res );

  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('method not supported');

END;

/




setVideoDuration( ) Method

Format


setVideoDuration(knownVideoDuration RETURN INTEGER);

Description

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

Parameters

knownVideoDuration

A known video duration.

Usage

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

none

Exception

If the value for the knownVideoDuration parameter is NULL, then calling this method raises a NULL_INPUT_VALUE exception.

Example

See the example in the setFrameSize( ) Method.


getVideoDuration Method

Format


getVideoDuration RETURN INTEGER;

Description

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

Parameters

none

Usage

none

Pragmas

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

Exception

none

Example

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;

/


getVideoDuration( ) Method

Format


getVideoDuration(ctx IN OUT RAW) RETURN INTEGER;

Description

Calls the format plug-in to read the video duration embedded in the stored video data.

Parameters

ctx

The format plug-in context information.

Usage

The video duration information is available from the header of the formatted video data.

If the format found in the object is NULL, then the getVideoDuration( ) method uses the default format plug-in to read the video data to determine the video duration; otherwise, it uses your user-defined format plug-in.

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

Pragmas

none

Exception

If the video plug-in raises an exception when calling this method, then it raises a VIDEO_PLUGIN_EXCEPTION exception.

Example

Calls the format plug-in to read the actual video duration embedded in the stored video data:


DECLARE

  obj ORDSYS.ORDVideo;

  res INTEGER;

  ctx RAW(4000) :=NULL;

BEGIN

  SELECT vid INTO obj FROM TVID  WHERE N=1 FOR UPDATE;

  res := obj.getVideoDuration(ctx);

  --DBMS_OUTPUT.put_line(res );

  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('method not supported');

END;

/


setNumberOfFrames( ) Method

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

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

none

Exception

If the value for the knownNumberOfFrames parameter is NULL, then calling this method raises a NULL_INPUT_VALUE exception.

Example

See the example in the setFrameSize( ) Method.


getNumberOfFrames Method

Format


getNumberOfFrames RETURN INTEGER;

Description

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

Parameters

none

Usage

none

Pragmas

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

Exception

none

Example

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;

/




getNumberOfFrames( ) Method

Format


getNumberOfFrames(ctx IN OUT RAW) RETURN INTEGER;

Description

Calls the format plug-in to read the number of frames embedded in the stored video data.

Parameters

ctx

The format plug-in context information.

Usage

The total number of frames information is available from the header of the formatted video data.

If the format found in the object is NULL, then the getNumberOfFrames( ) method uses the default format plug-in to read the video data to determine the number of frames; otherwise, it uses your user-defined format plug-in.

Total number of frames information can be extracted from the video data itself. 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 2.3.13 for more information.

Pragmas

none

Exception

If the video plug-in raises an exception when calling this method, then it raises a VIDEO_PLUGIN_EXCEPTION exception.

Example

Call the format plug-in to read the actual number of frames embedded in the stored video data:


DECLARE

  obj ORDSYS.ORDVideo;

  res INTEGER;

  ctx RAW(4000) :=NULL;

BEGIN

  SELECT vid INTO obj FROM TVID  WHERE N=1 FOR UPDATE;

  res := obj.getNumberOfFrames(ctx);

  DBMS_OUTPUT.put_line(res );

  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('method not supported');

END;

/


setCompressionType( ) Method

Format


setCompressionType(knownCompressionType IN VARCHAR2);

Description

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

Parameters

knownCompressionType

A known compression type.

Usage

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

none

Exception

If the value for the knownCompressionType parameter is NULL, then calling this method raises a NULL_INPUT_VALUE exception.

Example

See the example in the setFrameSize( ) Method.


getCompressionType Method

Format


getCompressionType RETURN VARCHAR2;

Description

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

Parameters

none

Usage

none

Pragmas

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

Exception

none

Example

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;

/




getCompressionType( ) Method

Format


getCompressionType(ctx IN OUT RAW) RETURN VARCHAR2;

Description

Calls the format plug-in to read the compression type embedded in the stored video data.

Parameters

ctx

The format plug-in context information.

Usage

The video compression type information is available from the header of the formatted video data.

If the format found in the object is NULL, then the getCompressionType( ) method uses the default format plug-in to read the video data to determine the compression type; otherwise, it uses your user-defined format plug-in.

Video compression type information can be extracted from the audio data itself. 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 2.3.13 for more information.

Pragmas

none

Exception

If the audio plug-in raises an exception when calling this method, then it raises a VIDEO_PLUGIN_EXCEPTION exception.

Example

Call the format plug-in to read the actual compression type embedded in the stored video data:


DECLARE

  obj ORDSYS.ORDVideo;

  res VARCHAR2(4000);

  ctx RAW(4000) :=NULL;

BEGIN

  SELECT vid INTO obj FROM TVID  WHERE N=1 FOR UPDATE;

  res := obj.getCompressionType(ctx);

  DBMS_OUTPUT.put_line(res );

  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('method not supported');

END;

/




setNumberOfColors( ) Method

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

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

none

Exception

If the value for the knownNumberOfColors parameter is NULL, then calling this method raises a NULL_INPUT_VALUE exception.

Example

See the example in the setFrameSize( ) Method.


getNumberOfColors Method

Format


getNumberOfColors RETURN INTEGER;

Description

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

Parameters

none

Usage

none

Pragmas

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

Exception

none

Example

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;

/




getNumberOfColors( ) Method

Format


getNumberOfColors(ctx IN OUT RAW) RETURN INTEGER;

Description

Calls the format plug-in to read the number of colors embedded in the stored video data.

Parameters

ctx

The format plug-in context information.

Usage

The total number of colors information is available from the header of the formatted video data.

If the format found in the object is NULL, then the getNumberOfColors( ) method uses the default format plug-in to read the video data to determine the number of colors; otherwise, it uses your user-defined format plug-in.

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

Pragmas

none

Exception

If the video plug-in raises an exception when calling this method, then it raises a VIDEO_PLUGIN_EXCEPTION exception.

Example

Calls the format plug-in to read the actual number of colors embedded in the stored video data:


DECLARE

  obj ORDSYS.ORDVideo;

  res INTEGER;

  ctx RAW(4000) :=NULL;

BEGIN

  SELECT vid INTO obj FROM TVID  WHERE N=1 FOR UPDATE;

  res := obj.getNumberOfColors(ctx);

  DBMS_OUTPUT.put_line(res );

  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('method not supported');

END;

/




setBitRate( ) Method

Format


setBitRate(knownBitRate IN INTEGER);

Description

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

Parameters

knownBitRate

The bit rate.

Usage

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

none

Exception

If the value for the knownBitRate parameter is NULL, then calling this method raises a NULL_INPUT_VALUE exception.

Example

See the example in the setFrameSize( ) Method.


getBitRate Method

Format


getBitRate RETURN INTEGER;

Description

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

Parameters

none

Usage

none

Pragmas

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

Exception

none

Example

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;

/

 


getBitRate( ) Method

Format


getBitRate(ctx IN OUT RAW) RETURN INTEGER;

Description

Calls the format plug-in to read the bit rate embedded in the stored video data.

Parameters

ctx

The format plug-in context information.

Usage

The video bit rate information is available from the header of the formatted video data.

If the format found in the object is NULL, then the getBitRate( ) method uses the default format plug-in to read the video data to determine the bit rate; otherwise, it uses your user-defined format plug-in.

Video bit rate information can be extracted from the video data itself. 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 2.3.13 for more information.

Pragmas

none

Exception

If the video plug-in raises an exception when calling this method, then it raises a VIDEO_PLUGIN_EXCEPTION exception.

Example

Call the format plug-in to read the actual bit rate embedded in the stored video data:


DECLARE

  obj ORDSYS.ORDVideo;

  res INTEGER;

  ctx RAW(4000) :=NULL;

BEGIN

  SELECT vid INTO obj FROM TVID  WHERE N=1 FOR UPDATE;

  res := obj.getBitRate(ctx);

  DBMS_OUTPUT.put_line(res );

  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('method not supported');

END;

/




setKnownAttributes( ) Method

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

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

none

Exception

none

Example

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


DECLARE

  obj ORDSYS.ORDVideo;

BEGIN

  select vid into obj from TVID where N =1 for update;

  obj.setKnownAttributes('MOOV',1,2,4,5,20,8,'Cinepak', 256, 1500);

  DBMS_OUTPUT.put_line('width: '  || TO_CHAR(obj.width));

  DBMS_OUTPUT.put_line('height: ' || TO_CHAR(obj.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;

/

 


setProperties( ) Method

Format


setProperties(ctx IN OUT RAW);

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.

Parameters

ctx

The format plug-in context information.

Usage

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

Exception

If the video plug-in raises an exception when calling this method, then it raises a VIDEO_PLUGIN_EXCEPTION exception.

Example

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);

  update TVID set vid = obj where N = 1;

  COMMIT;

  EXCEPTION

    WHEN OTHERS THEN

     DBMS_OUTPUT.put_line('exception raised');

END;

/




checkProperties( ) Method

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

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

Pragmas

none

Exception

If the video plug-in raises an exception when calling this method, then it raises a VIDEO_PLUGIN_EXCEPTION exception.

Example

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;

/




getAttribute( ) Method

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

The video data attributes are available from the header of the formatted video 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.

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 2.3.13 for more information.

Pragmas

none

Exception

If the video plug-in raises an exception when calling this method, then it raises a VIDEO_PLUGIN_EXCEPTION exception.

Example

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;

/




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 (','): Format, FrameSize, FrameResolution, FrameRate, VideoDuration, and NumberOfFrames. 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

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

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

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 2.3.13 for more information.

Pragmas

none

Exception

If the video plug-in raises an exception when calling this method, then it raises either a METHOD_NOT_SUPPORTED exception or a VIDEO_PLUGIN_EXCEPTION exception.

Example

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; /

5.2.9 ORDVideo Methods Associated with Processing Video Data

This section presents reference information on the ORDVideo methods associated with processing video data.


processVideoCommand( ) Method

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

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 2.3.13 for more information.

Pragmas

none

Exception

If the video plug-in raises an exception when calling this method, then it raises either a METHOD_NOT_SUPPORTED exception or a VIDEO_PLUGIN_EXCEPTION exception.

Example

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;

/



5.3 Packages or PL/SQL Plug-ins

This section presents reference information on the packages or PL/SQL plug-ins provided.

5.3.1 Video Format Packages

Use each of the following packages as a video format template in developing your own video format package. Note that these packages are just templates and that you must implement each of these packages yourself to support the methods described within each package.

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


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);

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 5-1 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 5-1 Methods Supported in the ORDPLUGINS.ORDX_DEFAULT_VIDEO Package
Name of Method  Level of Support 

getFormat  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getAttribute  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getFrameSize  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getFrameResolution  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getFrameRate  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getVideoDuration  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getNumberOfFrames  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getCompressionType  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getNumberOfColors  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getBitRate  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

setProperties  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

checkProperties  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getAllAttributes  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

processCommand  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

5.3.3 ORDPLUGINS.ORDX_AVI_VIDEO Package

The ORDPLUGINS.ORDX_AVI_VIDEO package is provided and is used for the AVI video format specification.


CREATE OR REPLACE PACKAGE ORDX_AVI_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);

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 5-2 shows the methods supported in the ORDPLUGINS.ORDX_AVI_VIDEO package and the exceptions raised if you call a method that is not supported.

Table 5-2 Methods Supported in the ORDPLUGINS.ORDX_AVI_VIDEO Package
Name of Method  Level of Support 

getFormat  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getAttribute  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getFrameSize  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getFrameResolution  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getFrameRate  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getVideoDuration  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getNumberOfFrames  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getCompressionType  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getNumberOfColors  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getBitRate  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

setProperties  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

checkProperties  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getAllAttributes  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

processCommand  

Not supported - raises exceptions METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

5.3.4 ORDPLUGINS.ORDX_MOOV_VIDEO Package

The ORDPLUGINS.ORDX_MOOV_VIDEO package is provided and is used for the MOOV video format specification.


CREATE OR REPLACE PACKAGE ORDX_MOOV_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);

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 5-3 shows the methods supported in the
ORDPLUGINS.ORDX_MOOV_VIDEO package and the exceptions raised if you call a method that is not supported.

Table 5-3 Methods Supported in the ORDPLUGINS.ORDX_MOOV_VIDEO Package
Name of Method  Level of Support 

getFormat  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getAttribute  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getFrameSize  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getFrameResolution  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getFrameRate  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getVideoDuration  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getNumberOfFrames  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getCompressionType  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getNumberOfColors  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getBitRate  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

setProperties  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

checkProperties  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getAllAttributes  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

processCommand  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

5.3.5 ORDPLUGINS.ORDX_MPEG_VIDEO Package

The ORDPLUGINS.ORDX_MPEG_VIDEO package is provided and is used for the MPEG video format specification.


CREATE OR REPLACE PACKAGE ORDX_MPEG_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);

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 5-4 shows the methods supported in the
ORDPLUGINS.ORDX_MPEG_VIDEO package and the exceptions raised if you call a method that is not supported.

Table 5-4 Methods Supported in the ORDPLUGINS.ORDX_MPEG_VIDEO Package
Name of Method  Level of Support 

getFormat  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getAttribute  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getFrameSize  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getFrameResolution  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getFrameRate  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getVideoDuration  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getNumberOfFrames  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getCompressionType  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getNumberOfColors  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getBitRate  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

setProperties  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

checkProperties  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

getAllAttributes  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

processCommand  

Not supported - raises exceptions: METHOD_NOT_SUPPORTED and VIDEO_PLUGIN_EXCEPTION  

5.3.6 Extending interMedia to Support a New Video Data Format

Extending interMedia to support a new video data format consists of three 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 2.3.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 5-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 E.3 for more information on installing your own video format plug-in and running the sample scripts provided.

Example 5-1 Package Body Listing 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)

  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;




Prev

Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index