分类:
2010-03-02 15:48:16
首先,我们来看一下TCPMP的播放模块的结构定义:
绝大多数节点都有一个对应的数据对象,记录该节点的数据和方法,每一个子节点对象都是以父节点对象作为该节点一个元素,类似C++的封装继承机制。如果子
节点的父节点没有数据对象,该节点可以从node节点直接继承。每一个节点都可以看成Node节点的直接或间接子节点,所以所有节点头以一个相同的
node结构开头,子节点可能还有自己的属性,在继承父对象后就是子节点自己的元素。
下面我们来看看struct node* Player;
首先我们如下般获得Player:
context* p = Context();
player* myplayer = NULL;
if(p) Moonplayer = (player*)(p->Player);
然后我们就可以通过Moonplayer来进行播放的控制了。例如Get可以获得播放的一些属性和状态,Set可以设定播放的属性和状态。
下表列出了Moonplayer控制的相关播放属性:(play.h)
// buffer size in KB (int)
#define PLAYER_BUFFER_SIZE
// microdrive buffer size in KB (int)
#define PLAYER_MD_BUFFER_SIZE 0x80
// microdrive mode (bool_t)
#define
PLAYER_MICRODRIVE
// repeat (bool_t)
#define
PLAYER_REPEAT
// shuffle (bool_t)
#define
PLAYER_SHUFFLE
// start play after open (bool_t)
#define
PLAYER_PLAYATOPEN
// start play after open in fullscreen (bool_t)
#define
PLAYER_PLAYATOPEN_FULL
// exit at the end (bool_t)
#define PLAYER_EXIT_AT_END
// keep playlist after WND set null (bool_t)
#define
PLAYER_KEEPLIST
// play or pause (bool_t)
#define
PLAYER_PLAY
// play speed (fraction)
#define
PLAYER_PLAY_SPEED
// fastforward (bool_t)
#define
PLAYER_FFWD
// fastforward speed (fraction)
#define
PLAYER_FFWD_SPEED
// position in fraction (fraction)
#define
PLAYER_PERCENT
// position in time (tick_t)
#define
PLAYER_POSITION
// duration (tick_t)
#define
PLAYER_DURATION
// timer shown on screen (tchar_t[])
#define
PLAYER_TIMER
// show left time (bool_t)
#define
PLAYER_TIMER_LEFT
// benchmark duration (tick_t)
#define
PLAYER_BENCHMARK
// benchmark video source size (point)
#define PLAYER_BENCHMARK_SRC 0xB6
// benchmark video dest size (point)
#define PLAYER_BENCHMARK_DST 0xB7
// display name (tchar_t[])
#define
PLAYER_TITLE
// current format (format*)
#define
PLAYER_FORMAT
// current stream (stream*)
#define
PLAYER_INPUT
// current audio stream (int)
#define
PLAYER_VSTREAM
// current video stream (int)
#define
PLAYER_ASTREAM
// current subtitle stream (int)
#define
PLAYER_SUBSTREAM
// current audio output class (int)
#define
PLAYER_AOUTPUTID
// current video output class (int)
#define
PLAYER_VOUTPUTID
// highest priorty audio output class (readonly int)
#define PLAYER_AOUTPUTID_MAX 0xA0
// highest priorty video output class (readonly int)
#define PLAYER_VOUTPUTID_MAX 0xA1
// current audio output (node*)
#define
PLAYER_AOUTPUT
// current video output (node*)
#define
PLAYER_VOUTPUT
// number of files in playlist (int)
#define
PLAYER_LIST_COUNT
// current file in playlist (int)
#define PLAYER_LIST_CURRENT 0x2F
// current file index (suffled) in playlist (int)
#define PLAYER_LIST_CURRIDX 0xA2
// fullscreen zoom factor (fraction_t)
#define
PLAYER_FULL_ZOOM
// skin mode zoom factor (fraction_t)
#define
PLAYER_SKIN_ZOOM
// bilinear zoom (bool_t)
#define
PLAYER_SMOOTH50
// bilinear zoom (bool_t)
#define PLAYER_SMOOTHALWAYS 0x7A
// fullscreen direction flags (int)
#define
PLAYER_FULL_DIR
// non fullscreen direction flags (int)
#define
PLAYER_SKIN_DIR
// current relative dir (readonly) (int)
#define
PLAYER_REL_DIR
// overlay is on top or clipping needed (bool_t)
#define
PLAYER_CLIPPING
// skin viewport rectangle (rect)
#define PLAYER_SKIN_VIEWPORT 0x3C
// prerotate portrait movies
#define PLAYER_AUTOPREROTATE 0x3D
// fullscreen mode (bool_t)
#define
PLAYER_FULLSCREEN
// volume volume (int 0..100)
#define
PLAYER_VOLUME
// volume mute (bool_t)
#define
PLAYER_MUTE
// panning (int -128..128)
#define
PLAYER_PAN
// preamp (int -128..128)
#define
PLAYER_PREAMP
// audio quality (int 0..2)
#define PLAYER_AUDIO_QUALITY 0x42
// auto video quality (int 0..2)
#define PLAYER_VIDEO_QUALITY 0xBC
// video idct acceleration (bool_t)
#define PLAYER_VIDEO_ACCEL
// keep audio playing in background
#define PLAYER_KEEPPLAY_AUDIO 0x63
// keep video playing in background
#define PLAYER_KEEPPLAY_VIDEO 0x72
#define PLAYER_SHOWINBACKGROUND 0xBF
#define PLAYER_SINGLECLICKFULLSCREEN 0xC0
// microdrive start at in KB (int)
#define
PLAYER_BURSTSTART
// how much to load (%)
#define
PLAYER_UNDERRUN
// how much to load for audio (int)
#define PLAYER_AUDIO_UNDERRUN 0xBB
// move back step time (tick_t)
#define PLAYER_MOVEBACK_STEP 0x68
// move ffwd step time (tick_t)
#define PLAYER_MOVEFFWD_STEP 0x7C
// stereo enum (int)
#define
PLAYER_STEREO
// aspect ratio
(frac)
#define
PLAYER_ASPECT
// application sent to background
(bool_t)
#define
PLAYER_BACKGROUND
// player window is foreground
(bool_t)
#define
PLAYER_FOREGROUND
// set before and after sleep
(bool_t)
#define
PLAYER_POWEROFF
// video caps
#define
PLAYER_VIDEO_CAPS
// discard saved playlist (bool)
#define PLAYER_DISCARDLIST
// video output is a real overlay, readonly (bool_t)
#define PLAYER_VIDEO_OVERLAY 0xBD
// player status
#define
PLAYER_SYNCING
#define
PLAYER_LOADMODE
#define
PLAYER_STREAMING
// notify pin for interface
#define
PLAYER_NOTIFY
// on list changed event
#define PLAYER_LIST_NOTIFY
// for open dialog
#define
PLAYER_CURRENTDIR
// commands:
// update video settings
#define PLAYER_UPDATEVIDEO
// update equalizer settings
#define PLAYER_UPDATEEQUALIZER 0xA5
// begin screen rotation (turn off video)
#define PLAYER_ROTATEBEGIN
// end screen rotation
#define
PLAYER_ROTATEEND
// reset video driver
#define
PLAYER_RESETVIDEO
// codec notify about not supported data (pin)
#define PLAYER_NOT_SUPPORTED_DATA 0x9F
// move back
#define
PLAYER_MOVEBACK
// move forward
#define
PLAYER_MOVEFFWD
// position bar moving state (boolean)
#define
PLAYER_INSEEK
// next chapter/track
#define
PLAYER_NEXT
// prev chapter/track
#define
PLAYER_PREV
// stop
#define
PLAYER_STOP
// resync
#define
PLAYER_RESYNC
// array type params (just a hint)
#define
PLAYER_ARRAY
// url in playlist (0x1000,0x1001,0x1002...)
#define
PLAYER_LIST_URL
// title in playlist (0x2000,0x2001,0x2002...)
#define
PLAYER_LIST_TITLE
// title or filename in playlist
#define PLAYER_LIST_AUTOTITLE 0x5000
// length in playlist (0x4000,0x4001,0x4002...)
#define PLAYER_LIST_LENGTH
// input comments
#define
PLAYER_COMMENT
举个例子:
播放的的话,我们可以如下设置:
Moonplayer->Set(Moonplayer,PLAYER_PLAYER,&b,sizeof(b));
停止的话,可以是:
Bool_t b=0;
Moonplayer->Set(Moonplayer,PLAYER_PLAYER,&b,sizeof(b));
其他播放类似,可以参考TCPMP或者我程序中的代码。