Show
Ignore:
Timestamp:
03/05/10 16:04:36 (3 years ago)
Author:
robert
Message:

Fixed warnings

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp

    r10892 r11165  
    88 
    99namespace osgFFmpeg { 
     10 
     11static int decode_video(AVCodecContext *avctx, AVFrame *picture, 
     12                         int *got_picture_ptr, 
     13                         const uint8_t *buf, int buf_size) 
     14{ 
     15#if LIBAVCODEC_VERSION_MAJOR >= 52 
     16    // following code segment copied from ffmpeg avcodec_decode_video() implementation 
     17    // to avoid warnings about deprecated function usage. 
     18    AVPacket avpkt; 
     19    av_init_packet(&avpkt); 
     20    avpkt.data = const_cast<uint8_t *>(buf); 
     21    avpkt.size = buf_size; 
     22    // HACK for CorePNG to decode as normal PNG by default 
     23    avpkt.flags = AV_PKT_FLAG_KEY; 
     24 
     25    return avcodec_decode_video2(avctx, picture, got_picture_ptr, &avpkt); 
     26#else 
     27    // fallback for older versions of ffmpeg that don't have avcodec_decode_video2. 
     28    return avcodec_decode_video(avctx, picture, got_picture_ptr, buf, buf_size); 
     29#endif 
     30} 
     31 
    1032 
    1133FFmpegDecoderVideo::FFmpegDecoderVideo(PacketQueue & packets, FFmpegClocks & clocks) : 
     
    166188            int frame_finished = 0; 
    167189 
    168             const int bytes_decoded = avcodec_decode_video(m_context, m_frame.get(), &frame_finished, m_packet_data, m_bytes_remaining); 
     190            const int bytes_decoded = decode_video(m_context, m_frame.get(), &frame_finished, m_packet_data, m_bytes_remaining); 
    169191 
    170192            if (bytes_decoded < 0)