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

📄 umc_structures.h

📁 audio-video-codecs.rar语音编解码器
💻 H
📖 第 1 页 / 共 2 页
字号:
        WMV3_VIDEO
    };

    enum ColorFormat
    {
        NONE    = -1,
        YV12    = 0,    // Planar Y, V, U (4:2:0) (note V,U order!)
        NV12    ,       // Planar Y, merged U->V (4:2:0)
        YUY2    ,       // Composite Y->U->Y->V (4:2:2)
        UYVY    ,       // Composite U->Y->V->Y (4:2:2)
        YUV411  ,       // Planar Y, U, V (4:1:1)
        YUV420  ,       // Planar Y, U, V (4:2:0)
        YUV422  ,       // Planar Y, U, V (4:2:2)
        YUV444  ,       // Planar Y, U, V (4:4:4)
        YUV_VC1 ,       // Planar Y, U, V (4:2:0), VC1 codec specific
        Y411    ,       // Composite Y, U, V (4:1:1)
        Y41P    ,       // Composite Y, U, V (4:1:1)
        RGB32   ,       // Composite B->G->R->A
        RGB24   ,       // Composite B->G->R
        RGB565  ,       // Composite B->G->R, 5 bit per B & R, 6 bit per G
        RGB555  ,       // Composite B->G->R->A, 5 bit per component, 1 bit per A
        RGB444  ,       // Composite B->G->R->A, 4 bit per component
        GRAY    ,       // Luminance component only.
        YUV420A ,       // Planar Y, U, V, Alpha
        YUV422A ,       // Planar Y, U, V, Alpha
        YUV444A ,       // Planar Y, U, V, Alpha
        YVU9    ,       // Planar Y, U, V
        GRAYA           // Luminance with Alpha
    };

    enum FrameType
    {
        NONE_PICTURE            = 0,
        I_PICTURE               = 1,
        P_PICTURE               = 2,
        B_PICTURE               = 3,
        D_PICTURE               = 4,
        VIDEO_FRAME             = 0x7,
        AUDIO_FRAME             = 0x8
    };

    enum InterlaceType
    {
        PROGRESSIVE                    = 0,
        //FIELD_PICTURE                  = 1,
        INTERLEAVED_TOP_FIELD_FIRST    = 2,
        INTERLEAVED_BOTTOM_FIELD_FIRST = 3
    };

    enum // decoding flags
    {
        //receiving this flag decoder must output decompressed data
        //in proper display order, otherwise it will output decompressed data
        //in decoding order, application is responsible to reorder frames to
        //before displaying
        FLAG_VDEC_REORDER         = 0x00000004,

        //next flag describes endian related properties of input data
        //when set, means that coded data should be accessed by 4-reading operations
        //for little-endian systems it means that each 4 bytes are swapped
        //i.e [0]<->[3], [1]<->[2]
        //for big-endian systems swapping is not required
        FLAG_VDEC_4BYTE_ACCESS    = 0x00000100,

        ////traditional, not UMC specific behavior
        ////original byte order, headers before data, return bytes consumed
        //FLAG_VDEC_COMPATIBLE      = 0x00001000,
    };

    enum // encoding flags
    {
        // The encoder should reorder the incoming frames in the encoding order itself.
        FLAG_VENC_REORDER       = 0x00000004
    };

    enum // color space conversion flag(s)
    {
        FLAG_CCNV_NONE          = 0x00000000,                       // do not use conversion
        FLAG_CCNV_CONVERT       = 0x00000001,                       // use color conversion
        FLAG_CCNV_RESIZE_2S     = 0x00000002 | FLAG_CCNV_CONVERT,   // convert & subsampling by 2
        FLAG_CCNV_RESIZE_4S     = 0x00000004 | FLAG_CCNV_CONVERT,   // convert & subsampling by 4
        FLAG_CCNV_RESIZE_8S     = 0x00000006 | FLAG_CCNV_CONVERT,   // convert & subsampling by 8
        FLAG_CCNV_RESIZE_2X     = 0x0000000a | FLAG_CCNV_CONVERT,   // convert & oversampling by 2
        FLAG_CCNV_RESIZE_4X     = 0x0000000c | FLAG_CCNV_CONVERT,   // convert & oversampling by 4
        FLAG_CCNV_RESIZE_8X     = 0x0000000e | FLAG_CCNV_CONVERT,   // convert & oversampling by 8
        FLAG_CCNV_RESIZE_CUSTOM = 0x00000010 | FLAG_CCNV_CONVERT,   // convert & custom resize

        FLAG_CCNV_DEINTERLACE   = 0x00000001                        // perform deinterlace after conversion
    };

    enum // video renderer flags
    {
        //render initialized with this flag will render decompressed data from decoder
        //in proper display order
        //see FLAG_VDEC_REORDER flag as pair for this
        FLAG_VREN_REORDER       = 0x00000001,
        FLAG_VREN_CONVERT       = 0x00000002,
        FLAG_VREN_USECOLORKEY   = 0x00000004
    };

    enum AudioChannelConfig
    {
        CHANNEL_FRONT_LEFT      = 0x1,
        CHANNEL_FRONT_RIGHT     = 0x2,
        CHANNEL_FRONT_CENTER    = 0x4,
        CHANNEL_LOW_FREQUENCY   = 0x8,
        CHANNEL_BACK_LEFT       = 0x10,
        CHANNEL_BACK_RIGHT      = 0x20,
        CHANNEL_FRONT_LEFT_OF_CENTER = 0x40,
        CHANNEL_FRONT_RIGHT_OF_CENTER = 0x80,
        CHANNEL_BACK_CENTER     = 0x100,
        CHANNEL_SIDE_LEFT       = 0x200,
        CHANNEL_SIDE_RIGHT      = 0x400,
        CHANNEL_TOP_CENTER      = 0x800,
        CHANNEL_TOP_FRONT_LEFT  = 0x1000,
        CHANNEL_TOP_FRONT_CENTER = 0x2000,
        CHANNEL_TOP_FRONT_RIGHT = 0x4000,
        CHANNEL_TOP_BACK_LEFT   = 0x8000,
        CHANNEL_TOP_BACK_CENTER = 0x10000,
        CHANNEL_TOP_BACK_RIGHT  = 0x20000,
        CHANNEL_RESERVED        = 0x80000000
    };

    enum // audio renderer flags
    {
        FLAG_AREN_VOID          = 0x00000001
    };

    enum // splitter flags
    {
        //invalid value
        UNDEF_SPLITTER             = 0x00000000,
        //audio splitting required in any present in stream
        AUDIO_SPLITTER             = 0x00000001,
        //video splitting required in any present in stream
        VIDEO_SPLITTER             = 0x00000002,
        //example if setup VIDEO_SPLITTER && !set AUDIO_SPLITTER, splitter will ignore
        //any audio elementary stream, only video data request will be valid

        //audio and video splitting required if any present in stream
        AV_SPLITTER                = AUDIO_SPLITTER|VIDEO_SPLITTER,

        //main video header (sequence header) is required to return from Init
        //splitter function, application is responsible to pass it to decoder
        //as a regular video data for properly decoding consequent data
        FLAG_VSPL_VIDEO_HEADER_REQ = 0x00000010,

        //the first video frame is required to return from Init
        //splitter function, application is responsible to pass it to decoder
        //as a regular video data for properly decoding consequent data.
        //The first frame will follow main video header. This flag expands
        //splitter behavior for FLAG_VSPL_VIDEO_HEADER_REQ case
        FLAG_VSPL_VIDEO_FRAME_REQ  = 0x00000020,
        FLAG_VSPL_AUDIO_INFO_REQ   = 0x00000040,
        FLAG_VSPL_VIDEO_INFO_REQ   = 0x00000080,

        //next flag describes endian related properties of input data
        //when set, means that coded data should be accessed by 4-reading operations
        //for little-endian systems it means that each 4 bytes are swapped
        //i.e [0]<->[3], [1]<->[2]
        //for big-endian systems swapping is not required
        FLAG_VSPL_4BYTE_ACCESS     = 0x00000100,

        ////traditional, not UMC specific behavior
        ////original byte order, headers before data, return bytes consumed
        //FLAG_VSPL_COMPATIBLE       = 0x00001000,

        //some splitters may have a behavior to run internal
        //to prohibit asynchronous splitting use this flag
        FLAG_VSPL_NO_INTERNAL_THREAD= 0x00002000,
        // if reposition is not supported

        FLAG_SPL_REPOSITION_DISABLED= 0x00004000,
    };

   enum // values to select video or audio output channels
    {
        SELECT_ANY_VIDEO_PID    = 0x00000000, //ask for one of available video streams
        SELECT_ANY_AUDIO_PID    = 0x00000000, //ask for one of available audio streams
        SELECT_ALL_AUDIO_PIDS   = 0xffffffff, //ask for all of available audio streams
        SELECT_ALL_VIDEO_PIDS   = 0xffffffff  //ask for all of available video streams
    };

    enum
    {
        SINGLE_CLIENT           = 0,    // Connection oriented with single client per server
        MULTIPLE_CLIENTS,               // Connection oriented with multiple clients per server
        BROADCAST                       // Connection less mode
    };

    enum
    {
        MAXIMUM_PATH            = 1024
    };

    struct StreamInfo
    {
    };

    typedef struct sAudioStreamInfo : public StreamInfo
    {
        Ipp32s channels;                                        // (Ipp32s) number of audio channels
        Ipp32s sample_frequency;                                // (Ipp32s) sample rate in Hz
        Ipp32u bitrate;                                         // (Ipp32u) bitstream in bps
        Ipp32u bitPerSample;                                    // (Ipp32u) 0 if compressed

        Ipp64f duration;                                        // (Ipp64f) duration of the stream

        AudioStreamType stream_type;                            // (AudioStreamType) general type of stream
        AudioStreamSubType stream_subtype;                      // (AudioStreamSubType) minor type of stream

        Ipp32u channel_mask;                                    // (Ipp32u) channel mask
        Ipp32u streamPID;                                       // (Ipp32u) unique ID

        bool   is_protected;                                    // audio is encrypted

    } AudioStreamInfo;

    typedef struct sClipInfo
    {
        Ipp32s width;                                           // (Ipp32s) width of media
        Ipp32s height;                                          // (Ipp32s) height of media

    } ClipInfo;

    typedef struct sVideoStreamInfo : public StreamInfo
    {
        ClipInfo            clip_info;                          // (ClipInfo) size of video stream
        ColorFormat         color_format;                       // (ColorFormat) color format of uncompressed video
        Ipp32u              bitrate;                            // (Ipp32u) bitrate of video
        Ipp32s              aspect_ratio_width;                 // (Ipp32s) pixel aspect ratio
        Ipp32s              aspect_ratio_height;                // (Ipp32s) pixel aspect ratio
        Ipp64f              framerate;                          // (Ipp64f) frame rate of video
        Ipp64f              duration;                           // (Ipp64f) duration of media stream
        InterlaceType       interlace_type;                     // (InterlaceType) interlaced info
        VideoStreamType     stream_type;                        // (VideoStreamType) video stream type
        VideoStreamSubType  stream_subtype;                     // (VideoStreamSubType) video stream type
        Ipp32u              streamPID;                          // (Ipp32u) unique ID
    } VideoStreamInfo;

    typedef struct sSystemStreamInfo
    {
        Ipp64f muxrate;                                         // (Ipp64f) stream bitrate
        SystemStreamType stream_type;                           // (SystemStreamType) stream type
    } SystemStreamInfo;

    struct RECT
    {
        RECT():
            left(0),
            top(0),
            right(0),
            bottom(0)
        {}

        Ipp16s left;
        Ipp16s top;
        Ipp16s right;
        Ipp16s bottom;
        inline
        void SwapBigEndian()
        {
            left = BIG_ENDIAN_SWAP16(left);
            top = BIG_ENDIAN_SWAP16(top);
            right = BIG_ENDIAN_SWAP16(right);
            bottom = BIG_ENDIAN_SWAP16(bottom);
        }
    };

    enum eUMC_Status
    {
        UMC_OK                        = VM_OK,               //0,    // no error
        UMC_ERR_FAILED                = VM_OPERATION_FAILED, //-999,
        UMC_ERR_NOT_INITIALIZED       = VM_NOT_INITIALIZED,  //-998,
        UMC_ERR_TIMEOUT               = VM_TIMEOUT,          //-987,
        UMC_ERR_NOT_ENOUGH_DATA       = VM_NOT_ENOUGH_DATA,  //-996, // not enough input data
        UMC_ERR_NULL_PTR              = VM_NULL_PTR,                 // null pointer in input parameters
        UMC_ERR_INIT                  =-899,                         // failed to initialize codec
        UMC_ERR_SYNC                  =-897,                         // can't find sync word in buffer
        UMC_ERR_NOT_ENOUGH_BUFFER     =-896,                         // not enough buffer to put output data
        UMC_ERR_END_OF_STREAM         =-895,
        UMC_ERR_OPEN_FAILED           =-894,                         // failed to open file/device
        UMC_ERR_ALLOC                 =-883,                         // failed to allocate memory
        UMC_ERR_INVALID_STREAM        =-882,
        UMC_ERR_UNSUPPORTED           =-879,
        UMC_ERR_NOT_IMPLEMENTED       =-878,
        UMC_ERR_INVALID_PARAMS        =-876,
        UMC_WRN_INVALID_STREAM        = 1,
        UMC_WRN_REPOSITION_INPROGRESS = 2,
        UMC_WRN_INFO_NOT_READY        = 3
    };

    typedef Ipp32s Status;

    const vm_char* GetErrString(Status ErrCode);
    const vm_char* GetStreamTypeString(SystemStreamType Code);
    const vm_char* GetFormatTypeString(ColorFormat Code);
    const vm_char* GetAudioTypeString(AudioStreamType Code);
    const vm_char* GetVideoTypeString(VideoStreamType Code);
    const vm_char* GetVideoRenderTypeString(VideoRenderType Code);
    const vm_char* GetAudioRenderTypeString(AudioRenderType Code);

    Status GetFormatType(const vm_char *Name, ColorFormat *Code);
    Status GetStreamType(const vm_char *Name, SystemStreamType *Code);
    Status GetAudioType(const vm_char *Name, AudioStreamType *Code);
    Status GetVideoType(const vm_char *Name, VideoStreamType *Code);

    enum
    {
        DEFAULT_ALIGN_VALUE     = 16
    };

    // forward declaration of template
    template<class T> inline
    T align_pointer(void *pv, size_t lAlignValue = DEFAULT_ALIGN_VALUE)
    {
        // some compilers complain to conversion to/from
        // pointer types from/to integral types.
        return (T) ((((size_t) (pv)) + (lAlignValue - 1)) &
                    ~(lAlignValue - 1));
    }

    // forward declaration of template
    template<class T> inline
    T align_value(size_t nValue, size_t lAlignValue = DEFAULT_ALIGN_VALUE)
    {
        return static_cast<T> ((nValue + (lAlignValue - 1)) &
                               ~(lAlignValue - 1));
    }

} // namespace UMC

#endif /* __UMC_STRUCTURES_H__ */

⌨️ 快捷键说明

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