WINCE TCPMP应用三:TCPMP的播放模块

首先,我们来看一下TCPMP的播放模块的结构定义:
 static const nodedef Player =
 {
  sizeof(player_base)|CF_GLOBAL|CF_SETTINGS,
  PLAYER_ID,
  NODE_CLASS,
  PRI_MAXIMUM+600,
  (nodecreate)Create,
  (nodedelete)Delete,
 };

绝大多数节点都有一个对应的数据对象,记录该节点的数据和方法,每一个子节点对象都是以父节点对象作为该节点一个元素,类似C++的封装继承机制。如果子节点的父节点没有数据对象,该节点可以从node节点直接继承。每一个节点都可以看成Node节点的直接或间接子节点,所以所有节点头以一个相同的node结构开头,子节点可能还有自己的属性,在继承父对象后就是子节点自己的元素。
    typedef struct node
 {
  int   Class;
  nodeenum Enum;
  nodeget  Get;
  nodeset  Set;
 } node;

 Class表示该对象的标识,如PLAYER_ID。
     Enum是一个函数指针,指向一个函数用于枚举当前节点的属性。
     Get是一个函数指针,得到当前节点某一属性值。
     Set是一个函数指针,设置当前节点的某一属性数值。

下面我们来看看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  0x20

// microdrive buffer size in KB (int)

#define PLAYER_MD_BUFFER_SIZE 0x80

// microdrive mode (bool_t)

#define PLAYER_MICRODRIVE   0x21

// repeat (bool_t)

#define PLAYER_REPEAT       0x22

// shuffle (bool_t)

#define PLAYER_SHUFFLE      0x23

// start play after open (bool_t)

#define PLAYER_PLAYATOPEN   0x24

// start play after open in fullscreen (bool_t)

#define PLAYER_PLAYATOPEN_FULL   0x7B

// exit at the end (bool_t)

#define PLAYER_EXIT_AT_END  0xB9

// keep playlist after WND set null (bool_t)

#define PLAYER_KEEPLIST     0x48

// play or pause (bool_t)

#define PLAYER_PLAY              0x32

// play speed (fraction)

#define PLAYER_PLAY_SPEED   0x3F

// fastforward (bool_t)

#define PLAYER_FFWD              0x49

// fastforward speed (fraction)

#define PLAYER_FFWD_SPEED   0x4A

// position in fraction (fraction)

#define PLAYER_PERCENT      0x25

// position in time (tick_t)

#define PLAYER_POSITION     0x28

// duration (tick_t)

#define PLAYER_DURATION     0x46

// timer shown on screen (tchar_t[])

#define PLAYER_TIMER        0x7E

// show left time (bool_t)

#define PLAYER_TIMER_LEFT   0x7F

// benchmark duration (tick_t)

#define PLAYER_BENCHMARK    0x55

// 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        0x29

// current format (format*)

#define PLAYER_FORMAT       0x2B

// current stream (stream*)

#define PLAYER_INPUT        0x2A

// current audio stream (int)

#define PLAYER_VSTREAM      0x76

// current video stream (int)

#define PLAYER_ASTREAM      0x77

// current subtitle stream (int)

#define PLAYER_SUBSTREAM    0x82

// current audio output class (int)

#define PLAYER_AOUTPUTID    0x83

// current video output class (int)

#define PLAYER_VOUTPUTID    0x84

// 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      0x2C

// current video output (node*)

#define PLAYER_VOUTPUT      0x2D

// number of files in playlist (int)

#define PLAYER_LIST_COUNT   0x2E

// 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    0x35

// skin mode zoom factor (fraction_t)

#define PLAYER_SKIN_ZOOM    0x36

// bilinear zoom (bool_t)

#define PLAYER_SMOOTH50     0x47

// bilinear zoom (bool_t)

#define PLAYER_SMOOTHALWAYS 0x7A

// fullscreen direction flags (int)

#define PLAYER_FULL_DIR     0x39

// non fullscreen direction flags (int)

#define PLAYER_SKIN_DIR     0x45

// current relative dir (readonly) (int)

#define PLAYER_REL_DIR      0x7D

// overlay is on top or clipping needed (bool_t)

#define PLAYER_CLIPPING     0x3B

// skin viewport rectangle (rect)

#define PLAYER_SKIN_VIEWPORT 0x3C

// prerotate portrait movies

#define PLAYER_AUTOPREROTATE 0x3D

// fullscreen mode (bool_t)

#define PLAYER_FULLSCREEN   0x3E

// volume volume (int 0..100)

#define PLAYER_VOLUME       0x40

// volume mute (bool_t)

#define PLAYER_MUTE              0x41

// panning (int -128..128)

#define PLAYER_PAN          0x9D

// preamp (int -128..128)

#define PLAYER_PREAMP       0x9E

// 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  0x44

// 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   0xA3

// how much to load (%)

#define PLAYER_UNDERRUN     0x67

// 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       0x74

// aspect ratio (frac)     

#define PLAYER_ASPECT       0xBE

// application sent to background (bool_t)        

#define PLAYER_BACKGROUND   0x98

// player window is foreground (bool_t)       

#define PLAYER_FOREGROUND   0xB4

// set before and after sleep (bool_t)        

#define PLAYER_POWEROFF     0xB5

// video caps

#define PLAYER_VIDEO_CAPS   0x64

// discard saved playlist (bool)

#define PLAYER_DISCARDLIST  0xBA

// video output is a real overlay, readonly (bool_t)

#define PLAYER_VIDEO_OVERLAY 0xBD

 

// player status

#define PLAYER_SYNCING      0x81

#define PLAYER_LOADMODE     0x96

#define PLAYER_STREAMING    0xB8

 

// notify pin for interface

#define PLAYER_NOTIFY       0x97

// on list changed event

#define PLAYER_LIST_NOTIFY  0x78

// for open dialog

#define PLAYER_CURRENTDIR   0x6D

 

// commands:

// update video settings

#define PLAYER_UPDATEVIDEO  0x90

// update equalizer settings

#define PLAYER_UPDATEEQUALIZER 0xA5

// begin screen rotation (turn off video)

#define PLAYER_ROTATEBEGIN  0x91

// end screen rotation

#define PLAYER_ROTATEEND    0x92

// reset video driver

#define PLAYER_RESETVIDEO   0x93

// codec notify about not supported data (pin)

#define PLAYER_NOT_SUPPORTED_DATA 0x9F

// move back

#define PLAYER_MOVEBACK     0x9A

// move forward

#define PLAYER_MOVEFFWD     0x9B

// position bar moving state (boolean)

#define PLAYER_INSEEK       0x9C

// next chapter/track

#define PLAYER_NEXT              0xB0

// prev chapter/track

#define PLAYER_PREV              0xB1

// stop

#define PLAYER_STOP              0xB2

// resync

#define PLAYER_RESYNC       0xB3

 

// array type params (just a hint)

#define PLAYER_ARRAY        0x1000

// url in playlist (0x1000,0x1001,0x1002...)

#define PLAYER_LIST_URL     0x1000

// title in playlist (0x2000,0x2001,0x2002...)

#define PLAYER_LIST_TITLE   0x2000

// title or filename in playlist

#define PLAYER_LIST_AUTOTITLE 0x5000

// length in playlist (0x4000,0x4001,0x4002...)

#define PLAYER_LIST_LENGTH  0x4000

// input comments

#define PLAYER_COMMENT      0x3000

 

举个例子:

播放的的话,我们可以如下设置:

    Bool_t b=1;

Moonplayer->Set(Moonplayer,PLAYER_PLAYER,&b,sizeof(b));

停止的话,可以是:

Bool_t b=0;

Moonplayer->Set(Moonplayer,PLAYER_PLAYER,&b,sizeof(b));

其他播放类似,可以参考TCPMP或者我程序中的代码。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值