Commit 0e3b6a6f authored by Ryan Martell's avatar Ryan Martell Committed by Panagiotis Issaris

Add the stream_bitrate GUID to the asf parsing code, and set stream bitrate

properties accordingly.
Patch by Ryan Martell, rdm4 % martellventures com.

Originally committed as revision 8046 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 8ffed8d8
...@@ -34,6 +34,9 @@ static const GUID index_guid = { ...@@ -34,6 +34,9 @@ static const GUID index_guid = {
0x90, 0x08, 0x00, 0x33, 0xb1, 0xe5, 0xcf, 0x11, 0x89, 0xf4, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb 0x90, 0x08, 0x00, 0x33, 0xb1, 0xe5, 0xcf, 0x11, 0x89, 0xf4, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb
}; };
static const GUID stream_bitrate_guid = { /* (http://get.to/sdp) */
0xce, 0x75, 0xf8, 0x7b, 0x8d, 0x46, 0xd1, 0x11, 0x8d, 0x82, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2
};
/**********************************/ /**********************************/
/* decoding */ /* decoding */
...@@ -68,6 +71,7 @@ static void print_guid(const GUID *g) ...@@ -68,6 +71,7 @@ static void print_guid(const GUID *g)
else PRINT_IF_GUID(g, ext_stream_embed_stream_header); else PRINT_IF_GUID(g, ext_stream_embed_stream_header);
else PRINT_IF_GUID(g, ext_stream_audio_stream); else PRINT_IF_GUID(g, ext_stream_audio_stream);
else PRINT_IF_GUID(g, metadata_header); else PRINT_IF_GUID(g, metadata_header);
else PRINT_IF_GUID(g, stream_bitrate_guid);
else else
printf("(GUID: unknown) "); printf("(GUID: unknown) ");
for(i=0;i<16;i++) for(i=0;i<16;i++)
...@@ -345,6 +349,21 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -345,6 +349,21 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
get_str16_nolen(pb, len3, s->copyright, sizeof(s->copyright)); get_str16_nolen(pb, len3, s->copyright, sizeof(s->copyright));
get_str16_nolen(pb, len4, s->comment , sizeof(s->comment)); get_str16_nolen(pb, len4, s->comment , sizeof(s->comment));
url_fskip(pb, len5); url_fskip(pb, len5);
} else if (!memcmp(&g, &stream_bitrate_guid, sizeof(GUID))) {
int stream_count = get_le16(pb);
int j;
// av_log(NULL, AV_LOG_ERROR, "stream bitrate properties\n");
// av_log(NULL, AV_LOG_ERROR, "streams %d\n", streams);
for(j = 0; j < stream_count; j++) {
int flags, bitrate, stream_id;
flags= get_le16(pb);
bitrate= get_le32(pb);
stream_id= (flags & 0x7f);
// av_log(NULL, AV_LOG_ERROR, "flags: 0x%x stream id %d, bitrate %d\n", flags, stream_id, bitrate);
asf->stream_bitrates[stream_id-1]= bitrate;
}
} else if (!memcmp(&g, &extended_content_header, sizeof(GUID))) { } else if (!memcmp(&g, &extended_content_header, sizeof(GUID))) {
int desc_count, i; int desc_count, i;
......
...@@ -76,6 +76,7 @@ typedef struct { ...@@ -76,6 +76,7 @@ typedef struct {
int is_streamed; int is_streamed;
int asfid2avid[128]; ///< conversion table from asf ID 2 AVStream ID int asfid2avid[128]; ///< conversion table from asf ID 2 AVStream ID
ASFStream streams[128]; ///< it's max number and it's not that big ASFStream streams[128]; ///< it's max number and it's not that big
uint32_t stream_bitrates[128]; ///< max number of streams, bitrate for each (for streaming)
/* non streamed additonnal info */ /* non streamed additonnal info */
uint64_t nb_packets; ///< how many packets are there in the file, invalid if broadcasting uint64_t nb_packets; ///< how many packets are there in the file, invalid if broadcasting
int64_t duration; ///< in 100ns units int64_t duration; ///< in 100ns units
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment