/* Test code, for now */ TermVector tv; int i, n; TreeNode *c; tv_build(&tv, terms); n = tv.n_nodes; for (i=0; i<n; i++) { c = tv.nodes[i].node; fprintf(stderr, "Term at line %d col %d is ", c->start_line, c->start_column); switch (tv.nodes[i].type) { case TRM_POS: fprintf(stderr, "Ordinary positional sumti\n"); break; case TRM_FA: fprintf(stderr, "Positioned sumti, place=%d\n", tv.nodes[i].pos); break; case TRM_TAG: fprintf(stderr, "Tagged sumti\n"); break; } } } #endif } }/*}}}*/ static void process_abstraction(TreeNode *x)/*{{{*/ { TreeNode *ss; TermVector pre, post; tv_init(&pre); tv_init(&post); ss = child_ref(x, 1); type_check(ss, SUBSENTENCE); process_subsentence(ss, &pre, &post); }/*}}}*/ static void process_relative_clause(TreeNode *x)/*{{{*/ { TreeNode *ss, *fc; TermVector pre, post; tv_init(&pre); tv_init(&post); fc = child_ref(x, 0); if (fc->data.nonterm.type == FULL_RELATIVE_CLAUSE) { ss = find_nth_child(fc, 1, SUBSENTENCE); if (ss) { process_subsentence(ss, &pre, &post); } } }/*}}}*/ static void process_metalinguistic(TreeNode *x)/*{{{*/ { /* Handle metalinguistic constructions (SEI...). This is slightly different to the other cases, in that we have to resolve the terms and selbri ourselves. */ TermVector pre, post; TreeNode *terms, *mmselbri, *selbri; LinkConv lc; terms = find_nth_child(x, 1, TERMS); mmselbri = find_nth_child(x, 1, METALINGUISTIC_MAIN_SELBRI); assert(mmselbri); selbri = child_ref(mmselbri, 0); tv_init(&pre); tv_init(&post); if (terms) { tv_build(&pre, terms); } lc_init(&lc); process_selbri_args(selbri, &pre, &post, &lc); }/*}}}*/
/* Test code, for now */ TermVector tv; int i, n; TreeNode *c; tv_build(&tv, terms); n = tv.n_nodes; for (i=0; i<n; i++) { c = tv.nodes[i].node; fprintf(stderr, "Term at line %d col %d is ", c->start_line, c->start_column); switch (tv.nodes[i].type) { case TRM_POS: fprintf(stderr, "Ordinary positional sumti\n"); break; case TRM_FA: fprintf(stderr, "Positioned sumti, place=%d\n", tv.nodes[i].pos); break; case TRM_TAG: fprintf(stderr, "Tagged sumti\n"); break; } } } #endif } }/*}}}*/ static void process_abstraction(TreeNode *x)/*{{{*/ { TreeNode *ss; TermVector pre, post; tv_init(&pre); tv_init(&post); ss = child_ref(x, 1); type_check(ss, SUBSENTENCE); process_subsentence(ss, &pre, &post); }/*}}}*/
/* Test code, for now */ TermVector tv; int i, n; TreeNode *c; tv_build(&tv, terms); n = tv.n_nodes; for (i=0; i<n; i++) { c = tv.nodes[i].node; fprintf(stderr, "Term at line %d col %d is ", c->start_line, c->start_column); switch (tv.nodes[i].type) { case TRM_POS: fprintf(stderr, "Ordinary positional sumti\n"); break; case TRM_FA: fprintf(stderr, "Positioned sumti, place=%d\n", tv.nodes[i].pos); break; case TRM_TAG: fprintf(stderr, "Tagged sumti\n"); break; } } } #endif } }/*}}}*/ static void process_abstraction(TreeNode *x)/*{{{*/ { TreeNode *ss; TermVector pre, post; tv_init(&pre); tv_init(&post); ss = child_ref(x, 1); type_check(ss, SUBSENTENCE); process_subsentence(ss, &pre, &post); }/*}}}*/ static void process_relative_clause(TreeNode *x)/*{{{*/ { TreeNode *ss, *fc; TermVector pre, post; tv_init(&pre); tv_init(&post); fc = child_ref(x, 0); if (fc->data.nonterm.type == FULL_RELATIVE_CLAUSE) { ss = find_nth_child(fc, 1, SUBSENTENCE); if (ss) { process_subsentence(ss, &pre, &post); } } }/*}}}*/
static Status ti_init(UI *ui) { TUI *tui = (TUI *)ui; /* Termkey */ /* Create new termkey instance monitoring stdin with * the SIGINT behaviour of Ctrl-C disabled */ tui->termkey = termkey_new(STDIN_FILENO, TERMKEY_FLAG_SPACESYMBOL | TERMKEY_FLAG_CTRLC); if (tui->termkey == NULL) { return st_get_error(ERR_UNABLE_TO_INITIALISE_TERMEKEY, "Unable to create termkey instance"); } /* Represent ASCII DEL character as backspace */ termkey_set_canonflags(tui->termkey, TERMKEY_CANON_DELBS | TERMKEY_CANON_SPACESYMBOL); if (tui->sess->wed_opt.test_mode) { tui->rows = 24; tui->cols = 80; return STATUS_SUCCESS; } /* ncurses */ initscr(); tui->rows = LINES; tui->cols = COLS; tv_init(&tui->tv, tui->rows, tui->cols); ti_init_display(ui); refresh(); return STATUS_SUCCESS; }
/*----------------------------------------------------------------------------- | Function : diag_tvout_fillcolour ------------------------------------------------------------------------------- | Description : This is the test function to fill the TV display with the | specified color | | Parameters : U8 tv_standard - Specifies the TV standard | U8 *color_arg - Pointer to buffer storing the color string entered | by the user | | Returns : status_t status +-----------------------------------------------------------------------------*/ status_t diag_tvout_fillcolour(U8 * color_arg, U8 * tv_std) { U8 color; U8 tv_standard; S32 ret_val; U32 tempsize = 1; U32 tv_device_handle; T_TV_INIT_STRUCT tv_init_struct; /* validate the color */ if (strcmp((char *)color_arg, "black") == 0) { color = tv_init_struct.background_color = BLACK_BACKGROUND; } else if (strcmp((char *)color_arg, "blue") == 0) { color = tv_init_struct.background_color = BLUE_BACKGROUND; } else if (strcmp((char *)color_arg, "red") == 0) { color = tv_init_struct.background_color = RED_BACKGROUND; } else if (strcmp((char *)color_arg, "magenta") == 0) { color = tv_init_struct.background_color = MAGENTA_BACKGROUND; } else if (strcmp((char *)color_arg, "green") == 0) { color = tv_init_struct.background_color = GREEN_BACKGROUND; } else if (strcmp((char *)color_arg, "cyan") == 0) { color = tv_init_struct.background_color = CYAN_BACKGROUND; } else if (strcmp((char *)color_arg, "yellow") == 0) { color = tv_init_struct.background_color = YELLOW_BACKGROUND; } else if (strcmp((char *)color_arg, "white") == 0) { color = tv_init_struct.background_color = WHITE_BACKGROUND; } else { printf("Invalid color %s\n", color_arg); return FAILURE; } ret_val = validate_video_standard(tv_std, &tv_standard); if (ret_val != SUCCESS) { printf("%s Not supported\n", tv_std); return FAILURE; } /* fill in the init structure */ tv_init_struct.sid = 0; tv_init_struct.video_std = tv_standard; tv_init_struct.image_capture_display = 0; /* initialize the tv */ ret_val = tv_init((void *)&tv_init_struct, &tv_device_handle); if (ret_val != SUCCESS) { printf("TVout init failed\n"); return 0; } /* fill the color */ ret_val = tv_write(tv_device_handle, TV_BACKGROUND_COLOR, &tempsize, &color); if (ret_val != SUCCESS) { printf("TV fillcolor test failed"); return ret_val; } return ret_val; }
/*}}}*/ static void scan_tu1_phase2(TreeNode *x)/*{{{*/ { int nc, i; struct nonterm *nt; TreeNode *c; if (x->type == N_NONTERM) { nt = &x->data.nonterm; if (nt->type == TANRU_UNIT_1) { XTermVector *xtv; XDoneTU1 *xdtu1; xtv = prop_term_vector(x, NO); xdtu1 = prop_done_tu1(x, NO); if (xtv && !xdtu1) { LinkConv lc; TreeNode *tu2; TermVector pre, post; tu2 = child_ref(x, 0); lc_init(&lc); lc_append_links(&lc, xtv->vec); tv_init(&pre); tv_init(&post); process_tanru_unit_2_args(tu2, &pre, &post, &lc); xdtu1 = prop_done_tu1(x, YES); } } nc = nt->nchildren; for (i=0; i<nc; i++) { c = nt->children[i]; scan_tu1_phase2(c); } } }
/* Scan down into the selbri inside a 'quantifier selbri' sumti, to mark up the tertau for conversions. */ TreeNode *c; LinkConv lc; TermVector empty_tv; tv_init(&empty_tv); c = find_nth_child(x, 1, SELBRI); assert(c); lc_init(&lc); process_selbri_args(c, &empty_tv, &empty_tv, &lc); }/*}}}*/ static void process_sumti_tail_1a(TreeNode *x)/*{{{*/ { /* Scan down into the selbri inside a sumti_tail construction. */ TreeNode *c; LinkConv lc; TermVector empty_tv; tv_init(&empty_tv); c = find_nth_child(x, 1, SELBRI); assert(c); lc_init(&lc); process_selbri_args(c, &empty_tv, &empty_tv, &lc); }/*}}}*/
/* Traverse down even for statement_3 (there may be abstractors, TO..TOI etc buried inside) */ nc = nt->nchildren; for (i=0; i<nc; i++) { c = nt->children[i]; scan_for_sentence_parents(c); } } }/*}}}*/ static void process_sumti_5b(TreeNode *x)/*{{{*/ { /* Scan down into the selbri inside a 'quantifier selbri' sumti, to mark up the tertau for conversions. */ TreeNode *c; LinkConv lc; TermVector empty_tv; tv_init(&empty_tv); c = find_nth_child(x, 1, SELBRI); assert(c); lc_init(&lc); process_selbri_args(c, &empty_tv, &empty_tv, &lc); }/*}}}*/
/*}}}*/ static void process_selbri_args(TreeNode *s, TermVector *pre, TermVector *post, LinkConv *lc)/*{{{*/ { /* Drill down into a selbri etc */ TreeNode *cs, *s1, *s2, *s3; /* The selbri chain */ TermVector empty_tv; tv_init(&empty_tv); type_check(s, SELBRI); cs = s; do { s1 = find_nth_child(cs, 1, SELBRI_1); /* Try to get selbri_2, or go round again if there's a NA */ s2 = find_nth_child(s1, 1, SELBRI_2); if (!s2) { cs = find_nth_child(s1, 1, SELBRI); assert(cs); } } while (!s2); /* OK, have selbri_2, the fun starts here if there's a CO. */ s3 = child_ref(s2, 0); if (nch(s2) > 1) { /* There is a CO following. Only the head terms apply to this first selbri_3, its other arguments are either linked sumti or are unspecified. */ process_selbri_3_args(s3, pre, &empty_tv, lc); while (nch(s2) > 1) { s2 = find_nth_child(s2, 1, SELBRI_2); } s3 = child_ref(s2, 0); process_selbri_3_args(s3, &empty_tv, post, lc); } else { /* All arguments apply to the selbri_3 */ process_selbri_3_args(s3, pre, post, lc); } }/*}}}*/
/*----------------------------------------------------------------------------- | Function : diag_tvout_colorbar ------------------------------------------------------------------------------- | Description : This is the test function to perform the colorbar test. | | Parameters : U8 tv_standard -Specifies the TV standard. | | Returns : status_t status +-----------------------------------------------------------------------------*/ status_t diag_tvout_colorbar(U8 * tv_std) { S32 ret_val; U8 data; U32 tempsize = 1; U32 tv_device_handle; U8 tv_standard; T_TV_INIT_STRUCT tv_init_struct; ret_val = validate_video_standard(tv_std, &tv_standard); if (ret_val != SUCCESS) { printf("%s Not supported\n", tv_std); return FAILURE; } /* fill in the init structure */ tv_init_struct.sid = 0; tv_init_struct.video_std = tv_standard; tv_init_struct.image_capture_display = 0; /* initialize the tv */ ret_val = tv_init((void *)&tv_init_struct, &tv_device_handle); if (ret_val != SUCCESS) { printf("tv initialization failed\n"); return ret_val; } /* generate the colorbar */ ret_val = tv_write(tv_device_handle, TV_GENERATE_COLORBAR, &tempsize, &data); if (ret_val != SUCCESS) { printf("tv fillcolor test failed\n"); return ret_val; } return ret_val; }
/*}}}*/ static void tv_build(TermVector *r, TreeNode *x)/*{{{*/ { /* Build a TermVector from a terms node in the parse tree. Any terms_1 or terms_2 with CEhE or PEhE inside is ignored - to defer the problem of what to do about afterthought termsets to somewhere else. */ TermVector vv; TreeNode *xx, *t1, *t2, *t, *tc, *tcc; struct nonterm *ntx, *ntt; int nc, ntc; type_check(x, TERMS); /* The main hassle is that the <terms> rule is left recursive, so we build the vector backwards and reverse it at the end. */ tv_init(&vv); xx = x; do { ntx = &xx->data.nonterm; nc = ntx->nchildren; if (nc == 1) { /* last term in the series */ t1 = ntx->children[0]; } else if (nc == 2) { t1 = ntx->children[1]; xx = ntx->children[0]; /* next term in the series */ } else { abort(); } type_check(t1, TERMS_1); /* No point assertion checking whether the children are nonterminals, they must be from the grammar */ ntt = &t1->data.nonterm; ntc = ntt->nchildren; if (ntc > 1) { /* aaaargh!! termset land */ fprintf(stderr, "No place tagging for termset at line %d\n", t1->start_line); continue; } t2 = ntt->children[0]; type_check(t2, TERMS_2); ntt = &t2->data.nonterm; ntc = ntt->nchildren; if (ntc > 1) { /* aaaargh!! termset land */ fprintf(stderr, "No place tagging for termset at line %d\n", t2->start_line); continue; } t = ntt->children[0]; assert(t->data.nonterm.type == TERM); /* Now, what sort of term is it? Have to drill down one layer further */ tc = t->data.nonterm.children[0]; switch (tc->data.nonterm.type) { case TERM_PLAIN_SUMTI: vv.nodes[vv.n_nodes].type = TRM_POS; vv.nodes[vv.n_nodes].node = t; vv.n_nodes++; break; case TERM_PLACED_SUMTI: { int pos; tcc = child_ref(tc, 0); pos = recover_fa_conv(tcc); if (pos == 0) { vv.nodes[vv.n_nodes].type = TRM_FAhI; vv.nodes[vv.n_nodes].node = t; vv.nodes[vv.n_nodes].pos = 0; } else { vv.nodes[vv.n_nodes].type = TRM_FA; vv.nodes[vv.n_nodes].node = t; vv.nodes[vv.n_nodes].pos = pos; } vv.n_nodes++; } break; case TERM_TAGGED_SUMTI: case TAGGED_TERMSET: vv.nodes[vv.n_nodes].type = TRM_TAG; vv.nodes[vv.n_nodes].node = t; vv.n_nodes++; break; case TERMSET: fprintf(stderr, "No place tagging for termset at line %d\n", t->start_line); break; case TERM_FLOATING_TENSE: case TERM_FLOATING_NEGATE: case TERM_OTHER: default: /* None of these are interesting for place tagging */ break; } } while (nc == 2); /* Keep looping whilst were in the left recursive <terms> rule */ /* Reverse the order to put the terms in natural order */ tv_reverse(r, &vv); }
/* Process selbri in the context of sumti. Allows conversions to be handled with full generality. */ int nc, i; struct nonterm *nt; TreeNode *c; if (x->type == N_NONTERM) { nt = &x->data.nonterm; if (nt->type == SUMTI_5B) { process_sumti_5b(x); } else if (nt->type == SUMTI_TAIL_1A) { process_sumti_tail_1a(x); } nc = nt->nchildren; for (i=0; i<nc; i++) { c = nt->children[i]; scan_for_selbri_in_sumti(c); } } }/*}}}*/ static void check_tu1_for_links(TreeNode *tu1)/*{{{*/ { /* Check whether there are linked sumti and add property */ TreeNode *la, *tm, *lk, *tc, *tcc; TermVector tv; XTermVector *xtv; type_check(tu1, TANRU_UNIT_1); if (tu1->data.nonterm.nchildren > 1) { /* There is a linkargs field */ tv_init(&tv); la = tu1->data.nonterm.children[1]; /* linkargs */ type_check(la, LINKARGS); do { tm = find_nth_child(la, 1, TERM); lk = find_nth_child(la, 1, LINKS); assert(tm); /* Always a term present */ /* But not always an lk */ /* Now, what sort of term is it? Have to drill down one layer further */ tc = child_ref(tm, 0); switch (tc->data.nonterm.type) { case TERM_PLAIN_SUMTI: tv.nodes[tv.n_nodes].type = TRM_POS; tv.nodes[tv.n_nodes].node = tm; tv.n_nodes++; break; case TERM_PLACED_SUMTI: { int pos; tcc = child_ref(tc, 0); pos = recover_fa_conv(tcc); if (pos == 0) { tv.nodes[tv.n_nodes].type = TRM_FAhI; tv.nodes[tv.n_nodes].node = tm; tv.nodes[tv.n_nodes].pos = 0; } else { tv.nodes[tv.n_nodes].type = TRM_FA; tv.nodes[tv.n_nodes].node = tm; tv.nodes[tv.n_nodes].pos = pos; } tv.n_nodes++; } break; case TERM_TAGGED_SUMTI: case TAGGED_TERMSET: tv.nodes[tv.n_nodes].type = TRM_TAG; tv.nodes[tv.n_nodes].node = tm; tv.n_nodes++; break; case TERMSET: fprintf(stderr, "Termset at line %d ignored, place tagging will be faulty\n", tm->start_line); break; case TERM_FLOATING_TENSE: case TERM_FLOATING_NEGATE: case TERM_OTHER: default: /* None of these are interesting for place tagging */ break; } la = lk; } while (la); /* Attach property to node */ xtv = prop_term_vector(tu1, YES); xtv->vec = new(TermVector); *(xtv->vec) = tv; } }/*}}}*/
/* Just ananlyse the child */ bt1 = nt->children[0]; process_bridi_tail_1(bt1, pre, post); } else { TermVector new_post, tail_terms; btc = find_nth_child(bt, 1, BRIDI_TAIL); assert(btc); bt1 = find_nth_child(bt, 1, BRIDI_TAIL_1); assert(bt1); tt = find_nth_child(bt, 1, TAIL_TERMS); if (tt) { ttt = find_nth_child(tt, 1, TERMS); if (ttt) { tv_build(&tail_terms, ttt); tv_catenate(&tail_terms, post, &new_post); process_bridi_tail_1(bt1, pre, &new_post); process_bridi_tail(btc, pre, &new_post); } else { process_bridi_tail_1(bt1, pre, &new_post); process_bridi_tail(btc, pre, post); } } else { process_bridi_tail_1(bt1, pre, &new_post); process_bridi_tail(btc, pre, post); } } }/*}}}*/ static void process_statement_3(TreeNode *x)/*{{{*/ { struct nonterm *nt, *nts, *ntc; TreeNode *sent, *terms, *btail, *c; TermVector pre_terms, tail_terms; assert(x->type == N_NONTERM && x->data.nonterm.type == STATEMENT_3); nt = & x->data.nonterm; if (nt->nchildren == 1) { /* Must be the form where 'sentence' is the only child. All the forms with TUhE and text_1 have at least 2 child nodes */ sent = nt->children[0]; /* This is the 'sentence' inside */ /* If the sentence is 'no_cu_sentence' or 'observative_sentence', drill down */ assert(sent->type == N_NONTERM); nts = &sent->data.nonterm; if (nts->nchildren == 1) { c = nts->children[0]; if (c->type == N_NONTERM) { ntc = & c->data.nonterm; if ((ntc->type == NO_CU_SENTENCE) || (ntc->type == OBSERVATIVE_SENTENCE)) { sent = c; nts = ntc; } } } /* Now looking at the '[terms [CU #]] bridi_tail' node. */ terms = find_nth_child(sent, 1, TERMS); btail = find_nth_child(sent, 1, BRIDI_TAIL); assert(btail); /* Every sentence has one of these! */ tv_init(&tail_terms); if (terms) { tv_build(&pre_terms, terms); } else { tv_init(&pre_terms); } process_bridi_tail(btail, &pre_terms, &tail_terms); #if 0 if (terms) { /* Test code, for now */ TermVector tv; int i, n; TreeNode *c; tv_build(&tv, terms); n = tv.n_nodes; for (i=0; i<n; i++) { c = tv.nodes[i].node; fprintf(stderr, "Term at line %d col %d is ", c->start_line, c->start_column); switch (tv.nodes[i].type) { case TRM_POS: fprintf(stderr, "Ordinary positional sumti\n"); break; case TRM_FA: fprintf(stderr, "Positioned sumti, place=%d\n", tv.nodes[i].pos); break; case TRM_TAG: fprintf(stderr, "Tagged sumti\n"); break; } } } #endif } }/*}}}*/
s32 drv_disp_init(void) { #ifdef CONFIG_FPGA return 0; #else disp_bsp_init_para para; int disp, num_screens; drv_disp_check_spec(); sunxi_pwm_init(); disp_sys_clk_init(); memset(¶, 0, sizeof(disp_bsp_init_para)); para.reg_base[DISP_MOD_DE] = DE_BASE; para.reg_size[DISP_MOD_DE] = DE_SIZE; para.reg_base[DISP_MOD_LCD0] = LCD0_BASE; para.reg_size[DISP_MOD_LCD0] = 0x3fc; #ifdef DISP_DEVICE_NUM #if DISP_DEVICE_NUM == 2 para.reg_base[DISP_MOD_LCD1] = LCD1_BASE; para.reg_size[DISP_MOD_LCD1] = 0x3fc; #endif #else # error "DEVICE_NUM undefined!" #endif #ifdef SUPPORT_DSI para.reg_base[DISP_MOD_DSI0] = MIPI_DSI0_BASE; para.reg_size[DISP_MOD_DSI0] = 0x2fc; #endif para.irq_no[DISP_MOD_DE] = AW_IRQ_DEIRQ0; para.irq_no[DISP_MOD_LCD0] = AW_IRQ_LCD0; #if defined(DISP_DEVICE_NUM) #if DISP_DEVICE_NUM == 2 para.irq_no[DISP_MOD_LCD1] = AW_IRQ_LCD1; #endif #else # error "DEVICE_NUM undefined!" #endif #if defined(SUPPORT_DSI) para.irq_no[DISP_MOD_DSI0] = AW_IRQ_MIPIDSI; #endif memset(&g_disp_drv, 0, sizeof(disp_drv_info)); bsp_disp_init(¶); num_screens = bsp_disp_feat_get_num_screens(); for(disp=0; disp<num_screens; disp++) { g_disp_drv.mgr[disp] = disp_get_layer_manager(disp); } #if defined(SUPPORT_HDMI) Hdmi_init(); #endif #if defined(SUPPORT_TV) tv_init(); #endif #if defined(CONFIG_USE_AC200) tv_ac200_init(); #endif bsp_disp_open(); lcd_init(); #if defined(CVBS_MODE_USED_GM7121) gm7121_module_init(); #endif init_flag = 1; printf("DRV_DISP_Init end\n"); return 0; #endif }
//================================================================================================= // Platform demo code //================================================================================================= void Platform_Demo_Code(void) { char video_path[32] ="C:\\Demo0091NBA.avi"; char audio_path[32] = "C:\\happy.mp3"; char image_path1[32] = "C:\\chen52.jpg"; char image_path2[32] = "C:\\chen53.jpg"; INT8S volume; INT32S nRet; INT32U decode_output_ptr; AUDIO_ARGUMENT audio_arg; IMAGE_ARGUMENT image_arg; VIDEO_ARGUMENT video_arg; VIDEO_INFO information; MEDIA_SOURCE src; AUDIO_CODEC_STATUS audio_status; IMAGE_CODEC_STATUS image_status; VIDEO_CODEC_STATUS video_status; while(1) { if(_devicemount(USE_DISK)) // Mount device { DBG_PRINT("Mount Disk Fail[%d]\r\n", USE_DISK); #if USE_DISK == FS_NAND1 nRet = _format(FS_NAND1, FAT32_Type); DrvNand_flush_allblk(); _deviceunmount(FS_NAND1); #endif } else { DBG_PRINT("Mount Disk success[%d]\r\n", USE_DISK); break; } } switch(USE_DISK) { case FS_SD: gp_memcpy((INT8S*)video_path, (INT8S*)"C:\\Demo0091NBA.avi", sizeof(video_path)); gp_memcpy((INT8S*)audio_path, (INT8S*)"C:\\happy.mp3", sizeof(audio_path)); gp_memcpy((INT8S*)image_path1, (INT8S*)"C:\\chen52.jpg", sizeof(image_path1)); gp_memcpy((INT8S*)image_path2, (INT8S*)"C:\\chen53.jpg", sizeof(image_path2)); break; case FS_NAND1: gp_memcpy((INT8S*)video_path, (INT8S*)"A:\\Demo0091NBA.avi", sizeof(video_path)); gp_memcpy((INT8S*)audio_path, (INT8S*)"A:\\happy.mp3", sizeof(audio_path)); gp_memcpy((INT8S*)image_path1, (INT8S*)"A:\\chen52.jpg", sizeof(image_path1)); gp_memcpy((INT8S*)image_path2, (INT8S*)"A:\\chen53.jpg", sizeof(image_path2)); break; case FS_USBH: gp_memcpy((INT8S*)video_path, (INT8S*)"G:\\Demo0091NBA.avi", sizeof(video_path)); gp_memcpy((INT8S*)audio_path, (INT8S*)"G:\\happy.mp3", sizeof(audio_path)); gp_memcpy((INT8S*)image_path1, (INT8S*)"G:\\chen52.jpg", sizeof(image_path1)); gp_memcpy((INT8S*)image_path2, (INT8S*)"G:\\chen53.jpg", sizeof(image_path2)); break; } // Initialize display device #if C_DISPLAY_DEVICE >= C_TV_QVGA tv_init(); #if C_DISPLAY_DEVICE == C_TV_QVGA tv_start (TVSTD_NTSC_J_NONINTL, TV_QVGA, TV_NON_INTERLACE); #elif C_DISPLAY_DEVICE == C_TV_VGA tv_start (TVSTD_NTSC_J, TV_HVGA, TV_INTERLACE); #elif C_DISPLAY_DEVICE == C_TV_D1 tv_start (TVSTD_NTSC_J, TV_D1, TV_NON_INTERLACE); #else while(1); #endif #else tft_init(); tft_start(C_DISPLAY_DEVICE); #endif user_defined_video_codec_entrance(); audio_decode_entrance(); image_decode_entrance(); video_decode_entrance(); adc_key_scan_init(); //init key scan volume = 0x3F; nRet = C_DISPLAY_DEV_HPIXEL*C_DISPLAY_DEV_VPIXEL*2; decode_output_ptr = (INT32U) gp_malloc_align(nRet, 64);//malloc decode frame buffer while(!decode_output_ptr); while(1) { adc_key_scan(); if(ADKEY_IO1) { //play audio if(video_decode_status() == VIDEO_CODEC_PROCESS_END) { src.type = SOURCE_TYPE_FS; src.type_ID.FileHandle = open(audio_path, O_RDONLY); src.Format.AudioFormat = MP3; audio_arg.Main_Channel = 1; // Use DAC Channel A+B audio_arg.L_R_Channel = 3; // Left + Right Channel audio_arg.mute = 0; audio_arg.volume = volume; // volume level = 0~63 G_snd_info.Speed = 12; //for speed control(golbal var) G_snd_info.Pitch = 12; //for pitch control(golbal var) audio_status = audio_decode_start(audio_arg, src); } } else if(ADKEY_IO2) { if(audio_decode_status(audio_arg) == AUDIO_CODEC_PROCESSING) audio_decode_stop(audio_arg); } else if(ADKEY_IO3) { //play image if(video_decode_status() == VIDEO_CODEC_PROCESS_END) { src.type = SOURCE_TYPE_FS; if((nRet++ % 2) == 0) src.type_ID.FileHandle = (INT32U)open(image_path1, O_RDONLY); else src.type_ID.FileHandle = (INT32U)open(image_path2, O_RDONLY); image_arg.OutputBufPtr=(INT8U *)decode_output_ptr; //decode output buffer image_arg.OutputBufWidth = C_DISPLAY_DEV_HPIXEL; //width of output buffer image_arg.OutputBufHeight = C_DISPLAY_DEV_VPIXEL; //Heigh of output buffer image_arg.OutputWidth = C_DISPLAY_DEV_HPIXEL; //scaler width of output image image_arg.OutputHeight = C_DISPLAY_DEV_VPIXEL; //scaler Heigh of output image image_arg.OutBoundaryColor = 0x008080; image_arg.ScalerOutputRatio = FIT_OUTPUT_SIZE; image_arg.OutputFormat = IMAGE_OUTPUT_FORMAT_YUYV; image_decode_start(image_arg, src); while (1) { image_status=image_decode_status(); if (image_status == IMAGE_CODEC_DECODE_END) { video_codec_show_image(C_DISPLAY_DEVICE, (INT32U)decode_output_ptr, C_DISPLAY_DEVICE,IMAGE_OUTPUT_FORMAT_YUYV); break; } else if(image_status==IMAGE_CODEC_DECODE_FAIL) { DBG_PRINT("image decode failed\r\n"); break; } } image_encode_stop(); close(src.type_ID.FileHandle); } } else if(ADKEY_IO4) { audio_arg.Main_Channel = 1; if(audio_decode_status(audio_arg) == AUDIO_CODEC_PROCESS_END) { DBG_PRINT("video_decode_start\r\n"); video_arg.bScaler = TRUE; video_arg.bUseDefBuf = FALSE; video_arg.DisplayWidth = C_DISPLAY_DEV_HPIXEL; video_arg.DisplayHeight = C_DISPLAY_DEV_VPIXEL; video_arg.DisplayBufferWidth = C_DISPLAY_DEV_HPIXEL; video_arg.DisplayBufferHeight = C_DISPLAY_DEV_VPIXEL; video_arg.OutputFormat = IMAGE_OUTPUT_FORMAT_YUYV; src.type = SOURCE_TYPE_FS; src.Format.VideoFormat = MJPEG; src.type_ID.FileHandle = open(video_path, O_RDONLY); if(src.type_ID.FileHandle < 0) { DBG_PRINT("file open fail\r\n"); close(src.type_ID.FileHandle); continue; } video_status = video_decode_paser_header(&information, video_arg, src); if(video_status != VIDEO_CODEC_STATUS_OK) { DBG_PRINT("paser header fail !!!\r\n"); continue; } video_decode_start(video_arg, src); audio_decode_volume(volume); } } else if(ADKEY_IO5) { if(video_decode_status() == VIDEO_CODEC_PROCESSING) { video_decode_stop(); DBG_PRINT("video_decode_stop\r\n"); } } else if(ADKEY_IO6) { } else if(ADKEY_IO7) { } else if(ADKEY_IO8) { } } }