⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 player.c.svn-base

📁 A Flash Player with ActionScript support. Write in C and C++. It have two part, one is Player and an
💻 SVN-BASE
字号:
#include <stdio.h>#include <getopt.h>#include <glib.h>#include "config.h"#include "player_pub.h"#include "swf_file_pub.h"#include "render_pub.h"#include "changed.h"#include "xwin_pub.h"#include "xwin_event.h"#include "action.h"#include <assert.h>#include <stdlib.h>#define DEBUG 1extern struct GraphicDevice gd;player_t *player_new() {    player_t 	*player_p;    player_p = g_new0(player_t,1);    pthread_mutex_init(&player_p->eventq_mutex , NULL);    pthread_mutex_init(&player_p->pcm_block_mutex,NULL);    return player_p;};void player_arg(player_t *player_p,int argc, char *argv[]) {    int c;    int index;#if HAVE_GETOPT_LONG    static struct option options[] = {                                         { "file"   , 1, NULL, 'f'                                         },                                         { "cmdpipe", 1, NULL, 'r' },                                         { "outpipe", 1, NULL, 'w' },                                         { "version", 0, NULL, 'v' },                                         { 0 },                                     };    while(1) {        c = getopt_long(argc, argv, "vf:r:w:", options, &index);#else    while(1) {        c = getopt(argc, argv, "vf:r:w:");#endif        if(c==-1)            break;        switch(c) {        case 'f':            player_p->play_filename_p = optarg;            break;        case 'r':            player_p->pipe_cmd_filename_p = optarg;            break;        case 'w':            player_p->pipe_out_filename_p = optarg;            break;        case 'v':            printf("%s \n",PACKAGE_STRING);            extern char* svn_version(void);            printf("version %s \n",svn_version());            printf("options: ");#if WITH_SOUND            printf("sound ");#endif#if WITH_RC            printf("rc ");#endif#if WITH_TEST            printf("test ");#endif            printf("\n");            exit(0);            break;        default:            //	do_help();            break;        }    }}/*  重置脏区 *  做1,2遍历 *  如果没晚点,画当前桢 *  处理事件队列. *  处理桢上事件 */extern int moved;void player_do_tick(player_t *player_p) {    swf_file_t		*swf_p = player_p->_level0_p;    changed_t		*changed_p = swf_p->changed_p;    render_t		*render_p = player_p->render_p;    xwin_t		*xwin_p = player_p->xwin_p;    GTimer		*timer_p;    float		current_time;    float		next_time;    UI32		tick = 1;    gulong		microseconds;    gboolean		late = FALSE;#if WITH_TEST    int			i;    float		end_time;#endif    timer_p = g_timer_new();    RenderPrepare(&gd,&(player_p->xwin_p->fd));    //  c=getBackgroundColor(&gd);    setBackgroundColor(&gd,player_p->_level0_p->BackgroundColor);    setMovieDimension(&gd,player_p->_level0_p->frame_size.Xmax - player_p->_level0_p->frame_size.Xmin, player_p->_level0_p->frame_size.Ymax - player_p->_level0_p->frame_size.Ymin);#if WITH_TEST    for (i=0;i<=200;i++) {#else    while(1) {#endif#if DEBUG        printf("frame begin ++++++++++++++++\n");#endif        chg_reset_dirty_area(changed_p);        swf_first_pass(swf_p->_root_p);        swf_second_pass(swf_p->_root_p);        if ((!late) && (xwin_p->win_visable)) {            render_clear_box(render_p);#if DEBUG            render_print_tree(swf_p->_root_p);#endif            render_do_render(render_p);            xwin_draw_frame(xwin_p,0);        };        xwin_move_position(xwin_p);#if DEBUG        chg_print_dirty_area(changed_p);        printf("  event begin +++++++++\n");#endif        swf_three_pass(swf_p->_root_p);        moved = FALSE;        event_dispatcher();        ac_exec();#if DEBUG        printf("  event end --------\n");        printf("frame end ------------------\n\n");#endif#if WITH_TEST        late = FALSE;#else        current_time = g_timer_elapsed( timer_p,&microseconds);        next_time = tick * (1e0/swf_p->frame_rate);        if (current_time < next_time) {            late = FALSE;            g_usleep(G_USEC_PER_SEC * (next_time-current_time));            tick++;        } else {            late = TRUE;            tick++;        };#endif        if (xwin_p->win_destory) {            printf("before exit\n");            break;        }    };#if WITH_TEST    end_time = g_timer_elapsed( timer_p,&microseconds);    printf("%f frame per second\n", 200/end_time);#endif    exit(0);    return;};void player_prn_banner(void) {    printf("%s \n",PACKAGE_STRING);    extern char* fplayer_svn_version(void);    printf("version %s \n",fplayer_svn_version());    printf("options: ");#if WITH_SOUND    printf("sound ");#endif#if WITH_RC    printf("rc ");#endif#if WITH_TEST    printf("test ");#endif    printf("\n");    printversion();	//打印 libkas 库 svn 版本};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -