?? play_mosaic.c
字號:
for (i=0; i< task_count; i++) { /* add eos event in list */ if (task_list[i].file_status == RM_ERRORENDOFFILE) { event_list[nEvents].ModuleID = dcc_info[i].video_decoder; event_list[nEvents].Mask = RUAEVENT_INBAND_COMMAND; nEvents++; } }check_other_events: event_index = task_count+1; /*each task can add as much as one event */ if (nEvents == task_count + 1) { all_blocked: /*all tasks are blocked: wait until something happens */ while ( RUAWaitForMultipleEvents(pRUA, event_list, nEvents, COMMON_TIMEOUT_US, &event_index) != RM_OK) { goto get_command; } nEvents--; } else { /*as long as one task can go on, don't wait too much for the other events */ if(RUAWaitForMultipleEvents(pRUA, event_list, nEvents, 0, &event_index) != RM_OK){ /* no events to process */ goto get_command; } } /*** PROCESS EVENTS *****/ if ((event_index == 0)){ /* next picture event recieved: refresh the mosaic */ err = RMSMXRefresh(smx); for(i = 0; i < task_count; i++){ if(task_list[i].smx_eos_wait){ struct rmsmx_slot_status status; RMSMXGetSlotStatus(smx, &status, i); if(status.starved){ task_list[i].smx_eos_wait = FALSE; task_list[i].nTimes++; fprintf(stderr, "%lx_WaitForEOS OK %ld times bc=%ld\n", task_list[i].id, task_list[i].nTimes, task_list[i].byte_counter); if (playback_options[i].loop_count > 0) playback_options[i].loop_count --; /* restart the playback if necessary */ if ((playback_options[i].loop_count > 0) || (playback_options[i].infinite_loop)) { /* restart playback */ /* fprintf(stderr, "%lx_Restart playback\n", task_list[i].id); */ if (RMSeekFile(task_list[i].file, 0, RM_FILE_SEEK_START) == RM_ERRORSEEKFILE) { fprintf(stderr, "%lx_Error seeking file to beginning\n", task_list[i].id); goto cleanup; } task_list[i].buf = NULL; task_list[i].buffer_used = FALSE; task_list[i].byte_counter = 0; task_list[i].sync_timer = TRUE; if (dcc_info[i].state == RM_PLAYING_TRICKMODE) { dcc_info[i].state = RM_PLAYING; dcc_info[i].trickmode_id = RM_NO_TRICKMODE; } err = DCCStopVideoSource(dcc_info[i].pVideoSource, DCCStopMode_LastFrame); if (RMFAILED(err)) { fprintf(stderr, "%lx_Cannot stop video decoder err=%d\n", task_list[i].id, err); goto cleanup; } err = RMSMXFlushSlot(smx, i); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "[%ld] Cannot flush video display fifo err %d\n",i, err)); goto cleanup; } err = RUAResetPool(task_list[i].pDMA); /* needed for no dram copy version on standalone */ if (RMFAILED(err)) { fprintf(stderr, "%lx_Error cannot reset dmapool\n", task_list[i].id); goto cleanup; } err = DCCPlayVideoSource(dcc_info[i].pVideoSource, DCCVideoPlayFwd); if (RMFAILED(err)) { fprintf(stderr, "%lx_Cannot play video decoder %d\n", task_list[i].id, err); goto cleanup; } } else if (playback_options[i].loop_count == 0) { /* check if all tasks are done */ RMuint32 done_tasks = 0; RMSMXSetInputSource(smx, NULL, i); for (i=0; i< task_count; i++) { play_opt = &playback_options[i]; if ((play_opt->loop_count > 0) || (play_opt->infinite_loop)) done_tasks++; } if(done_tasks == 0) goto cleanup; } break; } } } } else if (event_index < (task_count+1)) { nEvents--; /* got the videodecoder eos */ if(event_list[event_index].Mask == RUAEVENT_INBAND_COMMAND){ for(i = 0; i < task_count; i++){ if(event_list[event_index].ModuleID == dcc_info[i].video_decoder){ break; } } /* if(i == task_count){/\*error*\/} */ task_list[i].smx_eos_wait = TRUE; } } goto check_other_events; get_command: { RMuint32 decoder, new_decoder; struct rmsmx_window *win = NULL; decoder = PSMcontext.currentActivePSMContext; if(decoder && (!fullscreen)){ win = &(task_list[decoder - 1].smx_window); } err = process_command(&PSMcontext, pdcc_info, &actions); if (RMFAILED(err)) { fprintf(stderr, "Error while processing key %d\n", err); goto cleanup; } switch(actions.cmd){#if 0 case KEY_CMD_FULLSCREEN: if(decoder != 0){ if (!fullscreen){ fprintf(stderr, "going fullscreen\n"); for(i = 0; i < task_count; i++){ RMSMXSetOutputWindow(smx, &(task_list[i].smx_thumb_window), i); } RMSMXSetInputSource(smx, NULL, decoder - 1); RMSMXSetCanvasColor(smx, 0x00404020); err = DCCSetSurfaceSource(pDCC, DispMainVideoScaler, dcc_info[decoder - 1].pVideoSource); if (RMFAILED(err)) { fprintf(stderr, "%lx_Cannot set the surface source err=%d\n", task_list[decoder - 1].id, err); goto cleanup; } } else{ struct rmsmx_source source; fprintf(stderr, "ungoing fullscreen\n"); err = DCCSetSurfaceSource(pDCC, DispMainVideoScaler, NULL); if (RMFAILED(err)) { fprintf(stderr, "%lx_Cannot set the surface source err=%d\n", task_list[decoder - 1].id, err); goto cleanup; } usleep(40000); DCCSTCGetModuleId(dcc_info[decoder - 1].pStcSource, &source.stc_id); source.decoder_id = dcc_info[decoder - 1].video_decoder; RMSMXSetInputSource(smx, &source, decoder - 1); RMSMXSetCanvasColor(smx, 0xff808080); for(i = 0; i < task_count; i++){ RMSMXSetOutputWindow(smx, &(task_list[i].smx_window), i); } } fullscreen = !fullscreen; } break;#endif case KEY_CMD_PLUS_OUTPUT_SIZE: for(i = 0; i < task_count; i++){ if(decoder == i+1 || decoder == 0){ win = &(task_list[i].smx_window); if((win->x > 10 + win->border_width) && (win->x > 10 + win->border_width) && (win->width + win->x + 20 + 2*win->border_width < 720) && (win->height + win->y + 20 + 2*win->border_width < 480)){ win->x -= 10; win->y -= 10; win->width += 20; win->height += 20; RMSMXSetOutputWindow(smx, win, i); } } } break; case KEY_CMD_MINUS_OUTPUT_SIZE: for(i = 0; i < task_count; i++){ if(decoder == i+1 || decoder == 0){ win = &(task_list[i].smx_window); if((win->width > 20) && (win->height > 20)){ win->x += 10; win->y += 10; win->width -= 20; win->height -= 20; RMSMXSetOutputWindow(smx, win, i); } } } break; case KEY_CMD_LEFT_OUTPUT: for(i = 0; i < task_count; i++){ if(decoder == i+1 || decoder == 0){ win = &(task_list[i].smx_window); if(win->x > 10 + win->border_width){ win->x -= 10; RMSMXSetOutputWindow(smx, win, i); } } } break; case KEY_CMD_RIGHT_OUTPUT: for(i = 0; i < task_count; i++){ if(decoder == i+1 || decoder == 0){ win = &(task_list[i].smx_window); if(win->x + win->width + 2*win->border_width + 10 < 720){ win->x += 10; RMSMXSetOutputWindow(smx, win, i); } } } break; case KEY_CMD_TOP_OUTPUT: for(i = 0; i < task_count; i++){ if(decoder == i+1 || decoder == 0){ win = &(task_list[i].smx_window); if(win->y > 10 + win->border_width){ win->y -= 10; RMSMXSetOutputWindow(smx, win, i); } } } break; case KEY_CMD_BOTTOM_OUTPUT: for(i = 0; i < task_count; i++){ if(decoder == i+1 || decoder == 0){ win = &(task_list[i].smx_window); if(win->y + win->height + 2*win->border_width + 10 < 480){ win->y += 10; RMSMXSetOutputWindow(smx, win, i); } } } break; case RM_DECODER_CHANGE: if(fullscreen){ PSMcontext.currentActivePSMContext = decoder; break; } new_decoder = PSMcontext.currentActivePSMContext; if(new_decoder != decoder){ for(i = 0; i < task_count; i++){ if(decoder == i+1 || decoder == 0){ task_list[i].smx_window.border_width = 0; RMSMXSetOutputWindow(smx, &(task_list[i].smx_window), i); } if(new_decoder == i+1 || new_decoder == 0){ task_list[i].smx_window.border_width = 3; RMSMXSetOutputWindow(smx, &(task_list[i].smx_window), i); } } } break; case RM_STOP: for(i = 0; i < task_count; i++){ if(decoder == i+1 || decoder == 0){ err = RMSMXFlushSlot(smx, i); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "[%ld] Cannot flush video display fifo err %d\n",i, err)); } if(task_list[i].buf){ RUAReleaseBuffer(task_list[i].pDMA, task_list[i].buf); task_list[i].buf = NULL; } task_list[i].sync_timer = TRUE; } } break; case RM_QUIT: goto cleanup; break; } if (decoder != 0) update_hdmi(&(dcc_info[decoder - 1]), disp_opt, NULL); } if(nEvents == task_count + 1){ goto all_blocked; } } cleanup: RMTermExit(); for (i=0; i< task_count; i++) { if(task_list[i].buf){ RUAReleaseBuffer(task_list[i].pDMA, task_list[i].buf); } if (task_list[i].file != NULL){ RMCloseFile(task_list[i].file); } if (dcc_info[i].pVideoSource) { err = DCCStopVideoSource(dcc_info[i].pVideoSource, DCCStopMode_LastFrame); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "[%ld] Cannot stop video decoder err %d\n",i, err)); } err = RMSMXFlushSlot(smx, i); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "[%ld] Cannot flush video display fifo err %d\n",i, err)); } } } /* * this also flushes the display fifo * and needs to be done before closing the decoder */ RMSMXClose(smx); for (i=0; i< task_count; i++) { if (dcc_info[i].pVideoSource) { err = DCCCloseVideoSource(dcc_info[i].pVideoSource); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "[%ld] Cannot close video decoder err %d\n",i, err)); } } if (task_list[i].pDMA) { err = RUAClosePool(task_list[i].pDMA); if (RMFAILED(err)) { fprintf(stderr, "%lx_Error cannot close dmapool err=%d\n", task_list[i].id, err); } } clear_display_options(&dcc_info[i], disp_opt); } err = DCCClose(pDCC); if (RMFAILED(err)) { fprintf(stderr, "Cannot close DCC %d\n", err); } err = RUADestroyInstance(pRUA); if (RMFAILED(err)) { fprintf(stderr, "Cannot destroy RUA instance %d\n", err); return -1; } return 0;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -