Author: bcoudurier Date: Sun Jan 14 02:14:31 2007 New Revision: 7456 Modified: trunk/libavformat/swf.c Log: swf can contain only one audio track, simplify Modified: trunk/libavformat/swf.c ============================================================================== --- trunk/libavformat/swf.c (original) +++ trunk/libavformat/swf.c Sun Jan 14 02:14:31 2007 @@ -59,7 +59,7 @@ #include <assert.h> typedef struct { - + int audio_stream_index; offset_t duration_pos; offset_t tag_pos; @@ -808,8 +808,9 @@ get_byte(pb); v = get_byte(pb); swf->samples_per_frame = get_le16(pb); - ast = av_new_stream(s, 1); + ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */ av_set_pts_info(ast, 24, 1, 1000); /* 24 bit pts in ms */ + swf->audio_stream_index = ast->index; ast->codec->channels = 1 + (v&1); ast->codec->codec_type = CODEC_TYPE_AUDIO; if (v & 0x20) @@ -866,14 +867,12 @@ } url_fskip(pb, len-2); } else if (tag == TAG_STREAMBLOCK) { - for( i=0; i<s->nb_streams; i++ ) { - st = s->streams[i]; - if (st->id == 1) { - url_fskip(pb, 4); - av_get_packet(pb, pkt, len-4); - pkt->stream_index = st->index; - return pkt->size; - } + st = s->streams[swf->audio_stream_index]; + if (st->codec->codec_id == CODEC_ID_MP3) { + url_fskip(pb, 4); + av_get_packet(pb, pkt, len-4); + pkt->stream_index = st->index; + return pkt->size; } url_fskip(pb, len); } else {
Hi,
@@ -808,8 +808,9 @@ get_byte(pb); v = get_byte(pb); swf->samples_per_frame = get_le16(pb); - ast = av_new_stream(s, 1); + ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */
This sound like a hack, doesnt? Does the avformat supports this? What about incrementing ch_id with one for the video stream case, thus you doesnt need to use id -1 for audio. -- Alex Beregszaszi
Hi Alex Beregszaszi wrote:
Hi,
@@ -808,8 +808,9 @@ get_byte(pb); v = get_byte(pb); swf->samples_per_frame = get_le16(pb); - ast = av_new_stream(s, 1); + ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */
This sound like a hack, doesnt? Does the avformat supports this?
Kinda, it seems to support it.
What about incrementing ch_id with one for the video stream case, thus you doesnt need to use id -1 for audio.
why not. -- Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA SMARTJOG S.A. http://www.smartjog.com Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA Phone: +33 1 49966312
participants (3)
-
alex@rtfs.hu -
baptiste.coudurier@smartjog.com -
subversion@mplayerhq.hu