Skip Headers
Oracle® Multimedia Reference
11g Release 2 (11.2)

Part Number E10776-03
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

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

6 Oracle Multimedia ORDVideo Object Type

Oracle Multimedia provides the ORDVideo object type, which supports the storage and management of video data.

The ORDVideo object type is defined in the ordvspec.sql file. After installation, this file is available in the Oracle home directory at:

<ORACLE_HOME>/ord/im/admin (on Linux and UNIX)

<ORACLE_HOME>\ord\im\admin (on Windows)

This chapter contains these sections:

6.1 ORDVideo Object Examples

The examples in this chapter use the ONLINE_MEDIA table in the Product Media (PM) sample schema. To replicate the examples on your computer, begin with the examples shown in the reference pages for the ORDVideo constructors and the import( ) and importFrom( ) methods. Then, substitute your video files for those in the examples.

The example for the constructor ORDVideo for BLOBs uses the test video table TVID (see TVID Table Definition).

Note:

If you manipulate the video data itself (by either directly modifying the BLOB or changing the external source), 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.

See Also:

Oracle Database Sample Schemas for more information about the PM schema

6.1.1 Directory Definition for ORDVideo Object Examples

Issue the following statements before executing the examples, where c:\mydir\work is the directory where the user ron can find the video data:

CONNECT sys as sysdba
CREATE OR REPLACE DIRECTORY FILE_DIR as 'c:\mydir\work';
GRANT READ ON DIRECTORY FILE_DIR TO 'ron';

6.2 Important Notes for ORDVideo Methods

Methods invoked at the ORDSource level that are handed off to the source plug-in for processing have ctx (RAW) 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 must invoke the closeSource( ) method.

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

Methods invoked at the ORDVideo level that are handed off to the format plug-in for processing have ctx (RAW) 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, none of the plug-ins provided by Oracle and not all source or format plug-ins use the ctx argument, but if you code as previously described, your application should work with current or future source or format plug-ins.

Use any of the individual set methods to set the attribute value for an object for formats not natively supported; otherwise, for formats natively supported, use the setProperties( ) method to populate the attributes of the object or write a format plug-in.


ORDVideo Object Type

The ORDVideo object type supports the storage and management of video data. The attributes for this object type are defined as follows in the ordvspec.sql file:

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

where:


ORDVideo Constructors

This section describes these Oracle Multimedia constructor functions:


ORDVideo for BLOBs

Format

ORDVideo(SELF IN OUT NOCOPY ORDSYS.ORDVideo, data IN BLOB, setproperties IN INTEGER DEFAULT 0) RETURN SELF AS RESULT

Description

Constructs an ORDVideo object from a BLOB. The data stored in the BLOB is copied into the ORDVideo object when the constructed ORDVideo object is inserted or updated into a table.

Parameters

data

Video content stored in a BLOB.

setproperties

Indicator flag that determines whether the setProperties( ) method is called in the constructor. If the value is 1, the setProperties( ) method is called. If the value is 0, the method is not called. The default is 0.

Pragmas

None.

Exceptions

None.

Usage Notes

Use this constructor to create an ORDVideo object when the audio content is stored in either a temporary or a persistent BLOB.

Examples

Create an ORDVideo object from a BLOB object and insert it into the table.

Note:

The user who runs this statement must have the SELECT privilege on the table tvid created by the user mediauser.

See Section 7.2.5 for a definition of the test video table TVID.

INSERT INTO pm.online_media (product_id, product_video)
  SELECT 2004, ORDSYS.ORDVideo(t.vid) FROM mediauser.tvid t WHERE t.n = 1;

ORDVideo for Other Sources

Format

ORDVideo( SELF IN OUT NOCOPY ORDSYS.ORDVideo, source_type IN VARCHAR2 DEFAULT 'LOCAL', source_location IN VARCHAR2 DEFAULT NULL, source_name IN VARCHAR2 DEFAULT NULL, setproperties IN INTEGER DEFAULT 0 ) RETURN SELF AS RESULT

Description

Constructs an ORDVideo object from a specific source. By default, an empty object with a local source is constructed.

Parameters

source_type

The type of the source video data. Valid values are: FILE, HTTP, LOCAL, or user-defined. The default is LOCAL.

The parameter value LOCAL indicates that the data is stored in Oracle Database. The parameter value LOCAL is never stored in the srcType attribute. Rather, this parameter value indicates that the data is stored in Oracle Database in the localData attribute. (See Section 2.2 for a description of the ORDSource object.)

source_location

The location from which the source video data is to be imported. (See Table 2-2.)

source_name

The name of the source video data. (See Table 2-3.)

setproperties

Indicator flag that determines whether the setProperties( ) method is called in the constructor. If the value is 1, the setProperties( ) method is called. If the value is 0, the method is not called. The default is 0.

Pragmas

None.

Exceptions

None.

Usage Notes

Use this constructor to create an ORDVideo object when the video content is not stored in a BLOB, as in any of these situations:


The content is in a local file.
The content is referenced by a URL.
The content is not available when the ORDVideo object is created.

Examples

Create an ORDVideo object from a specified source:

-- Construct an ORDVideo object from an external file and insert it into the table.
INSERT INTO pm.online_media (product_id, product_video)
  VALUES (2030, ORDSYS.ORDVideo('FILE', 'FILE_DIR', 'speakers.rm'));
 
-- Initialize an ORDVideo object in the table.
INSERT INTO pm.online_media (product_id, product_video)
  VALUES(2004, ORDSYS.ORDVideo());

ORDVideo Methods

This section presents reference information about the Oracle Multimedia methods used specifically for video data manipulation.

Chapter 2 presents reference information about the Oracle Multimedia methods that are common to ORDAudio, ORDDoc, ORDImage, and ORDVideo. Use the methods presented in both chapters to get and set attributes, and to perform metadata extractions.

This section describes these methods:

See Also:

Oracle Database Concepts for more information about object types and methods


checkProperties( )

Format

checkProperties(ctx IN OUT RAW) RETURN BOOLEAN;

Description

Checks all the properties of the stored video data, including these video attributes: format, width, height, 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. (See Section 6.2.)

Usage Notes

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

Pragmas

None.

Exceptions

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION

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

See Appendix G for more information about these exceptions.

Examples

Check property information for known video attributes:

DECLARE
 obj ORDSYS.ORDVideo;
 ctx RAW(64) :=NULL;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p 
   WHERE p.product_id  = 2030;
 IF(obj.checkProperties(ctx)) THEN
  DBMS_OUTPUT.PUT_LINE('check Properties returned true');
 ELSE
  DBMS_OUTPUT.PUT_LINE('check Properties returned false');
 END IF;
 COMMIT;
 EXCEPTION
  WHEN ORDSYS.ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION THEN
   DBMS_OUTPUT.PUT_LINE('ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION caught');
  WHEN OTHERS THEN
   DBMS_OUTPUT.PUT_LINE('EXCEPTION caught');
END;
/

getAllAttributes( )

Format

getAllAttributes(ctx IN OUT RAW,

attributes IN OUT NOCOPY CLOB);

Description

Returns a formatted string for convenient client access. For natively supported formats, the string includes this list of audio data attributes separated by a comma (,): width, height, format, frameResolution, frameRate, videoDuration, numberOfFrames, compressionType, numberOfColors, and bitRate. For user-defined formats, the string is defined by the format plug-in.

Parameters

ctx

The format plug-in context information. (See Section 6.2.)

attributes

The attributes.

Usage Notes

Generally, these video data attributes are available from the header of the formatted video data.

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

See Also:

Oracle Multimedia User's Guide for more information about extending support for media formats

Pragmas

None.

Exceptions

ORDVideoExceptions.METHOD_NOT_SUPPORTED

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

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

See Appendix G for more information about these exceptions.

Examples

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

DECLARE
 obj ORDSYS.ORDVideo;
 tempLob   CLOB;
 ctx RAW(64) :=NULL;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p 
  WHERE p.product_id  = 2030;
 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));
 COMMIT;
 EXCEPTION
  WHEN ORDSYS.ORDVideoExceptions.METHOD_NOT_SUPPORTED THEN
   DBMS_OUTPUT.PUT_LINE('VIDEO METHOD_NOT_SUPPORTED EXCEPTION caught');
  WHEN OTHERS THEN
   DBMS_OUTPUT.PUT_LINE('EXCEPTION CAUGHT');
END;
/

getAttribute( )

Format

getAttribute(ctx IN OUT RAW,

name IN VARCHAR2)

