[FFmpeg-cvslog] lavf: move nb_decoded_frames out of info.

Michael Niedermayer git at videolan.org
Sat Aug 4 15:50:46 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Aug  4 15:38:05 2012 +0200| [2107009e7d351ff83a87fda161cc5269d2752428] | committer: Michael Niedermayer

lavf: move nb_decoded_frames out of info.

This way the variable is available outside find_stream_info

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2107009e7d351ff83a87fda161cc5269d2752428
---

 libavformat/avformat.h |    7 ++++++-
 libavformat/utils.c    |    8 ++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 1614646..58b02a6 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -741,7 +741,6 @@ typedef struct AVStream {
         int duration_count;
         double duration_error[2][2][MAX_STD_TIMEBASES];
         int64_t codec_info_duration;
-        int nb_decoded_frames;
         int found_decoder;
 
         /**
@@ -823,6 +822,12 @@ typedef struct AVStream {
      * Number of samples to skip at the start of the frame decoded from the next packet.
      */
     int skip_samples;
+
+    /**
+     * Number of internally decoded frames, used internally in libavformat, do not access
+     * its lifetime differs from info which is why its not in that structure.
+     */
+    int nb_decoded_frames;
 } AVStream;
 
 #define AV_PROGRAM_RUNNING 1
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 4926b57..7bd815c 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -910,11 +910,11 @@ static int has_decode_delay_been_guessed(AVStream *st)
         return 1;
 #endif
     if(st->codec->has_b_frames<3)
-        return st->info->nb_decoded_frames >= 7;
+        return st->nb_decoded_frames >= 7;
     else if(st->codec->has_b_frames<4)
-        return st->info->nb_decoded_frames >= 18;
+        return st->nb_decoded_frames >= 18;
     else
-        return st->info->nb_decoded_frames >= 20;
+        return st->nb_decoded_frames >= 20;
 }
 
 static AVPacketList *get_next_pkt(AVFormatContext *s, AVStream *st, AVPacketList *pktl)
@@ -2385,7 +2385,7 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option
         }
         if (ret >= 0) {
             if (got_picture)
-                st->info->nb_decoded_frames++;
+                st->nb_decoded_frames++;
             pkt.data += ret;
             pkt.size -= ret;
             ret       = got_picture;



More information about the ffmpeg-cvslog mailing list