changeset 23357:ab5ff1c5ccaa

Set i_bps for ASF video streams according to extended stream properties
author zuxy
date Tue, 22 May 2007 13:55:14 +0000
parents 73656c3dd7f9
children ccb70d86d797
files libmpdemux/asf.h libmpdemux/asfheader.c libmpdemux/demux_asf.c
diffstat 3 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/asf.h	Tue May 22 13:44:14 2007 +0000
+++ b/libmpdemux/asf.h	Tue May 22 13:55:14 2007 +0000
@@ -241,6 +241,7 @@
     int aud_ext_timing_index;
     int vid_ext_frame_index;
     int know_frame_time;
+    unsigned bps;
 };
 
 #endif
--- a/libmpdemux/asfheader.c	Tue May 22 13:44:14 2007 +0000
+++ b/libmpdemux/asfheader.c	Tue May 22 13:55:14 2007 +0000
@@ -198,6 +198,7 @@
   int pos=0;
   uint8_t *buffer = &buf[0];
   uint64_t avg_ft;
+  unsigned bitrate;
 
   while ((pos = find_asf_guid(buf, asf_ext_stream_header, pos, buf_len)) >= 0) {
     int this_stream_num, stnamect, payct, i, objlen;
@@ -213,7 +214,9 @@
     // max-object-size(4),
     // flags(4) (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved)
 
-    buffer +=8+8+4+4+4+4+4+4+4+4;
+    buffer += 8+8;
+    bitrate = AV_RL32(buffer);
+    buffer += 8*4;
     this_stream_num=AV_RL16(buffer);buffer+=2;
 
     if (this_stream_num == stream_num) {
@@ -222,6 +225,7 @@
       buffer+=2; //skip stream-language-id-index
       avg_ft = AV_RL64(buffer); // provided in 100ns units
       buffer+=8;
+      asf->bps = bitrate / 8;
 
       // after this are values for stream-name-count and
       // payload-extension-system-count
@@ -556,6 +560,7 @@
           sh_video->aspect = asp_ratio * sh_video->bih->biWidth /
             sh_video->bih->biHeight;
         }
+        sh_video->i_bps = asf->bps;
 
         if( mp_msg_test(MSGT_DEMUX,MSGL_V) ) print_video_header(sh_video->bih, MSGL_V);
         //asf_video_id=streamh.stream_no & 0x7F;
--- a/libmpdemux/demux_asf.c	Tue May 22 13:44:14 2007 +0000
+++ b/libmpdemux/demux_asf.c	Tue May 22 13:55:14 2007 +0000
@@ -715,7 +715,6 @@
         } else {
             sh_video=demuxer->video->sh;sh_video->ds=demuxer->video;
             sh_video->fps=1000.0f; sh_video->frametime=0.001f;
-            //sh_video->i_bps=10*asf->packetsize; // FIXME!
 
             if (asf->asf_is_dvr_ms) {
                 sh_video->bih->biWidth = 0;