RETURN VARCHAR2;

Description

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

Note:

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

Parameters

ctx

The format plug-in context information. (See Section 6.2.)

name

The name of the attribute.

Usage Notes

None.

Pragmas

None.

Exceptions

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION

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

See Appendix G for more information about these exceptions.

Examples

Return information for the specified video attribute for video data stored in the database. (Because this example uses a supported data format, rather than a user-written plug-in, an exception is raised.)

DECLARE
 obj ORDSYS.ORDVideo;
 res VARCHAR2(4000);
 ctx RAW(64) :=NULL;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p 
  WHERE p.product_id  = 2030;
 DBMS_OUTPUT.PUT_LINE('getting video duration');
 DBMS_OUTPUT.PUT_LINE('---------------------');
 res := obj.getAttribute(ctx,'video_duration');
 COMMIT;
 EXCEPTION
  WHEN ORDSYS.ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION THEN
   DBMS_OUTPUT.PUT_LINE('VIDEO PLUGIN EXCEPTION caught');
  WHEN OTHERS THEN
   DBMS_OUTPUT.PUT_LINE('EXCEPTION caught');
END;
/

getBitRate( )

Format

getBitRate( ) RETURN INTEGER;

Description

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

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

None.

Examples

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

DECLARE
 obj ORDSYS.ORDVideo;
 res INTEGER;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p 
  WHERE p.product_id  = 2030;
 res := obj.getBitRate();
 DBMS_OUTPUT.PUT_LINE('bit rate : ' || res );
 COMMIT;
END;
/

getCompressionType( )

Format

getCompressionType( ) RETURN VARCHAR2;

Description

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

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

None.

Examples

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

DECLARE
 obj ORDSYS.ORDVideo;
 res VARCHAR2(4000);
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p 
  WHERE p.product_id  = 2030;
 res := obj.getCompressionType();
 DBMS_OUTPUT.PUT_LINE('compression type: ' ||res);
 COMMIT;
END;
/

getContentInLob( )

Format

getContentInLob(ctx IN OUT RAW,

dest_lob IN OUT NOCOPY BLOB,

mimeType OUT VARCHAR2,

format OUT VARCHAR2);

Description

Copies data from a data source into the specified BLOB. The BLOB must not be the BLOB in the source.localData attribute (of the embedded ORDSource object).

Parameters

ctx

The source plug-in context information. (See Section 6.2.)

dest_lob

The LOB in which to receive data.

mimeType

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

format

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

Usage Notes

None.

Pragmas

None.

Exceptions

ORDSourceExceptions.METHOD_NOT_SUPPORTED

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

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

See Appendix G for more information about these exceptions.

Examples

Get data from a data source into the specified BLOB on the local source:

DECLARE
 obj ORDSYS.ORDVideo;
 tempBLob BLOB;
 mimeType VARCHAR2(4000);
 format VARCHAR2(31);
 ctx RAW(64) :=NULL;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p 
  WHERE p.product_id  = 2030;
 IF (obj.isLocal) THEN
  DBMS_OUTPUT.PUT_LINE('local is true');
 END IF;
 DBMS_LOB.CREATETEMPORARY(tempBLob, true, 10);
 obj.getContentInLob(ctx,tempBLob, mimeType,format);
 DBMS_OUTPUT.PUT_LINE('Length is ' ||TO_CHAR(DBMS_LOB.getLength(tempBLob)));
 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;
/

getContentLength( )

Format

getContentLength(ctx IN OUT RAW) RETURN INTEGER;

Description

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

Parameters

ctx

The source plug-in context information. (See Section 6.2.)

Usage Notes

None.

Pragmas

None.

Exceptions

ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION

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

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

See Appendix G for more information about these exceptions.

Examples

See the example in import( ).


getDescription( )

Format

getDescription( ) RETURN VARCHAR2;

Description

Returns the description of the video data.

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

ORDVideoExceptions.DESCRIPTION_IS_NOT_SET

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

See Appendix G for more information about this exception.

Examples

See the example in setDescription( ).


getFormat( )

Format

getFormat( ) RETURN VARCHAR2;

Description

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

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

ORDVideoExceptions.VIDEO_FORMAT_IS_NULL

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

See Appendix G for more information about this exception.

Examples

Get the format for some stored video data:

