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

📄 simple_player.cpp

📁 audio-video-codecs.rar语音编解码器
💻 CPP
📖 第 1 页 / 共 3 页
字号:
                if (0 == uiIterations) {
                    vm_debug_message(VM_STRING("Error! Wrong iteration number (-i) parameter!\n"));
                    umcRes = UMC::UMC_ERR_INIT;
                }
                break;
            case 's':
            case 'S':
                //  Turn sound off
                cc.ulSplitterFlags &= ~UMC::AUDIO_SPLITTER;
                break;
            case 'b':
            case 'B':
                //  Turn off color conversion and displaying - decoding only
                cc.ulReduceCoeff = 0;
                break;
            case 'n':
            case 'N':
                //  Play synchronously (in real time) even if
                //  sound is turned off
                cc.bSync = false;
                break;
            case 't':
            case 'T':
                if (2 == vm_string_strlen(argv[i])) {
                    i++;
                    if(argv[i][0]=='-') {
                        PrintHelp(argv[0]);
                        return 1;
                    } else {
                        cc.uiLimitVideoDecodeThreads = (Ipp32s)vm_string_atol(argv[i]);
                    }
                } else {
                    cc.uiLimitVideoDecodeThreads = (Ipp32s)vm_string_atol(argv[i] + 2);
                }
                break;
            case 'u':
            case 'U':
                //  Decode audio but don't render it
                cc.ulAudioRenderFlags |= UMC::FLAG_AREN_VOID;
                break;
            case 'd':
            case 'D':
                //  Deinterlacing
                cc.lDeinterlacing = UMC::DEINTERLACING_DUPLICATE;
                break;
            case 'K':
            case 'k':
                {
                    vm_char* szCode = NULL;
                    //  Use predefined color format instead of selected automatically
                    if (2 == stArgLen)
                    {
                        szCode = argv[++i];
                        if (i >= argc)
                            break;
                    }
                    else
                    {
                        szCode = argv[i] + 2;
                    }

                    if (0 == vm_string_strcmp(szCode, VM_STRING("16")))
                    {
                        cc.iBitDepth = 16;
                    } else {
                        cc.iBitDepth = 8;
                    }
                }
                break;
            case 'a':
            case 'A':
                {
                    vm_char* szCode = NULL;
                    //  Use predefined audio render instead of selected automatically
                    if (2 == stArgLen)
                    {
                        szCode = argv[++i];
                        if (i >= argc)
                            break;
                    }
                    else
                    {
                        szCode = argv[i] + 2;
                    }
                    if (0 == vm_string_strcmp(szCode, VM_STRING("def")))
                    {   cc.uiPrefAudioRender = UMC::DEF_AUDIO_RENDER;    }
                    else if (0 == vm_string_strcmp(szCode, VM_STRING("dsound")))
                    {   cc.uiPrefAudioRender = UMC::DSOUND_AUDIO_RENDER; }
                    else if (0 == vm_string_strcmp(szCode, VM_STRING("winmm")))
                    {   cc.uiPrefAudioRender = UMC::WINMM_AUDIO_RENDER;    }
                    else if (0 == vm_string_strcmp(szCode, VM_STRING("alsa")))
                    {   cc.uiPrefAudioRender = UMC::ALSA_AUDIO_RENDER;    }
                    else if (0 == vm_string_strcmp(szCode, VM_STRING("oss")))
                    {   cc.uiPrefAudioRender = UMC::OSS_AUDIO_RENDER;    }
                    else if (0 == vm_string_strcmp(szCode, VM_STRING("coreaudio")))
                    {   cc.uiPrefAudioRender = UMC::COREAUDIO_RENDER; }
                    else if (0 == vm_string_strcmp(szCode, VM_STRING("fw")))
                    {
                        cc.bSync = false;
                        cc.uiPrefAudioRender = UMC::FW_AUDIO_RENDER;
                    }
                    else if (0 == vm_string_strcmp(szCode, VM_STRING("fwf")))
                    {
                        cc.bSync = false;
                        cc.uiPrefAudioRender = UMC::FW_AUDIO_RENDER;
                        if (5 == stArgLen)
                        {
                            if ((i+1) < argc)
                            {
                                vm_file   *p_file = NULL;
                                i = FileNameFromParams(argc, argv, ++i, cc.szOutputAudio);

                                p_file = vm_file_open(cc.szOutputAudio, __VM_STRING("wb"));
                                if (!p_file)
                                {
                                    vm_debug_message(VM_STRING("Error! Wrong usage of key (-afwf). File %s can't be written!\n"),cc.szOutputAudio);
                                    umcRes = UMC::UMC_ERR_INIT;
                                }
                                else
                                    vm_file_fclose(p_file);
                            }

                            else {
                                vm_debug_message(VM_STRING("Error! Wrong usage of key (-afwf). Name of output audio file is absent!\n"));
                                umcRes = UMC::UMC_ERR_INIT;
                            }
                        } else {
                            argv[i] += 5;
                            i = FileNameFromParams(argc, argv, i, cc.szOutputAudio);
                        }

                    }
                    else if (0 == vm_string_strcmp(szCode, VM_STRING("nul")))
                    {   cc.uiPrefAudioRender = UMC::NULL_AUDIO_RENDER; }
                    break;
                }
            case 'f':
            case 'F':
                {
                    vm_char* szCode = NULL;
                    //  Use predefined color format instead of selected automatically
                    if (2 == stArgLen)
                    {
                        szCode = argv[++i];
                        if (i >= argc)
                            break;
                    }
                    else
                    {
                        szCode = argv[i] + 2;
                    }
                    if (0 == vm_string_strcmp(szCode, VM_STRING("yv12")))
                    {   cc.cformat = UMC::YV12;    }
                    else if (0 == vm_string_strcmp(szCode, VM_STRING("yuv420")))
                    { cc.cformat = UMC::YUV420; }
                    else if (0 == vm_string_strcmp(szCode, VM_STRING("yuv422")))
                    { cc.cformat = UMC::YUV422; }
                    else if (0 == vm_string_strcmp(szCode, VM_STRING("yuy2")))
                    {   cc.cformat = UMC::YUY2;    }
                    else if (0 == vm_string_strcmp(szCode, VM_STRING("rgb565")))
                    {   cc.cformat = UMC::RGB565; }
                    else if (0 == vm_string_strcmp(szCode, VM_STRING("rgb24")))
                    {   cc.cformat = UMC::RGB24; }
                    else if (0 == vm_string_strcmp(szCode, VM_STRING("def")))
                    {   cc.cformat = UMC::NONE; }
                    break;
                }
            case 'v':
            case 'V':
            {
                vm_char* szCode = NULL;
                //  Use predefined video render instead of selected automatically
                if (2 == stArgLen)
                {
                    szCode = argv[++i];
                    if (i >= argc)
                        break;
                }
                else
                {
                    szCode = argv[i] + 2;
                }
                if (0 == vm_string_strcmp(szCode, VM_STRING("def")))
                {   cc.uiPrefVideoRender = UMC::DEF_VIDEO_RENDER;    }
                else if (0 == vm_string_strcmp(szCode, VM_STRING("dx")))
                {   cc.uiPrefVideoRender = UMC::DX_VIDEO_RENDER; }
                else if (0 == vm_string_strcmp(szCode, VM_STRING("blt")))
                {   cc.uiPrefVideoRender = UMC::BLT_VIDEO_RENDER;    }
                else if (0 == vm_string_strcmp(szCode, VM_STRING("gdi")))
                {   cc.uiPrefVideoRender = UMC::GDI_VIDEO_RENDER;    }
                else if (0 == vm_string_strcmp(szCode, VM_STRING("gx")))
                {   cc.uiPrefVideoRender = UMC::GX_VIDEO_RENDER; }
                else if (0 == vm_string_strcmp(szCode, VM_STRING("sdl")))
                {   cc.uiPrefVideoRender = UMC::SDL_VIDEO_RENDER;    }
                else if (0 == vm_string_strcmp(szCode, VM_STRING("agl")))
                {   cc.uiPrefVideoRender = UMC::AGL_VIDEO_RENDER;    }
                else if (0 == vm_string_strcmp(szCode, VM_STRING("fb")))
                {   cc.uiPrefVideoRender = UMC::FB_VIDEO_RENDER; }
                else if (0 == vm_string_strcmp(szCode, VM_STRING("nul")))
                {   cc.uiPrefVideoRender = UMC::NULL_VIDEO_RENDER; }
                else if (0 == vm_string_strcmp(szCode, VM_STRING("fw")))
                {
                    cc.bSync = false;
                    cc.uiPrefVideoRender = UMC::FW_VIDEO_RENDER;
                }
                else if (0 == vm_string_strcmp(szCode, VM_STRING("fwf")))
                {
                    cc.bSync = false;
                    cc.uiPrefVideoRender = UMC::FW_VIDEO_RENDER;
                    if (5 == stArgLen)
                    {
                        if ((i+1) < argc)
                        {
                                vm_file  *p_file = NULL;
                                i = FileNameFromParams(argc, argv, ++i, cc.szOutputVideo);

                                p_file = vm_file_open(cc.szOutputVideo, __VM_STRING("wb"));
                                if (!p_file)
                                {
                                    vm_debug_message(VM_STRING("Error! Wrong usage of key (-vfwf). File %s can't be written!\n"),cc.szOutputVideo);
                                    umcRes = UMC::UMC_ERR_INIT;
                                }
                                else
                                    vm_file_fclose(p_file);
                        }
                        else {
                            vm_debug_message(VM_STRING("Error! Wrong usage of key (-afwf). Name of output video file is absent!\n"));
                            umcRes = UMC::UMC_ERR_INIT;
                        }
                    } else {
                        argv[i] += 5;
                        i = FileNameFromParams(argc, argv, i, cc.szOutputVideo);
                    }
                }
                else if (0 == vm_string_strcmp(szCode, VM_STRING("ovl2")))
                {
                    cc.uiPrefVideoRender = UMC::OVL2_VIDEO_RENDER;
                    cc.cformat = UMC::YV12;
                }
                break;
            }
            default:
                vm_debug_message(VM_STRING("Unknown option: %s\n"), argv[i]);
                umcRes = UMC::UMC_ERR_INIT;
                break;
            }
        } else {
            if (0 == szFileName[0])
            {   i = FileNameFromParams(argc, argv, i, szFileName);  }
            else
            {
                vm_debug_message(VM_STRING("Too many file names in command line - %s and %s\n"),
                           szFileName, argv[i]);

                umcRes = UMC::UMC_ERR_INIT;
            }
        }
        i++;
    }

    if (UMC::UMC_OK == umcRes && 0 != szFileName[0]) {
        if (bPlayFromList)
        {
            umcRes = PlayListFromFile(AVSync,
                                      cc,
                                      szFileName,
                                      szPerfLogFileName,
                                      uiIterations,
                                      // in case of WinCE main() function
                                      // is called by WinMain(). So to signal
                                      // to main() it's time to stop WinMAin
                                      // uses first byte of first parameter
                                      // from argv[] array. To stop playing
                                      // WinMAin sets it to zero.
                                      argv[0]);
        }
        else
        {
            umcRes = PlaySingleFile(AVSync,
                                    cc,
                                    szFileName,
                                    szPerfLogFileName,
                                    uiIterations,
                                    argv[0]);

        }

        if (UMC::UMC_ERR_UNSUPPORTED == umcRes)
            vm_string_printf(VM_STRING("Unsupported media format\n"));

    } else {
        if (0 == szFileName[0]) {
            vm_debug_message(VM_STRING("No file to play in command line\n"));
        }
        PrintHelp(argv[0]);
    }
    return 0;
}

⌨️ 快捷键说明

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