[MPlayer-dev-eng] [PATCH] Set i_bps for ASF files
Zuxy Meng
zuxy.meng at gmail.com
Tue May 15 13:49:42 CEST 2007
Hi,
2007/5/15, Reimar Doeffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de>:
> Hello,
> On Tue, May 08, 2007 at 09:24:35AM +0800, Zuxy Meng wrote:
> > 2007/5/7, Zuxy Meng <zuxy.meng at gmail.com>:
> > >2007/3/4, Zuxy Meng <zuxy.meng at gmail.com>:
> > >> The patch sets i_bps for asf files, according either to their extended
> > >> stream property or (if the former isn't available) the stream bitrate
> > >> object. Extended stream property gives bitrate for raw data (without
> > >> overhead) i.e. data that is actually sent out to network when streamed
> > >> and is the same as what WMP reports as bitrate.
> > >
> > >Attached is the patch against current SVN. A similar patch has been
> > >committed for ffmpeg.
> > >
> > >Comments?
> >
> > Oops, the SVN has just changed a little bit so patch updated.
>
> Looks mostly okay, but I don't really maintain asf.
>
> > +static unsigned get_bitrate(char *buf, int buf_len, int this_stream_num)
>
> If you have some extra time, could you check if the mms streaming code
> maybe can reuse this? It also checks the bitrate...
The mms streaming code already extracts bitrate information from the
stream bitrate property object, but that bitrate includes payload so
is a bit larger than what this patch gets.
Actually stream bitrate property object is parsed even in asfheader.c
(sorry I overlooked this in the original patch), although it's called
stream group object. To avoid code duplication I stripped similar code
in my patch. Now I guess it's much cleaner.
And comments from the maintainer? (A'rpi I guess?)
--
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6
-------------- next part --------------
Index: libmpdemux/demux_asf.c
===================================================================
--- libmpdemux/demux_asf.c ?????? 23320??
+++ libmpdemux/demux_asf.c ????????????
@@ -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;
Index: libmpdemux/asfheader.c
===================================================================
--- libmpdemux/asfheader.c ?????? 23320??
+++ libmpdemux/asfheader.c ????????????
@@ -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_RL32(buffer) | (uint64_t)AV_RL32(buffer + 4) << 32; // 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;
Index: libmpdemux/asf.h
===================================================================
--- libmpdemux/asf.h ?????? 23320??
+++ libmpdemux/asf.h ????????????
@@ -241,6 +241,7 @@
int aud_ext_timing_index;
int vid_ext_frame_index;
int know_frame_time;
+ unsigned bps;
};
#endif
More information about the MPlayer-dev-eng
mailing list