mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-23 19:30:05 +00:00
fix swf seeking by fixing new stream detection
Originally committed as revision 17952 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
38eb4b114d
commit
4e35ffa978
@ -90,8 +90,16 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
tag = get_swf_tag(pb, &len);
|
||||
if (tag < 0)
|
||||
return AVERROR(EIO);
|
||||
if (tag == TAG_VIDEOSTREAM && !vst) {
|
||||
if (tag == TAG_VIDEOSTREAM) {
|
||||
int ch_id = get_le16(pb);
|
||||
len -= 2;
|
||||
|
||||
for (i=0; i<s->nb_streams; i++) {
|
||||
st = s->streams[i];
|
||||
if (st->codec->codec_type == CODEC_TYPE_VIDEO && st->id == ch_id)
|
||||
goto skip;
|
||||
}
|
||||
|
||||
get_le16(pb);
|
||||
get_le16(pb);
|
||||
get_le16(pb);
|
||||
@ -104,10 +112,17 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
vst->codec->codec_id = codec_get_id(swf_codec_tags, get_byte(pb));
|
||||
av_set_pts_info(vst, 64, 256, swf->frame_rate);
|
||||
vst->codec->time_base = (AVRational){ 256, swf->frame_rate };
|
||||
len -= 10;
|
||||
} else if ((tag == TAG_STREAMHEAD || tag == TAG_STREAMHEAD2) && !ast) {
|
||||
len -= 8;
|
||||
} else if (tag == TAG_STREAMHEAD || tag == TAG_STREAMHEAD2) {
|
||||
/* streaming found */
|
||||
int sample_rate_code;
|
||||
|
||||
for (i=0; i<s->nb_streams; i++) {
|
||||
st = s->streams[i];
|
||||
if (st->codec->codec_type == CODEC_TYPE_AUDIO && st->id == -1)
|
||||
goto skip;
|
||||
}
|
||||
|
||||
get_byte(pb);
|
||||
v = get_byte(pb);
|
||||
swf->samples_per_frame = get_le16(pb);
|
||||
@ -139,7 +154,9 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
}
|
||||
}
|
||||
} else if (tag == TAG_STREAMBLOCK) {
|
||||
st = s->streams[swf->audio_stream_index];
|
||||
for (i = 0; i < s->nb_streams; i++) {
|
||||
st = s->streams[i];
|
||||
if (st->codec->codec_type == CODEC_TYPE_AUDIO && st->id == -1) {
|
||||
if (st->codec->codec_id == CODEC_ID_MP3) {
|
||||
url_fskip(pb, 4);
|
||||
av_get_packet(pb, pkt, len-4);
|
||||
@ -148,10 +165,12 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
}
|
||||
pkt->stream_index = st->index;
|
||||
return pkt->size;
|
||||
}
|
||||
}
|
||||
} else if (tag == TAG_JPEG2) {
|
||||
for (i=0; i<s->nb_streams; i++) {
|
||||
st = s->streams[i];
|
||||
if (st->id == -2)
|
||||
if (st->codec->codec_id == CODEC_ID_MJPEG && st->id == -2)
|
||||
break;
|
||||
}
|
||||
if (i == s->nb_streams) {
|
||||
@ -179,6 +198,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
pkt->stream_index = st->index;
|
||||
return pkt->size;
|
||||
}
|
||||
skip:
|
||||
url_fskip(pb, len);
|
||||
}
|
||||
return 0;
|
||||
|
@ -3518,28 +3518,28 @@ ret:-1 st:-1 ts:-1.000000 flags:0
|
||||
ret:-1 st:-1 ts:1.894167 flags:1
|
||||
ret:-1 st: 0 ts:0.800000 flags:0
|
||||
ret:-1 st: 0 ts:-0.320000 flags:1
|
||||
ret:-1 st: 1 ts:2.560000 flags:0
|
||||
ret:-1 st: 1 ts:1.480000 flags:1
|
||||
ret:-1 st: 2 ts:0.360000 flags:0
|
||||
ret:-1 st: 2 ts:-0.760000 flags:1
|
||||
ret:-1 st: 3 ts:2.160000 flags:0
|
||||
ret:-1 st: 3 ts:1.040000 flags:1
|
||||
ret:-1 st: 4 ts:-0.040000 flags:0
|
||||
ret:-1 st: 4 ts:2.840000 flags:1
|
||||
ret:-1 st: 5 ts:1.720000 flags:0
|
||||
ret:-1 st: 5 ts:0.640000 flags:1
|
||||
ret:-1 st: 6 ts:-0.480000 flags:0
|
||||
ret:-1 st: 6 ts:2.400000 flags:1
|
||||
ret:-1 st: 7 ts:1.320000 flags:0
|
||||
ret:-1 st: 7 ts:0.200000 flags:1
|
||||
ret:-1 st: 8 ts:-0.920000 flags:0
|
||||
ret:-1 st: 8 ts:2.000000 flags:1
|
||||
ret:-1 st: 9 ts:0.880000 flags:0
|
||||
ret:-1 st: 9 ts:-0.240000 flags:1
|
||||
ret:-1 st:10 ts:2.680000 flags:0
|
||||
ret:-1 st:10 ts:1.560000 flags:1
|
||||
ret:-1 st:11 ts:0.480000 flags:0
|
||||
ret:-1 st:11 ts:-0.640000 flags:1
|
||||
ret:-1 st:-1 ts:2.576668 flags:0
|
||||
ret:-1 st:-1 ts:1.470835 flags:1
|
||||
ret:-1 st: 0 ts:0.360000 flags:0
|
||||
ret:-1 st: 0 ts:-0.760000 flags:1
|
||||
ret:-1 st:-1 ts:2.153336 flags:0
|
||||
ret:-1 st:-1 ts:1.047503 flags:1
|
||||
ret:-1 st: 0 ts:-0.040000 flags:0
|
||||
ret:-1 st: 0 ts:2.840000 flags:1
|
||||
ret:-1 st:-1 ts:1.730004 flags:0
|
||||
ret:-1 st:-1 ts:0.624171 flags:1
|
||||
ret:-1 st: 0 ts:-0.480000 flags:0
|
||||
ret:-1 st: 0 ts:2.400000 flags:1
|
||||
ret:-1 st:-1 ts:1.306672 flags:0
|
||||
ret:-1 st:-1 ts:0.200839 flags:1
|
||||
ret:-1 st: 0 ts:-0.920000 flags:0
|
||||
ret:-1 st: 0 ts:2.000000 flags:1
|
||||
ret:-1 st:-1 ts:0.883340 flags:0
|
||||
ret:-1 st:-1 ts:-0.222493 flags:1
|
||||
ret:-1 st: 0 ts:2.680000 flags:0
|
||||
ret:-1 st: 0 ts:1.560000 flags:1
|
||||
ret:-1 st:-1 ts:0.460008 flags:0
|
||||
ret:-1 st:-1 ts:-0.645825 flags:1
|
||||
----------------
|
||||
tests/data/b-libav.ts
|
||||
ret: 0 st: 0 dts:0.660000 pts:0.700000 pos:564 size:24921 flags:1
|
||||
|
Loading…
Reference in New Issue
Block a user