Oracle Multimedia provides a relational interface that consists of a set of static methods for each of these Oracle Multimedia objects:
ORDAudio
ORDDoc
ORDImage
ORDVideo
Because these are static methods, no objects are instantiated. So, data is passed by method arguments rather than by object attributes.
The static methods for these four Oracle Multimedia objects are defined in the ordaspec.sql
, orddspec.sql
, ordispec.sql
, and ordvspec.sql
files, respectively. After installation, these files are 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 includes these sections:
Static Methods Unique to the ORDAudio Object Type Relational Interface
Static Methods Unique to the ORDDoc Object Type Relational Interface
Static Methods Unique to the ORDImage Object Type Relational Interface
Static Methods Unique to the ORDVideo Object Type Relational Interface
Application developers, who created multimedia applications without using the Oracle Multimedia object types to store and manage media data in relational tables, and who do not want to migrate their existing multimedia applications to use Oracle Multimedia objects, can use the Oracle Multimedia relational interface for managing their media data. The Oracle Multimedia relational interface consists of a set of methods for these operations:
Extracting information directly from media data, either as an XML string or as XML and individual attributes
Processing and copying image data
Loading media data into Oracle Database
Exporting media data from Oracle Database into operating system files
The Oracle Multimedia relational interface enables application developers to take advantage of Oracle Multimedia functions with only minimal changes to their applications, and all without having to change their schemas to the Oracle Multimedia objects to store their data.
The examples of static methods for the relational interface (including methods common to all object types and methods that are unique to a particular object type) use this list of tables:
Name | Purpose | Definition |
---|---|---|
TAUD | ORDAudio relational methods (and the common relational method export( )) | Section 7.2.2 |
TDOC | ORDDoc relational methods (and the common relational method importFrom( )) | Section 7.2.3 |
TIMG | ORDImage relational methods (and the common relational method importFrom( ) (all attributes)) | Section 7.2.4 |
TVID | ORDVideo relational methods | Section 7.2.5 |
When reading through the examples in this chapter, use the directory and table definitions that are provided in this section and with the example for each relational method.
Note:
The tables described in this chapter are also used in the examples for these object constructors:Some examples in this chapter use mediauser
to represent the user, and c:\mydir\work
to represent the directory specification where your test files can be located. See the example for each method for specific directory definitions for media data files and other details specific to that method.
The examples in Static Methods Unique to the ORDAudio Object Type Relational Interface use the audio table TAUD.
CREATE TABLE taud(n NUMBER, aud BLOB, attributes CLOB, mimetype VARCHAR2(4000), format VARCHAR2(31), encoding VARCHAR2(256), numberofchannels INTEGER, samplingrate INTEGER, samplesize INTEGER, compressiontype VARCHAR2(4000), audioduration INTEGER) LOB(aud) STORE AS SECUREFILE; INSERT INTO taud VALUES(1,EMPTY_BLOB(),EMPTY_CLOB(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); INSERT INTO taud VALUES(2,EMPTY_BLOB(),EMPTY_CLOB(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); COMMIT;
The examples in Static Methods Unique to the ORDDoc Object Type Relational Interface use the document table TDOC.
CREATE TABLE tdoc(n NUMBER, document BLOB, attributes CLOB, mimetype VARCHAR2(80), format VARCHAR2(80), contentlength INTEGER) LOB(document) STORE AS SECUREFILE; INSERT INTO tdoc VALUES(1, EMPTY_BLOB(), EMPTY_CLOB(), NULL, NULL, NULL); INSERT INTO tdoc VALUES(2, EMPTY_BLOB(), EMPTY_CLOB(), NULL, NULL, NULL); INSERT INTO tdoc VALUES(3, EMPTY_BLOB(), EMPTY_CLOB(), NULL, NULL, NULL); INSERT INTO tdoc VALUES(4, EMPTY_BLOB(), EMPTY_CLOB(), NULL, NULL, NULL); COMMIT;
The examples in Static Methods Unique to the ORDImage Object Type Relational Interface use the image table TIMG.
CREATE TABLE timg(n NUMBER, img BLOB, attributes CLOB, mimetype VARCHAR2(4000), width INTEGER, height INTEGER, fileformat VARCHAR2(4000), contentformat VARCHAR2(4000), compressionformat VARCHAR2(4000), contentlength INTEGER) LOB(img) STORE AS SECUREFILE; INSERT INTO timg VALUES(1, EMPTY_BLOB(), EMPTY_CLOB(), NULL, NULL, NULL, NULL, NULL, NULL, NULL); INSERT INTO timg VALUES(2, EMPTY_BLOB(), EMPTY_CLOB(), NULL, NULL, NULL, NULL, NULL, NULL, NULL); COMMIT;
The examples in Static Methods Unique to the ORDVideo Object Type Relational Interface use the video table TVID.
CREATE TABLE tvid(n NUMBER, vid BLOB, attributes CLOB, mimetype VARCHAR2(4000), format VARCHAR2(31), width INTEGER, height INTEGER, frameresolution INTEGER, framerate INTEGER, videoduration INTEGER, numberofframes INTEGER, compressiontype VARCHAR2(4000), numberofcolors INTEGER, bitrate INTEGER) LOB(vid) STORE AS SECUREFILE; INSERT INTO tvid VALUES(1, EMPTY_BLOB(), EMPTY_CLOB(), NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); INSERT INTO tvid VALUES(2, EMPTY_BLOB(), EMPTY_CLOB(), NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); COMMIT;
Methods related to the source of the media 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.
ORDAudio, ORDDoc, and ORDVideo methods related to media parsing 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.
This section presents reference information about these Oracle Multimedia common static methods, which are used for the relational interface:
The common static methods for the ORDAudio, ORDDoc, ORDImage, and ORDVideo relational interfaces are defined in the ordaspec.sql
, orddspec.sql
, ordispec.sql
, and ordvspec.sql
files, respectively.
Note:
The examples in this section assume that these tables exist: TAUD, TDOC, and TIMG.export(ctx IN OUT RAW,
local_data IN BLOB,
source_type IN VARCHAR2,
source_location IN VARCHAR2,
source_name IN VARCHAR2);
Copies data from a local source (local_data) within the database to an external data source.
Note:
The export( ) method provides native support only when the value of the source_type parameter isFILE
. In this case, this method writes the data to a file within a directory that is accessible to Oracle Database. User-defined sources may support the export( ) method to provide WRITE access to other types of data stores.The source plug-in context information. (See Section 7.3.)
The BLOB location that is being exported.
The type of the external source data. This parameter is not case sensitive. (See Table 2-1.)
The location to which the source data is to be exported. (See Table 2-2.)
The name of the object to which the source data is to be exported. (See Table 2-3.)
After calling the export( ) method, you can issue a SQL DELETE statement or call the DBMS_LOB.TRIM procedure to delete the content stored locally, if desired.
The export( ) method for a source type of FILE
does not modify data stored in the BLOB.
When the source_type parameter has a value of FILE
, the source_location parameter specifies the name of an Oracle directory object, and the source_name parameter specifies the name of the file to contain the data.
The export( ) method writes only to 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 and WRITE access.
For example, the following SQL*Plus commands create a directory object and grant the user mediauser
permission to read and write to 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,WRITE ON DIRECTORY FILE_DIR TO mediauser;
See Section 7.2 for more information about directory and table definitions.
ORDSourceExceptions.INCOMPLETE_SOURCE_INFORMATION
This exception is raised if you call the export( ) method and the value of the source_type parameter is NULL
.
ORDSourceExceptions.IO_ERROR
This exception is raised if the export( ) method encounters an error writing the BLOB data to the file specified.
ORDSourceExceptions.METHOD_NOT_SUPPORTED
This exception is raised if you call the export( ) method and this method is not supported by the source plug-in being used.
See Appendix G for more information about these exceptions.
Export data from a local source to an external data source:
Note:
Replace c:\mydir\work with the directory specification where your exported file should be located, and replace password with thesys
password.CONNECT sys as sysdba Enter password: password; CREATE OR REPLACE DIRECTORY AUDIODIR AS 'c:\mydir\work'; GRANT READ, WRITE ON DIRECTORY AUDIODIR TO mediauser; CONNECT mediauser Enter password: password; DECLARE audio_data BLOB; ctx RAW(64) :=NULL; BEGIN SELECT aud INTO audio_data FROM taud WHERE N = 1; ORDSYS.ORDAudio.export(ctx,audio_data,'file','AUDIODIR','testaud.dat'); EXCEPTION WHEN OTHERS THEN RAISE; END; /
importFrom(ctx IN OUT RAW,
local_data IN OUT NOCOPY BLOB,
source_type IN VARCHAR2,
source_location IN VARCHAR2,
source_name IN VARCHAR2);
Transfers data from the specified external data source to the BLOB specified by the local_data parameter.
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 7.3.)
The BLOB location to receive the data.
The type of the source data. (See Table 2-1.)
The location from which the source data is to be imported. (See Table 2-2.)
The name of the source data. (See Table 2-3.)
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 for the external source location 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 mediauser
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 mediauser;
See Section 7.2 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.
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
This exception is raised if you call the importFrom( ) method and the value of the local_data parameter is NULL
or has not been initialized.
See Appendix G for more information about these exceptions.
Import data from the specified external data source into the local source:
Note:
Replace c:\mydir\work with the directory specification where your test files are located, replace testimg.dat, testaud.dat, and testvid.dat with the file specifications of your test files, and replace password with the system password.CONNECT sys as sysdba Enter password: password; CREATE OR REPLACE DIRECTORY DOCDIR AS 'c:\mydir\work'; GRANT READ ON DIRECTORY DOCDIR TO mediauser; CONNECT mediauser Enter password: password; DECLARE document_data BLOB; ctx RAW(64) :=NULL; BEGIN SELECT document INTO document_data FROM tdoc WHERE N = 1 FOR UPDATE; ORDSYS.ORDDoc.importFrom(ctx,document_data,'file','DOCDIR','testimg.dat'); UPDATE tdoc SET document = document_data WHERE N = 1; COMMIT; SELECT document INTO document_data FROM tdoc WHERE N = 2 FOR UPDATE; ORDSYS.ORDDoc.importFrom(ctx,document_data,'file','DOCDIR','testaud.dat'); UPDATE tdoc SET document = document_data WHERE N = 2; COMMIT; SELECT document INTO document_data FROM tdoc WHERE N = 3 FOR UPDATE; ORDSYS.ORDDoc.importFrom(ctx,document_data,'file','DOCDIR','testvid.dat'); UPDATE tdoc SET document = document_data WHERE N = 3; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
importFrom(ctx IN OUT RAW,
local_data IN OUT NOCOPY BLOB,
source_type IN VARCHAR2,
source_location IN VARCHAR2,
source_name IN VARCHAR2,
format OUT VARCHAR2,
mime_type OUT VARCHAR2);
Transfers data from the specified external data source to the BLOB specified by the local_data parameter.
The source plug-in context information. (See Section 7.3.)
The BLOB location to receive the data.
The type of the source data. (See Table 2-1.)
The location from which the source data is to be imported. (See Table 2-2.)
The name of the source data. (See Table 2-3.)
The format of the data. The value is returned if it is available (from HTTP sources).
The MIME type of the data. The value is returned if it is available (from HTTP sources).
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 for the external source location 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 mediauser
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 mediauser;
See Section 7.2 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.
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
This exception is raised if you call the importFrom( ) method and the value of the local_data parameter is NULL
or has not been initialized.
See Appendix G for more information about these exceptions.
Import image data from the specified external data source into the local source:
Note:
Replace c:\mydir\work with the directory specification where your test file is located, replace testimg.dat with the file specification of your test file, and replace password with the system password.CONNECT sys as sysdba Enter password: password; CREATE OR REPLACE DIRECTORY IMAGEDIR AS 'c:\mydir\work'; GRANT READ ON DIRECTORY IMAGEDIR TO mediauser; CONNECT mediauser Enter password: password; DECLARE image_data BLOB; ctx RAW(64) :=NULL; img_format VARCHAR2(32) := NULL; img_mime_type VARCHAR2(80); BEGIN SELECT img INTO image_data FROM timg WHERE N = 1 FOR UPDATE; ORDSYS.ORDImage.importFrom(ctx,image_data,'file','IMAGEDIR', 'testimg.dat',img_format,img_mime_type); UPDATE timg SET img = image_data WHERE N = 1; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
This section presents reference information about these Oracle Multimedia static methods, which are unique to the ORDAudio relational interface:
The relational interface adds Oracle Multimedia support to audio data stored in BLOBs and BFILEs rather than in the ORDAudio object type. The static methods that are unique to the ORDAudio relational interface are defined in the ordaspec.sql
file.
getProperties(ctx IN OUT RAW,
audioBfile IN OUT NOCOPY BFILE,
attributes IN OUT NOCOPY CLOB,
format IN VARCHAR2);
Reads the audio BFILE data to get the values of the media attributes for supported formats, and then stores them in the input CLOB. This method populates the CLOB with an extensive set of format and application properties in XML form.
The format plug-in context information. (See Section 7.3.)
The audio data represented as a BFILE.
The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the audio BFILE data in XML form.
The format of the audio data. If a non-NULL value is specified for this parameter, then the format plug-in for this format type is invoked.
ORDAudioExceptions.AUDIO_PLUGIN_EXCEPTION
This exception is raised if you call the getProperties( ) method and the audio plug-in raises an exception.
ORDSourceExceptions.EMPTY_SOURCE
This exception is raised when the value of the source.local attribute is 1
or 0
(TRUE), but the value of the source.localData attribute is NULL
.
See Appendix G for more information about these exceptions.
Get the property information for known audio attributes:
DECLARE aud_attrib CLOB; ctx RAW(64) :=NULL; aud_data BFILE := BFILENAME('AUDIODIR','testaud.dat'); aud_format VARCHAR2(160) := NULL; BEGIN DBMS_LOB.CREATETEMPORARY(aud_attrib, FALSE, DBMS_LOB.CALL); ORDSYS.ORDAudio.getProperties(ctx, aud_data, aud_attrib, aud_format); DBMS_OUTPUT.put_line('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(aud_attrib))); EXCEPTION WHEN OTHERS THEN RAISE; END; /
getProperties(ctx IN OUT RAW,
audioBfile IN OUT NOCOPY BFILE,
attributes IN OUT NOCOPY CLOB,
mimeType OUT VARCHAR2,
format IN OUT VARCHAR2
encoding OUT VARCHAR2,
numberOfChannels OUT INTEGER,
samplingRate OUT INTEGER,
sampleSize OUT INTEGER,
compressionType OUT VARCHAR2,
audioDuration OUT INTEGER);
Reads the audio BFILE data to get the values of the media attributes for supported formats, and then stores them in the input CLOB and returns them as explicit parameters. This method gets the properties for these attributes of the audio data: duration, MIME type, compression type, format, encoding type, number of channels, sampling rate, and sample size. It populates the CLOB with an extensive set of format and application properties in XML form.
The format plug-in context information. (See Section 7.3.)
The audio data represented as a BFILE.
The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the audio BFILE data in XML form.
The MIME type of the audio data.
The format of the audio data. If a non-NULL value is specified, then the format plug-in for this format type is invoked. If not specified, the default plug-in is used and the derived format value is returned.
The encoding type of the audio data.
The number of channels in the audio data.
The sampling rate in samples per second at which the audio data was recorded.
The sample width or number of samples of audio in the data.
The compression type of the audio data.
The total time required to play the audio data.
If a property cannot be extracted from the media source, then the respective parameter is set to NULL.
ORDAudioExceptions.AUDIO_PLUGIN_EXCEPTION
This exception is raised if you call the getProperties( ) method and the audio plug-in raises an exception.
ORDSourceExceptions.EMPTY_SOURCE
This exception is raised when the value of the source.local attribute is 1
or 0
(TRUE), but the value of the source.localData attribute is NULL
.
See Appendix G for more information about these exceptions.
Get the property information for known audio attributes:
DECLARE aud_attrib CLOB; ctx RAW(64) :=NULL; data BFILE := BFILENAME('AUDIODIR','testaud.dat'); mimeType VARCHAR2(80); format VARCHAR2(32) := NULL; encoding VARCHAR2(160); numberOfChannels NUMBER; samplingRate NUMBER; sampleSize NUMBER; compressionType VARCHAR2(160); audioDuration NUMBER; BEGIN DBMS_LOB.CREATETEMPORARY(aud_attrib, FALSE, DBMS_LOB.CALL); ORDSYS.ORDAudio.getProperties(ctx, data, aud_attrib, mimeType, format, encoding, numberOfChannels, samplingRate, sampleSize, compressionType, audioDuration); DBMS_OUTPUT.put_line('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(aud_attrib))); DBMS_OUTPUT.put_line('mimeType: ' || mimeType ); DBMS_OUTPUT.put_line('format: ' || format ); DBMS_OUTPUT.put_line('encoding: ' || encoding ); DBMS_OUTPUT.put_line('numberOfChannels: ' || numberOfChannels ); DBMS_OUTPUT.put_line('samplingRate: ' || samplingRate ); DBMS_OUTPUT.put_line('sampleSize: ' || sampleSize ); DBMS_OUTPUT.put_line('compressionType: ' || compressionType ); DBMS_OUTPUT.put_line('audioDuration: ' || audioDuration ); EXCEPTION WHEN OTHERS THEN RAISE; END; /
getProperties(ctx IN OUT RAW,
audioBlob IN BLOB,
attributes IN OUT NOCOPY CLOB,
format IN VARCHAR2);
Reads the audio BLOB data to get the values of the media attributes for supported formats, and then stores them in the input CLOB. This method populates the CLOB with an extensive set of format and application properties in XML form.
The format plug-in context information. (See Section 7.3.)
The audio data represented as a BLOB.
The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the audio BLOB data in XML form.
The format of the audio data. If a non-NULL value is specified for this parameter, then the format plug-in for this format type is invoked; otherwise, the default plug-in is used.
ORDAudioExceptions.AUDIO_PLUGIN_EXCEPTION
This exception is raised if you call the getProperties( ) method and the audio plug-in raises an exception.
ORDSourceExceptions.EMPTY_SOURCE
This exception is raised when the value of the source.local attribute is 1
or 0
(TRUE), but the value of the source.localData attribute is NULL
.
See Appendix G for more information about these exceptions.
Get the property information for known audio attributes:
DECLARE aud_attrib CLOB; ctx RAW(64) :=NULL; aud_data BLOB; aud_format VARCHAR2(160) := NULL; BEGIN SELECT aud, attributes INTO aud_data, aud_attrib FROM taud WHERE N =1 FOR UPDATE; ORDSYS.ORDAudio.getProperties(ctx,aud_data,aud_attrib,aud_format); DBMS_OUTPUT.put_line('Size of XML Annotations: ' || TO_CHAR(DBMS_LOB.GETLENGTH(aud_attrib))); UPDATE taud SET attributes=aud_attrib WHERE N=1; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
getProperties(ctx IN OUT RAW,
audioBlob IN BLOB,
attributes IN OUT NOCOPY CLOB,
mimeType OUT VARCHAR2,
format IN OUT VARCHAR2
encoding OUT VARCHAR2,
numberOfChannels OUT INTEGER,
samplingRate OUT INTEGER,
sampleSize OUT INTEGER,
compressionType OUT VARCHAR2,
audioDuration OUT INTEGER);
Reads the audio BLOB data to get the values of the media attributes for supported formats, and then stores them in the input CLOB and returns them as explicit parameters. This method gets the properties for these attributes of the audio data: duration, MIME type, compression type, format, encoding type, number of channels, sampling rate, and sample size. It populates the CLOB with an extensive set of format and application properties in XML form.
The format plug-in context information. (See Section 7.3.)
The audio data represented as a BLOB.
The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the audio BLOB data in XML form.
The MIME type of the audio data.
The format of the audio data. If a non-NULL value is specified, then the format plug-in for this format type is invoked. If not specified, the derived format value is returned.
The encoding type of the audio data.
The number of channels in the audio data.
The sampling rate in samples per second at which the audio data was recorded.
The sample width or number of samples of audio in the data.
The compression type of the audio data.
The total time required to play the audio data.
If a property cannot be extracted from the media source, then the respective parameter is set to NULL.
ORDAudioExceptions.AUDIO_PLUGIN_EXCEPTION
This exception is raised if you call the getProperties( ) method and the audio plug-in raises an exception.
ORDSourceExceptions.EMPTY_SOURCE
This exception is raised when the value of the source.local attribute is 1
or 0
(TRUE), but the value of the source.localData attribute is NULL
.
See Appendix G for more information about these exceptions.
Get the property information for known audio attributes:
DECLARE aud_attrib CLOB; ctx RAW(64) := NULL; aud_data BLOB; mimeType VARCHAR2(80); format VARCHAR2(32) := NULL; encoding VARCHAR2(160); numberOfChannels NUMBER; samplingRate NUMBER; sampleSize NUMBER; compressionType VARCHAR2(160); audioDuration NUMBER; BEGIN SELECT aud, attributes, mimetype, format, encoding, numberofchannels, samplingrate, samplesize, compressiontype, audioduration INTO aud_data, aud_attrib, mimeType, format, encoding, numberOfChannels, samplingRate, sampleSize, compressionType, audioDuration FROM taud WHERE N = 1 FOR UPDATE; ORDSYS.ORDAudio.getProperties(ctx, aud_data, aud_attrib, mimeType, format, encoding, numberOfChannels, samplingRate, sampleSize, compressionType, audioDuration); DBMS_OUTPUT.put_line('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(aud_attrib))); DBMS_OUTPUT.put_line('mimeType: ' || mimeType ); DBMS_OUTPUT.put_line('format: ' || format ); DBMS_OUTPUT.put_line('encoding: ' || encoding ); DBMS_OUTPUT.put_line('numberOfChannels: ' || numberOfChannels ); DBMS_OUTPUT.put_line('samplingRate: ' || samplingRate ); DBMS_OUTPUT.put_line('sampleSize: ' || sampleSize ); DBMS_OUTPUT.put_line('compressionType: ' || compressionType ); DBMS_OUTPUT.put_line('audioDuration: ' || audioDuration ); UPDATE taud SET aud=aud_data, attributes=aud_attrib, mimetype=mimeType, format=format, encoding=encoding, numberofchannels=numberOfChannels, samplingrate=samplingRate, samplesize=sampleSize, compressiontype=compressionType, audioduration=audioDuration WHERE n=1; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
This section presents reference information about these Oracle Multimedia static methods, which are unique to the ORDDoc relational interface:
The relational interface adds Oracle Multimedia support to audio, image, video, and other heterogeneous media data stored in BLOBs and BFILEs rather than in the ORDDoc object type. The static methods that are unique to the ORDDoc relational interface are defined in the orddspec.sql
file.
getProperties(ctx IN OUT RAW,
docBfile IN OUT NOCOPY BFILE,
attributes IN OUT NOCOPY CLOB,
format IN VARCHAR2);
Reads the document BFILE data to get the values of the media attributes, and then stores them in the input CLOB. It populates the CLOB with an extensive set of format and application properties in XML form.
The format plug-in context information. (See Section 7.3.)
The document data represented as a BFILE.
The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the document BFILE data in XML form.
The format of the document data. If a non-NULL value is specified, then the format plug-in for this format type is invoked.
ORDDocExceptions.DOC_PLUGIN_EXCEPTION
This exception is raised if you call the getProperties( ) method and the document plug-in raises an exception.
ORDSourceExceptions.EMPTY_SOURCE
This exception is raised when the value of the source.local attribute is 1
or 0
(TRUE), but the value of the source.localData attribute is NULL
.
See Appendix G for more information about these exceptions.
Get the property information for known document attributes:
DECLARE doc_attrib CLOB; ctx RAW(64) :=NULL; doc_data BFILE := BFILENAME('DOCDIR','testvid.dat'); doc_format VARCHAR2(160) := NULL; BEGIN DBMS_LOB.CREATETEMPORARY(doc_attrib, FALSE, DBMS_LOB.CALL); ORDSYS.ORDDoc.getProperties(ctx, doc_data, doc_attrib, doc_format); DBMS_OUTPUT.put_line('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(doc_attrib))); EXCEPTION WHEN OTHERS THEN RAISE; END; /
getProperties(ctx IN OUT RAW,
docBfile IN OUT NOCOPY BFILE,
attributes IN OUT NOCOPY CLOB,
mimeType OUT VARCHAR2,
format IN OUT VARCHAR2,
contentLength OUT INTEGER);
Reads the document BFILE data to get the values of the media attributes for supported formats, and then stores them in the input CLOB and returns them as explicit parameters. This method gets the properties for these attributes of the document data: MIME type, content length, and format. It populates the CLOB with an extensive set of format and application properties in XML form.
The format plug-in context information. (See Section 7.3.)
The document data represented as a BFILE.
The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the document BFILE data in XML form.
The MIME type of the document data.
The format of the document data. If a non-NULL value is specified, then the format plug-in for this format type is invoked. If not specified, the derived format is returned.
The length of the content, in bytes.
If a property cannot be extracted from the media source, then the respective parameter is set to NULL.
ORDDocExceptions.DOC_PLUGIN_EXCEPTION
This exception is raised if you call the getProperties( ) method and the document plug-in raises an exception.
ORDSourceExceptions.EMPTY_SOURCE
This exception is raised when the value of the source.local attribute is 1
or 0
(TRUE), but the value of the source.localData attribute is NULL
.
See Appendix G for more information about these exceptions.
Get the property information for known document attributes:
DECLARE doc_attrib CLOB; ctx RAW(64) :=NULL; doc_data BFILE := BFILENAME('DOCDIR','testimg.dat'); doc_mimeType VARCHAR2(80); doc_format VARCHAR2(32) := NULL; doc_contentLength NUMBER; BEGIN DBMS_LOB.CREATETEMPORARY(doc_attrib, FALSE, DBMS_LOB.CALL); ORDSYS.ORDDoc.getProperties(ctx, doc_data, doc_attrib, doc_mimeType, doc_format, doc_contentLength); DBMS_OUTPUT.put_line('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(doc_attrib))); DBMS_OUTPUT.put_line('mimeType: ' || doc_mimeType ); DBMS_OUTPUT.put_line('format: ' || doc_format ); DBMS_OUTPUT.put_line('contentLength: ' || doc_contentLength ); EXCEPTION WHEN OTHERS THEN RAISE; END; /
getProperties(ctx IN OUT RAW,
docBlob IN BLOB,
attributes IN OUT NOCOPY CLOB,
format IN VARCHAR2);
Reads the document BLOB data to get the values of the media attributes, and then stores them in the input CLOB. This method populates the CLOB with an extensive set of format and application properties in XML form.
The format plug-in context information. (See Section 7.3.)
The document data represented as a BLOB.
The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the document BLOB data in XML form.
The format of the document data. If a non-NULL value is specified, then the format plug-in for this format type is invoked.
ORDDocExceptions.DOC_PLUGIN_EXCEPTION
This exception is raised if you call the getProperties( ) method and the document plug-in raises an exception.
ORDSourceExceptions.EMPTY_SOURCE
This exception is raised when the value of the source.local attribute is 1
or 0
(TRUE), but the value of the source.localData attribute is NULL
.
See Appendix G for more information about these exceptions.
Get the property information for known document attributes:
DECLARE doc_attrib CLOB; ctx RAW(64) :=NULL; doc_data BLOB; doc_format VARCHAR2(160) := NULL; BEGIN SELECT document,attributes INTO doc_data,doc_attrib FROM tdoc WHERE N = 1 FOR UPDATE; ORDSYS.ORDDoc.getProperties(ctx, doc_data, doc_attrib, doc_format); DBMS_OUTPUT.put_line('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(doc_attrib))); UPDATE tdoc SET document=doc_data, attributes=doc_attrib WHERE N=1; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
getProperties(ctx IN OUT RAW,
docBlob IN BLOB,
attributes IN OUT NOCOPY CLOB,
mimeType OUT VARCHAR2,
format IN OUT VARCHAR2,
contentLength OUT INTEGER);
Reads the document BLOB data to get the values of the media attributes, and then stores them in the input CLOB and returns them as explicit parameters. This method gets the properties for these attributes of the document data: MIME type, content length, and format. It populates the CLOB with an extensive set of format and application properties in XML form.
The format plug-in context information. (See Section 7.3.)
The document data represented as a BLOB.
The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the document BLOB data in XML form.
The MIME type of the document data.
The format of the document data. If a non-NULL value is specified, then the format plug-in for this format type is invoked.
The length of the content, in bytes.
If a property cannot be extracted from the media source, then the respective parameter is set to NULL.
ORDDocExceptions.DOC_PLUGIN_EXCEPTION
This exception is raised if you call the getProperties( ) method and the document plug-in raises an exception.
ORDSourceExceptions.EMPTY_SOURCE
This exception is raised when the value of the source.local attribute is 1
or 0
(TRUE), but the value of the source.localData attribute is NULL
.
See Appendix G for more information about these exceptions.
Get the property information for known document attributes:
DECLARE doc_attrib CLOB; ctx RAW(64) :=NULL; doc_data BLOB; doc_mimeType VARCHAR2(80); doc_format VARCHAR2(32):=NULL; doc_contentLength NUMBER; BEGIN SELECT document, attributes, mimetype, format, contentlength INTO doc_data, doc_attrib, doc_mimeType, doc_format, doc_contentLength FROM tdoc WHERE N = 1 FOR UPDATE; ORDSYS.ORDDoc.getProperties(ctx, doc_data, doc_attrib, doc_mimeType, doc_format, doc_contentLength); DBMS_OUTPUT.put_line('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(doc_attrib))); DBMS_OUTPUT.put_line('mimeType: ' || doc_mimeType ); DBMS_OUTPUT.put_line('format: ' || doc_format ); DBMS_OUTPUT.put_line('contentLength: ' || doc_contentLength ); UPDATE tdoc SET document=doc_data, attributes=doc_attrib, mimetype=doc_mimeType, format=doc_format, contentlength=doc_contentLength WHERE N=1; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
This section presents reference information about these Oracle Multimedia static methods, which are unique to the ORDImage relational interface:
The relational interface adds Oracle Multimedia support to image data stored in BLOBs and BFILEs rather than in the ORDImage object type. The static methods that are unique to the ORDImage relational interface are defined in the ordispec.sql
file.
applyWatermark(imageBfile IN OUT NOCOPY BFILE,
added_image IN OUT NOCOPY BFILE,
dest IN OUT NOCOPY BLOB,
logging OUT VARCHAR2,
watermark_properties IN ordsys.ord_str_list default null),
Overlays an image watermark onto a source image stored in a BFILE and writes it to a destination BLOB.
The source image data represented as a BFILE.
The watermark image stored in a BFILE to be added to the source image.
The destination BLOB for the watermarked image.
A string that contains information about any unexpected behavior that occurred during the watermarking operation. If the operation is successful, an empty string is returned.
A string list of name-value pairs that define attributes of the watermark image, including: width, height, position, position_x, position_y, and transparency. See Table D-2 for the complete list of watermark properties.
Calling this method processes the image into the destination BLOB from any source BFILE.
See Section D.6 for more information about watermarking operations and watermark properties.
ORDImageExceptions.NULL_CONTENT
This exception is raised when the source image or added image is NULL.
ORDImageExceptions.NULL_DESTINATION
This exception is raised when the destination image BLOB is NULL.
See Appendix G for more information about these exceptions.
Add a watermark image to an image BFILE:
-- add image as watermark for BFILE DECLARE source_image BFILE := BFILENAME('IMAGEDIR','testimg.jpg'); added_image BFILE := BFILENAME('IMAGEDIR','testlogo.png'); dest_image BLOB; prop ordsys.ord_str_list; logging VARCHAR2(2000); BEGIN SELECT img INTO dest_image FROM timg WHERE N = 4003 FOR UPDATE; -- specify properties prop := ordsys.ord_str_list( 'position=bottomright', 'transparency=0.2'); -- add image watermark to source image ORDSYS.ORDImage.applyWatermark(source_image, added_image, dest_image, logging, prop); UPDATE timg SET img = dest_image WHERE N = 4003; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
where:
testimg.jpg
: the source image (in JPEG format) stored in the table. The source image is larger than the watermark image.
testlogo.png
: the watermark image (in PNG format) stored in the table. The watermark image is overlaid onto the bottom right position of the source image.
4003
: the resulting watermarked image stored in the table.
applyWatermark(imageBlob IN BLOB,
added_image IN BLOB,
dest IN OUT NOCOPY BLOB,
logging OUT VARCHAR2,
watermark_properties IN ordsys.ord_str_list default null),
Overlays an image watermark onto a source image stored in a BLOB and writes it to a destination BLOB.
The source image data represented as a BLOB.
The watermark image stored in a BLOB to be added to the source image.
The destination BLOB for the watermarked image.
A string that contains information about any unexpected behavior that occurred during the watermarking operation. If the operation is successful, an empty string is returned.
A string list of name-value pairs that define attributes of the watermark image, including: width, height, position, position_x, position_y, and transparency. See Table D-2 for the complete list of watermark properties.
Because temporary LOBs do not have read consistency, you cannot use the same temporary LOB for both the imageBlob and dest parameters.
Calling this method processes the image into the destination BLOB from any source BLOB.
See Section D.6 for more information about watermarking operations and watermark properties.
ORDImageExceptions.NULL_CONTENT
This exception is raised when the source image or added image is NULL.
ORDImageExceptions.NULL_DESTINATION
This exception is raised when the destination image BLOB is NULL.
See Appendix G for more information about this exception.
Add a watermark image to an image BLOB:
-- add image as watermark for BLOB DECLARE source_image BLOB; added_image BLOB; dest_image BLOB; prop ordsys.ord_str_list; logging VARCHAR2(2000); BEGIN SELECT img INTO source_image FROM timg WHERE N = 4001; SELECT img INTO added_image FROM timg WHERE N = 4002; SELECT img INTO dest_image FROM timg WHERE N = 4003 FOR UPDATE; -- specify properties prop := ordsys.ord_str_list( 'position=bottomright', 'transparency=0.2'); -- add image watermark to source image ORDSYS.ORDImage.applyWatermark(source_image, added_image, dest_image, logging, prop); UPDATE timg SET img = dest_image WHERE N = 4003; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
where:
4001
: the source image (in JPEG format) stored in the table. The source image is larger than the watermark image.
4002
: the watermark image (in PNG format) stored in the table. The watermark image is overlaid onto the bottom right position of the source image.
4003
: the resulting watermarked image stored in the table.
applyWatermark(imageBfile IN OUT NOCOPY BFILE,
added_text IN VARCHAR2,
dest IN OUT NOCOPY BLOB,
logging OUT VARCHAR2,
watermark_properties IN ordsys.ord_str_list default null),
Overlays a text watermark onto a source image stored in a BFILE and writes it to a destination BLOB.
The source image data represented as a BFILE.
The watermark text stored in a string to be added to the source image.
The destination BLOB for the watermarked image.
A string that contains information about any unexpected behavior that occurred during the watermarking operation. If the operation is successful, an empty string is returned. Otherwise, this method returns a string that describes the unexpected behavior. For example: if watermark text is so long that it is truncated, this string is returned: WARNING: text is too long and truncated.
A string list of name-value pairs that define attributes of the watermark text, including: font_name, font_style, font_size, text_color, position_x, position_y, and transparency. See Table D-2 for the complete list of watermark properties.
Calling this method processes the image into the destination BLOB from any source BFILE.
See Section D.6 for more information about watermarking operations and watermark properties.
ORDImageExceptions.NULL_CONTENT
This exception is raised when the source image is NULL.
ORDImageExceptions.NULL_DESTINATION
This exception is raised when the destination image BLOB is NULL.
See Appendix G for more information about these exceptions.
Add watermark text to an image BFILE:
-- add text as watermark for BFILE DECLARE source_image BFILE := BFILENAME('IMAGEDIR','testimg.jpg'); added_text varchar2(200); dest_image BLOB; prop ordsys.ord_str_list; logging VARCHAR2(2000); BEGIN SELECT img INTO dest_image FROM timg WHERE N = 4003 FOR UPDATE; added_text := 'Oracle Multimedia © 2009'; -- specify properties prop := ordsys.ord_str_list( 'font_name=Times New Roman', 'font_style=bold', 'font_size=50', 'text_color=red', 'position_x=100', 'position_y=100', 'transparency=0.6'); -- add text watermark to source image ORDSYS.ORDImage.applyWatermark(source_image, added_text, dest_image, logging, prop); UPDATE timg SET img = dest_image WHERE N = 4003; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
where:
testimg.jpg
: the source image (in JPEG format) stored in the table.
4003
: the resulting watermarked image stored in the table.
applyWatermark(imageBlob IN BLOB,
added_text IN VARCHAR2,
dest IN OUT NOCOPY BLOB,
logging OUT VARCHAR2,
watermark_properties IN ordsys.ord_str_list default null),
Overlays a text watermark onto a source image stored in a BLOB and writes it to a destination BLOB.
The source image data represented as a BLOB.
The watermark text stored in a string to be added to the source image.
The destination BLOB for the watermarked image.
A string that contains information about any unexpected behavior that occurred during the watermarking operation. If the operation is successful, an empty string is returned. Otherwise, this method returns a string that describes the unexpected behavior. For example: if watermark text is so long that it is truncated, this string is returned: WARNING: text is too long and truncated.
A string list of name-value pairs that define attributes of the watermark text, including: font_name, font_style, font_size, text_color, position_x, position_y, and transparency. See Table D-2 for the complete list of watermark properties.
Because temporary LOBs do not have read consistency, you cannot use the same temporary LOB for both the imageBlob and dest parameters.
Calling this method processes the image into the destination BLOB from any source BLOB.
See Section D.6 for more information about watermarking operations and watermark properties.
ORDImageExceptions.NULL_CONTENT
This exception is raised when the source image is NULL.
ORDImageExceptions.NULL_DESTINATION
This exception is raised when the destination image BLOB is NULL.
See Appendix G for more information about this exception.
Add watermark text to an image BLOB:
-- add text as watermark for BLOB DECLARE source_image BLOB; added_text varchar2(200); dest_image BLOB; prop ordsys.ord_str_list; logging VARCHAR2(2000); BEGIN SELECT img INTO source_image FROM timg WHERE N = 4001; SELECT img INTO dest_image FROM timg WHERE N = 4003 FOR UPDATE; added_text := 'Oracle Multimedia © 2009'; -- specify properties prop := ordsys.ord_str_list( 'font_name=Times New Roman', 'font_style=bold', 'font_size=50', 'text_color=red', 'position_x=100', 'position_y=100', 'transparency=0.6'); -- add text watermark to source image ORDSYS.ORDImage.applyWatermark(source_image, added_text, dest_image, logging, prop); UPDATE timg SET img = dest_image WHERE N = 4003; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
where:
4001
: the source image (in JPEG format) stored in the table.
4003
: the resulting watermarked image stored in the table.
getMetadata(imageBfile IN NOCOPY BFILE,
metadataType IN VARCHAR2 DEFAULT 'ALL'
RETURN XMLSequenceType;
Extracts the specified types of metadata from the imageBfile and returns an array of schema-valid XML documents. If no matching metadata is found, an empty array is returned.
The image data represented as a BFILE.
A string that identifies the types of embedded metadata to extract. Valid values are: ALL
, ORDIMAGE
, XMP
, EXIF
, and IPTC-IIM
. The default value is ALL
.
When the value of input parameter metadataType is ALL
, and two or more types of supported metadata are present in the image, this method returns several XML documents, one for each type of metadata found. For other values of the input parameter, the method returns zero or one XML document.
Each document is stored as an instance of XMLType, and is based on one of the metadata schemas. Use the XQuery function fn:namespace-uri
to determine the type of metadata represented in that document.
See Appendix F for information about the supported metadata schemas.
See Also:
Oracle Multimedia User's Guide for more information about the metadata feature
Oracle XML DB Developer's Guide for more information about XQuery functions
ORDImageExceptions.NULL_CONTENT
This exception is raised when the imageBfile parameter is NULL.
See Appendix G for more information about this exception.
Extract the embedded metadata from an imageBfile, and return an array of schema-valid XML documents:
DECLARE imageBfile BFILE := BFILENAME('MEDIA_DIR','keyboard.jpg'); metav XMLSequenceType; ns varchar2(4000); BEGIN metav := ORDSYS.ORDImage.getMetadata(imageBfile, 'ALL'); -- print the namespace of each metadata document FOR i in 1..metav.count LOOP select xmlcast(xmlquery('fn:namespace-uri($x)' passing metav(i) as "x" returning content) as varchar2(4000)) into ns from dual; DBMS_OUTPUT.PUT_LINE('namespace: ' || ns); END LOOP; EXCEPTION WHEN ORDSYS.ORDImageExceptions.NULL_CONTENT THEN DBMS_OUTPUT.PUT_LINE('imageBlob is null'); WHEN OTHERS THEN RAISE; END; /
getMetadata(imageBlob IN NOCOPY BLOB,
metadataType IN VARCHAR2 DEFAULT 'ALL')
RETURN XMLSequenceType;
Extracts the specified types of metadata from the imageBlob and returns an array of schema-valid XML documents. If no matching metadata is found, an empty array is returned.
The image data represented as a BLOB.
A string that identifies the types of embedded metadata to extract. Valid values are: ALL
, ORDIMAGE
, XMP
, EXIF
, and IPTC-IIM
. The default value is ALL
.
When the value of input parameter metadataType is ALL
, and two or more types of supported metadata are present in the image, this method returns several XML documents, one for each type of metadata found. For other values of the input parameter, the method returns zero or one XML document.
Each document is stored as an instance of XMLType, and is based on one of the metadata schemas. Use the XQuery function fn:namespace-uri
to determine the type of metadata represented in that document.
See Appendix F for information about the supported metadata schemas.
See Also:
Oracle Multimedia User's Guide for more information about the metadata feature
Oracle XML DB Developer's Guide for more information about XQuery functions
ORDImageExceptions.NULL_CONTENT
This exception is raised when the imageBlob parameter is NULL.
See Appendix G for more information about this exception.
Extract the embedded metadata from an imageBlob, and return an array of schema-valid XML documents:
DECLARE imageBlob BLOB; metav XMLSequenceType; ns varchar2(4000); BEGIN SELECT ad_photo INTO imageBlob FROM pm.print_media WHERE product_id = 3106; metav := ORDSYS.ORDImage.getMetadata(imageBlob, 'ALL'); -- print the namespace of each metadata document FOR i in 1..metav.count LOOP select xmlcast(xmlquery('fn:namespace-uri($x)' passing metav(i) as "x" returning content) as varchar2(4000)) into ns from dual; DBMS_OUTPUT.PUT_LINE('namespace: ' || ns); END LOOP; EXCEPTION WHEN ORDSYS.ORDImageExceptions.NULL_CONTENT THEN DBMS_OUTPUT.PUT_LINE('imageBlob is null'); WHEN OTHERS THEN RAISE; END; /
Reads the image BFILE data to get the values of the media attributes for supported formats, and then stores them in the input CLOB. This method populates the CLOB with a set of format properties in XML form.
The image data represented as a BFILE.
The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with a set of format properties of the image BFILE data in XML form.
ORDImageExceptions.NULL_CONTENT
This exception is raised when the imageBfile parameter is NULL.
See Appendix G for more information about this exception.
Get the property information for known image attributes:
DECLARE img_attrib CLOB; data BFILE := BFILENAME('IMAGEDIR','testimg.dat'); BEGIN DBMS_LOB.CREATETEMPORARY(img_attrib, FALSE, DBMS_LOB.CALL); ORDSYS.ORDImage.getProperties(data, img_attrib); DBMS_OUTPUT.put_line('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(img_attrib))); EXCEPTION WHEN OTHERS THEN RAISE; END; /
getProperties(imageBfile IN OUT NOCOPY BFILE,
attributes IN OUT NOCOPY CLOB,
mimeType OUT VARCHAR2,
width OUT INTEGER,
height OUT INTEGER,
fileFormat OUT VARCHAR2,
contentFormat OUT VARCHAR2,
compressionFormat OUT VARCHAR2,
contentLength OUT INTEGER);
Reads the image BFILE data to get the values of the media attributes for supported formats, and then stores them in the input CLOB and returns them as explicit parameters. This method gets the properties for these attributes of the image data: MIME type, width, height, file format, content format, compression format, and content length. It populates the CLOB with a set of format properties in XML form.
The image data represented as a BFILE.
The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with a set of format properties of the image BFILE data in XML form.
The MIME type of the image data.
The width of the image in pixels.
The height of the image in pixels.
The format of the image data.
The type of image (monochrome, and so on).
The compression algorithm used on the image data.
The size of the image file on disk, in bytes.
If a property cannot be extracted from the media source, then the respective parameter is set to NULL.
ORDImageExceptions.NULL_CONTENT
This exception is raised when the imageBfile parameter is NULL.
See Appendix G for more information about this exception.
Get the property information for known image attributes:
DECLARE img_data BFILE := BFILENAME('IMAGEDIR','testimg.dat'); img_attrib CLOB; mimeType VARCHAR2(80); width NUMBER; height NUMBER; fileFormat VARCHAR2(32); contentFormat VARCHAR2(4000); compressionFormat VARCHAR2(4000); contentLength NUMBER; BEGIN DBMS_LOB.CREATETEMPORARY(img_attrib, FALSE, DBMS_LOB.CALL); ORDSYS.ORDImage.getProperties(img_data, img_attrib, mimeType, width, height, fileFormat, contentFormat, compressionFormat, contentLength); DBMS_OUTPUT.put_line('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(img_attrib))); DBMS_OUTPUT.put_line('mimeType: ' || mimeType ); DBMS_OUTPUT.put_line('width: ' || width ); DBMS_OUTPUT.put_line('height: ' || height ); DBMS_OUTPUT.put_line('fileFormat: ' || fileFormat ); DBMS_OUTPUT.put_line('contentFormat: ' || contentFormat ); DBMS_OUTPUT.put_line('compressionFormat: ' || compressionFormat ); DBMS_OUTPUT.put_line('contentLength: ' || contentLength ); EXCEPTION WHEN OTHERS THEN RAISE; END; /
Reads the image BLOB data to get the values of the media attributes for supported formats, and then stores them in the input CLOB. This method populates the CLOB with a set of format properties in XML form.
The image data represented as a BLOB.
The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with a set of format properties of the image BLOB data in XML form.
ORDImageExceptions.NULL_CONTENT
This exception is raised when the imageBlob parameter is NULL.
See Appendix G for more information about this exception.
Get the property information for known image attributes:
DECLARE img_attrib CLOB; img_data BLOB; BEGIN SELECT img, attributes INTO img_data, img_attrib FROM timg WHERE N = 1 FOR UPDATE; ORDSYS.ORDImage.getProperties(img_data, img_attrib); DBMS_OUTPUT.put_line('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(img_attrib))); UPDATE timg SET img=img_data, attributes=img_attrib WHERE N=1; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
getProperties(imageBlob IN BLOB,
attributes IN OUT NOCOPY CLOB,
mimeType OUT VARCHAR2,
width OUT INTEGER,
height OUT INTEGER,
fileFormat OUT VARCHAR2,
contentFormat OUT VARCHAR2,
compressionFormat OUT VARCHAR2,
contentLength OUT INTEGER);
Reads the image BLOB data to get the values of the media attributes for supported formats, and then stores them in the input CLOB and returns them as explicit parameters. This method gets the properties for these attributes of the image data: MIME type, width, height, file format, content format, compression format, and content length. It populates the CLOB with a set of format properties in XML form.
The image data represented as a BLOB.
The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with a set of format properties of the image BLOB data in XML form.
The MIME type of the image data.
The width of the image in pixels.
The height of the image in pixels.
The format of the image data.
The type of image (monochrome, and so on).
The compression algorithm used on the image data.
The size of the image file on disk, in bytes.
If a property cannot be extracted from the media source, then the respective parameter is set to NULL
.
ORDImageExceptions.NULL_CONTENT
This exception is raised when the imageBlob parameter is NULL.
See Appendix G for more information about this exception.
Get the property information for known image attributes:
DECLARE img_data BLOB; img_attrib CLOB; mimeType VARCHAR2(4000); width NUMBER; height NUMBER; fileFormat VARCHAR2(32); contentFormat VARCHAR2(4000); compressionFormat VARCHAR2(4000); contentLength NUMBER; BEGIN SELECT img, attributes, mimetype, width, height, fileformat, contentformat, compressionformat, contentlength INTO img_data, img_attrib, mimeType, width, height, fileFormat, contentFormat, compressionFormat, contentLength FROM timg WHERE N = 1 FOR UPDATE; ORDSYS.ORDImage.getProperties(img_data, img_attrib, mimeType, width, height, fileFormat, contentFormat, compressionFormat, contentLength); DBMS_OUTPUT.put_line('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(img_attrib))); DBMS_OUTPUT.put_line('mimeType: ' || mimeType ); DBMS_OUTPUT.put_line('width: ' || width ); DBMS_OUTPUT.put_line('height: ' || height ); DBMS_OUTPUT.put_line('fileFormat: ' || fileFormat ); DBMS_OUTPUT.put_line('contentFormat: ' || contentFormat ); DBMS_OUTPUT.put_line('compressionFormat: ' || compressionFormat ); DBMS_OUTPUT.put_line('contentLength: ' || contentLength ); UPDATE timg SET img=img_data, attributes=img_attrib, mimetype=mimeType, width=width, height=height, fileformat=fileFormat, contentformat=contentFormat, compressionformat=compressionFormat, contentlength=contentLength WHERE N=1; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
Performs one or more image processing operations on a BLOB, writing the image back onto itself.
The image data represented as a BLOB.
A list of image processing operations to perform on the image.
You can change one or more of the image attributes shown in Table 5-1. Table 5-2 shows additional changes that can be made only to raw pixel and foreign images.
See Appendix D for more information about process( ) operators.
The process( ) method changes image attributes, therefore if you are storing image attributes, call the getProperties( ) method after calling the process( ) method.
ORDImageExceptions.DATA_NOT_LOCAL
This exception is raised if you call the process( ) method and the imageBlob parameter is not initialized.
See Appendix G for more information about this exception.
Example 1:
Change the image in the image_data BLOB to use higher quality JPEG compression and double the length of the image along the X-axis:
ORDSYS.ORDImage.process( image_data,'compressionFormat=JPEG,compressionQuality=MAXCOMPRATIO, xScale="2.0"');
Note:
Changing the length on one axis (for example, xScale=2.0) does not affect the length on the other axis; thus, it distorts the image. Only the xScale and yScale operators can be combined in a single scale operation; any other combination of scale operators causes an error.Example 2:
Create at most a 32-by-32 pixel thumbnail image, preserving the original aspect ratio. The maxScale and fixedScale operators are especially useful for creating thumbnail images from various-sized originals:
ORDSYS.ORDImage.process(image_data, 'maxScale=32 32');
Example 3:
Convert the image to TIFF:
DECLARE img_attrib CLOB; image_data BLOB; BEGIN SELECT img, attributes INTO image_data, img_attrib FROM timg WHERE N = 1 FOR UPDATE; ORDSYS.ORDImage.process(image_data, 'fileFormat=TIFF'); ORDSYS.ORDImage.getProperties(image_data, img_attrib); UPDATE timg SET img = image_data, attributes=img_attrib WHERE N = 1; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
Reads the image in the source BFILE, performs one or more image processing operations on the image, and then stores the resulting image in the destination BLOB. The original image content in the source BFILE remains unchanged.
The image data represented as a BFILE.
A list of image processing changes to make for the image in the destination BLOB.
The destination of the new image.
See Table 5-1 and Table 5-2 for information about image processing operators.
Calling this method processes the image into the destination BLOB from any source BFILE.
The processCopy( ) method changes image attributes, therefore, if you are storing image attributes, call the getProperties( ) method on the destination image after calling the processCopy( ) method.
See Appendix D for more information about processCopy( ) operators.
ORDImageExceptions.NULL_DESTINATION
This exception is raised if you call the processCopy( ) method and the destination image is NULL.
ORDImageExceptions.NULL_LOCAL_DATA
This exception is raised when the imageBfile parameter is NULL.
See Appendix G for more information about these exceptions.
Generate a thumbnail image of, at most, 32 x 32 pixels in the destination image:
DECLARE dest_attrib CLOB; image_data BFILE := BFILENAME('IMAGEDIR','testimg.dat'); destination_data BLOB; the_Command VARCHAR2(4000); BEGIN SELECT img, attributes INTO destination_data, dest_attrib FROM timg WHERE N = 2 FOR UPDATE; the_Command := 'maxScale=32 32'; ORDSYS.ORDImage.processCopy(image_data, the_Command, destination_data); ORDSYS.ORDImage.getProperties(destination_data, dest_attrib); UPDATE timg SET img = destination_data, attributes=dest_attrib WHERE N = 2; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
Reads the image in the source BLOB, performs one or more image processing operations on the image, and then stores the resulting image in the destination BLOB. The original image content in the source BLOB remains unchanged.
The source image data represented as a BLOB.
A list of image processing changes to make for the image in the destination BLOB.
The destination of the new image.
See Table 5-1 and Table 5-2 for information about image processing operators.
Because temporary LOBs do not have read consistency, you cannot use the same temporary LOB for both the imageBlob and dest parameters.
Calling this method processes the image into the destination BLOB from any source BLOB.
The processCopy( ) method changes image attributes, therefore, if you are storing image attributes, call the getProperties( ) method on the destination image after calling the processCopy( ) method.
See Appendix D for more information about processCopy( ) operators.
ORDImageExceptions.DATA_NOT_LOCAL
This exception is raised if you call the processCopy( ) method and the imageBlob parameter is not initialized.
See Appendix G for more information about this exception.
Create a new image, changing the file format, compression format, and content format in the destination image:
DECLARE dest_attrib CLOB; image_data BLOB; destination_data BLOB; the_Command VARCHAR2(4000); BEGIN SELECT img INTO image_data FROM timg WHERE N = 1; SELECT img, attributes INTO destination_data, dest_attrib FROM timg WHERE N = 2 FOR UPDATE; the_Command := 'fileFormat=tiff, compressionFormat=packbits, contentFormat=8bitlut'; ORDSYS.ORDImage.processCopy(image_data, the_Command, destination_data); ORDSYS.ORDImage.getProperties(destination_data, dest_attrib); UPDATE timg SET img = destination_data, attributes=dest_attrib WHERE N = 2; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
putMetadata(imageBfile IN NOCOPY BFILE,
dest IN OUT NOCOPY BLOB
xmlData IN NOCOPY XMLType,
metadataType IN VARCHAR2 DEFAULT 'XMP',
encoding IN VARCHAR2 DEFAULT "UTF-8");
Accepts a BFILE containing an image and a schema-valid XML document, and creates a binary packet suitable for embedding in the target image file format. The packet is encoded according to the value of the encoding parameter. If the value of the metadataType parameter is XMP
, this method writes a new XMP packet to the image, replacing any existing XMP packets. The new image file with embedded metadata is returned in the dest parameter.
The BFILE handle to the image.
The BLOB to receive the image containing the embedded metadata.
The XMLtype that contains a schema-valid XML document for the indicated metadataType. If the value of the metadataType parameter is XMP
, the root element should contain a well-formed RDF document.
A string that specifies the type of metadata to write. The valid value is XMP
; it is also the default.
The character encoding to be used in the image file. Valid values are: UTF-8
, UTF-16
, UTF-16BE
, and UTF-16LE
. The default is UTF-8
.
The binary metadata packet generated from the same xmlData input may have different sizes for different encodings. Different image file formats support different encodings, and may restrict the binary metadata packet size. The restrictions of the supported image formats are as follows:
GIF89a supports UTF-8 encoding only.
JPEG requires a binary packet size of less than 65502 bytes.
TIFF requires a binary packet size of less than 4 gigabytes.
See Also:
Oracle Multimedia User's Guide for more information about the metadata feature
ORDImageExceptions.NULL_CONTENT
This exception is raised when the image is NULL.
ORDImageExceptions.NULL_DESTINATION
This exception is raised when the destination image is NULL.
See Appendix G for more information about these exceptions.
Insert a new image into the table pm.print_media
. The new image is a copy of the image keyboard.jpg
from the MEDIA_DIR
directory object, with updated XMP metadata:
DECLARE imageBfile BFILE := BFILENAME('MEDIA_DIR','keyboard.jpg'); dest BLOB; xmlData XMLType; BEGIN SELECT ad_photo INTO dest FROM pm.print_media WHERE product_id = 3106 FOR UPDATE; xmlData := xmltype( '<xmpMetadata xmlns="http://xmlns.oracle.com/ord/meta/xmp">' || '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"' || ' xmlns:dc="http://purl.org/dc/elements/1.1/">' || '<rdf:Description>' || ' <dc:rights>' || ' <rdf:Alt>' || ' <rdf:li>' || ' Oracle Corporation' || ' </rdf:li>' || ' </rdf:Alt>'|| ' </dc:rights>' || '</rdf:Description>' || '</rdf:RDF>' || '</xmpMetadata>', 'http://xmlns.oracle.com/ord/meta/xmp'); ORDSYS.ORDImage.putMetadata(imageBfile, dest, xmlData, 'xmp', 'utf-8'); UPDATE pm.print_media SET ad_photo = dest WHERE product_id = 3106; COMMIT; EXCEPTION WHEN ORDSYS.ORDImageExceptions.NULL_CONTENT THEN DBMS_OUTPUT.PUT_LINE('image source is null'); WHEN ORDSYS.ORDImageExceptions.NULL_DESTINATION THEN DBMS_OUTPUT.PUT_LINE('image destionation is null'); WHEN OTHERS THEN RAISE; END;/
putMetadata(imageBlob IN NOCOPY BLOB,
dest IN OUT NOCOPY BLOB
xmlData IN NOCOPY XMLType,
metadataType IN VARCHAR2 DEFAULT 'XMP',
encoding IN VARCHAR2 DEFAULT "UTF-8");
Accepts a BLOB containing an image and a schema-valid XML document, and creates a binary packet suitable for embedding in the target image file format. The packet is encoded according to the value of the encoding parameter. If the value of the metadataType parameter is XMP
, this method writes a new XMP packet to the image, replacing any existing XMP packets. The new image file with embedded metadata is returned in the dest parameter.
The BLOB handle to the image.
The BLOB to receive the image containing the embedded metadata.
The XMLtype that contains a schema-valid XML document for the indicated metadataType. If the value of the metadataType parameter is XMP
, the root element should contain a well-formed RDF document.
A string that specifies the type of metadata to write. The valid value is XMP
; it is also the default.
The character encoding to be used in the image file. Valid values are: UTF-8
, UTF-16
, UTF-16BE
, and UTF-16LE
. The default is UTF-8
.
Because temporary LOBs do not have read consistency, you cannot use one temporary LOB for both the imageBlob and dest parameters. The binary metadata packet generated from the same xmlData input may have different sizes for different encodings. Different image file formats support different encodings, and may restrict the binary metadata packet size. The restrictions of the supported image formats are as follows:
GIF89a supports UTF-8 encoding only.
JPEG requires a binary packet size of less than 65502 bytes.
TIFF requires a binary packet size of less than 4 gigabytes.
See Also:
Oracle Multimedia User's Guide for more information about the metadata feature
ORDImageExceptions.NULL_CONTENT
This exception is raised when the image is NULL.
ORDImageExceptions.NULL_DESTINATION
This exception is raised when the destination image is NULL.
See Appendix G for more information about these exceptions.
Replace an image in the table pm.print_media
with updated XMP metadata:
DECLARE imageBlob BLOB; tmp BLOB; xmlData XMLType; ctx RAW(64):=NULL; BEGIN SELECT ad_photo INTO imageBlob FROM pm.print_media WHERE product_id = 3106 FOR UPDATE; xmlData := xmltype( '<xmpMetadata xmlns="http://xmlns.oracle.com/ord/meta/xmp">' || '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"' || ' xmlns:dc="http://purl.org/dc/elements/1.1/">' || '<rdf:Description>' || ' <dc:rights>' || ' <rdf:Alt>' || ' <rdf:li>' || ' Oracle Corporation' || ' </rdf:li>' || ' </rdf:Alt>'|| ' </dc:rights>' || '</rdf:Description>' || '</rdf:RDF>' || '</xmpMetadata>', 'http://xmlns.oracle.com/ord/meta/xmp'); tmp := imageBlob; ORDSYS.ORDImage.putMetadata(tmp, imageBlob, xmlData, 'xmp', 'utf-8'); UPDATE pm.print_media SET ad_photo = imageBlob WHERE product_id = 3106; COMMIT; EXCEPTION WHEN ORDSYS.ORDImageExceptions.NULL_CONTENT THEN DBMS_OUTPUT.PUT_LINE('image source is null'); WHEN ORDSYS.ORDImageExceptions.NULL_DESTINATION THEN DBMS_OUTPUT.PUT_LINE('image destionation is null'); WHEN OTHERS THEN RAISE; END;/
This section presents reference information about these Oracle Multimedia static methods, which are unique to the ORDVideo relational interface:
The relational interface adds Oracle Multimedia support to video data stored in BLOBs and BFILEs rather than in the ORDVideo object type. The static methods that are unique to the ORDVideo relational interface are defined in the ordvspec.sql
file.
getProperties(ctx IN OUT RAW,
videoBfile IN OUT NOCOPY BFILE,
attributes IN OUT NOCOPY CLOB,
format IN VARCHAR2);
Reads the video BFILE data to get the values of the media attributes for supported formats, and then stores them in the input CLOB. This method populates the CLOB with an extensive set of format and application properties in XML form.
The format plug-in context information. (See Section 7.3.)
The video data represented as a BFILE.
The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the video BFILE data in XML form.
The format of the video data. If a non-NULL value is specified, then the format plug-in for this format type is invoked.
ORDSourceExceptions.EMPTY_SOURCE
This exception is raised when the value of the source.local attribute is 1
or 0
(TRUE), but the value of the source.localData attribute is NULL
.
ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION
This exception is raised if you call the getProperties( ) method and the video plug-in raises an exception.
See Appendix G for more information about these exceptions.
Get the property information for known video attributes:
DECLARE vid_attrib CLOB; ctx RAW(64) :=NULL; vid_data BFILE := BFILENAME('VIDEODIR','testvid.dat'); vid_format VARCHAR2(160) := NULL; BEGIN DBMS_LOB.CREATETEMPORARY(vid_attrib, FALSE, DBMS_LOB.CALL); ORDSYS.ORDVideo.getProperties(ctx, vid_data, vid_attrib, vid_format); DBMS_OUTPUT.put_line('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(vid_attrib))); EXCEPTION WHEN OTHERS THEN RAISE; END; /
getProperties(ctx IN OUT RAW,
videoBfile IN OUT NOCOPY BFILE,
attributes IN OUT NOCOPY CLOB,
mimeType OUT VARCHAR2,
format IN OUT VARCHAR2,
width OUT INTEGER,
height OUT INTEGER,
frameResolution OUT INTEGER,
frameRate OUT INTEGER,
videoDuration OUT INTEGER,
numberOfFrames OUT INTEGER,
compressionType OUT VARCHAR2,
numberOfColors OUT INTEGER,
bitRate OUT INTEGER);
Reads the video BFILE data to get the values of the media attributes for supported formats, and then stores them in the input CLOB and returns them as explicit parameters. This method gets the properties for these attributes of the video data: MIME type, format, frame size, frame resolution, frame rate, video duration, number of frames, compression type, number of colors, and bit rate. It populates the CLOB with an extensive set of format and application properties in XML form.
The format plug-in context information. (See Section 7.3.)
The video data represented as a BFILE.
The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the video BFILE data in XML form.
The MIME type of the video data.
The format of the video data. If a non-NULL value is specified, then the format plug-in for this format type is invoked. If specified as NULL
, the format of the video data is returned.
The width of the frame in pixels of the video data.
The height of the frame in pixels of the video data.
The number of pixels per inch of frames in the video data.
The number of frames per second at which the video data was recorded.
The total time required to play the video data.
The total number of frames in the video data.
The compression type of the video data.
The number of colors in the video data.
The bit rate in the video data.
If a property cannot be extracted from the media source, then the respective parameter is set to NULL.
ORDSourceExceptions.EMPTY_SOURCE
This exception is raised when the value of the source.local attribute is 1
or 0
(TRUE), but the value of the source.localData attribute is NULL
.
ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION
This exception is raised if you call the getProperties( ) method and the video plug-in raises an exception.
See Appendix G for more information about these exceptions.
Get the property information for known video attributes:
DECLARE vid_attrib CLOB; ctx RAW(64) :=NULL; vid_data BFILE := BFILENAME('VIDEODIR','testvid.dat'); mimeType VARCHAR2(80); format VARCHAR2(32) := NULL; width NUMBER; height NUMBER; frameResolution NUMBER; frameRate NUMBER; videoDuration NUMBER; numberOfFrames NUMBER; compressionType VARCHAR2(160); numberOfColors NUMBER; bitRate NUMBER; BEGIN DBMS_LOB.CREATETEMPORARY(vid_attrib, FALSE, DBMS_LOB.CALL); ORDSYS.ORDVideo.getProperties(ctx, vid_data, vid_attrib, mimeType, format, width, height, frameResolution, frameRate, videoDuration, numberOfFrames, compressionType, numberOfColors, bitRate); DBMS_OUTPUT.put_line('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(vid_attrib))); DBMS_OUTPUT.put_line('mimeType: ' || mimeType ); DBMS_OUTPUT.put_line('format: ' || format ); DBMS_OUTPUT.put_line('width: ' || width ); DBMS_OUTPUT.put_line('height: ' || height ); DBMS_OUTPUT.put_line('frameResolution: ' || frameResolution ); DBMS_OUTPUT.put_line('frameRate: ' || frameRate ); DBMS_OUTPUT.put_line('videoDuration: ' || videoDuration ); DBMS_OUTPUT.put_line('numberOfFrames: ' || numberOfFrames ); DBMS_OUTPUT.put_line('compressionType: ' || compressionType ); DBMS_OUTPUT.put_line('numberOfColors: ' || numberOfColors ); DBMS_OUTPUT.put_line('bitRate: ' || bitRate ); EXCEPTION WHEN OTHERS THEN RAISE; END; /
getProperties(ctx IN OUT RAW,
videoBlob IN BLOB,
attributes IN OUT NOCOPY CLOB,
format IN VARCHAR2);
Reads the video BLOB data to get the values of the media attributes for supported formats, and then stores them in the input CLOB. This method populates the CLOB with an extensive set of format and application properties in XML form.
The format plug-in context information. (See Section 7.3.)
The video data represented as a BLOB.
The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the video BLOB data in XML form.
The format of the video data. If a non-NULL value is specified, then the format plug-in for this format type is invoked.
ORDSourceExceptions.EMPTY_SOURCE
This exception is raised when the value of the source.local attribute is 1
or 0
(TRUE), but the value of the source.localData attribute is NULL
.
ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION
This exception is raised if you call the getProperties( ) method and the video plug-in raises an exception.
See Appendix G for more information about these exceptions.
Get the property information for known video attributes:
DECLARE vid_attrib CLOB; ctx RAW(64) :=NULL; vid_data BLOB; vid_format VARCHAR2(31) := NULL; BEGIN SELECT vid, attributes INTO vid_data, vid_attrib FROM tvid WHERE N = 1 FOR UPDATE; ORDSYS.ORDVideo.getProperties(ctx, vid_data, vid_attrib, vid_format); DBMS_OUTPUT.put_line('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(vid_attrib))); UPDATE tvid SET vid=vid_data, attributes=vid_attrib WHERE N=1; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
getProperties(ctx IN OUT RAW,
videoBlob IN BLOB,
attributes IN OUT NOCOPY CLOB,
mimeType OUT VARCHAR2,
format IN OUT VARCHAR2
width OUT INTEGER,
height OUT INTEGER,
frameResolution OUT INTEGER,
frameRate OUT INTEGER,
videoDuration OUT INTEGER,
numberOfFrames OUT INTEGER,
compressionType OUT VARCHAR2,
numberOfColors OUT INTEGER,
bitRate OUT INTEGER);
Reads the video BLOB data to get the values of the media attributes for supported formats, and then stores them in the input CLOB and returns them as explicit parameters. This method gets the properties for these attributes of the video data: MIME type, format, frame size, frame resolution, frame rate, video duration, number of frames, compression type, number of colors, and bit rate. It populates the CLOB with an extensive set of format and application properties in XML form.
The format plug-in context information. (See Section 7.3.)
The video data represented as a BLOB.
The CLOB to hold the XML attribute information generated by the getProperties( ) method. This CLOB is populated with an extensive set of format and application properties of the video BLOB data in XML form.
The MIME type of the video data.
The format of the video data. If a non-NULL value is specified, then the format plug-in for this format type is invoked. If specified as NULL
, the format of the video data is returned.
The width of the frame in pixels of the video data.
The height of the frame in pixels of the video data.
The number of pixels per inch of frames in the video data.
The number of frames per second at which the video data was recorded.
The total time required to play the video data.
The total number of frames in the video data.
The compression type of the video data.
The number of colors in the video data.
The bit rate in the video data.
If a property cannot be extracted from the media source, then the respective parameter is set to NULL.
ORDSourceExceptions.EMPTY_SOURCE
This exception is raised when the value of the source.local attribute is 1
or 0
(TRUE), but the value of the source.localData attribute is NULL
.
ORDVideoExceptions.VIDEO_PLUGIN_EXCEPTION
This exception is raised if you call the getProperties( ) method and the video plug-in raises an exception.
See Appendix G for more information about these exceptions.
Get the property information for known video attributes:
DECLARE vid_attrib CLOB; ctx RAW(64) :=NULL; vid_data BLOB; mimeType VARCHAR2(80); format VARCHAR2(32); width NUMBER; height NUMBER; frameResolution NUMBER; frameRate NUMBER; videoDuration NUMBER; numberOfFrames NUMBER; compressionType VARCHAR2(160); numberOfColors NUMBER; bitRate NUMBER; BEGIN SELECT vid, attributes, mimetype, format, width, height, frameresolution, framerate, videoduration, numberofframes, compressiontype, numberofcolors, bitrate INTO vid_data, vid_attrib, mimeType, format, width, height, frameResolution, frameRate, videoDuration, numberOfFrames, compressionType, numberOfColors, bitRate FROM tvid WHERE N = 1 FOR UPDATE; ORDSYS.ORDVideo.getProperties(ctx, vid_data, vid_attrib, mimeType, format, width, height, frameResolution, frameRate, videoDuration, numberOfFrames, compressionType, numberOfColors, bitRate); DBMS_OUTPUT.put_line('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(vid_attrib))); DBMS_OUTPUT.put_line('mimeType: ' || mimeType ); DBMS_OUTPUT.put_line('format: ' || format ); DBMS_OUTPUT.put_line('width: ' || width ); DBMS_OUTPUT.put_line('height: ' || height ); DBMS_OUTPUT.put_line('frameResolution: ' || frameResolution ); DBMS_OUTPUT.put_line('frameRate: ' || frameRate ); DBMS_OUTPUT.put_line('videoDuration: ' || videoDuration ); DBMS_OUTPUT.put_line('numberOfFrames: ' || numberOfFrames ); DBMS_OUTPUT.put_line('compressionType: ' || compressionType ); DBMS_OUTPUT.put_line('numberOfColors: ' || numberOfColors ); DBMS_OUTPUT.put_line('bitRate: ' || bitRate ); UPDATE tvid SET vid=vid_data, attributes=vid_attrib, mimetype=mimeType, format=format, width=width, height=height, frameresolution=frameResolution, framerate=frameRate, videoduration=videoDuration, numberofframes=numberOfFrames, compressiontype=compressionType, numberofcolors=numberOfColors, bitrate=bitRate WHERE N=1; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /