avformat/flvdec: Cosmetics

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
pull/342/head
Andreas Rheinhardt 5 years ago
parent 55c7bb0665
commit b054a3a216
  1. 25
      libavformat/flvdec.c

@ -514,8 +514,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream,
if (key && if (key &&
(ioc->seekable & AVIO_SEEKABLE_NORMAL) && (ioc->seekable & AVIO_SEEKABLE_NORMAL) &&
!strcmp(KEYFRAMES_TAG, key) && depth == 1) !strcmp(KEYFRAMES_TAG, key) && depth == 1)
if (parse_keyframes_index(s, ioc, if (parse_keyframes_index(s, ioc, max_pos) < 0)
max_pos) < 0)
av_log(s, AV_LOG_ERROR, "Keyframe index parsing failed\n"); av_log(s, AV_LOG_ERROR, "Keyframe index parsing failed\n");
else else
add_keyframes_index(s); add_keyframes_index(s);
@ -732,8 +731,7 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos)
astream = stream; astream = stream;
if (flv->last_keyframe_stream_index == -1) if (flv->last_keyframe_stream_index == -1)
flv->last_keyframe_stream_index = i; flv->last_keyframe_stream_index = i;
} } else if (stream->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE)
else if (stream->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE)
dstream = stream; dstream = stream;
} }
@ -1058,8 +1056,7 @@ retry:
if (type == 0 && dts == 0 || type < 0) { if (type == 0 && dts == 0 || type < 0) {
if (type < 0 && flv->validate_count && if (type < 0 && flv->validate_count &&
flv->validate_index[0].pos > next && flv->validate_index[0].pos > next &&
flv->validate_index[0].pos - 4 < next flv->validate_index[0].pos - 4 < next) {
) {
av_log(s, AV_LOG_WARNING, "Adjusting next position due to index mismatch\n"); av_log(s, AV_LOG_WARNING, "Adjusting next position due to index mismatch\n");
next = flv->validate_index[0].pos - 4; next = flv->validate_index[0].pos - 4;
} }
@ -1120,7 +1117,6 @@ skip:
st = create_stream(s, stream_types[stream_type]); st = create_stream(s, stream_types[stream_type]);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
av_log(s, AV_LOG_TRACE, "%d %X %d \n", stream_type, flags, st->discard); av_log(s, AV_LOG_TRACE, "%d %X %d \n", stream_type, flags, st->discard);
@ -1133,10 +1129,9 @@ skip:
stream_type == FLV_STREAM_TYPE_AUDIO)) stream_type == FLV_STREAM_TYPE_AUDIO))
av_add_index_entry(st, pos, dts, size, 0, AVINDEX_KEYFRAME); av_add_index_entry(st, pos, dts, size, 0, AVINDEX_KEYFRAME);
if ( (st->discard >= AVDISCARD_NONKEY && !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || (stream_type == FLV_STREAM_TYPE_AUDIO))) if ((st->discard >= AVDISCARD_NONKEY && !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || stream_type == FLV_STREAM_TYPE_AUDIO)) ||
||(st->discard >= AVDISCARD_BIDIR && ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && (stream_type == FLV_STREAM_TYPE_VIDEO))) (st->discard >= AVDISCARD_BIDIR && ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && stream_type == FLV_STREAM_TYPE_VIDEO)) ||
|| st->discard >= AVDISCARD_ALL st->discard >= AVDISCARD_ALL) {
) {
avio_seek(s->pb, next, SEEK_SET); avio_seek(s->pb, next, SEEK_SET);
ret = FFERROR_REDO; ret = FFERROR_REDO;
goto leave; goto leave;
@ -1299,10 +1294,10 @@ retry_duration:
ff_add_param_change(pkt, channels, 0, sample_rate, 0, 0); ff_add_param_change(pkt, channels, 0, sample_rate, 0, 0);
} }
if ( stream_type == FLV_STREAM_TYPE_AUDIO || if (stream_type == FLV_STREAM_TYPE_AUDIO ||
((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY) || (flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY ||
stream_type == FLV_STREAM_TYPE_SUBTITLE || stream_type == FLV_STREAM_TYPE_SUBTITLE ||
stream_type == FLV_STREAM_TYPE_DATA) stream_type == FLV_STREAM_TYPE_DATA)
pkt->flags |= AV_PKT_FLAG_KEY; pkt->flags |= AV_PKT_FLAG_KEY;
leave: leave:

Loading…
Cancel
Save