# HG changeset patch # User bcoudurier # Date 1168736834 0 # Node ID 50bbf9658436656d0b1f2b192ac16be9581532d1 # Parent 783969dab069f9a7cd7e51836ed67e7f482c8165 use ch_id as AVStream id and simplify diff -r 783969dab069 -r 50bbf9658436 swf.c --- a/swf.c Sun Jan 14 00:54:03 2007 +0000 +++ b/swf.c Sun Jan 14 01:07:14 2007 +0000 @@ -69,7 +69,6 @@ int swf_frame_number; int video_frame_number; int ms_per_frame; - int ch_id; int tag; uint8_t *audio_fifo; @@ -313,7 +312,6 @@ uint8_t buf1[256]; int i, width, height, rate, rate_base; - swf->ch_id = -1; swf->audio_in_pos = 0; swf->audio_out_pos = 0; swf->audio_size = 0; @@ -775,7 +773,6 @@ a correct framerate */ swf->ms_per_frame = ( 1000 * 256 ) / frame_rate; swf->samples_per_frame = 0; - swf->ch_id = -1; firstTagOff = url_ftell(pb); for(;;) { @@ -792,13 +789,13 @@ return AVERROR_IO; } if ( tag == TAG_VIDEOSTREAM && !vst) { - swf->ch_id = get_le16(pb); + int ch_id = get_le16(pb); get_le16(pb); get_le16(pb); get_le16(pb); get_byte(pb); /* Check for FLV1 */ - vst = av_new_stream(s, 0); + vst = av_new_stream(s, ch_id); av_set_pts_info(vst, 24, 1, 1000); /* 24 bit pts in ms */ vst->codec->codec_type = CODEC_TYPE_VIDEO; vst->codec->codec_id = codec_get_id(swf_codec_tags, get_byte(pb)); @@ -856,22 +853,18 @@ if (tag < 0) return AVERROR_IO; if (tag == TAG_VIDEOFRAME) { + int ch_id = get_le16(pb); for( i=0; inb_streams; i++ ) { st = s->streams[i]; - if (st->id == 0) { - if ( get_le16(pb) == swf->ch_id ) { - frame = get_le16(pb); - av_get_packet(pb, pkt, len-4); - pkt->pts = frame * swf->ms_per_frame; - pkt->stream_index = st->index; - return pkt->size; - } else { - url_fskip(pb, len-2); - continue; - } + if (st->codec->codec_type == CODEC_TYPE_VIDEO && st->id == ch_id) { + frame = get_le16(pb); + av_get_packet(pb, pkt, len-4); + pkt->pts = frame * swf->ms_per_frame; + pkt->stream_index = st->index; + return pkt->size; } } - url_fskip(pb, len); + url_fskip(pb, len-2); } else if (tag == TAG_STREAMBLOCK) { for( i=0; inb_streams; i++ ) { st = s->streams[i];