changeset 7566:ab5984ab6af0

- demuxer->audio->id is set to -2 when using 'frameno.avi', so in that case, just skip audio packets. - When processing NuppelVideo files with mencoder, remaining time, estimated size, etc. fields are not computed. SOLUTION: Update demuxer->filepos variable when reading the packets. patch by Petr Pudlak <wandermind@centrum.cz>
author arpi
date Mon, 30 Sep 2002 21:10:41 +0000
parents d59a3e098800
children 85e9956a6727
files libmpdemux/demux_nuv.c
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_nuv.c	Mon Sep 30 08:04:20 2002 +0000
+++ b/libmpdemux/demux_nuv.c	Mon Sep 30 21:10:41 2002 +0000
@@ -140,8 +140,9 @@
 	struct rtframeheader rtjpeg_frameheader;
 	off_t orig_pos;
 	nuv_priv_t* priv = demuxer->priv;
+	int want_audio = (demuxer->audio)&&(demuxer->audio->id!=-2);
 
-	orig_pos = stream_tell ( demuxer->stream );
+	demuxer->filepos = orig_pos = stream_tell ( demuxer->stream );
 	if (stream_read ( demuxer->stream, (char*)& rtjpeg_frameheader, sizeof ( rtjpeg_frameheader ) ) < sizeof(rtjpeg_frameheader))
 	    return 0; /* EOF */
 
@@ -183,9 +184,18 @@
 	    (rtjpeg_frameheader.comptype == '0'))
 	{
 	    priv->current_audio_frame++;
-	    /* put Audio to audio buffer */
-	    ds_read_packet ( demuxer->audio, demuxer->stream, rtjpeg_frameheader.packetlength, 
-		rtjpeg_frameheader.timecode*0.001, orig_pos + 12, 0 );
+	    if (want_audio) {
+	      /* put Audio to audio buffer */
+	      ds_read_packet ( demuxer->audio, demuxer->stream,
+			       rtjpeg_frameheader.packetlength, 
+			       rtjpeg_frameheader.timecode*0.001,
+			       orig_pos + 12, 0 );
+	    } else {
+	      /* skip audio block */
+	      stream_seek ( demuxer->stream,
+			    stream_tell ( demuxer->stream )
+			    + rtjpeg_frameheader.packetlength );
+	    }
 	}
 
 	return 1;