[FFmpeg-cvslog] r22166 - trunk/libavformat/bink.c

pross subversion
Wed Mar 3 10:44:31 CET 2010


Author: pross
Date: Wed Mar  3 10:44:30 2010
New Revision: 22166

Log:
Support demuxing of streamed Bink files

Modified:
   trunk/libavformat/bink.c

Modified: trunk/libavformat/bink.c
==============================================================================
--- trunk/libavformat/bink.c	Wed Mar  3 10:38:09 2010	(r22165)
+++ trunk/libavformat/bink.c	Wed Mar  3 10:44:30 2010	(r22166)
@@ -211,18 +211,17 @@ static int read_packet(AVFormatContext *
         bink->remain_packet_size -= 4 + audio_size;
         bink->current_track++;
         if (audio_size > 0) {
-            /* Each audio packet reports the number of decompressed samples
-               (in bytes). We use this value to calcuate the audio PTS */
-            int reported_size = get_le32(pb) / (2 * s->streams[bink->current_track]->codec->channels);
-            url_fseek(pb, -4, SEEK_CUR);
-
             /* get one audio packet per track */
             if ((ret = av_get_packet(pb, pkt, audio_size))
                                            != audio_size)
                 return ret;
             pkt->stream_index = bink->current_track;
             pkt->pts = bink->audio_pts[bink->current_track - 1];
-            bink->audio_pts[bink->current_track -1] += reported_size;
+
+            /* Each audio packet reports the number of decompressed samples
+               (in bytes). We use this value to calcuate the audio PTS */
+            bink->audio_pts[bink->current_track -1] +=
+                AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codec->channels);
             return 0;
         }
     }
@@ -246,6 +245,9 @@ static int read_seek(AVFormatContext *s,
     BinkDemuxContext *bink = s->priv_data;
     AVStream *vst = s->streams[0];
 
+    if (url_is_streamed(s->pb))
+        return -1;
+
     /* seek to the first frame */
     url_fseek(s->pb, vst->index_entries[0].pos, SEEK_SET);
     bink->video_pts = 0;



More information about the ffmpeg-cvslog mailing list