diff utils.c @ 4844:8b4d5223daa5 libavformat

Make try_decode_frame() use the new avcodec_decode_* API. Patch by Thilo Borgmann thilo.borgmann AT g00glemail dot com.
author stefano
date Fri, 10 Apr 2009 11:03:06 +0000
parents 78eb7d728be4
children dcd4702bcc21
line wrap: on
line diff
--- a/utils.c	Thu Apr 09 21:48:45 2009 +0000
+++ b/utils.c	Fri Apr 10 11:03:06 2009 +0000
@@ -1841,7 +1841,7 @@
     return enc->codec_id != CODEC_ID_NONE && val != 0;
 }
 
-static int try_decode_frame(AVStream *st, const uint8_t *data, int size)
+static int try_decode_frame(AVStream *st, AVPacket *avpkt)
 {
     int16_t *samples;
     AVCodec *codec;
@@ -1860,16 +1860,16 @@
   if(!has_codec_parameters(st->codec)){
     switch(st->codec->codec_type) {
     case CODEC_TYPE_VIDEO:
-        ret = avcodec_decode_video(st->codec, &picture,
-                                   &got_picture, data, size);
+        ret = avcodec_decode_video2(st->codec, &picture,
+                                    &got_picture, avpkt);
         break;
     case CODEC_TYPE_AUDIO:
-        data_size = FFMAX(size, AVCODEC_MAX_AUDIO_FRAME_SIZE);
+        data_size = FFMAX(avpkt->size, AVCODEC_MAX_AUDIO_FRAME_SIZE);
         samples = av_malloc(data_size);
         if (!samples)
             goto fail;
-        ret = avcodec_decode_audio2(st->codec, samples,
-                                    &data_size, data, size);
+        ret = avcodec_decode_audio3(st->codec, samples,
+                                    &data_size, avpkt);
         av_free(samples);
         break;
     default:
@@ -2144,7 +2144,7 @@
              st->codec->codec_id == CODEC_ID_PPM ||
              st->codec->codec_id == CODEC_ID_SHORTEN ||
              (st->codec->codec_id == CODEC_ID_MPEG4 && !st->need_parsing))*/)
-            try_decode_frame(st, pkt->data, pkt->size);
+            try_decode_frame(st, pkt);
 
         count++;
     }