BCM70015 Module

From LEXWiKi

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
-
 
+
[[Category:AllowPages]]
== The Sample code source you can download form ==
== The Sample code source you can download form ==
Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/BCM70015/BCM70015_Demo_Src.rar BCM70015_Demo_Src.rar]
Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/BCM70015/BCM70015_Demo_Src.rar BCM70015_Demo_Src.rar]

Revision as of 14:29, 23 November 2010

The Sample code source you can download form

Source file: BCM70015_Demo_Src.rar

Reference Document: BCMSDK.doc

The procedure should do before build the source file : 

1. download and install the DXSDK

2. build the BaseClasses(both Debug and Release):
   the path : DXSDK\Samples\C++\DirectShow\BaseClasses

3. add the include file and library file in Tools -> Options -> Projects -> VC++ Directories:
   (Suppose DXSDK install in C:\)

   Include files :
      C:\DXSDK\Include
      C:\DXSDK\Samples\C++\DirectShow\BaseClasses
      C:\DXSDK\Samples\C++\Common\Include

   Library files : 
      C:\DXSDK\Lib
      C:\DXSDK\Samples\C++\DirectShow\BaseClasses\Debug
      C:\DXSDK\Samples\C++\DirectShow\BaseClasses\Release

4. After build , should install the driver in the BCM70012_Demo_Bin.rar first. Adn then you can execute the AP which you build.

Binary file: BCM70015_Demo_Bin.rar

How to use the DEMO application

Image:BCM70012AP.jpg

1.Open the video file to play , the file will play automatically.

2.The button used to play the video.

3.The button used to pause the video.

4.The button used to stop the video.

5.Full screen.

6.To show the status of the video and you can pull the bar to change the video's play status.

7.Where the video play in.

8.You can input the words. The words can show on the video such as 11.

9.Choose the speed of the word run on the video , the speed will be chang after press the Set button(10).

10.Show the words.


Sample code Introduction

1.Functions List:

SDK Initialize	
BCM_InitSDK	            Initializes the SDK
BCM_SetViewPos	            Setting the video playing area
BCM_SetNotifyWindow	    Setting the receive message window and code

Load Video File and controls	
BCM_LoadFile	            Load video file 
BCM_Run                     Begin playing the video file
BCM_Pause	            Pause play
BCM_Stop	            Stop play
BCM_SetFullScreen	    Playing the video with FullScreen or Quit fullscreen

Slider bar:	
BCM_GetDuration             Get the video length
BCM_GetCurrentPosition      Get the current playing position
BCM_SetCurrentPosition	    Set the current play position

Scroll Text:	
BCM_SetScrollText	    Set scroll text contain
BCM_SetScrollTextSpeed      Set scroll text speed
BCM_SetScrollTextAlignment  Formats the scroll text style
BCM_SetScrollTextColor	    Set scroll text color
BCM_SetScrollTextAlpha	    Set scroll text alpha 
BCM_SetScrollTextFont	    Set scroll text format 
BCM_SetScrollTextDir	    Set text scrolls direction
BCM_InsertScrollText	    Insert scroll text item
BCM_SetItemText             Change the text of a list view item
BCM_ClearScrollTextItem     Clean all the scroll text
BCM_GetScrollTextCount	    Retrieves the number of strings
BCM_DisplayScrollText	    Start show scroll text
BCM_DisableVMRBitmap	    Disable Mixbitmap

Bitmap:	
BCM_LoadBitmap	            Load bitmap for display
BCM_SetBitmapRect	    The area for bitmap displaying.
BCM_SetBitmapAlpha	    Specifices the alpha blending value
BCM_SetTransparent	    Set transparent color
BCM_ShowBitmap	            Display the bitmap

AudioControl:	
BCM_GetVolume	            Retrieves the volume(amplitude) of the audio signal.
BCM_SetVolume	            Sets the volume (amplitude) of the audio signal.
BCM_GetAudioBalance	    Retrieves the balance for the audio signal.
BCM_SetAudioBalance	    Sets the balance of the audio signal.
Functions Reference:
2.Data Type:

