[FFmpeg-devel] [PATCH] rmdec.c: merge old/new packet reading code

Ronald S. Bultje rsbultje
Tue Mar 10 19:29:11 CET 2009


Hi,

On Tue, Mar 10, 2009 at 1:58 PM, Kostya <kostya.shishkov at gmail.com> wrote:
> Looks like some leftover from dead code, so you may start thinking
> of getting read of it completely ;)

As you wish. You'll see the bottom part of this patch shows the only
useful use of seq, but that condition (in any version that I've ever
seen) is always true, so not sure what the use is... I just removed it
so we index only keyframes, I suppose that was the intention anyway.

Ronald
-------------- next part --------------
Index: ffmpeg-svn/libavformat/rmdec.c
===================================================================
--- ffmpeg-svn.orig/libavformat/rmdec.c	2009-03-10 14:20:09.000000000 -0400
+++ ffmpeg-svn/libavformat/rmdec.c	2009-03-10 14:24:27.000000000 -0400
@@ -587,7 +587,7 @@
 int
 ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
                     AVStream *st, RMStream *ast, int len, AVPacket *pkt,
-                    int *seq, int *flags, int64_t *timestamp)
+                    int *flags, int64_t *timestamp)
 {
     RMDemuxContext *rm = s->priv_data;
 
@@ -704,9 +704,9 @@
 {
     RMDemuxContext *rm = s->priv_data;
     AVStream *st;
-    int i, len, seq = 1;
+    int i, len;
     int64_t timestamp, pos;
-    int flags;
+    int flags = 2;
 
     for (;;) {
         if (rm->audio_pkt_cnt) {
@@ -722,7 +722,6 @@
                 timestamp = AV_NOPTS_VALUE;
                 len = !ast->audio_framesize ? RAW_PACKET_SIZE :
                     ast->coded_framesize * ast->sub_packet_h / 2;
-                flags = (seq++ == 1) ? 2 : 0;
             } else {
                 len=sync(s, &timestamp, &flags, &i, &pos);
                 st = s->streams[i];
@@ -732,8 +731,10 @@
                 return AVERROR(EIO);
 
             if (ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt,
-                                    &seq, &flags, &timestamp) < 0)
+                                    &flags, &timestamp) < 0) {
+                flags = 0;
                 continue;
+            }
         }
 
         if(  (st->discard >= AVDISCARD_NONKEY && !(flags&2))
@@ -743,7 +744,7 @@
             break;
     }
 
-    if((flags&2) && (seq&0x7F) == 1)
+    if (flags & 2)
         av_add_index_entry(st, pos, timestamp, 0, 0, AVINDEX_KEYFRAME);
 
     return 0;



More information about the ffmpeg-devel mailing list