zoukankan      html  css  js  c++  java
  • iOS硬解码注意点

    (不定期更新。。。。)

    1 在硬解码中,当你使用回调的方式拿解码后的数据,又想解码前传一个东西(结构体,指针等等),解码后仍然能拿到这个东西,用来操作解码后数据的时候:

    VT_EXPORT OSStatus  VTDecompressionSessionDecodeFrame(
        CM_NONNULL VTDecompressionSessionRef    session,
        CM_NONNULL CMSampleBufferRef            sampleBuffer,
        VTDecodeFrameFlags                        decodeFlags, // bit 0 is enableAsynchronousDecompression
        void * CM_NULLABLE                        sourceFrameRefCon,
        VTDecodeInfoFlags * CM_NULLABLE         infoFlagsOut) API_AVAILABLE(macosx(10.8), ios(8.0), tvos(10.2));

    @param sourceFrameRefCon

    Your reference value for the frame.  

    Note that if sampleBuffer contains multiple frames, the output callback function will be called

    multiple times with this sourceFrameRefCon.


    @param sampleBuffer

    A CMSampleBuffer containing one or more video frames. 

    hardDecOutputCallback(void             *DEComprOutputRefCon,
                                       void             *sourceFrameRefCon,
                                       OSStatus          status,
                                       VTDecodeInfoFlags infoFlags,
                                       CVImageBufferRef  ImageBuffer,
                                       CMTime            TimeStamp,
                                       CMTime            Duration)
    //注册回调
    
     const VTDecompressionOutputCallbackRecord CallBack = {hardDecOutputCallback, this};
        nStatus = VTDecompressionSessionCreate(NULL,
                                               FormatDEC,
                                               NULL,
                                               PixelBufferAttributes,
                                               &CallBack,
                                               &DecSession);

    注意;上边两个函数里的 sourceFrameRefCon不限于非得是CVPixelBufferRef类型;这个东西是一个指针,可以是你自己定义的一个 char* ,void* 结构体指针强转,只要你需要通过解码附带传输什么地址,你就可以用它;

  • 相关阅读:
    vector
    vector-back
    vector-back
    vector-begin
    vector-begin
    vector-at
    vector-at
    Vector-assign
    Vector-assign
    Vector-Constructors
  • 原文地址:https://www.cnblogs.com/8335IT/p/15090680.html
Copyright © 2011-2022 走看看