2.1 The function return value
   Syntax: 
      BCM_SUCCEEDED	                 0x0000
      BCM_FAILED			 0x8000 
      BCM_NODRIVER			 0x8010
      //Video format is not supported.
      BCM_UNSUPPORTED_VIDEO_FORMAT	 0x8101
      //Audio format is not supported.
      BCM_UNSUPPORTED_AUDIO_FORMAT	 0x8102
      //File format is not supported.
      BCM_UNSUPPORTED_FILE_FORMAT	 0x8104
      BCM_NOINITIALIZE			 0xff00
   Description:
      The method returned code.

2.2 Whether use Hardware decorder
   Syntax:
      //Hardware Decorder 
      BCM_HWDECODER  		         1
      //Software Decorder
      BCM_SWDECODER 			 2

2.3 DirectShow EventHandle
   Syntax:
      //The video file is playing finished
      BCM_EC_COMPLETE			 0x1
      BCM_EC_USERABORT		         0x2
      BCM_EC_ERRORABORT                  0x3
   Description:
      Video’s status

2.4 ScrollText Directions:
   Syntax:
      BCM_ST_DIRECTION_LEFT		 1
       Form right to left.
      BCM_ST_DIRECTION_RIGHT		 2
       From left to right.
      BCM_ST_DIRECTION_UP		 3
       From down to up.
      BCM_ST_DIRECTION_DOWN              4
       From up to down.
      //Sets text at the top of video screen
      BCM_ST_ALIGN_TOP			 1
      //Sets text at the center of video screen 
      BCM_ST_ALIGN_CENTER		 2
      //Sets text at the bottom of video screen
      BCM_ST_ALIGN_BOTTOM		 3
      //Sets text at the left of video screen
      BCM_ST_ALIGN_LEFT                  4
      //Sets text at the right of video screen 
      BCM_ST_ALIGN_RIGHT		 5
3. Method

3.1 Initializes the DirectShow environment 

3.1.1 BCM_InitSDK
     Syntax:
        INT BCM_InitSDK();
     Parameters:
        None
     Return Value:
        BCM_SUCCEEDED : Function succeeded.
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        This function initializes Com Environment.

3.1.2 BCM_SetViewPos
     Syntax:
        INT BCM_SetViewPos(HWND hWndMain,INT left,INT top,INT right,INT bottom)
     Parameters:
        hWndMain : The window which used to display the video playing.
        left,top,right,bottom : These parameters are for area which displays the video play.
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        This function set the main window and the area for diaplay.

3.1.3 BCM_SetNotifyWindow
     Syntax:
        INT BCM_SetNotifyWindow(HWND hWnd,WPARAM msg,LPARAM lData)
     Parameters:
        hWnd : Handle to the window, or NULL to stop receiving event messages. 
        msg : Window message to be passed as the notification. 
        lData : Value to be passed as the lParam parameter for the msg message. 
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        This function set the window to receive event messages.


3.2 The playing control:

3.2.1 BCM_Run
     Syntax:
        INT BCM_Run()
     Parameters:
        None
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        This function runs all the filters in the filter graph.

3.2.2 BCM_Pause
     Syntax:
        INT BCM_Pause()
     Parameters:
        None
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        This function pauses all the filters in the filter graph.

3.2.3 BCM_Stop
     Syntax:
        INT BCM_Stop()
     Parameters:
        None
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        This function stops the video play.

3.2.4 BCM_LoadFile
     Syntax:
        INT BCM_LoadFile(DECODER_TYPE type,LPCSTR szFile)
     Parameters:
        type : Query whether the graph filter renderer in Hardware D			ecorder.
        szFile : This should specify the absolute path to a file on disk or the URL of a file to download.
     Return Value
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NODRIVER_BCM : No Broadcom Video Decorder.
        BCM_UNSUPPORTVIDEOFORMAT : Unsupport video decorder .
        BCM_UNSUPPORTAUDIOFORMAT : Unsupport audio decorder.
     Description:
        This function loads the video file and queries whether the graph filter uses Hardware Decorder.
        This method initializates the interface.It is not designed to load multiple files,and calls to this method after the first call will fail.

3.2.5 BCM_SetFullScreen
     Syntax:
        INT BCM_SetFullScreen(BOOL inEnable);
     Parameters:
        inEnable : Set the playing with fullscreen if the inEnable is true,else with normal model.
     Return Value
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        This function queries whether the video renderer is in full-screen mode.
 

3.3 The SliderCtrl used

3.3.1 BCM_GetDuration
     Syntax:
        INT BCM_GetDuration(DOUBLE* outDuration)
     Paramerters:
        outDuration : Pointer to a variable that receives the duration, in units of the current time format.
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        This function retrieves the duration of the stream at normal playback speed.Changing the playback rate does not affect the duration.

3.3.2 BCM_GetCurrentPosition
     Syntax:
        INT BCM_GetCurrentPosition(DOUBLE* outPosition);
     Parameters:
        outPosition : Pointer to a variable that receives the current position,in units of the current time format.
     Return Value
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        This function returns the current position that playback has reached.

3.3.3 BCM_SetCurrentPosition
     Syntax:
        INT BCM_SetCurrentPosition(DOUBLE inPosition);
     Parameters:
        inPosition : Offset of the play cursor,int bytes,from the beginning of the buffer.
     Return Value
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        This function sets the position of the play cursor,which is the point at which the next bytes of data is read from the buffer.


3.4 The Scroll Text function

3.4.1 BCM_SetScrollText
     Syntax:
        INT BCM_SetScrollText(LPCSTR sText);
     Parameters:
        sText : Receive the scroll text content.
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        This function receives the scroll text content.

3.4.2 BCM_SetScrollTextSpeed
     Syntax:
        INT BCM_SetScrollTextSpeed(DOUBLE dbSlider);
     Parameters:
        dbSlider : The scroll text moves the percent of display’s width or height.If dbSlider is 0 ,the scrollText will display by the middle of the display’s area.
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        This function sets the speed of the scroll text moving.

3.4.3 BCM_SetScrollTextAlpha
     Syntax:
        INT BCM_SetScrollTextAlpha(INT alpha);
     Paramerters:
        alpha : An alpha transparency value to be used on the entire source bitmap.The default oxff(255)assumes that your image is opaque,and that you want to use per-pixel alpha only.
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        The function sets the scroll text value of transparency.

3.4.4 BCM_SetScrollTextFont
     Syntax:
        INT BCM_SetScrollTextFont(HFONT& font);
     Paramerters:
        font : The new font format to be selected by GDI.
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        An application can select a font into memory device contexts only and into only one memory device context at a time.

3.4.5 BCM_SetScrollTextColor
     Syntax:
        INT BCM_SetScrollTextColor(COLORREF color);
     Paramerters:
        color : Specifies the color of text as an RGB color value.
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        The system will use this text color when writting text to this device context and also when converting bitmaps between color and monochrome device contexts.

3.4.6 BCM_InsertScrollText
     Syntax:
        INT BCM_InsertScrollText(LPCSTR insertItem);
     Paramerters:
        insertItem : Add a new string to the scroll text list.
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        Insert an item to scroll text.

3.4.7 BCM_GetScrollTextCount
     Syntax:
        INT BCM_GetScrollTextCount();
     Paramerters:
        NULL;
     Return Value:
        BCM_SUCCEEDED : Function succeeded.
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        Retrieves the numbers of the scroll text.

3.4.8 BCM_GetItemText
     Syntax:
        INT BCM_GetItemText(INT nItem,LPCSTR& lpszText);
     Paramerters:
        nItem : The index of the item whose text is to be retrieved.
        lpszText : Pointer to a string that is to receive the item text.
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        Retrieves the text of a list view item.

