Oracle interMedia Audio, Image, and Video Java Classes User's Guide and Reference Release 8.1.7 Part Number A85374-01 |
|
interMedia Java Classes describes the ORDVideo object type, which supports the storage and management of video data.
Methods invoked at the ORDVideo level that are handed off for processing to the database source plug-in or database format plug-in have byte[ ] ctx[ ]
as a context parameter. In cases where a client system is connecting to a database server, the space for the parameter is created by the client (in the reference examples, 4000 bytes of space), but the content of the context parameter is generated by the server. The context parameter is passed from the client to the server for the processing of context information.
See Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.
You will need to include the following import statements in your Java file in order to run interMedia methods:
import java.sql.*; import java.io.*; import oracle.jdbc.driver.*; import oracle.sql.*; import oracle.ord.im.*;
The examples in this reference chapter are based on the assumption that the following operations have already been performed:
For examples of making a connection and populating a local object, see Section 2.3.2.
This section presents reference information on the methods that operate on ORDVideo objects.
public boolean checkProperties(byte[ ] ctx[ ])
Checks if the properties stored in the object attributes of the application ORDVideo object are consistent with the values stored in the application BLOB data.
The format plug-in context information. It is set to NULL if there is no context information.
This method returns TRUE if the attribute values stored in the object attributes are the same as the properties stored in the BLOB data; FALSE otherwise.
java.sql.SQLException
byte[ ] ctx[ ] = new byte[4000][1]; if(vidObj.checkProperties(ctx)) System.out.println("checkProperties successful");
where:
public void clearLocal( )
Clears the source local field of the application ORDVideo object.
None.
None.
java.sql.SQLException
vidObj.clearLocal( );
public int closeSource(byte[ ] ctx[ ])
Closes the file source of the application ORDVideo object.
The source plug-in context information. It is set to NULL if there is no context information.
This method returns 0 if the operation is successful, or an integer greater than 0 in case of failure.
java.sql.SQLException
byte[ ] ctx[ ] = new byte[4000][1]; int i = vidObj.closeSource(ctx); if(i == 0) System.out.println("closeSource successful");
where:
public void deleteContent( )
Deletes the media data in the application ORDVideo object.
None.
None.
java.sql.SQLException
vidObj.deleteContent( );
public void export (byte[ ] ctx[ ], String sourceType, String sourceLocation, String sourceName)
Exports the data from the application ORDVideo object to the location specified in the parameters. The location is of the form:
sourceType://sourceLocation/sourceName
This method will work only if you are running Oracle8i database server release 8.1.7 or later.
See Chapter 4 of Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.
The source plug-in context information. It is set to NULL if there is no context information.
The source type to which the content will be exported.
The source location to which the content will be exported.
The source name to which the content will be exported.
None.
java.sql.SQLException
byte[ ] ctx[ ] = new byte[4000][1]; vidObj.export(ctx,"FILE","VIDEODIR","complete.dat");
where:
public CLOB getAllAttributes(byte[ ] ctx[ ])
Gets all the attributes from the application ORDVideo object and puts them in a CLOB.
The format plug-in context information. It is set to NULL if there is no context information.
This method returns a CLOB that contains the attribute values of the ORDVideo object.
java.sql.SQLException
byte[ ] ctx[ ] = new byte[4000][1]; CLOB attributes = vidObj.getAllAttributes(ctx);
where:
public String getAttribute(byte[ ] ctx[ ], String name)
Gets the value of a specified attribute from the application ORDVideo object as a String.
The format plug-in context information. It is set to NULL if there is no context information.
The name of the attribute to get.
This method returns the value of the specified attribute, as a String.
java.sql.SQLException
byte[ ] ctx[ ] = new byte[4000][1]; String attribute = vidObj.getAttribute(ctx, video_duration);
where:
public oracle.sql.BFILE getBFILE( )
Gets the BFILE attribute of the application ORDVideo object.
None.
This method returns the BFILE.
java.sql.SQLException
BFILE videoBFILE = vidObj.getBFILE( );
public int getBitRate( )
Gets the bit rate of the application ORDVideo object, in bits per second.
None.
This method returns the bit rate of the ORDVideo object.
java.sql.SQLException
int bitRate = vidObj.getBitRate( );
public oracle.sql.CLOB getComments( )
Gets the comments from the application ORDVideo object and loads them into a CLOB.
None.
This method returns a CLOB that contains the comments from the ORDVideo object.
java.sql.SQLException
CLOB comments = vidObj.getComments( );
public String getCompressionType( )
Gets the compression type of the application ORDVideo object as a String.
None.
This method returns the compression type of the ORDVideo object, as a String.
java.sql.SQLException
String compressionType = vidObj.getCompressionType( );
public oracle.sql.BLOB getContent( )
Gets the LOB locator from the application ORDVideo object.
None.
This method returns the LOB locator of the application object.
java.sql.SQLException
BLOB localContent = vidObj.getContent( );
public BLOB getContentInLob(byte[ ] ctx[ ], String mimetype[ ], String format[ ])
Gets the content of the application ORDVideo object and puts it in a BLOB.
The source plug-in context information. It is set to NULL if there is no context information.
The MIME type of the content returned, stored in mimetype[0]
The format of the content returned, stored in format[0].
This method returns the LOB content in another LOB locator.
java.sql.SQLException
byte[ ] ctx[ ] = new byte[4000][1]; String mimeType[ ] = new String[1]; mimeType[0] = "audio/x-aiff" String format[ ] = new String[1]; format[0] = "AIFF" BLOB localContent = vidObj.getContentInLob(ctx,mimeType,format);
where:
public int getContentLength( )
Gets the content length of the media data in the application ORDVideo object.
None.
This method returns the content length of the media data.
java.sql.SQLException
int contentLength = vidObj.getContentLength( );
public int getContentLength(byte[ ] ctx[ ])
Gets the content length of the media data in the application ORDVideo object.
The source plug-in context information. It is set to NULL if there is no context information.
This method returns the content length of the media data.
java.sql.SQLException
byte[ ] ctx[ ] = new byte[4000][1]; int contentLength = vidObj.getContentLength(ctx);
where:
public byte[ ] getDataInByteArray( )
Gets data from the LOB locator of the application ORDVideo object and puts it in a local byte array.
None.
This method returns the byte array from which the data will be read.
java.sql.SQLException
java.io.IOException
java.lang.OutOfMemoryError
byte[ ] byteArr = vidObj.getDataInByteArray( );
public boolean getDataInFile(String filename)
Gets data from the LOB locator of the application ORDVideo object and puts it in a local file.
The name of the file into which the data will be loaded.
This method returns TRUE if loading is successful; FALSE otherwise.
java.sql.SQLException
java.io.IOException
boolean load = vidObj.getDataInFile("output1.dat"); if(load) System.out.println("getDataInFile completed successfully"); else System.out.println("Error in getDataInFile");
where:
public InputStream getDataInStream( )
Gets data from the LOB locator of the application ORDVideo object and puts it in a local input stream.
None.
This method returns the input stream from which the data will be read.
java.sql.SQLException
InputStream inpStream = vidObj.getDataInStream( );
public String getDescription( )
Gets the description attribute of the application ORDVideo object.
None.
This method returns the description attribute as a String.
java.sql.SQLException
String description = vidObj.getDescription( );
public String getFormat( )
Gets the format attribute of the application ORDVideo object as a String.
None.
This method returns the format attribute as a String.
java.sql.SQLException
String format = vidObj.getFormat( );
public int getFrameRate( )
Get the frame rate in the application ORDVideo object, in frames per second.
None.
This method returns the frame rate of the ORDVideo object, as an integer.
java.sql.SQLException
int frameRate = vidObj.getFrameRate( );
public int getFrameResolution( )
Gets the frame resolution of the application ORDVideo object, in pixels per inch.
None.
This method returns the frame resolution of the ORDVideo object.
java.sql.SQLException
int frameResolution = vidObj.getFrameResolution( );
public int getHeight( )
Gets the height of the application ORDVideo object.
None.
This method returns the height of the ORDVideo object.
java.sql.SQLException
int height = vidObj.getHeight( );
public String getMimeType( )
Gets the MIME type of the application ORDVideo object as a String.
None.
This method returns the MIME type of the ORDVideo object, as a String.
java.sql.SQLException
String mimeType = vidObj.gtMimeType( );
public int getNumberOfColors( )
Gets the number of colors in the application ORDVideo object.
None.
This method returns the number of colors in the ORDVideo object, as an integer.
java.sql.SQLException
int numberOfColors = vidObj.getNumberOfColors( );
public int getNumberOfFrames( )
Gets the number of frames in the application ORDVideo object.
None.
This method returns the number of frames in the ORDVideo object, as an integer.
java.sql.SQLException
int numberOfFrames = vidObj.getNumberOfFrames( );
public String getSource( )
Gets the application ORDVideo object source information, including the source location, name, and type.
None.
This method returns a String containing the object source information.
java.sql.SQLException
String source = viObj.getSource( );
public String getSourceLocation( )
Gets the application ORDVideo object source location as a String.
None.
This method returns a String containing the object source location.
java.sql.SQLException
String location = vidObj.getSourceLocation( );
public String getSourceName( )
Gets the application ORDVideo object source name as a String.
None.
This method returns a String containing the object source name.
java.sql.SQLException
String name = vidObj.getSourceName( );
public String getSourceType( )
Gets the application ORDVideo object source location as a String.
None.
This method returns a String containing the object source type.
java.sql.SQLException
String type = vidObj.getSourceType( );
public java.sql.Timestamp getUpdateTime( )
Gets a Timestamp object that contains information on when the application ORDVideo object was most recently updated.
None.
This method returns a Timestamp object that contains the time of the most recent update.
java.sql.SQLException
Timestamp time = audObj.getUpdateTime( );
public int getVideoDuration( )
Gets the video duration of the application ORDVideo object.
None.
This method returns the video duration of the ORDVideo object.
java.sql.SQLException
int videoDuration = vidObj.getVideoDuration( );
public int getWidth( )
Gets the width of the application ORDVideo object.
None.
This method returns the width of the ORDVideo object.
java.sql.SQLException
int width = vidObj.getWidth( );
public void importData(byte[ ] ctx[ ])
Imports data from an external source into the application ORDVideo object.
The srcType, srcLocation, and srcName attributes must all be defined for this method to work.
The source plug-in context information. It is set to NULL if there is no context information.
None.
java.sql.SQLException
byte[ ] ctx[ ] = new byte[4000][1]; vidObj.importData(ctx);
where:
public void importFrom(byte[ ] ctx[ ], String sourceType, String sourceLocation, String sourceName)
Imports data from an external source into the application ORDVideo object. The location of the external source is of the form:
sourceType://sourceLocation/sourceName
The source plug-in context information. See Chapter 4 of Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.
The source type from which the data will be imported.
The source location from which the data will be imported.
The source name from which the data will be imported.
None.
java.sql.SQLException
byte[ ] ctx[ ] = new byte[4000][1]; vidObj.importFrom(ctx,"FILE","VIDEODIR","testvid.dat");
where:
public boolean isLocal( )
Checks if the application ORDVideo object local attribute is set.
None.
This method returns TRUE if the ORDVideo object local attribute is set; FALSE otherwise.
java.sql.SQLException
if(vidObj.isLocal( )) System.out.println("local attribute is set to true"); else System.out.println("lcoal attribute is set to false");
public boolean loadDataFromByteArray(byte[ ] byteArr)
Loads data from the local byte buffer into the database ORDVideo object LOB locator and into the application object. It also calls setLocal( ), which sets the local field of the application ORDVideo object, but not the database object, and setUpdateTime(null), which sets the updateTime attribute to the SYSDATE of the database server.
The name of the local byte array from which to load data.
This method returns TRUE if loading is successful; FALSE otherwise.
java.sql.SQLException
java.io.IOException
byte[ ] data = new byte[32000]; FileInputStream fStream = new FileInputStream("testvid.dat"); fStream.read(data,0,32300); boolean success = vidObj.loadDataFromByteArray(data); if(success) System.out.println("loadDataFromByteArray was successful"); else System.out.println("loadDataFromByteArray was unsuccessful");
where:
public boolean loadDataFromFile(String filename)
Loads data from the local file buffer into the database ORDVideo object LOB locator and into the application object. It also calls setLocal( ), which sets the local field of the application ORDVideo object, but not the database object, and setUpdateTime(null), which sets the updateTime attribute to the SYSDATE of the database server.
The name of the local file from which to load data.
This method returns TRUE if loading is successful; FALSE otherwise.
java.sql.SQLException
java.io.IOException
vidObj.loadDataFromFile("testvid.dat");
where:
public boolean loadDataFromInputStream(InputStream inpStream)
Loads data from the local input stream into the database ORDVideo object LOB locator and into the application object. It also calls setLocal( ), which sets the local field of the application ORDVideo object, but not the database object, and setUpdateTime(null), which sets the updateTime attribute to the SYSDATE of the database server.
The name of the local input stream from which to load data.
This method returns TRUE if loading is successful; FALSE otherwise.
java.sql.SQLException
java.io.IOException
FileInputStream fStream = new FileInputStream("testvid.dat"); vidObj.loadDataFromInputStream(fStream);
where:
public int openSource(byte[ ] userarg, byte[ ] ctx[ ])
Opens the file source of the application ORDVideo object.
Permission-related parameters that are supplied by the user, such as READONLY. These may be used by user-defined source plug-ins.
The parameter for passing the context information of the caller. See Chapter 4 of Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.
This method returns 0 if the operation is successful, or an integer greater than 0 in case of failure.
java.lang.Exception
byte[ ] userarg = new byte[4000]; byte[ ] ctx[ ] = new byte[4000][1]; int i = audObj.openSource(userarg,ctx); if(i == 0) System.out.println("openSource successful"); else System.out.println("openSource unsuccessful");
where:
public OrdVideo( )
Creates an ORDVideo object.
This method is the default ORDVideo constructor.
None.
None.
None.
None.
public byte[ ] processSourceCommand(byte[ ] ctx[ ], String command, String args, byte[ ] result[ ])
Processes the specified command on the application ORDVideo object by calling the database processSourceCommand( ) method.
The source plug-in context information. See Chapter 4 of Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.
The command to be executed.
The arguments of the command to be executed.
The results of the command.
This method returns the results of executing the command.
java.sql.SQLException
byte[ ] ctx[ ] = new byte[4000][1]; String command; String arguments; byte[ ] result; //assign a command value to command //assign any arguments to args byte[ ] commandResults = vidObj.processSourceCommand(ctx,command, arguments,result);
where:
public byte[ ] processVideoCommand(byte[ ] ctx[ ], String command, String args, byte[ ] result[ ])
Processes the specified command on the application ORDVideo object by calling the database processVideoCommand( ) method.
The format plug-in context information. It is set to NULL if there is no context information.
The command to be executed.
The arguments of the command to be executed.
The results of the command.
This method returns the results of executing the command.
java.sql.SQLException
byte[ ] ctx[ ] = new byte[4000][1] String command; String arguments; byte[ ] result; //assign a command value to command //assign any arguments to args byte[ ] commandResults = vidObj.processVideoCommand(ctx,command, arguments,result);
where:
public int readFromSource(byte[ ] ctx[ ], int startpos, int numbytes, byte[ ] buffer)
Reads data from the comments field of the application ORDVideo object.
The source plug-in context information. See Chapter 4 of Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.
The initial position in the comments field.
The number of bytes to be read.
The buffer into which the content will be read.
This method returns the number of bytes read.
java.sql.SQLException
byte[ ] ctx[ ] = new byte[4000][1]; byte[ ] commentBuffer = new byte[12]; int i = vidObj.readFromSource(ctx,0,12,commentBuffer);
where:
public void setBitRate(int bitRate)
Sets the bit rate of the application ORDVideo object.
setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.
The bit rate to be set in the ORDVideo object, in bits per second.
None.
java.sql.SQLException
vidObj.setBitRate(1500);
where:
public void setComments(oracle.sql.CLOB comments)
Sets the comments in the application ORDVideo object.
The comments attribute is reserved for use by interMedia. You can set your own value, but it could be overwritten by interMedia Annotator.
A CLOB that contains comments for the ORDVideo object.
None.
java.sql.SQLException
vidObj.setComments(commentsData);
where:
public void setCompressionType(String CompressionType)
Sets the compression type of the application ORDVideo object.
setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.
The compression type of the ORDVideo object, as a String.
None.
java.sql.SQLException
vidObj.setCompressionType("Cinepak");
where:
public void setDescription(String description)
Sets the description attribute of the application ORDVideo object.
A String that describes the contents of the ORDVideo object.
None.
java.sql.SQLException
vidObj.setDescription("My video file");
where:
public void setFrameRate(int frameRate)
Sets the frame rate of the application ORDVideo object.
setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.
The frame rate to be set in the ORDVideo object, in frames per second.
None.
java.sql.SQLException
vidObj.setFrameRate(5);
where:
public void setFrameResolution(int frameResolution)
Sets the frame resolution of the application ORDVideo object.
setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.
The frame resolution to be set in the ORDVideo object.
None.
java.sql.SQLException
vidObj.setFrameResolution(4);
where:
public void setFormat(String format)
Sets the format attribute of the application ORDVideo object.
setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.
The format of the contents of the ORDVideo object, as a String.
None.
java.sql.SQLException
vidObj.setFormat("MOOV");
where:
public void setHeight(int height)
Sets the height of the application ORDVideo object.
setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.
The height of the ORDVideo object, in pixels.
None.
java.sql.SQLException
vidObj.setHeight(24);
where:
public void setKnownAttributes(String knownformat, String knownwidth, String knownheight,
int knownframeresolution, int knownframerate, int knownvideoduration,
int knownnumberofframes, String knowncompressiontype,
int knownnumberofcolors, int knownbitrate
Sets the known attributes of the application ORDVideo object.
setProperties( ) will automatically set these attributes; use this method only if you are not using setProperties( ). Also, this method will set only the attribute values; it does not change the media file itself.
The video data format.
The video width.
The video height.
The frame resolution.
The frame rate.
The video duration.
The number of frames.
The compression type.
The number of colors.
The bit rate.
None.
java.sql.SQLException
vidObj.setKnownAttributes("MOOV",1,2,4,5,20,8,"Cinepak",256,1500);
where:
public void setLocal( )
Sets the source local field of the application ORDVideo object.
None.
None.
java.sql.SQLException
vidObj.setLocal( );
public void setMimeType(String MimeType)
Sets the MIME type of the application ORDVideo object.
setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.
The MIME type of the contents of the ORDVideo object, as a String.
None.
java.sql.SQLException
vidObj.setMimeType("video/avi");
where:
public void setNumberOfColors(int numberOfColors)
Sets the number of colors in the application ORDVideo object.
setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.
The number of colors to be set in the ORDVideo object.
None.
java.sql.SQLException
vidObj.setNumberOfColors(256);
where:
public void setNumberOfFrames(int numberOfFrames)
Sets the number of frames in the application ORDVideo object.
setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.
The number of frames to be set in the ORDVideo object.
None.
java.sql.SQLException
vidObj.setNumberOfFrames(8);
where:
public void setProperties(byte[ ] ctx[ ])
Reads the video data, extract the attributes, and sets the properties in the application ORDVideo object.
The properties to be set include format, frame size, frame resolution, frame rate, video duration, number of frames, compression type, number of colors, and bit rate.
The format plug-in context information. It is set to NULL if there is no context information.
None.
java.sql.SQLException
byte[ ] ctx[ ] = new byte[4000][1]; vidObj.setProperties(ctx);
where:
public void setProperties(byte[ ] ctx[ ], boolean setComments)
Reads the video data, extract the attributes, and sets the properties in the application ORDVideo object.
The properties to be set include format, frame size, frame resolution, frame rate, video duration, number of frames, compression type, number of colors, and bit rate.
The format plug-in context information. It is set to NULL if there is no context information.
A Boolean value to determine whether or not to set the comments in the ORDAudio object. If TRUE, the comments field is populated with a set of format and application properties of the audio object in XML. If FALSE, the comments field remains unpopulated. The default value is FALSE.
None.
java.sql.SQLException
byte[ ] ctx[ ] = new byte[4000][1]; vidObj.setProperties(ctx,true);
where:
public void setSource(String sourceType, String sourceLocation, String sourceName)
Sets the application ORDVideo object source information.
The type of the source.
The location of the source.
The name of the source.
None.
java.sql.SQLException
vidObj.setSource("LOCAL","VIDEODIR","video.dat");
where:
public void setUpdateTime(java.sql.Timestamp currentTime)
Sets the update time in the application ORDVideo object to the current time.
setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.
The current time, which will be set in the ORDVideo object. This value should be NULL; the method will then use the SYSDATE of the database server.
None.
java.sql.SQLException
vidObj.setUpdateTime(null);
public void setVideoDuration(int videoDuration)
Sets the video duration of the application ORDVideo object.
setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.
The video duration of the ORDVideo object.
None.
java.sql.SQLException
vidObj.setVideoDuration(20);
where:
public void setWidth(int width)
Sets the width of the application ORDVideo object.
setProperties( ) will automatically set this attribute; use this method only if you are not using setProperties( ). Also, this method will set only the attribute value; it does not change the media file itself.
The width value to be set, in pixels.
None.
java.sql.SQLException
vidObj.setWidth(24);
where:
public int trimSource(byte[ ] ctx[ ], int newLen)
Trims the application ORDVideo file source to the given length.
The source plug-in context information. It is set to NULL if there is no context information.
The length to which the source will be trimmed.
This method returns 0 if the operation is successful, or an integer greater than 0 in case of failure.
java.sql.SQLException
byte[ ] ctx[ ] = new byte[4000][1]; int i = vidObj.trimSource(ctx,10); if (i == 0) System.out.println("trimSource successful"); else System.out.println("trimSource unsuccessful");
where:
public int writeToSource(byte[ ] ctx[ ], int startpos, int numbytes, byte[ ] buffer)
Writes data to the comments field of the application ORDVideo object.
The source plug-in context information. See Chapter 4 of Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.
The initial position in the comments field.
The number of bytes to be written.
The buffer containing the content to be written.
This method returns the number of bytes written.
java.sql.SQLException
byte[ ] ctx[ ] = new byte[4000][1]; byte[ ] data = new byte[20]; //populate data with 20 bytes of content int i = vidObj.writeToSource(ctx,1,20,data);
where:
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|