📄 umc_transcoder.h
字号:
/* ///////////////////////////////////////////////////////////////////////////////// INTEL CORPORATION PROPRIETARY INFORMATION// This software is supplied under the terms of a license agreement or// nondisclosure agreement with Intel Corporation and may not be copied// or disclosed except in accordance with the terms of that agreement.// Copyright(c) 2003-2005 Intel Corporation. All Rights Reserved.////*/#ifndef __UMC_TRANSCODER_H#define __UMC_TRANSCODER_H#include "umc_data_reader.h"#include "umc_splitter.h"#include "umc_video_decoder.h"#include "umc_base_color_space_converter.h"#include "umc_cyclic_buffer.h"#include "umc_video_encoder.h"#include "umc_dual_thread_codec.h"#include "umc_muxer.h"#include "umc_data_writer.h"#include "umc_video_render.h"#include "umc_media_data_ex.h"#include "umc_source_types.h"#include "vm_thread.h"class Transcoder{public: // Default constructor Transcoder(void); // Destructor ~Transcoder(void); // Load source file bool LoadSource(UMC::SourceInfo *lpSourceInfo, bool bUsedEncodedParams = false); // Load source video file bool LoadSourceVideo(UMC::SourceInfo *lpSourceInfo, bool bUsedEncodedParams = false); // Load source audio file bool LoadSourceAudio(UMC::SourceInfo *lpSourceInfo, bool bUsedEncodedParams = false); // Set destination file name bool SetDestination(vm_char *lpcFileDest); // Set video compressor bool SetVideoCompression(UMC::BaseCodecParams *lpParams, UMC::VideoStreamType VideoType); // Set audio compressor bool SetAudioCompression(UMC::BaseCodecParams *lpParams, UMC::AudioStreamType AudioType); // Set muser bool SetMuxerType(UMC::MuxerParams *lpParams, UMC::SystemStreamType SystemType); // Set preview renderer bool SetPreviewRenderer(UMC::VideoRender *lpPreviewRenderer, UMC::VideoRenderParams *lpPreviewParams, long lFrameRateDevider = 10); // Start transcoding bool Run(UMC::DataWriter * lpDataWriter = NULL); // Get current position of transcoding double GetProgress(void); // Pause the transcoding bool Pause(void); // Stop the transcoding void Stop(void); // Reset media stream(s) to original state void Reset(void); // Get source video format bool GetSourceVideoInfo(UMC::sVideoStreamInfo &videoInfo); // Get source audio format bool GetSourceAudioInfo(UMC::sAudioStreamInfo &audioInfo); // Get current performance void GetPerformance(long &lEncodedFrames, double &dElapsedTime); void SetExit(bool exit){m_bExit = exit;};protected: // Release whole transcoder void Release(void); // Release video chain of transcoder void ReleaseVideo(void); // Release audio chain of transcoder void ReleaseAudio(void); // Release compression object(s) of transcoder void ReleaseDestination(void); // Create compression object(s) of transcoder bool CreateDestination(vm_char *lpcFileDest, UMC::DataWriter * lpDataWriter = NULL); // Start all internal thread(s) bool RunWorkingThreads(void); // Init data reader UMC::Status InitDataReader(UMC::SourceInfo *lpSourceInfo, UMC::DataReader *(&lpReader)); // Init splitter UMC::Status InitSplitter(UMC::SourceInfo *lpSourceInfo, UMC::MediaDataEx &mediaSrc, long lFlags, UMC::Splitter *(&lpSplitter)); // Init video decoder UMC::Status InitVideoDecoder(UMC::MediaData &mediaSrc, bool bUsedEncodedParams); // Init audio decoder UMC::Status InitAudioDecoder(bool bUsedEncodedParams); // Create video encoder UMC::Status CreateVideoEncoder(void); // Create audio encoder UMC::Status CreateAudioEncoder(void); // Create muxer UMC::Status CreateMuxer(void); // Create data writer UMC::Status InitDataWriter(vm_char *lpcFile, UMC::DataWriter *lpWriter); bool m_bExit; // (bool) flag to exit bool m_bPause; // (bool) flag to pause bool m_ExternalDataWriter; UMC::DataReader *m_lpDataReaderVideo; // (UMC::DataReader *) pointer to video data reader UMC::Splitter *m_lpSplitterVideo; // (UMC::Splitter *) pointer to video splitter UMC::DataReader *m_lpDataReaderAudio; // (UMC::DataReader *) pointer to audio data reader UMC::Splitter *m_lpSplitterAudio; // (UMC::Splitter *) pointer to audio splitter UMC::VideoDecoder *m_lpVideoDecoder; // (UMC::VideoDecoder *) pointer to video decoder UMC::BaseCodec *m_lpAudioDecoder; // (UMC::BaseCodec *) pointer to audio decoder UMC::DualThreadedCodec *m_lpDTAudioDecoder; // (UMC::DualThreadedCodec *) pointer to dual threaded audio decoder UMC::MediaBuffer *m_lpMediaBuffer; // (UMC::MediaBuffer *) pointer to source audio buffer UMC::VideoRender *m_lpPreview; // (UMC::VideoRender *) external pointer to preview renderer UMC::BaseColorSpaceConverter *m_lpColorConverter; // (UMC::BaseColorSpaceConverter *) pointer to color converter UMC::ColorConversionParams m_ConversionParams; // (UMC::ColorConversionParams) color convertion parameters UMC::VideoBuffer *m_lpYUVBuffer; // (UMC::VideoBuffer *) pointer to uncompressed video buffer UMC::VideoEncoder *m_lpVideoEncoder; // (UMC::VideoEncoder *) pointer to video encoder UMC::BaseCodec *m_lpAudioEncoder; // (UMC::BaseCodec *) pointer to audio encoder UMC::MediaBuffer *m_lpPCMBuffer; // (UMC::MediaBuffer *) pointer to uncompressed audio buffer UMC::DualThreadedCodec *m_lpDTAudioEncoder; // (UMC::DualThreadedCodec *) pointer to dual threaded audio encoder UMC::Muxer *m_lpMuxer; // (UMC::Muxer *) pointer to muxer UMC::DataWriter *m_lpDataWriter; // (UMC::DataWriter *) pointer to data writer // video encode param(s) UMC::VideoStreamType m_VideoEncodeType; // (UMC::VideoStreamType) video encoder type UMC::BaseCodecParams *m_lpVideoEncodeParams; // (UMC::BaseCodecParams *) external pointer to video encoder params long m_lIPDistance; // (long) distance between I(ntra coded) and P(redicted) frames // audio encode param(s) UMC::AudioStreamType m_AudioEncodeType; // (UMC::AudioStreamType) audio encoder type UMC::BaseCodecParams *m_lpAudioEncodeParams; // (UMC::BaseCodecParams *) external pointer to audio encoder params // output stream param(s) UMC::SystemStreamType m_SystemEncodeType; // (UMC::SystemStreamType) type of muxer UMC::MuxerParams *m_lpMuxerParams; // (UMC::MuxerParams *) external pointer to muxer params // video renderer param(s) UMC::ColorConversionParams m_PreviewParams; // (UMC::ColorConversionParams) preview param(s) long m_lFrameRateDevider; // (long) devider of frame rate vm_thread m_hVideoDecoding; // (vm_thread) handle to video decoding thread vm_thread m_hVideoEncoding; // (vm_thread) handle to video encoding thread vm_thread m_hAudioDecoding; // (vm_thread) handle to audio decoding thread vm_thread m_hAudioEncoding; // (vm_thread) handle to audio encoding thread // Working procedure for video decoding thread static unsigned int VideoDecodingThreadRoutine(void *lpvParam); // Working procedure for video encoding thread static unsigned int VideoEncodingThreadRoutine(void *lpvParam); // Working procedure for audio decoding thread static unsigned int AudioDecodingThreadRoutine(void *lpvParam); static unsigned int AudioDecodingThreadRoutine_(void *lpvParam); // Working procedure for audio encoding thread static unsigned int AudioEncodingThreadRoutine(void *lpvParam); static unsigned int AudioEncodingThreadRoutine_(void *lpvParam); UMC::SourceInfo *m_lpSourceInfoVideo; // (UMC::SourceInfo *) pointer to source video info UMC::SourceInfo *m_lpSourceInfoAudio; // (UMC::SourceInfo *) pointer to source audio info vm_char m_cDestinationFile[UMC::MAXIMUM_PATH]; // (char []) destination file name // statistic variable(s) long m_lEncodedFrames; // (long) counter of encoded frames double m_dElapsedTime; // (double) time spended for transcoding double m_dAdditionalTime; // (double) time spended for transcoding before pause};#endif //__UMC_TRANSCODER_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -