关键函数:truecast 项目中truecast.c:plugin_control(void* args); av_render 项|~l: 视频插件:av render open;pp->set_output_list = dxapp_set_output_list;pp->set_param pp->num_inputs *pp->inputs =dxa_pp_so t_param; 〃实现视频和音频信号的同步=1;=dxa_pp_input;pp->closepp->qucrypp->clear_data =av_render_c】ose;=av_rcndcr_qucry;二 av_render_c1ear_data;/// -- 查询一//// --清楚数据一 //pp->set_output_iist = av_render_set_output_list; // -- 设置输出列表 -- //pp->get param10 12pp->set_parampp->num_inputs *pp->inputs* (pp->inputs+l)=av render get param:14 16 18 20=av_rcndcr_sct_param;二 num_inputs;=av_render_vinput;= av render ainput;/// -得到参数~//处理声音和口型同步8/// -设置参数-- // 1 7// 一编号输入一 //音频插件:pp->pclass =PP CLASS DECODER;pp->opcn =dxa_pp_opcn;pp->close 二 dxa_pp_close;pp->query =dxa_pp_query; // 频参数的赋值pp->clear data =dxa pp clear data;/// 渲染器的设置数据结构: //ttdefine ALLOW SUB OPTIONS 1//#include "types・h"//#include "slrcam^plugin. h"//#include ^truecast^player・h"〃说你行就行不行也得行,说你不行就不行行也不行不服不行typcdcf char tc8;typedef unsigned chtir tcu8;typedef short tcl6;typedef unsigned short tcul6;typedef int tc32;typedef unsigned int tcu32;// --------------------------- typedef enum internalTCState (TCTS_STOP,TCIS_PLAY,TC1S_P/WSE,TCISJT,TCTS RW} TCTS;//typedef struct TrueCastStateData ( tc8 range_set,scale_sel;tc32 sccile;double start_time,end time;} tcstdata_t;// ----------------------------------typedef enum {CLOSE_CB,OPEN CB,STOP CB,PLAY.CB,PAISE_CB,F1LCB,RW CB,BUEEER1NG_CB,INFO_CB,CB REASON SIZE)CB REASON;enum eTCRVTC FILE NOT FOUND = -404,TC^BUFFER UNDERRUN = -203, TC_BUFFER_EMPTY = -202, TC_BUF1;ER_EULL = - 201,TC MSG TOO LARGE = -102, TC_TTMEDOUT = -101, TC_WOULDBLOCK = -100,TC INVALID VERSION = -& TC TNPROGRESS = -7, TC_INVAL T D^STATE_CI I ANGE = -6, TC_NO_PLUGIN = -5, TC_RESOURCE_LOCKED = -4, TC_NO_MEM = -3, TC INVALID PARAMS = -2, TC_ERROR = -1, TC_OK = 0,TC_DONE = 1};typedef enum eTCRV TCRV;typedef void(*TCRequestCompleteCallback)(void* user_data, CB_REASON reason, TCRV tcrv, tcu32 flags, tc8* info);// ----------------------------------typedef int on2_mutcx_t;// ------------------// --------------struct on2_buffer { void* buf^handlo; tc32 num_buffers;tc8* ref count;on2_mutex_t* mutexes;tc8* last_complt;};typcdef struct on2_buffer *on2_buffcr_t;typedef long long tc64;typcdef enum {PP INPUT TYPE UPDATE,PP_INPUT_TYPE_NULLJ1PDATE,PP INPUT TYPE PAUSED,PP INPUT TYPE DISCONTINUITY,PP INPUT TYPE EOF,PP INPUT TYPE TIMESTAMP} PP_INPUT_TYPE;typedef TCRV(*pp_input_func)(void* handle, tcu8* data, tcu32 data_len, tc64 timestamp, tc8* data format, PP TNPUT TYPE type);struct pp_output_nodc { struct {pp_input_func output; tc8* output fmt;void* handle,* reserved;} pp_out;struct pp_output_node* next;};struct pp _output_list {struct pp_output_nodc* head,* tail;};// -----------------------// -----------------------struct actv_pp_node {struct player_plugin* plug; void* handle;struct pp output 1ist outputs; struct actv pp node* next;};struct pp_list_node { struct {struct actv_pp_node* head,* tail; } list;struct pp_list_node* next; };struct pp_active_list {struct pp 1i st node* head,* tai 1; };struct tcplayer {const tc8* options;on2_buffcr_t on2_buf;TCRequestCompleteCallback req_complete;void* req complete user data;struct pp_output_list outputs; //list of output pathsstruct pp_active_list pp_active; //flat, per stream, list of all active plugins TCRV* last outputrv;TCIS curr^statc,desired_state;tc32 num bufs;int nbaudioupdates;}; ///////////////////////////////////////////struct TrueCastStruct{tc8* uri,*options,*render_plugin; // This is needed to get how much time has been rendered.tc8 force rebuffer;struct {tc8 stop_on_done,rebuffer on empty; //buffer empty behavior 1二rebuffor// #if ALLOW MAX BUFFERtc32 max_bufFer_ms; //max amt allowed buffered (if set//we" 11 force a rebuffer if exceeded)//ttendif} opts;struct {struct strcancplugin* plug;void* handle;)splugin;struct {tcu8 flags;TC1S curr_state;TC1S desired_state;struct TrueCastStateData sdata;tc32 last_scale; //used for time calculation during a state change } testate;TCRequestCompleteCallback req_complete;void* req complete user data; on2_mutex_t mutex;tcu32 cb_thresh,cb count[CB REASON SIZE],cb flags;struct teplayer player;tc8 player_open,sp open:tc32 sp_loglvl;〃#if ALLOW_SUB_OPT1ONStc32 tcopts_off;//ttendif };/*//// Copyright (c) 0n2 Technologies Inc・ All Rights Reserved・// ////// File: $Workfile: player plugin. h$////$Revision: 12$// Last Update: $DatelTC: 2008-03-26 22:49:14Z$//^define PP CLASS_DECRYPTOR "decryptor" 廿define PP_CLASS_FILTER "Citer" ^define PP_CLASS_UNDEE1NED "undefined" /*get/set parameter options*/#ifndef PLAYER.PLUGIN.H^define PLAYER PLUGIN II/* player plugin version info */^define playcr_plugin_vcrsion "0・0・0・0"^define I5L A YER J?LUG I N_VERS 10N_CI 11EF 0^define PLAYER_PLUGTN VERSION MAJOR 0^define PLAYER PLUGIN VERSION MINOR^define PLAYER PLUGIN VERSION PATCH 0MM MM/* end 一 player plugin version info */#inelude "retypes・h"#if defined(_cplusplus)extern "C" {Sendif^define PP TERMINAL OUTPUTSTR "step3:pro门t//*plugin classes*/^define PP_CLASS_RENDERER 〃 ( 〃renderer#define PP CLASS DECODER "docodor"//^define PP_PARAM_D1SPLAY J hXNDLE 〃disp_handle 〃 //(get/set) ^define PP_PARAM_PLAY_T1\IE ^define PP PARAM TNPUTS #define PP PARAM VSTATS ^define PP PARAM ASTATS M OHB ^define PP_P/\KAM_VOLIME ^define I)P_PARAM_LOGLEVEL ^define PP PARAM CUSTOMstruct pp stats { //player plugin stats structure tc32 num;tcu32 time_ms;float percent, fps;};typodef enum {PP INPUT TYPE UPDATE,PP INPUT TYPE NULL UPDATE,PP INPUT TYPE PAUSED,PP TNPUT TYPE DTSCONTTNliTTY,PP INPUT TYPE EOF,PP_INPIT_TYPE_T1MEST/\MP)PP_INPUT_TYPE;struct pp _output_list;typedef tc8*(*pp_query_func) (void* htindle, const tc8* data_fornicit,tc32* input_index);typedef TCRV(*pp open func)(const tc8* data format,const tc8* options, void** handie);typedef TCRV(*pp_input_func) (void* handle, tcu8* data, tcu32 data^lcn, tc64 timestcimp, tc8* data.format, PP_INPIT_TYPE type);typedef TCRV(*pp_clear_data_func)(void* handle);typedef TCRV(*pp set output 1ist func)(void* handie,struct pp output_list* output_list);typedef void(*pp 一close_func)(void* handle);typedef TCRV (*pp_get_parcim_ fun c) (void* han die, tc8* pareim,void* value, size_t* value_size);typedef TCRV(*pp set param func)(void* handle, tc8* param,void* value, size_t value_size);struct pp_output_node {struct {"playtime" inputs //(get) returns "vslals" //(get) returns "astats"//(get) returns 〃 i 〃 volume"loglevel"“ 亠〃customplatform specific display handle playtime in ms in a tc64a video stats structurea video stats structurepp input func output; tc8* output_fmt; void* handie,* reserved;} pp_out;struct pp_output_nodc* next; };struct pp output 1ist {struct pp output node* head, *tail;}; typedef struct player_plugin { // 解码vp7文件的结构体tc8* name,* pci ass;pp_opcn_func open;pp_close_func close;pp_query_func query;pp clear data func clear data;pp _input_ func* in puts;pp_sct_output_list^func sct_output_list; pp_get_param_func get_parcim;pp_set_param_func set_param;tc32 num_inputs;} plyrpignut;#if defined(_cplusplus)}#endif#endif /*PLAYER_PLUGIN_H*/。