3.4.9 BCM_SetItemText
     Syntax:
        INT BCM_SetItemText(INT nItem,LPCSTR lpszText)
     Paramerters:
        nItem : Index of the item whose text is to be set.
        lpszText : A string that contains the new item text.
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        Changes the text of a list view item.

3.4.10 BCM_ClearScrollTextItem
      Syntax:
         INT BCM_ClearScrollTextItem();
      Paramerters:
         NULL;
      Return Value:
         BCM_SUCCEEDED : Function succeeded
         BCM_FAILED : Function failed.
         BCM_NOINITIALIZE : Lack necessary devices.
      Description:
         Clear all the scroll text.

3.4.11 BCM_SetScrollTextDir
      Syntax:
         INT BCM_SetScrollTextDir(UINT nFlags);
      Paramerters:
         nFlags : The direction of scroll text.
      Return Value:
         BCM_SUCCEEDED : Function succeeded
         BCM_FAILED : Function failed.
         BCM_NOINITIALIZE : Lack necessary devices.
      Description:
         The text scrolls direction.
 
3.4.12 BCM_DisplayScrollText
      Syntax:
         INT BCM_DisplayScrollText();
      Paramerters:
         NULL;
      Return Value:
         BCM_SUCCEEDED : Function succeeded
         BCM_FAILED : Function failed.
         BCM_NOINITIALIZE : Lack necessary devices.
      Description:
         Start display text scroll.

3.4.13 BCM_DisableVMRBitmap
      Syntax:
         INT BCM_DisableVMRBitmap();
      Paramerters:
         NULL;
      Return Value:
         BCM_SUCCEEDED : Function succeeded
         BCM_FAILED : Function failed.
         BCM_NOINITIALIZE : Lack necessary devices.
      Description:
         Disable text scroll .

3.4.14 BCM_SetScrollTextAlignment
      Syntax:
         INT BCM_SetScrollTextAlignment( UINT Vertical, UINT Horizontal );
      Paramerters:
         Vertical : The align style in the vertical direction.
         Horizontal : The align style in the horizontal direction .
      Return Value:
         BCM_SUCCEEDED : Function succeeded
         BCM_FAILED : Function failed.
         BCM_NOINITIALIZE : Lack necessary devices.
      Description:
         Formats the scroll text align style.


3.5 The bitmap 

3.5.1 BCM_LoadBitmap
     Syntax:
        INT BCM_LoadBitmap(LPCSTR filePath);
     Paramerters:
        filePath:		A string that contains the name of the bitmap resource.
     Return Value:
        BCM_SUCCEEDED:		Function succeeded
        BCM_FAILED:			Function failed.
        BCM_NOINITIALIZE:	Lack necessary devices.
     Description:
        Loads the bitmap resource named by filePath.

3.5.2 BCM_SetBitmapRect
     Syntax:
        INT BCM_SetBitmapRect(INT left,INT top,INT width,INT height);
     Paramerters:
        left : Specifies the logical x-coordinate of the upper-left corner of the destination rectangle.
        top : Specifies the logical y-coordinate of the upper-left corner of the destination rectangle.
        width : Specifies the width of the destination rectangle and source bitmap.
        height : Specifies the height of the destination rectangle and source bitmap.
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        The area for bitmap display.

3.5.3 BCM_SetBitmapAlpha
     Syntax:
        INT BCM_SetBitmapAlpha();
     Paramerters:
        NULL;
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        Specifies the alpha blending value.

3.5.4 BCM_SetTransparent
     Syntax:
        INT BCM_SetTransparent(UINT color);
     Paramerters:
        color : The RGB color in the source bitmap to treat as transparent.
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        Call this member function to transfer a bit-block of the color data, which corresponds to a rectangle of pixels from the specified source device context, into a destination device context.

3.5.5 BCM_ShowBitmap
     Syntax:
        INT BCM_ShowBitmap();
     Paramerters:
        NULL;
     Return Value:
        BCM_SUCCEEDED : Function succeeded
        BCM_FAILED : Function failed.
        BCM_NOINITIALIZE : Lack necessary devices.
     Description:
        Display bitmap .


3.6 Audio control

3.6.1 BCM_GetVolume
     Syntax:
        INT BCM_GetVolume( LONG* plVolume );
     Paramerters:
        plVolume : Returned value of the volume property (0 is slience, 100 is full).
     Return Value:
        BCM_SUCCEEDED : Function succeeded.
        BCM_NOINITIALIZE : Lack necessary devices.
        BCM_UNSUPPORTAUDIOFORMAT : Unsupport audio decorder format(or No audio device or not install audio driver).
     Description:
        Retrieves the volume (amplitude) of the audio signal.

3.6.2 BCM_SetVolume 
     Syntax:
        INT BCM_SetVolume(LONG lVolume);
     Paramerters:
        lVolume:	Value to which to set the volume property( 0 is slience, 100 is full).
     Return Value:
        BCM_SUCCEEDED:		Function succeeded.
        BCM_NOINITIALIZE:	Lack necessary devices.
        BCM_UNSUPPORTAUDIOFORMAT:	Unsupport audio decorder format(or No audio device or not install audio driver).
     Description:
        Sets the volume(amplitude) of the audio signal.

3.6.3 BCM_GetAudioBalance
     Syntax:
        INT BCM_GetAudioBalance(LONG* plBalance);
     Paramerters:
        plBalance: Returned value of the balance property.0 is a neutral balance ,-50 left channel is full and right is slience, 50 right is full and left is slience.
     Return Value:
        BCM_SUCCEEDED : Function succeeded.
        BCM_NOINITIALIZE : Lack necessary devices.
        BCM_UNSUPPORTAUDIOFORMAT : Unsupport audio decorder format(or No audio device or not install audio driver).
     Description:
        Retrieves the balance for the audio signal.

3.6.4 BCM_SetAudioBalance
     Syntax:
        INT BCM_SetAudioBalance(LONG inBalance)
     Paramerters:
        inBalance: Value to which to set the balance property. 0 is a neutral balance ,-50 right channel is full and left is slience, 50 right is full and left is slience.
     Return Value:
        BCM_SUCCEEDED : Function succeeded.
        BCM_NOINITIALIZE : Lack necessary devices.
        BCM_UNSUPPORTAUDIOFORMAT : Unsupport audio decorder format(or No audio device or not install audio driver).
     Description:
        Sets the balance of the audio signal.
File Format:
1. MKV
2. MP4
3. AVI
4. OGG/OGM
5. MPEG TS
6. WMV

Video Format:
1. MEDIASUBTYPE_MPEG2_VIDEO 
2. MEDIASUBTYPE_MPEG1Video
3. WVC1
4. WMVA
5. WMV3
6. AVC1

Audio Format:
Major type : MEDIATYPE_MPEG2_PES
1. MEDIASSUBTYPE_DOLBY_AC3
2. MEDIASUBTYPE_MPEG1AudioPayload
3. MEDIASUBTYPE_MPEG2_AUDIO
4. MEDIASUBTYPE_DVD_LPCM_AUDIO

Major type : MEDIATYPE_DVD_ENCRYPTED_PACK
5. MEDIASSUBTYPE_DOLBY_AC3
6. MEDIASUBTYPE_MPEG1AudioPayload
7. MEDIASUBTYPE_MPEG2_AUDIO
8. MEDIASUBTYPE_DVD_LPCM_AUDIO

Major type : MEDIATYPE_Audio
9. MEDIASUBTYPE_DVD_LPCM_AUDIO
10. MEDIASUBTYPE_DOLBY_AC3
11. MEDIASUBTYPE_MPEG2_AUDIO
Personal tools