B2C2, Inc. - Software Development Kit

IB2C2MPEG2AVCtrl2

  IB2C2MPEG2AVCtrl2      
  Call Sequences and Overview      
  Methods      
           

A channel typically contains multiple program streams of packeted information identified by PID (Program Identifier). After a channel is locked onto by a tuner, the desired program is selected by setting its PID. IB2C2MPEG2AVCtrl2 supports satellite and cable tuners.

IB2C2MPEG2AVCtrl2 methods allow access to MPEG2 Audio and Video elementary streams by setting or deleting their PIDs. For Video in Windows, a Video callback structure can be configured to pass Video window size, aspect ratio, and frame rate when instructed by the application.

In Windows, IB2C2MPEG2AVCtrl2 is an interface implemented on the B2C2MPEG2Filter.

In Linux, IB2C2MPEG2AVCtrl2 is an instantiated member of the overall class B2C2MPEG2Adapter, which controls B2C2's broadband device.

Call Sequences and Overview

(Windows) Here is the sequence of calls that should be followed at the application level:

1.

Set up the filter graph directly or by using B2C2MPEG2Adapter class and tune the tuner.

   
2. Using the SetCallbackForVideoMode method, specify the user function which will be called by the B2C2 MPEG-2 filter.
   
3. Specify the Audio and Video PIDs using the SetAudioVideoPIDs method.
   
4. Start playback by calling Run () from the IMediaControl interface; see also GetMediaControl.
   
5. The callback function specified in step 2 will be passed an MPEG2_VIDEO_INFO structure containing horizontal and vertical Video window sizes in pixels, Video window aspect ratio, and frame rate. The callback will take place after the PIDs are set and prior to play being initiated.
   
Note:  
 
  • The user function will be called each time and once per change to Audio/Video PIDs.
  • Because a synchronized callback scheme is in use, the user function should return as soon as possible, as the calling thread (in this case the B2C2 MPEG-2 filter) will be blocked.
  • If the user function is no longer valid, SetCallbackForVideoMode method should be called again with an argument of NULL.
  • For further information see the Test AV Filter sample code.
   

Methods

For backwards compatibility IB2C2MPEG2AVCtrl is defined. But the derived class IB2C2MPEG2AVCtrl2 interface supports all methods from previous version IB2C2MPEG2AVCtrl. Methods for all versions are shown in the table.

IUnknown methods

Description

Operating System (Windows, Linux)
QueryInterface Retrieves pointers to supported interfaces. W
AddRef Increments the reference count. W
Release Decrements the reference count. W

IB2C2MPEG2AVCtrl  methods

Description

 
SetAudioVideoPIDs Sets the Audio and Video PIDs (Program Identifiers) of interest to the application.
W, L

IB2C2MPEG2AVCtrl2  methods

Description

 
DeleteAudioVideoPIDs Deletes Audio and Video PIDs.
W, L
GetAudioVideoState Returns the current Audio and Video settings.
W, L
SetCallbackForVideoMode Sets Callback for Video mode of operation.
W

 


IB2C2MPEG2AVCtrl2::SetAudioVideoPIDs

Return to Top

Sets the Audio and Video PIDs of interest to the application.

Syntax

HRESULT SetAudioVideoPIDs(

long lAudioPID,

long lVideoPID

);

Parameters

lAudioPID

[in] Audio PID of interest to the application.

lVideoPID

[in] Video PID of interest to the application.

Return Value

Returns an HRESULT value. Use SUCCEEDED and FAILED macros to interpret the return value.

Remarks

To specify only one PID (e.g. only Audio or only Video), set the other PID to 0.

See also

DeleteAudioVideoPIDs


IB2C2MPEG2AVCtrl2::DeleteAudioVideoPIDs

Return to Top

Deletes Audio and Video PIDs.

Syntax

HRESULT DeleteAudioVideoPIDs(

long bAudioPID,

long bVideoPID

);

Parameters

bAudioPID

[in] A nonzero value indicates that the current Audio PID shall be deleted.

bVideoPID

[in] A nonzero value indicates that the current Video PID shall be deleted.

Return Value

Returns an HRESULT value. Use SUCCEEDED and FAILED macros to interpret the return value.

Remarks

To specify only one PID (e.g. Audio or only Video), set the other PID to 0.

See also

SetAudioVideoPIDs


IB2C2MPEG2AVCtrl2::GetAudioVideoState

Return to Top

Returns current Audio and Video settings in terms of which streams are open or running and how many.

Syntax

HRESULT GetAudioVideoState(

long * plAudioOpen,

long * plVideoOpen,

long * plAudioRunning,

long * plVideoRunning,

long * plAudioPID,

long * plVideoPID

);

Parameters

plAudioOpen

[out] Pointer to long variable created by the caller. Variable will hold the count of currently open Audio streams. A value of 0 indicates that no Audio stream is open. Pass NULL for this argument if no return is desired.

plVideoOpen

[out] Pointer to long variable created by the caller. Variable will hold the count of currently open Video streams. A value of 0 indicates that no Video stream is open. Pass NULL for this argument if no return is desired.

plAudioRunning

[out] Pointer to long variable created by the caller. Variable will hold the count of currently running Audio streams. A value of 0 indicates that no Audio stream is running. Pass NULL for this argument if no return is desired.

plVideoRunning

[out] Pointer to long variable created by the caller. Variable will hold the count of currently running Video streams. A value of 0 indicates that no Video stream is running. Pass NULL for this argument if no return is desired.

plAudioPID

[out] Pointer to long variable created by the caller. Variable will hold the value of the current Audio PID. A value of 0 indicates that no Audio PID is set. Pass NULL for this argument if no return is desired.

plVideoPID

[out] Pointer to long variable created by the caller. Variable will hold the value of the current Video PID. A value of 0 indicates that no Video PID is set. Pass NULL for this argument if no return is desired.

Return Value

Returns an HRESULT value. Use SUCCEEDED and FAILED macros to interpret the return value.

Remarks

None.


IB2C2MPEG2AVCtrl2::SetCallbackForVideoMode

Return to Top

(Windows only.) Sets Callback for Video mode of operation, which allows Video aspect ratio to be reported back to the user application when the user application passes a parameter.

Syntax

HRESULT SetCallbackForVideoMode(

PVOID pCallbackFunc

);

Parameters

pCallbackFunc

[in] Pointer to a callback function with the format: UINT __stdcall <function name> (MPEG2_VIDEO_INFO *).

Return Value

Returns an HRESULT value. Use SUCCEEDED and FAILED macros to interpret the return value.

Remarks

None.


Copyright © 1998-2002 B2C2, Inc. Proprietary and Confidential