support discarding of uninterresting packets
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 22 Jan 2005 01:48:11 +0000 (01:48 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 22 Jan 2005 01:48:11 +0000 (01:48 +0000)
Originally committed as revision 3858 to svn://svn.ffmpeg.org/ffmpeg/trunk

ffmpeg.c
libavformat/avformat.h
libavformat/avidec.c

index 65f9709..dc61d6a 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2900,6 +2900,8 @@ static void opt_input_file(const char *filename)
             //fprintf(stderr, "\nInput Audio channels: %d", enc->channels);
             audio_channels = enc->channels;
             audio_sample_rate = enc->sample_rate;
+            if(audio_disable)
+                ic->streams[i]->discard= 1;
             break;
         case CODEC_TYPE_VIDEO:
             frame_height = enc->height;
@@ -2933,6 +2935,8 @@ static void opt_input_file(const char *filename)
             frame_rate_base = rfps_base;
 
             enc->rate_emu = rate_emu;
+            if(video_disable)
+                ic->streams[i]->discard= 1;
             break;
         case CODEC_TYPE_DATA:
             break;
index 67a2166..d4daa03 100644 (file)
@@ -227,6 +227,8 @@ typedef struct AVStream {
     int pts_wrap_bits; /* number of bits in pts (used for wrapping control) */
     /* ffmpeg.c private use */
     int stream_copy; /* if TRUE, just copy stream */
+    int discard; ///< if 1, packets can be discarded at will and dont need to be demuxed
+    //FIXME move stuff to a flags field?
     /* quality, as it has been removed from AVCodecContext and put in AVVideoFrame
      * MN:dunno if thats the right place, for it */
     float quality; 
index f394bfc..d489ddf 100644 (file)
@@ -449,6 +449,11 @@ resync:
           AVIStream *ast;
           st = s->streams[n];
           ast = st->priv_data;
+          
+          if(st->discard){
+                url_fskip(pb, size);
+                goto resync;
+          }
 
           if(   ((ast->prefix_count<5 || sync+9 > i) && d[2]<128 && d[3]<128) || 
                 d[2]*256+d[3] == ast->prefix /*||