DECLARE
 obj ORDSYS.ORDVideo;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p 
  WHERE p.product_id  = 2030;
 DBMS_OUTPUT.PUT_LINE('writing format');
 DBMS_OUTPUT.PUT_LINE('--------------');
 DBMS_OUTPUT.PUT_LINE(obj.getFormat());
 COMMIT;
END;
/

getFrameRate( )

Format

getFrameRate( ) RETURN INTEGER;

Description

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

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

None.

Examples

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

DECLARE
 obj ORDSYS.ORDVideo;
 res INTEGER;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p 
  WHERE p.product_id  = 2030;
 res := obj.getFrameRate();
 DBMS_OUTPUT.PUT_LINE('frame rate : ' ||res);
 COMMIT;
END;
/

getFrameResolution( )

Format

getFrameResolution( ) RETURN INTEGER;

Description

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

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

None.

Examples

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

DECLARE
 obj ORDSYS.ORDVideo;
 res INTEGER;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p 
  WHERE p.product_id  = 2030;
 res := obj.getFrameResolution();
 DBMS_OUTPUT.PUT_LINE('resolution : ' ||res);
 COMMIT;
END;
/

getFrameSize( )

Format

getFrameSize(retWidth OUT INTEGER,

retHeight OUT INTEGER);

Description

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

Parameters

retWidth

The frame width in pixels.

retHeight

The frame height in pixels.

Usage Notes

None.

Pragmas

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

Exceptions

None.

Examples

Return the frame size (width and height) for video data:

DECLARE
 obj ORDSYS.ORDVideo;
 width INTEGER;
 height INTEGER;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p 
  WHERE p.product_id  = 2030;
 obj.getFrameSize(width, height);
 DBMS_OUTPUT.PUT_LINE('width :' || width);
 DBMS_OUTPUT.PUT_LINE('height :' || height);
 COMMIT;
END;
/

getNumberOfColors( )

Format

getNumberOfColors( ) RETURN INTEGER;

Description

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

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

None.

Examples

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

DECLARE
 obj ORDSYS.ORDVideo;
 res INTEGER;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p 
  WHERE p.product_id  = 2030;
 res := obj.getNumberOfColors();
 DBMS_OUTPUT.PUT_LINE('number of colors: ' ||res);
 COMMIT;
END;
/

getNumberOfFrames( )

Format

getNumberOfFrames( ) RETURN INTEGER;

Description

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

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

None.

Examples

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

DECLARE
 obj ORDSYS.ORDVideo;
 res INTEGER;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p 
  WHERE p.product_id  = 2030;
 res := obj.getNumberOfFrames();
 DBMS_OUTPUT.PUT_LINE('number of frames : ' ||res);
 COMMIT;
END;
/

getVideoDuration( )

Format

getVideoDuration( ) RETURN INTEGER;

Description

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

Parameters

None.

Usage Notes

None.

Pragmas

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

Exceptions

None.

Examples

Return the total time to play the video data:

DECLARE
 obj ORDSYS.ORDVideo;
 res INTEGER;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p 
  WHERE p.product_id  = 2030;
 res := obj.getVideoDuration();
 DBMS_OUTPUT.PUT_LINE('video duration : ' ||res);
 COMMIT;
END;
/

import( )

Format

import(ctx IN OUT RAW);

Description

Transfers video data from an external video data source to the source.localData attribute (of the embedded ORDSource object) within the database.

Parameters

ctx

The source plug-in context information. This parameter must be allocated and initialized to NULL. If you are using a user-defined source plug-in, call the openSource( ) method. (See Section 6.2.)

Usage Notes

Use the setSource( ) method to set the source.srcType, source.srcLocation, and source.srcName attributes (of the embedded ORDSource object) for the external source before calling the import( ) method.

