Oracle8i interMedia Audio, Image, and Video User's Guide and Reference Release 8.1.5 A67299-01 |
|
Oracle8i interMedia includes a number of scripts and sample programs that you can use.
Sample Oracle8i interMedia scripts and programs are available in the following directories after you install this product:
$ORACLE_HOME/ord/aud/demo/ $ORACLE_HOME/ord/img/demo/ $ORACLE_HOME/ord/vid/demo/
The audio scripts consist of the following files:
See the README.txt file in the$ORACLE_HOME/ord/aud/demo directory for requirements and instructions on running this SQL demo.
Once you have installed Oracle8i interMedia image, you may choose to run the Oracle8i interMedia image demonstration program. This program can also be used as a test to confirm successful installation.
This section contains the steps required to build and run the interMedia image demo.
The interMedia image demo files are located in <ORACLE_HOME>/ord/img/demo, where <ORACLE_HOME> is the ORACLE_HOME directory.
% svrmgrl SVRMGRL> connect internal; SVRMGRL> create user SCOTT identified by tiger; SVRMGRL> grant connect,resource to SCOTT;
% svrmgrl SVRMGRL> connect internal; SVRMGRL> create or replace directory imgdemodir as `<ORACLE_HOME>/ord/img/ demo';
The directory specification is operating system specific. See the installation and configuration guide for your operating system for details on how to properly specify the location.
SVRMGRL> grant read on directory imgdemodir to public with grant option;
% cd <ORACLE_HOME>/ord/img/demo % make -f demo_ordimg.mk imgdemo
The make operation is operating system specific. See the installation and configuration guide for your operating system for details on how to make this program on your operating system.
The file imgdemo is a sample program that shows how Oracle8i interMedia image can be used from within a program. The demo is written in C and uses OCI, Oracle Call Interface, to access the database and exercise Oracle8i interMedia image.
The program operates on imgdemo.dat, which is a bitmap (BMP) image in the demo directory. Optionally, you can supply an image file name on the command line, provided the file resides in the same directory as the demo. In either case, once the image has been manipulated by Oracle8i interMedia image, the resulting image is written to the file imgdemo.out and can then be viewed with common rendering tools that you supply.
When the demo is run, it deletes and re-creates a table named IMGDEMOTAB in the SCOTT/TIGER schema of the default database. This table is used to hold the demo data. Once the table is created, a reference to the image file is inserted into the table. The data is then loaded into the table and converted to JFIF using the
processCopy( ) method of ORDImage.
The image properties are extracted within the database using the setProperties( ) method. An UPDATE command is issued after the setProperties( ) invocation. This is required because the setProperties( ) invocation has only updated a local copy of the type attributes.
Next, the Oracle8i interMedia image process( ) method is used to cut and scale the image within the database. This is followed by an update that commits the change. The program cuts a portion of the image 100 pixels wide by 100 pixels high starting from pixel location (100,100). This subimage is scaled to twice its original size and the resulting image is written out to the file system in a file named imgdemo.out.
Upon completion, the demo program leaves the imgdemo.out file in the current directory. It also leaves the table IMGDEMOTAB in the SCOTT/TIGER schema of the database.
Execute the demo by typing imgdemo on the command line. Optionally, a different image can be used in the demo by first copying the file to the directory in which the demo resides and then specifying its file name on the command line as an argument to imgdemo.
Use the following command:
$ imgdemo <optional-image-filename>
The demo displays a number of messages describing its progress, along with any errors encountered in the event that something was not set up correctly. Expect to see the following messages:
Dropping table IMGDEMOTAB... Creating and populating table IMGDEMOTAB... Loading data into cartridge... Modifying image characteristics... Writing image to file imgdemo.out... Disconnecting from database... Logged off and detached from server. Demo completed successfully.
If the program encounters any errors, it is likely that either Oracle8i interMedia image software has not been installed correctly or the database has not been started. If the program completes successfully, the original image and the resultant image, which has undergone the cutting and scaling described earlier, can be viewed with common image rendering tools.
The video scripts consist of the following files:
See the README.txt file in the $ORACLE_HOME/ord/vid/demo directory for requirements and instructions on how to run this SQL demo.
A Java demo has been provided to help you learn to use both the audio and video client-side Java classes so you can build your own applications. In these two demos, the audio and video object is instantiated at the client side and a number of accessor methods are invoked. The audio Java demo files are located in the ORACLE_HOME/ord/aud/demo directory and the video Java demo files are located in the $ORACLE_HOME/ord/vid/demo directory. See the README.txt file in each directory for requirements and instructions on how to run each respective Java demo.