📄 parse_video_cmdline.c
字号:
} i += 2; } else err = RM_ERROR; } else if (RMCompareAscii(argv[i], "-ttx")) { options->display_ttx = TRUE; // ttx should be a playback option instead of video err = RM_OK; // put it here to be handled together with cc i++; } else if (RMCompareAscii(argv[i], "-cc")) { if (argc > i+1) { err = RM_OK; if(RMCompareAscii(argv[i+1], "tv")) { options->display_cc = TRUE; options->use_soft_cc_decoder = 0; } else if(RMCompareAscii(argv[i+1], "soft") || RMCompareAscii(argv[i+1], "608soft") || RMCompareAscii(argv[i+1], "cc1")) { options->display_cc = TRUE; options->use_soft_cc_decoder = 1; options->cc_select = EMhwlibCCSelect_CC1; } else if(RMCompareAscii(argv[i+1], "cc2") ){ options->display_cc = TRUE; options->use_soft_cc_decoder = 1; options->cc_select = EMhwlibCCSelect_CC2; } else if(RMCompareAscii(argv[i+1], "cc3") ){ options->display_cc = TRUE; options->use_soft_cc_decoder = 1; options->cc_select = EMhwlibCCSelect_CC3; } else if(RMCompareAscii(argv[i+1], "cc4") ){ options->display_cc = TRUE; options->use_soft_cc_decoder = 1; options->cc_select = EMhwlibCCSelect_CC4; } else if(RMCompareAscii(argv[i+1], "708soft")) { options->display_cc = TRUE; options->use_soft_cc_decoder = 2; } else if(RMCompareAscii(argv[i+1], "off")) { options->display_cc = FALSE; } else err = RM_ERROR; i += 2; } else err = RM_ERROR; } else if (RMCompareAscii(argv[i], "-vcodec")) { if (argc > i+3) { err = RM_OK; if(RMCompareAscii(argv[i+1], "mpeg2")) { options->vcodec = EMhwlibVideoCodec_MPEG2; } else if(RMCompareAscii(argv[i+1], "mpeg4")) { options->vcodec = EMhwlibVideoCodec_MPEG4; } else if(RMCompareAscii(argv[i+1], "divx3")) { options->vcodec = EMhwlibVideoCodec_DIVX3; } else if(RMCompareAscii(argv[i+1], "vc1")) { options->vcodec = EMhwlibVideoCodec_VC1; } else if(RMCompareAscii(argv[i+1], "wmv")) { options->vcodec = EMhwlibVideoCodec_WMV; } else if(RMCompareAscii(argv[i+1], "h264")) { options->vcodec = EMhwlibVideoCodec_H264; } else if(RMCompareAscii(argv[i+1], "jpeg")) { options->vcodec = EMhwlibJPEGCodec; if (options->vcodec_profile == 0) options->vcodec_profile = EMhwlib_JPEG_422_Profile; } else err = RM_ERROR; if (err != RM_ERROR) { RMasciiToUInt32(argv[i+2], &(options->vcodec_max_width)); RMasciiToUInt32(argv[i+3], &(options->vcodec_max_height)); /* if ((options->vcodec_max_width > 1920) || (options->vcodec_max_height > 1088)){ RMDBGLOG((ENABLE,"ERROR - too much memory required for %ld x %ld\n", options->vcodec_max_width, options->vcodec_max_height)); err = RM_ERROR; }*/ } i += 4; } else err = RM_ERROR; } else if (RMCompareAscii(argv[i], "-vprofile")) { if (argc > i+1) { RMasciiToUInt32(argv[i+1], &(options->vcodec_profile)); i += 2; err = RM_OK; } else err = RM_ERROR; } else if (RMCompareAscii(argv[i], "-vlevel")) { if (argc > i+1) { RMasciiToUInt32(argv[i+1], &(options->vcodec_level)); i += 2; err = RM_OK; } else err = RM_ERROR; } else if (RMCompareAscii(argv[i], "-extrapict")) { if (argc > i+1) { RMasciiToUInt32(argv[i+1], (RMuint32*)&(options->vcodec_extra_pictures)); i += 2; err = RM_OK; } else err = RM_ERROR; } else if (RMCompareAscii(argv[i], "-vfifo")) { if (argc > i+1) { RMasciiToUInt32(argv[i+1], &(options->fifo_size)); options->fifo_size *= 1024; i += 2; err = RM_OK; } else err = RM_ERROR; } else if (RMCompareAscii(argv[i], "-vxfer")) { if (argc > i+1) { RMasciiToUInt32(argv[i+1], &(options->xfer_count)); i += 2; err = RM_OK; } else err = RM_ERROR; } else if (RMCompareAscii(argv[i], "-ms")) { options->MSflag = TRUE; err = RM_OK; i++; } else if (RMCompareAscii(argv[i], "-lowdelay")) { options->lowdelay = TRUE; err = RM_OK; i++; } else if (RMCompareAscii(argv[i], "-scan")) { if (argc > i+1) { err = RM_OK; if(RMCompareAscii(argv[i+1], "frame")) { options->input_scan_mode = EMhwlibScanMode_Progressive; } else if(RMCompareAscii(argv[i+1], "top")) { options->input_scan_mode = EMhwlibScanMode_Interlaced_TopFieldFirst; } else if(RMCompareAscii(argv[i+1], "bot")) { options->input_scan_mode = EMhwlibScanMode_Interlaced_BotFieldFirst; } else err = RM_ERROR; i += 2; } else err = RM_ERROR; } else if (RMCompareAscii(argv[i], "-displayerror")) { if (argc > i+1) { RMasciiToUInt32(argv[i+1], &(options->display_error_threshold)); i += 2; err = RM_OK; } else err = RM_ERROR; } else if (RMCompareAscii(argv[i], "-err_prop_threshold")) { if (argc > i+1) { RMasciiToUInt32(argv[i+1], &(options->anchor_error_parms.AnchorErrPropagationThreshold)); i += 2; err = RM_OK; } else err = RM_ERROR; } else if (RMCompareAscii(argv[i], "-err_prop_length")) { if (argc > i+1) { RMasciiToUInt32(argv[i+1], &(options->anchor_error_parms.AnchorErrPropagationLength)); i += 2; err = RM_OK; } else err = RM_ERROR; } else if (RMCompareAscii(argv[i], "-intprog")) { if (argc > i+1) { err = RM_OK; if(RMCompareAscii(argv[i+1], "std")) { options->interlaced_progressive_algorithm = INTERLACED_PROGRESSIVE_ALGORITHM_USING_DECODER_SPECIFICATION; } else if(RMCompareAscii(argv[i+1], "mpeg2_prog_seq")) { options->interlaced_progressive_algorithm = INTERLACED_PROGRESSIVE_ALGORITHM_USING_MPEG2_PROGRESSIVE_SEQ; } else if(RMCompareAscii(argv[i+1], "mpeg2_menu_prog")) { options->interlaced_progressive_algorithm = INTERLACED_PROGRESSIVE_ALGORITHM_USING_MPEG2_MENU_PROGRESSIVE; } else err = RM_ERROR; i += 2; } else err = RM_ERROR; } else if (RMCompareAscii(argv[i], "-use_afd")) { options->UseAFD = TRUE; err = RM_OK; i++; } else if (RMCompareAscii(argv[i], "-act")) { if (argc > i+1) { options->ForceAFD = TRUE; options->afd.ActiveFormatValid = TRUE; if (RMCompareAscii(argv[i+1], "none")) { options->afd.ActiveFormatValid = FALSE; } else if (RMCompareAscii(argv[i+1], "full")) { options->afd.ActiveFormat = EMhwlibAF_same_as_picture; } else if (RMCompareAscii(argv[i+1], "16x9top")) { options->afd.ActiveFormat = EMhwlibAF_16x9_top; } else if (RMCompareAscii(argv[i+1], "14x9top")) { options->afd.ActiveFormat = EMhwlibAF_14x9_top; } else if (RMCompareAscii(argv[i+1], "64x27")) { options->afd.ActiveFormat = EMhwlibAF_64x27_centered; } else if (RMCompareAscii(argv[i+1], "4x3")) { options->afd.ActiveFormat = EMhwlibAF_4x3_centered; } else if (RMCompareAscii(argv[i+1], "16x9")) { options->afd.ActiveFormat = EMhwlibAF_16x9_centered; } else if (RMCompareAscii(argv[i+1], "14x9")) { options->afd.ActiveFormat = EMhwlibAF_14x9_centered; } else if (RMCompareAscii(argv[i+1], "4x3_14x9")) { options->afd.ActiveFormat = EMhwlibAF_4x3_centered_prot_14x9; } else if (RMCompareAscii(argv[i+1], "16x9_14x9")) { options->afd.ActiveFormat = EMhwlibAF_16x9_centered_prot_14x9; } else if (RMCompareAscii(argv[i+1], "16x9_4x3")) { options->afd.ActiveFormat = EMhwlibAF_16x9_centered_prot_4x3; } else { err = RM_ERROR; } if (err != RM_ERROR) err = RM_OK; i += 2; } else err = RM_ERROR; } *index = i; return err;}RMstatus apply_video_decoder_options(struct dcc_context *dcc_info, struct video_cmdline *options){ RMstatus err; if (options->VopInfo.FixedVopRate) { RMDBGLOG((ENABLE,"Fixed VOP Rate = %ld / %ld \n", options->VopInfo.VopTimeIncrementResolution, options->VopInfo.FixedVopTimeIncrement)); err = RUASetProperty(dcc_info->pRUA, dcc_info->video_decoder, RMVideoDecoderPropertyID_VopInfo, &options->VopInfo, sizeof(options->VopInfo), 0 ); if (RMFAILED(err)) { RMDBGLOG((ENABLE,"************** Error setting fixed VOP rate : %d !\n", err)); options->VopInfo.FixedVopRate = FALSE; } } else if (options->vtimescale.enable) { RMDBGLOG((ENABLE,"VideoTimeScale = %ld \n", options->vtimescale.time_resolution)); err = RUASetProperty(dcc_info->pRUA, dcc_info->video_decoder, RMVideoDecoderPropertyID_VideoTimeScale, &options->vtimescale, sizeof(options->vtimescale), 0 ); if (RMFAILED(err)) { RMDBGLOG((ENABLE,"************** Error setting VideoTimeScale : %d !\n", err)); options->vtimescale.enable = FALSE; } } if (options->skipNCP) { RMbool dummy = TRUE; RMDBGLOG((ENABLE, "SkipNotCodedPFrames\n")); err = RUASetProperty(dcc_info->pRUA, dcc_info->video_decoder, RMVideoDecoderPropertyID_SkipNotCodedPFrames, &dummy, sizeof(dummy), 0); if (err != RM_OK) fprintf(stderr, "error setting skip not coded p frames property: %s\n", RMstatusToString(err)); } err = RUASetProperty(dcc_info->pRUA, dcc_info->video_decoder, RMVideoDecoderPropertyID_DisplayErrorThreshold, &options->display_error_threshold, sizeof(options->display_error_threshold), 0 ); if (RMFAILED(err)) { RMDBGLOG((ENABLE,"************** Error setting DisplayErrorThreshold : %d !\n", err)); } err = RUASetProperty(dcc_info->pRUA, dcc_info->video_decoder, RMVideoDecoderPropertyID_AnchorErrPropagation, &options->anchor_error_parms, sizeof(options->anchor_error_parms), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE,"************** Error setting AnchorErrPropagation: %d !\n", err)); } err = RUASetProperty(dcc_info->pRUA, dcc_info->video_decoder, RMVideoDecoderPropertyID_InterlacedProgressiveAlgorithm, &options->interlaced_progressive_algorithm, sizeof(options->interlaced_progressive_algorithm), 0 ); if (RMFAILED(err)) { RMDBGLOG((ENABLE,"************** Error setting InterlacedProgressiveAlgorithm : %d !\n", err)); } if (options->force_input_color_space) { struct VideoDecoder_ForceColorSpace_type prop; prop.Enable = TRUE; prop.ColorSpace = options->input_color_space; err = RUASetProperty(dcc_info->pRUA, dcc_info->video_decoder, RMVideoDecoderPropertyID_ForceColorSpace, &prop, sizeof(prop), 0); if (RMFAILED(err)) RMDBGLOG((ENABLE,"Error setting input color space: %d !\n", err)); } err = RUASetProperty(dcc_info->pRUA, dcc_info->video_decoder, RMVideoDecoderPropertyID_ScanMode, &(options->input_scan_mode), sizeof(options->input_scan_mode), 0); if (RMFAILED(err)) RMDBGLOG((ENABLE,"Error setting video scan mode: %d !\n", err)); if (options->display_cc) { RMuint32 entry_count, fifo_size, mixer, stc_id = 0; struct CCFifo_Open_type cc_open; entry_count = 256;#if 0 switch (dcc_info->route) { case DCCRoute_Main: mixer = EMHWLIB_MODULE(DispMainMixer, 0); break; case DCCRoute_Secondary: return RM_NOTIMPLEMENTED; default: return RM_ERROR; }#else /* FIXME: Closed caption won't work if route != DCCRoute_Main */ mixer = EMHWLIB_MODULE(DispMainMixer, 0);#endif dcc_info->ccfifo_in_id = EMHWLIB_MODULE(CCFifo, 0); err = RUAExchangeProperty(dcc_info->pRUA, dcc_info->ccfifo_in_id, RMCCFifoPropertyID_DRAMSize, &entry_count, sizeof(entry_count), &fifo_size, sizeof(fifo_size)); if (RMFAILED(err)) { fprintf(stderr, "CCfifo error %s\n", RMstatusToString(err)); return err; } if(dcc_info->pStcSource) DCCSTCGetModuleId(dcc_info->pStcSource, &stc_id); cc_open.UncachedAddress = DCCMalloc(dcc_info->pDCC, 0, RUA_DRAM_UNCACHED, fifo_size); cc_open.EntryCount = entry_count; cc_open.UncachedSize = fifo_size; cc_open.STCModuleId = stc_id; dcc_info->ccfifo_in_addr = cc_open.UncachedAddress; err = RUASetProperty(dcc_info->pRUA, dcc_info->ccfifo_in_id, RMCCFifoPropertyID_Open, &cc_open, sizeof(cc_open), 0); if (RMFAILED(err)) { fprintf(stderr, "Cannot open ccfifo %s\n", RMstatusToString(err)); return err; } /* open second CC fifo for pass-through */ if (options->use_soft_cc_decoder) { dcc_info->ccfifo_out_id = EMHWLIB_MODULE(CCFifo, 1); err = RUAExchangeProperty(dcc_info->pRUA, dcc_info->ccfifo_out_id, RMCCFifoPropertyID_DRAMSize, &entry_count, sizeof(entry_count), &fifo_size, sizeof(fifo_size)); if (RMFAILED(err)) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -