IBM VideoCharger Player Version 2.0
Software Developer's Kit
Notices
Trademarks
Introduction
to the IBM VideoCharger Player SDK
API
Language Reference
Steps to Use the API in a Visual Basic Application
Steps to Use the API in a Visual J++ Application
Steps to Use the API in a Visual C++ Application
Visual C++
and Visual Basic Code Samples
Before using this document, read the general information under "Notices".
First Edition, July 1999
This edition applies to Version 2.0 of the IBM VideoCharger Player Software Developer's
Kit and to all subsequent releases and modifications
until otherwise indicated in new editions or technical newsletters.
(c) Copyright International Business Machines Corporation 1999. All rights
reserved.
This information was developed for products and services offered in the
U.S.A. IBM may not offer the products, services, or features discussed in
this document in other countries. Consult your local IBM representative for
information on the products and services currently available in your area.
Any reference to an IBM product, program, or service is not intended to state
or imply that only that IBM product, program, or service may be used. Any
functionally equivalent product, program, or service that does not infringe
any IBM intellectual property right may be used instead. However, it is the
user's responsibility to evaluate and verify the operation of any non-IBM
product, program, or service.
IBM may have patents or pending patent applications covering subject matter
described in this document. The furnishing of this document does not give
you any license to these patents. You can send license inquiries, in writing,
to:
IBM Director of Licensing
IBM Corporation
North Castle Drive
Armonk, NY 10504-1785
U.S.A.
For license inquiries regarding double-byte (DBCS) information, contact
the IBM Intellectual Property Department in your country or send inquiries,
in writing, to:
IBM World Trade Asia Corporation
IBM Corporation
Licensing
2-31 Roppongi 3-chome, Minato-ku
Tokyo 106, Japan
The following paragraph does not apply to the United Kingdom
or any other country where such provisions are inconsistent with local law:
INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY
OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of
express or implied warranties in certain transactions, therefore, this statement
may not apply to you.
This information could include technical inaccuracies or typographical
errors. Changes are periodically made to the information herein; these changes
will be incorporated in new editions of the publication. IBM may make improvements
and/or changes in the product(s) and/or the program(s) described in this publication
at any time without notice.
Licensees of this program who wish to have information about it for the
purpose of enabling: (i) the exchange of information between independently
created programs and other programs (including this one) and (ii) the mutual
use of the information which has been exchanged, should contact:
IBM Corporation
Department W92/H3
555 Bailey Avenue
P.O. Box 49023
San Jose, CA 95161-9023
U.S.A.
Such information may be available, subject to appropriate terms and conditions,
including in some cases, payment of a fee.
The licensed program described in this information and all licensed material
available for it are provided by IBM under terms of the IBM Customer Agreement,
IBM International Program License Agreement, or any equivalent agreement between
us.
The following terms are trademarks of International Business
Machines Corporation in the United States or other countries or
both:
- ADSTAR
- AIX
- AIXwindows
- DB2
- NetView
- Micro Channel
- RS/6000
- StorageSmart
- IBM
Java is a trademark of Sun Microsystems, Inc. Java and all Java-based trademarks
and logos are trademarks or registered trademarks of Sun Microsystems, Inc.
in the United States and/or other countries.
Microsoft, Windows, Windows NT, and the Windows logo are trademarks of
Microsoft Corporation in the United States and/or other countries.
Other company, product, and service names may be trademarks or service
marks of others.
The VideoCharger Player provides a high level API based on the ActiveX component
specification for the Windows 95/98/NT environment. It enables custom Windows
applications to access streaming video and audio from a VideoCharger Server. The API
defines the basic control operations for playing media such as play, pause, stop and seek. Applications can integrate the video window provided by the player API
into its application without detail knowledge of the internal operations of the
VideoCharger Server.
Installing the Player SDK
- You must already have installed the VideoCharger Player on your PC.
- Unzip iscsdk.zip in the existing "IBM VideoCharger Player" directory.
The Player SDK consists of online help, the API DLL, associated source files,
and sample programs:
- "sdk\Doc\"
Directory containing the SDK Programming Reference in HTML format
for Visual Basic, Visual C++, and Visual J++(version 6.0) applications.
- "sdk\Src\"
Directory containing the C++ files used to access the ActiveX
Mplayer APIs.
- "sdk\Samples\"
Directories containing sample Visual Basic, Visual C++, and Visual J++(version 6.0) programs.
Users not familiar with the ActiveX Component Object Model (COM) should consult the
Microsoft Visual C++ or Visual Basic online help.
The Player API currently supports the operations of the IBM VideoCharger Player application
and the associated VideoCharger web browser plugin by providing the video display window and control operation.
These two applications define the initial API requirements and share the common services
of the Player API. The API consists of methods for initialization/cleanup,
metadata file interface, window control, VCR control, and advanced GUI functions.
The methods are listed alphabetically in this section.
As you will notice, each method is declared as a C++
method (STDMETHOD), followed by a Visual Basic subroutine (Sub), followed by
a J++ method.
STDMETHOD Cleanup ();
Sub Cleanup()
void Cleanup();
- Destroys and cleans up the ISCMPlayer object.
- Releases all interfaces to ActiveMovie filter graph and filters.
- Releases references to the video window and information panel.
STDMETHOD CreateInfoPanel( OAHWND hOleWnd);
Sub CreateInfoPanel(hOleWnd As Long)
void CreateInfoPanel( long hOleWnd);
- Creates the built-in information panel as a child window of the
specified parent window handle. The information panel is a black
panel at the bottom of the video window, above the VCR controls.
It displays:
- the duration (hh:mm:ss),
- the current time of the clip (hh1:mm1:ss1),
- the current status of the clip (Connecting|Playing|Paused|Stopped|Complete),
- the repeat count, if any (n of m)
- Parameter:
- hOleWnd: Handle of the parent window.
STDMETHOD DeleteMetaFile();
Sub DeleteMetaFile()
void DeleteMetaFile();
- Deletes the metadata file from the Windows TEMP directory.
If the metadata file is not in the TEMP directory, this function
assumes the user intends to reuse the metadata file again, and
does not delete the file.
STDMETHOD DisplayStatistics(OAHWND hOleWnd);
Sub DisplayStatistics(hOAWnd As Long)
void DisplayStatistics(long hOAWnd);
- Displays the statistics property sheet. The non-modal
statistics dialog displays:
- Normal play rate (bits per second)
- Network transmission rate achieved (bps)
- Transmission packet size (bytes)
- Received number of packets
- Lost number of packets
- Cache buffer utilization (percent and milliseconds)
- Parameter:
- hOleWnd: Handle of the parent window.
STDMETHOD Forward();
Sub Forward()
void Forward();
- Fast forwards the current position of the clip to the end, or to the
End Tab (SetTabEnd()).
- If Auto-rewind (SetAutoRewind())
has been set to TRUE (1), the position will then rewind to the
beginning of the clip, or to the Begin Tab
(SetTabBegin()).
STDMETHOD FullScreen();
Sub FullScreen()
void FullScreen();
- Switches the video from the current size to full screen mode.
- User can toggle Play and Pause by clicking the left mouse button.
- After user clicks right mouse button or hits any key,
the video changes back to the previous size.
STDMETHOD GetCurrentPlayPosition(double *pos);
Sub GetCurrentPlayPosition(pos As Double)
void GetCurrentPlayPosition(double* pos);
- Returns the current position in the output parameter.
- Parameter:
- pos: (OUT) The current position in reference time (number of 100-nanosceond
units).
STDMETHOD GetMovieName(BSTR *bsName);
Sub GetMovieName(bsName As String)
void GetMovieName(BSTR* bsName);
- Returns the name of the audio/video clip in the output parameter.
- For local files, the movie name is the filename.
- For streamed files, the movie name is the "title" of the asset in the
VideoCharger server.
- Parameter:
- bsName: (OUT) The string of the name of the clip.
STDMETHOD GetPlayDuration(double *duration);
Sub GetPlayDuration(duration As Double)
void GetPlayDuration(double* duration);
- Returns the audio/video clip's length in the output parameter.
- Parameter:
- duration: (OUT) The length of the clip in seconds.
STDMETHOD GetPlayingState(short *nPlayingState);
Sub GetPlayingState(nPlayingState As Integer)
void GetPlayingState(short* nPlayingState);
- Returns the playing state in the output parameter.
- The playing state can be set by calling
SetPlayState().
- Parameter:
- nPlayingState: (OUT) One of the values defined in iscplaysdk.h,
including: M_PLAYING (1) and M_STOP (3).
STDMETHOD GetInvalidCommands(ulong *restrictions);
Sub GetInvalidCommands(restrictions As UnknownType)
void GetInvalidCommands(unsigned long* restrictions);
- Returns the bit mask of the invalid VCR commands for the clip
in the output parameter. The user application can use this
information to disable specific VCR controls.
- Parameter:
- restrictions: (OUT) bit mask defined in iscplaysdk.h, including:
BIT_SEEKF (0x0001) and BIT_STOP (0x0020).
STDMETHOD GetPlayRange(double* pStart, double* pStop);
Sub GetPlayRange(pStart As Double, pStop As Double)
void GetPlayRange(double* pStart, double* pStop);
- Returns the start and stop positions in the output parameters.
- Parameters:
- pStart: (OUT) The start position in reference time (number of 100-nanosecond units).
- pStop: (OUT) The stop position in reference time.
STDMETHOD GetVideoSize(short *width, short *height);
Sub GetVideoSize(width As Integer, height As Integer)
void GetVideoSize(short* width, short* height);
- Returns the video's default dimensions in the output parameter.
- For audio only files, the dimensions are 0.
- Parameters:
- width: (OUT) The video's native width, as used in C++ Window GUI methods.
- height: (OUT) The video's native height, as used in C++ Window GUI methods.
STDMETHOD Initialize ( OAHWND hOleWnd, BOOL bNPlugIn, short nPlayType);
Sub Initialize(hOleWnd As Long, bNPlugIn As Long, nPlayType As Integer)
void Initialize ( long hOleWnd, long bNPlugIn, short nPlayType);
- Creates and initializes the ISCMPlayer object.
- SetMetaData() must be called
before this call.
- Returns 0 if successful, otherwise S_FALSE.
- Parameters:
- hOleWnd: Handle of the parent window.
- bPlugIn: This parameter is reserved. It must be set to FALSE or 0.
- nPlayType: This parameter must be set according to the results of
the SetMetaData parameter, pMetaError. If pMetaError is 0, set to
M_STREAMING (6). If pMetaError is 1, set to M_LOCALFILE (4), as defined in
iscplaysdk.h.
STDMETHOD InitRegData(BOOL bInitData);
Sub InitRegData(bInitData As Long)
void InitRegData(long bInitData);
- Initializes the ISCMPlayer registration data in the Windows Registry
under "My Computer\HKEY_CURRENT_USER\Software\IBM\ISCView\Settings".
- \PlayDll\CacheIOTime - 5000 (msec)
- \PlayDll\ConnectTimeout - 3600 (sec)
- \PlayDll\ConnectType - 3
- \PlayDll\MulticastDelay - 1000 (msec)
- \PlayDll\ServerPortRangeConfigured - 0
- \PlayDll\Transport - "DEFAULT"
- \Trace\TraceFile - ".\pcstrace.log"
- Parameter:
- bInitData: This parameter is reserved. It must be set to FALSE or 0.
STDMETHOD IsMulticast(BOOL *bMulticast);
Sub IsMultiCast(bMultiCast As Long)
void IsMulticast(long* bMulticast);
- Returns the playing state of the audio/video clip in the output parameter.
- Parameter:
- bMultiCast: (OUT) TRUE (1) if playing multicast, FALSE (0) if playing on-demand
or local file.
STDMETHOD Mute();
Sub Mute()
void Mute();
STDMETHOD NewClip ( OAHWND hOleWnd, UINT nPlayType);
Sub NewClip(hOleWnd As Long, nPlayType As Integer)
void NewClip ( long hOleWnd, short nPlayType);
- Terminates the current playing clip and creates a new ISCMPlayer object.
- Basically the same method as Initialize().
- Returns 0 if successful, otherwise S_FALSE.
- Parameters:
- hOleWnd: Handle of the parent window.
If NULL, it defaults to the current parent window.
- nPlayType: This parameter must be set according to the results of
the SetMetaData parameter, pMetaError. If pMetaError is 0, set to
M_STREAMING (6). If pMetaError is 1, set to M_LOCALFILE (4).
STDMETHOD Pause();
Sub Pause()
void Pause();
- Pauses the video/audio clip without changing the current position.
STDMETHOD Play();
Sub Play()
void Play();
- Starts or resumes a paused video/audio clip.
STDMETHOD ResetInfoPanel();
Sub ResetInfoPanel()
void ResetInfoPanel();
- Resets the information panel to the initial state.
- Resets the current position to 0.
- Clears any repeat count display.
STDMETHOD Rewind();
Sub Rewind()
void Rewind();
- Rewinds the current position of the clip to the beginning, or
to the Begin Tab (SetTabBegin()).
STDMETHOD SetAutoRepeat(BOOL bRepeat);
Sub SetAutoRepeat(bRepeat As Long)
void SetAutoRepeat(long bRepeat);
- Turns the auto repeat state ON or OFF according to the input parameter.
- Parameter:
- bRepeat: Set to TRUE (1) to automatically loop the clip when it reaches
the end. Set to FALSE (0) to stop the clip when it reaches the end.
STDMETHOD SetAutoRewind(BOOL rewind);
Sub SetAutoRewind(rewind As BOOL)
void SetAutoRewind(long rewind);
- Turns the auto rewind state ON or OFF according to the input parameter.
- Parameter:
- rewind: Set to TRUE (1) to automatically rewind the clip when it reaches
the end. Set to FALSE (0) to stop the clip at the end position when it reaches the end.
STDMETHOD SetConfiguration (short left, short right, short top, short bottom);
Sub SetConfiguration(left As Integer, right As Integer, top As Integer, bottom As Integer)
void SetConfiguration (short left, short right, short top, short bottom);
- Displays the configuration property sheet. The modal dialog contains
two tabbed windows for playback and network configurations.
- Parameters:
- left: The left coordinate of current player window.
- right: The right coordinate of current player window.
- top: The top coordinate of current player window.
- bottom: The bottom coordinate of current player window.
STDMETHOD SetInfoPanelPos( OAHWND hOleWnd,
short x, short y, short width, short height, BOOL bBottomLine);
Sub SetInfoPanelPos(hOleWnd As Long, x As Integer, y As Integer,
width As Integer, height As Integer, bBottomLine As Long)
void SetInfoPanelPos( long hOleWnd,
short x, short y, short width, short height, long bBottomLine);
- Sets the information panel's size and position by anchoring
itself to the bottom of the parent window. The input coordinates
are of the parent window.
- Parameters:
- hOleWnd: Handle of a window. If NULL, it defaults to the
current parent window.
- x: The left coordinates of the playing screen, as used by the C++ GUI methods.
- y: The top coordinates of the playing screen, as used by the C++ GUI methods.
- width: The width of the playing screen, as used by the C++ GUI methods.
- height: The height of the playing screen, as used by the C++ GUI methods.
- bBottomLine: This is a reserved parameter. It must be set to TRUE or 1.
STDMETHOD SetMetaData( BSTR szFile, short* pMetaError);
Sub SetMetaData(szFile As String, pMetaError As Integer)
void SetMetaData( BSTR szFile, short* pMetaError);
- Parses the specified metadata file received from the server.
- A metadata file is the initial control data passed to the player
requesting the player to receive and play the media stream.
It is an ASCII file including location and attributes of the server
and the selected videos. The Appendix contains an overview of the
metadata file structure. See the VideoCharger Programmers Reference
for complete details of the metadata file.
- The given file name can also be a local video/audio file.
- This is the first call to the Player API.
- Parameters:
- szFile: The fully qualified path of the metadata file or local
video/audio file.
- pMetaError: (OUT) The return code.
- 0 - successully parsed the metadata file,
- 1 - the file is a local file, or
- 2 - metadata file parse error.
STDMETHOD SetPlayState(short *nPlayingState);
Sub SetPlayState(nPlayState As Integer)
void SetPlayState(short nPlayState);
- Sets the playing state.
- The playing state can be retrieved by calling
GetPlayingState().
- Parameter:
- nPlayingState: One of the value defined in iscplaysdk.h,
including: M_PLAYING (1) and M_STOP (3).
STDMETHOD SetTabBegin(short t_step);
Sub SetTabBegin(t_step As Integer)
void SetTabBegin(short t_step);
- Sets the beginning play range either to the beginning
of the clip or to the current position, according to the input parameter.
- The playrange can be retrieved by calling
GetPlayRange().
- Parameter:
- t_step: Set to 1, to always begin at the current position.
Set to 0 to start at the beginning of the clip.
STDMETHOD SetTabEnd(short t_step);
Sub SetTabEnd(t_step As Integer)
void SetTabEnd(short t_step);
- Sets the ending play range either to the end of the clip or to the
current position, according to the input parameter.
- The playrange can be retrieved by calling
GetPlayRange().
- Parameter:
- t_step: Set to 1, to always stop at the current position.
Set to 0 to stop at the end of the clip.
STDMETHOD SetVolume(long volume);
Sub SetVolume(volume As Long)
void SetVolume(long volume);
- Sets the sound volume according to the input parameter.
- Parameter:
- volume: Set to a value from 1 to 10,000, where
1 is mute and 10,000 is the maximum volume.
STDMETHOD SetWindowPos ( OAHWND hOleWnd, short x, short y, short width, short height);
Sub SetWindowPos(hOleWnd As Long, x As Integer, y As Integer, width As Integer, height As Integer)
void SetWindowPos ( long hOleWnd, short x, short y, short width, short height);
- Sets the ISCMPlayer's dimensions and position on the parent window.
- Parameters:
- hOleWnd: Handle of the parent window. If NULL, it defaults to the current parent window.
- x: The left coordinates of the playing screen, as used by the C++ GUI methods.
- y: The top coordinates of the playing screen, as used by the C++ GUI methods.
- width: The width of the playing screen, as used by the C++ GUI methods.
- height: The height of the playing screen, as used by the C++ GUI methods.
STDMETHOD ShowInfoPanel(BOOL bShow)
Sub ShowInfoPanel(bShow As Long)
void ShowInfoPanel(long bShow)
- Sets the display state of the information panel (see CreateInfoPanel().), according to the input parameter.
- Parameter:
- bShow: Set to TRUE (1) to display the current information panel.
Set to FALSE (0) to hide it.
STDMETHOD StepBackward (long btime);
Sub StepBackward(btime As Double)
void StepBackward (double btime);
- Rewinds the number of seconds in the input parameter.
If btime is 0, it backs up 1/10 or 3 seconds of the video,
whichever is greater.
- Parameter:
- btime: the number of seconds to back up from the current position.
STDMETHOD StepForward(long ftime);
Sub StepForward(ftime As Double)
void StepForward(double ftime);
- Fast forwards the number of seconds in the input parameter.
If ftime is 0, it forwards up 1/10 or 3 seconds of the video,
whichever is greater.
- Parameter:
- ftime: the number of seconds to forward from the current position.
STDMETHOD Stop();
Sub Stop()
void Stop();
- Stops the video/audio clip.
STDMETHOD StopSeekPause( double position);
Sub StopSeekPause(position As Double)
void StopSeekPause( double position);
- Stops the video/audio clip,
seeks to the specified position then pauses.
- Parameter:
- position: The new seeking position in reference time (the number of
100-nanosecond units).
STDMETHOD TraceSetup (OAHWND hOleWnd);
Sub TraceSetup(hOAWnd As Long)
void TraceSetup (long hOAWnd);
- Displays the trace setup property sheet. The trace setup sheet
displays a modal dialog with multiple tabbed pages for trace levels,
trace file, and trace components.
- Parameter:
- hOleWnd: Handle of the parent window.
STDMETHOD UpdatePlayEvent();
Sub UpdatePlayEvent()
void UpdatePlayEvent();
- Updates the network information and play state.
It should be called by a timer at least every 500 milliseconds.
- Mandatory to monitor the video/audio playback.
These are the steps for creating a new Visual Basic application
which uses the VideoCharger SDK to play audio/video files. The steps
assume you are using Microsoft Visual Basic 6.0 development environment.
You must already have IBM VideoCharger Player installed on your machine.
The instructions assume you have a working knowledge of Windows GUI
programming. As a starting point, you can use the
Code Samples for reference.
- Create a new application with Visual Basic:
- On the Visual Basic File menu, click New Project.
- Double-click the Standard EXE icon to add an ordinary EXE project
- In the Project Explorer window, right-click on Project1 to open the context menu.
Click Set as Start Up to make the EXE project the Startup project for the project group.
- On the Project menu, click References to open the References dialog box. Check
"Mplayer 1.0 Type Library", then click OK.
- If MPlayerLib doesn’t appear in the list of available references, click Browse
to add Mplayer.dll, which is located in the IBM VideoCharger Player directory, and then repeat the previous step.
- View the MPlayerLib in the Object Viewer:
- Press F2 to open the Object Browser.
- In the Project/Library list, select MplayerLib.
- Then enter asterisk in the Search Text field to show the ISCMPlayer class and members.
You can use the Object Browser to examine the ISCMPlayer object and its methods.
- Click Close to close the Object Browser when you’re done.
- Add code to create an ISCMPlayer object:
- Place the following code in the Declarations section of the application’s form module:
Option Explicit
' Reference to an ISCMPlayer object.
Dim player As MPLAYERLib.ISCMPlayer
- Call ISCMPlayer methods:
- SetMetaData() - Mandatory first call
Example: Call player.SetMetaData(VideoName, playType)
- Initialize() - Mandatory
Example: Call player.Initialize(Me.hWnd, 0, 6)
- GetVideoSize() - Optional to adjust application window accordingly
Example: Call player.GetVideoSize(w, h)
- GetPlayDuration, CreateInfoPanel, ShowInfoPanel - Optional to display
Example: Call player.GetPlayDuration(duration)
- Play, Pause, Stop, Rewind, etc. - VCR controls
Example: Call player.Play
- Cleanup - Mandatory last call
Example: Call player.Cleanup
- Create a Timer object for an interval of less than 500 milliseconds. Call
player.UpdatePlayEvent() to update video and network status.
These are the steps for creating a new Visual J++ application
which uses the VideoCharger SDK to play audio/video files. The steps
assume you are using Microsoft Visual J++ 6.0 development environment.
You must have IBM VideoCharger Player installed on your machine.
The instructions assume you have a working knowledge of Windows GUI
programming. As a starting point, you can use the
Code Samples for reference.
- Copy IISCMPlayer.java and ISCMPlayer.java into winnt\java\TrustLib\mplayer directory.
- Create a new application with Visual J++:
- When a New Project Dialog appears, select Windows Application and
Open project.
- A dialog will appear asking whether to enable for
Microsoft Language Extensions, click yes.
- Place the following code in the Import section of the Form1.java:
import mplayer.*;
- Place the following code in the Declarations section of the Form1.java:
IISCMPlayer mplayer;
- Place the following code in the inline code of the Form1.java:
mplayer = new ISCMPlayer();
- Call ISCMPlayer methods:
- SetMetaData() - Mandatory first call
Example: mplayer.SetMetaData(VideoName, err);
- Initialize() - Mandatory
Example: mplayer.Initialize(mplayer.Initialize(getHandle(), 0,
(short)0);
- GetVideoSize(); - Optional to adjust application window accordingly
Example: mplayer.GetVideoSize(w, h);
- GetPlayDuration, CreateInfoPanel, ShowInfoPanel - Optional to display
Example: mplayer.GetPlayDuration(duration);
- Play, Pause, Stop, Rewind, etc. - VCR controls
Example: mplayer.Play();
- Cleanup - Mandatory last call
Example: mplayer.Cleanup();
- Create a Timer object for an interval of less than 500 milliseconds. Call
mplayer.UpdatePlayEvent() to update video and network status.
These are the steps for creating a new Visual C++ application
which uses the VideoCharger SDK to play audio/video files. The steps
assume you are using Microsoft Visual C++ 5.0 development environment.
You must have IBM VideoCharger Player installed on your machine.
The instructions assume you have a working knowledge of Windows C++
GUI programming. As a starting point, you can use the
Code Samples for reference.
The client application is a single document interface
Win32 application whose purpose is to call functions in the Mplayer
COM.
- Create a new application with Visual C++:
- Start a new project workspace and fill out the New Project
Workspace dialog box.
- We will build a MFC AppWizard(exe) project called "vcPlayer".
- The application will be "single document-interface", and support OLE automation.
- Some of the files generated by VC++ should include the following:
- MainFrm.cpp
- StdAfx.cpp
- vcPlayer.cpp
- vcPlayer.rc
- MainFrm.h
- Resource.h
- StdAfx.h
- vcPlayer.h
- Copy the following files from \sdk\Src\ to the
current project directory. These are external dependencies that will
automatically be added to your project:
- mplayer.tlb
- mplayer_i.c
- iscplaysdk.h
- Make modifications to the generated files to reference the
ISCMPlayer COM object.
stdafx.h:
Note: You can copy stdafx.h
from the \sdk\Src\ directory to the current project directory to
replace the default file. The changes specified here
have already been made.
To add the Mplayer COM in vcPlayer's path, open stdafx.h and add the
following lines immediately after the MFC include
#include < afxdisp.h>:
#import "MPlayer.tlb"
#include "MPlayer_i.c"
vcPlayer.h:
Declare the mplayer namespace in the vcPlayer file.
MPLAYERLib is defined in mplayer_i.c. Open the file vcPlayer.h and
add the following line after the #include resource.h declaration:
using namespace MPLAYERLib;
vcPlayer.cpp:
Declare the mplayer namespace in the CPP file.
Add the following line after the #define statements:
using namespace MPLAYERLib;
Create a member variable that will hold a pointer to an interface
in MPlayer's COM object. We use IISCMPlayer as the template type,
since that is the name of the interface that will be created.
IISCMPlayer is declared in MPlayer_i.c, which is
included in stdafx.h. After declaring theApp object
(CVcPlayerApp theApp;), add the following line:
IISCMPlayerPtr p_ISCMPlayer;
Mainfrm.h:
Declare the mplayer namespace in the main frame CPP
file where we will be making our mplayer calls. Add the
following line at the top of the file, before the class statement:
using namespace MPLAYERLib;
Mainfrm.cpp:
Declare the mplayer pointer in the main frame file to
use the COM object. Verify the iscplaysdk.h is in the current project
directory. Add the following lines immediately after the include
statements:
#include "iscplaysdk.h"
extern IISCMPlayerPtr pISCMPlayer;
- Call ISCMPlayer methods:
- Before each ISCMPlayer call, you should set the player variable.
pISCMPlayer = IISCMPlayerPtr(CLSID_ISCMPlayer);
- SetMetaData() - Mandatory first call
Example: rc =pISCMPlayer->SetMetaData(metafile, &err);
- Initialize() - Mandatory
Example: rc = pISCMPlayer->Initialize((OAHWND)GetSafeHwnd(), FALSE, 0);
- GetVideoSize() - Optional to adjust application window accordingly
Example: pISCMPlayer->GetVideoSize(&v_width, &v_height);
- GetPlayDuration, CreateInfoPanel, ShowInfoPanel - Optional to display
Example: pISCMPlayer->GetPlayDuration(&m_duration);
- Play, Pause, Stop, Rewind, etc. - VCR controls
Example: pISCMPlayer->Play();
- Cleanup - Mandatory last call
Example: pISCMPlayer->Cleanup();
- In OnInitDialog(), SetTimer() for an interval of less than 500 milliseconds.
In the corresponding OnTimer() message Handler, call
pISCMPLayer->UpdatePlayer() to update video and network status.
The sample applications are located in the directories
found at the following location:
sdk\Samples\
The following list shows the sample programs written in Visual Basic,
Visual C++, and Visual J++ to use the VideoCharger SDK to create streaming media players.
- vbPlayer - Demonstrates a simple media player written in Visual Basic.
It has VCR controls to play and stop, with a timer that displays the current
play time.
The main source code that uses the ISCMPlayer object is vbVideo.frm.
- vcPlayer - Demonstrates a simple media player written in Visual C++.
The main source code that uses the ISCMPlayer object is mainfrm.cpp.
- vjPlayer - Demonstrates a simple media player written in Visual J++. The
main source code that uses the ISCMPlayer object is Form1.java.
The Metadata file contains pertinent information regarding the session and the video stream.
This information is created by the VideoCharger Server. A description of the
fields within the metadata file follows.
Session Data
The following information is related to the session that is established
between the VideoCharger Client and the Server.
- version - Identifies the version, and the data format of the metadata file.
- passticket - A ticket which correlates a video selection to the
request to play the video. Passticket of 1000 allows
the metadata file to be reused multiple times.
- protocol - Protocol used to communicate between the
VideoCharger Client and the VideoCharger Server. Protocol 1 is the Sockets protocol.
- serveraddr - Network address (including port number in the case of
sockets) of the Application Server to which the client
should connect. (e.g. 9.67.123.456:1234)
- codepage - For future use, currently set to 0.
- numberstreams - For future use, currently set to 1.
- sessiontype - Session type 1 for unicast, or 2 for multicast.
- dataprotocol - For future use, currently set to 1
- sourceaddr - Multicast address. For Unicast, sourceaddr is 0.0.0.0:0
Stream Data
The following information is related to the stream to be viewed.
- Title - Title of the selected video
- longname - The Control Server "asset name" of the video
- length - Size of the video in seconds
- mediatype - Decimal of the type of media (MPEG1, MPEG2, LBR):
0 = 0x00000000 unknown encoding
16777216 = 0x01000000 MPEG I
33554432 = 0x02000000 MPEG II
50331648 = 0x03000000 AVI
67108864 = 0x04000000 MJPEG - video only
83886080 = 0x05000000 H.263 - video only
100663296 = 0x06000000 H.723 - audio only
117440512 = 0x07000000 H.263 + G.723 interleaved
134217728 = 0x08000000 Quicktime movie
150994944 = 0x09000000 WAV - audio only
- bitrate - Bitrate of data to be played
- autoplay - Set to 1 to instruct the viewer to automatically issue
the play command to start the video.
- inv_cmds - Decimal of the commands restricted from client use.
The commands can be bit-wise OR'ed to denote a set of
invalid commands. For example, inv_cmds of 3 indicates
the user is restricted from seeking forward and backwards.
See iscplaysdk.h for bit filters.
- filesize64 - long decimal (64 bit) video file size. Data is returned
in two long values, separated by a comma.
Metadata File Format
The file format is a collection of "stanzas". Each stanza is delimited
by a starting and ending keyword enclosed in brackets. Within the
bracketed section are keyword/value pairs.
All values are character which should be converted to ulong when
received by the client except serveraddr, title, and longname which
should remain character strings.
************************ Begin metadata file ************************
Content_type: video/x-ibm-ivs
[ivs_session_begin]
version=
passticket=
protocol=
serveraddr=
codepage=
numberstreams=
sessiontype=
dataprotocol=
sourceaddr=
[ivs_session_end]
[ivs_stream_begin]
title=
longname=
length=
mediatype=
bitrate=
autoplay=
invalidcommands=
filesize64=
[ivs_stream_end]
***************************** End of metadata file ************************