After importing data from an external video data source to a local source (within 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.

If the value of the source.srcType attribute is FILE, the source.srcLocation attribute contains the name of a database directory object that contains the file to be imported, and the source.srcName attribute contains the name of the file to be imported. You must ensure that the directory for the external source location exists or is created before you use this method.

The import( ) method reads only from a database directory object that the user has privilege to access. That is, you can access a directory object that you have created using the SQL statement CREATE DIRECTORY, or one to which you have been granted READ access.

For example, the following SQL*Plus commands create a directory object and grant the user ron permission to read any file within the directory c:\mydir\work:

CONNECT sys as sysdba
Enter password: password
CREATE OR REPLACE DIRECTORY FILE_DIR AS 'c:\mydir\work';
GRANT READ ON DIRECTORY FILE_DIR TO ron;

See Section 6.1 for more information about directory and table definitions.

If the value of the source.srcType attribute is HTTP, the source.srcLocation attribute contains the base URL needed to find the directory that contains the object to be imported, and the source.srcName attribute contains the name of the object to be imported.

This method uses the PL/SQL UTL_HTTP package to import media data from an HTTP data source. You can use environment variables to specify the proxy behavior of the UTL_HTTP package. For example, on Linux and UNIX, setting the environment variable http_proxy to a URL specifies that the UTL_HTTP package must use that URL as the proxy server for HTTP requests. Setting the no_proxy environment variable to a domain name specifies that the HTTP proxy server not be used for URLs in the specified domain.

See Also:

Oracle Database PL/SQL Packages and Types Reference for more information about the UTL_HTTP package

If the value of the source.srcType attribute is a user-defined name, the source.srcLocation attribute contains an identifier string required to access the user-defined object to be imported, and the source.srcName attribute contains the name of the object to be imported.

Pragmas

None.

Exceptions

ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION

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

ORDSourceExceptions.METHOD_NOT_SUPPORTED

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

ORDSourceExceptions.NULL_SOURCE

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

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

See Appendix G for more information about these exceptions.

Examples

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

DECLARE
 obj ORDSYS.ORDVideo;
 ctx RAW(64) :=NULL;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p
  WHERE p.product_id = 2030 FOR UPDATE;
 DBMS_OUTPUT.PUT_LINE('setting and getting source');
 DBMS_OUTPUT.PUT_LINE('--------------------------');
 -- Set source to a file:
 obj.setSource('file','FILE_DIR','speakers.rm');
 -- Get source information:
 DBMS_OUTPUT.PUT_LINE(obj.getSource());
 -- Import data:
 obj.import(ctx);
 -- Check size:
 DBMS_OUTPUT.PUT_LINE('Length is ' || TO_CHAR(obj.getContentLength(ctx)));
 UPDATE pm.online_media p SET p.product_video = obj WHERE p.product_id = 2030;
 COMMIT;
END;
/

importFrom( )

Format

importFrom(ctx IN OUT RAW,

source_type IN VARCHAR2,

source_location IN VARCHAR2,

source_name IN VARCHAR2);

Description

Transfers video data from the specified external video data source to the source.localData attribute (of the embedded ORDSource object) within the database.

Parameters

ctx

The source plug-in context information. This parameter must be allocated and initialized to NULL. If you are using a user-defined source plug-in, call the openSource( ) method. (See Section 6.2.)

source_type

The type of the source video data. (See Table 2-1.)

source_location

The location from which the source video data is to be imported. (See Table 2-2.)

source_name

The name of the source video data. (See Table 2-3.)

Usage Notes

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

After importing data from an external video data source to a local source (within 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.

If the value of the source_type parameter is FILE, the source_location parameter contains the name of a database directory object that contains the file to be imported, and the source_name parameter contains the name of the file to be imported. You must ensure that the directory indicated by the source_location parameter exists or is created before you use this method.

The importFrom( ) method reads only from a database directory object that the user has privilege to access. That is, you can access a directory object that you have created using the SQL statement CREATE DIRECTORY, or one to which you have been granted READ access.

For example, the following SQL*Plus commands create a directory object and grant the user ron permission to read any file within the directory c:\mydir\work:

CONNECT sys as sysdba
Enter password: password
CREATE OR REPLACE DIRECTORY FILE_DIR AS 'c:\mydir\work';
GRANT READ ON DIRECTORY FILE_DIR TO ron;

See Section 6.1 for more information about directory and table definitions.

If the value of the source_type parameter is HTTP, the source_location parameter contains the base URL needed to find the directory that contains the object to be imported, and the source_name parameter contains the name of the object to be imported.

This method uses the PL/SQL UTL_HTTP package to import media data from an HTTP data source. You can use environment variables to specify the proxy behavior of the UTL_HTTP package. For example, on Linux and UNIX, setting the environment variable http_proxy to a URL specifies that the UTL_HTTP package must use that URL as the proxy server for HTTP requests. Setting the no_proxy environment variable to a domain name specifies that the HTTP proxy server not be used for URLs in the specified domain.

See Also:

Oracle Database PL/SQL Packages and Types Reference for more information about the UTL_HTTP package

If the value of the source_type parameter is a user-defined name, the source_location parameter contains an identifier string required to access the user-defined object to be imported, and the source_name parameter contains the name of the object to be imported.

Pragmas

None.

Exceptions

ORDSourceExceptions.METHOD_NOT_SUPPORTED

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

ORDSourceExceptions.NULL_SOURCE exception

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

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

See Appendix G for more information about these exceptions.

Examples

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

DECLARE
  obj ORDSYS.ORDVideo;
  ctx RAW(64) :=NULL;
BEGIN
  SELECT p.product_video INTO obj FROM pm.online_media p
     WHERE p.product_id = 2004 FOR UPDATE;
  DBMS_OUTPUT.PUT_LINE('setting and getting source');
  DBMS_OUTPUT.PUT_LINE('--------------------------');
  -- Import data:
  obj.importFrom(ctx,'file','FILE_DIR','speakers.rm');
  -- Check size:
  DBMS_OUTPUT.PUT_LINE('Length is ' ||TO_CHAR(obj.getContentLength(ctx)));
  UPDATE pm.online_media p SET p.product_video = obj WHERE p.product_id = 2004;
  COMMIT;
  EXCEPTION
        WHEN ORDSYS.ORDSourceExceptions.METHOD_NOT_SUPPORTED THEN
         DBMS_OUTPUT.put_line('Source METHOD_NOT_SUPPORTED caught');
        WHEN ORDSYS.ORDVideoExceptions.METHOD_NOT_SUPPORTED THEN
         DBMS_OUTPUT.put_line('VIDEO METHOD_NOT_SUPPORTED EXCEPTION caught');
        WHEN ORDSYS.ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION THEN
         DBMS_OUTPUT.put_line('VIDEO PLUGIN EXCEPTION caught');
        WHEN OTHERS THEN
         DBMS_OUTPUT.PUT_LINE('EXCEPTION Caught');
END;
/

processVideoCommand( )

Format

processVideoCommand(ctx IN OUT RAW,

cmd IN VARCHAR2,

arguments IN VARCHAR2,

result OUT RAW)

RETURN RAW;

Description

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

Note:

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

Parameters

ctx

The format plug-in context information. (See Section 6.2.)

cmd

Any command recognized by the format plug-in.

arguments

The arguments of the command.

result

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

Usage Notes

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

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

You can extend support to a format that is not understood by the ORDVideo object by preparing an ORDPLUGINS.ORDX_<format>_VIDEO package that supports that format.

See Also:

Oracle Multimedia User's Guide for more information about extending support for media formats

Pragmas

None.

Exceptions

ORDVideoExceptions.METHOD_NOT_SUPPORTED

This exception is raised when the video plug-in does not support the method or the plug-in is not found.

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION

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

See Appendix G for more information about these exceptions.

Examples

None.


setBitRate( )

Format

setBitRate(knownBitRate IN INTEGER);

Description

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

Parameters

knownBitRate

The bit rate.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

ORDVideoExceptions.NULL_INPUT_VALUE

This exception is raised if you call the setBitRate( ) method and the value of the knownBitRate parameter is NULL.

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

See Appendix G for more information about these exceptions.

Examples

See the example in setFrameSize( ).


setCompressionType( )

Format

setCompressionType(knownCompressionType IN VARCHAR2);

Description

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

Parameters

knownCompressionType

A known compression type.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

ORDVideoExceptions.NULL_INPUT_VALUE

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

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

See Appendix G for more information about these exceptions.

Examples

See the example in setFrameSize( ).


setDescription( )

Format

setDescription (user_description IN VARCHAR2);

Description

Sets the description of the video data.

Parameters

user_description

The description of the video data.

Usage Notes

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

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

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

See Appendix G for more information about this exception.

Examples

Set the description attribute for some video data:

DECLARE
 obj ORDSYS.ORDVideo;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p
  WHERE p.product_id = 2030 FOR UPDATE;
 DBMS_OUTPUT.PUT_LINE('writing description');
 DBMS_OUTPUT.PUT_LINE('-------------');
 obj.setDescription('This is a video of a speaker');
 DBMS_OUTPUT.PUT_LINE(obj.getDescription());
 UPDATE pm.online_media p SET p.product_video = obj WHERE p.product_id = 2688;
 COMMIT;
END;
/

setFormat( )

Format

setFormat(knownFormat IN VARCHAR2);

Description

Sets the format attribute of the video object.

Parameters

knownFormat

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

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

ORDVideoExceptions.NULL_INPUT_VALUE

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

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

See Appendix G for more information about these exceptions.

Examples

Set the format for some stored video data:

DECLARE
 obj ORDSYS.ORDVideo;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p
  WHERE p.product_id = 2030 FOR UPDATE;
 DBMS_OUTPUT.PUT_LINE('current format');
 DBMS_OUTPUT.PUT_LINE('--------------');
 DBMS_OUTPUT.PUT_LINE(obj.getFormat());
 obj.setFormat('rm');
 DBMS_OUTPUT.PUT_LINE('new format');
 DBMS_OUTPUT.PUT_LINE('--------------');
 DBMS_OUTPUT.PUT_LINE(obj.getFormat());
  UPDATE pm.online_media p SET p.product_video = obj 
    WHERE p.product_id = 2030;
 COMMIT;
 EXCEPTION
  WHEN ORDSYS.ORDVideoExceptions.NULL_INPUT_VALUE THEN
   DBMS_OUTPUT.PUT_LINE('ORDVideoExceptions.NULL_INPUT_VALUE caught');
  WHEN OTHERS THEN
   DBMS_OUTPUT.PUT_LINE('EXCEPTION caught');
 END;
 /

setFrameRate( )

Format

setFrameRate(knownFrameRate IN INTEGER);

Description

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

Parameters

knownFrameRate

The frame rate.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

ORDVideoExceptions.NULL_INPUT_VALUE

This exception is raised if you call the setFrameRate( ) method and the value of the knownFrameRate parameter is NULL.

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

See Appendix G for more information about these exceptions.

Examples

See the example in setFrameSize( ).


setFrameResolution( )

Format

setFrameResolution(knownFrameResolution IN INTEGER);

Description

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

Parameters

knownFrameResolution

The known frame resolution in pixels per inch.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

ORDVideoExceptions.NULL_INPUT_VALUE

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

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

See Appendix G for more information about these exceptions.

Examples

See the example in setFrameSize( ).


setFrameSize( )

Format

setFrameSize(knownWidth IN INTEGER,

knownHeight IN INTEGER);

Description

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

Parameters

knownWidth

The frame width in pixels.

knownHeight

The frame height in pixels.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

ORDVideoExceptions.NULL_INPUT_VALUE

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

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

See Appendix G for more information about these exceptions.

Examples

Set the frame size (width and height) for video data:

DECLARE
 obj ORDSYS.ORDVideo;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p
   WHERE p.product_id = 2030 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 pm.online_media p SET p.product_video = obj WHERE p.product_id = 2030;
 COMMIT;
END;
/

setKnownAttributes( )

Format

setKnownAttributes(knownFormat IN VARCHAR2,

knownWidth IN INTEGER,

knownHeight IN INTEGER,

knownFrameResolution IN INTEGER,

knownFrameRate IN INTEGER,

knownVideoDuration IN INTEGER,

knownNumberOfFrames IN INTEGER,

knownCompressionType IN VARCHAR2,

knownNumberOfColors IN INTEGER,

knownBitRate IN INTEGER);

Description

Sets the known video attributes for the video data.

Parameters

knownFormat

The known format.

knownWidth

The known width.

knownHeight

The known height.

knownFrameResolution

The known frame resolution.

knownFrameRate

The known frame rate.

knownVideoDuration

The known video duration.

knownNumberOfFrames

The known number of frames.

knownCompressionType

The known compression type.

knownNumberOfColors

The known number of colors.

knownBitRate

The known bit rate.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

See Appendix G for more information about this exception.

Examples

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

DECLARE
 obj ORDSYS.ORDVideo;
 width integer;
 height integer;
BEGIN
 SELECT p.product_video INTO obj FROM pm.online_media p
  WHERE p.product_id = 2030 FOR UPDATE;
 obj.setKnownAttributes('MOOV',1,2,4,5,20,8,'Cinepak', 256, 1500);
 obj.getFrameSize(width, height);
 DBMS_OUTPUT.PUT_LINE('width: '  || TO_CHAR(width));
 DBMS_OUTPUT.PUT_LINE('height: ' || TO_CHAR(height));
 DBMS_OUTPUT.PUT_LINE('format: ' || obj.getFormat());
 DBMS_OUTPUT.PUT_LINE('frame resolution: ' || TO_CHAR(obj.getFrameResolution()));
 DBMS_OUTPUT.PUT_LINE('frame rate: ' || TO_CHAR(obj.getFrameRate()));
 DBMS_OUTPUT.PUT_LINE('video duration: ' || TO_CHAR(obj.getVideoDuration()));
 DBMS_OUTPUT.PUT_LINE('number of frames: ' || TO_CHAR(obj.getNumberOfFrames()));
 DBMS_OUTPUT.PUT_LINE('compression type: ' || obj.getCompressionType());
 DBMS_OUTPUT.PUT_LINE('bit rate: ' || TO_CHAR(obj.getBitRate()));
 DBMS_OUTPUT.PUT_LINE('number of colors: ' || TO_CHAR(obj.getNumberOfColors()));
 UPDATE pm.online_media p SET p.product_video = obj 
   WHERE p.product_id = 2030;
 COMMIT;
END;
/

setNumberOfColors( )

Format

setNumberOfColors(knownNumberOfColors IN INTEGER);

Description

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

Parameters

knownNumberOfColors

A known number of colors.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

ORDVideoExceptions.NULL_INPUT_VALUE

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

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

See Appendix G for more information about these exceptions.

Examples

See the example in setFrameSize( ).


setNumberOfFrames( )

Format

setNumberOfFrames(knownNumberOfFrames IN INTEGER);

Description

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

Parameters

knownNumberOfFrames

A known number of frames.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

ORDVideoExceptions.NULL_INPUT_VALUE

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

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

See Appendix G for more information about these exceptions.

Examples

See the example in setFrameSize( ).


setProperties( )

Format

setProperties(ctx IN OUT RAW,

setComments IN BOOLEAN);

Description

Reads the video data to get the values of the object attributes and then stores them in the object. This method sets the properties for each of these attributes of the video data for which values are available: format, height, width, frame resolution, frame rate, video duration, number of frames, compression type, number of colors, and bit rate. This method populates the comments field of the object with a rich set of format and application properties in XML form if the value of the setComments parameter is TRUE.

Parameters

ctx

The format plug-in context information. (See Section 6.2.)

setComments

A Boolean value that indicates whether the comments field of the object is populated. If the value is TRUE, then the comments field of the object is populated with a rich set of format and application properties of the video object in XML form; otherwise, if the value is FALSE, the comments field of the object remains unpopulated. The default value is FALSE.

Usage Notes

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

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

Pragmas

None.

Exceptions

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION

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

See Appendix G for more information about these exceptions.

Examples

Set the property information for known video attributes:

DECLARE
  obj ORDSYS.ORDVideo;
  ctx RAW(64) :=NULL;
BEGIN
  SELECT p.product_video INTO obj FROM pm.online_media p 
    WHERE p.product_id  = 2030 FOR UPDATE;
  obj.setProperties(ctx,FALSE);
  UPDATE pm.online_media p SET p.product_video = obj 
    WHERE p.product_id = 2030;
  COMMIT;
  EXCEPTION
   WHEN ORDSYS.ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION THEN
    DBMS_OUTPUT.PUT_LINE('ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION caught');
   WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('exception raised');
END;
/

setVideoDuration( )

Format

setVideoDuration(knownVideoDuration IN INTEGER);

Description

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

Parameters

knownVideoDuration

A known video duration.

Usage Notes

Calling this method implicitly calls the setUpdateTime( ) method.

Pragmas

None.

Exceptions

ORDVideoExceptions.NULL_INPUT_VALUE

This exception is raised if you call the setVideoDuration( ) method and the value of the knownVideoDuration parameter is NULL.

ORDVideoExceptions.NULL_SOURCE

This exception is raised when the value of the ORDVideo.source attribute is NULL.

See Appendix G for more information about these exceptions.

Examples

See the example in setFrameSize( ).