Compare commits

..

No commits in common. "71007e6c1255432d8e23f629efa2b6fd37214bc7" and "7cbc26267b6968eb2b8cc5f70e3603b6ee9b2101" have entirely different histories.

2 changed files with 12 additions and 34 deletions

View File

@ -318,10 +318,8 @@ static av_cold int mlp_decode_init(AVCodecContext *avctx)
av_channel_layout_uninit(&avctx->ch_layout); av_channel_layout_uninit(&avctx->ch_layout);
avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1; avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1;
} }
else { else
av_log(avctx, AV_LOG_WARNING, "Invalid downmix layout\n"); av_log(avctx, AV_LOG_WARNING, "Invalid downmix layout\n");
av_channel_layout_uninit(&m->downmix_layout);
}
} }
ff_thread_once(&init_static_once, init_static); ff_thread_once(&init_static_once, init_static);
@ -454,22 +452,26 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
} }
m->substream[1].mask = mh.channel_layout_thd_stream1; m->substream[1].mask = mh.channel_layout_thd_stream1;
if (mh.channels_thd_stream1 == 2 && if (mh.channels_thd_stream1 == 2 &&
mh.channels_thd_stream2 == 2) mh.channels_thd_stream2 == 2 &&
m->avctx->ch_layout.nb_channels == 2)
m->substream[0].mask = AV_CH_LAYOUT_STEREO; m->substream[0].mask = AV_CH_LAYOUT_STEREO;
if ((substr = (mh.num_substreams > 1))) if ((substr = (mh.num_substreams > 1)))
m->substream[0].mask = AV_CH_LAYOUT_STEREO; m->substream[0].mask = AV_CH_LAYOUT_STEREO;
if (mh.num_substreams == 1 && if (mh.num_substreams == 1 &&
mh.channels_thd_stream1 == 1 && mh.channels_thd_stream1 == 1 &&
mh.channels_thd_stream2 == 1) mh.channels_thd_stream2 == 1 &&
m->avctx->ch_layout.nb_channels == 1)
m->substream[0].mask = AV_CH_LAYOUT_MONO; m->substream[0].mask = AV_CH_LAYOUT_MONO;
if (mh.num_substreams > 2) if (mh.num_substreams > 2)
if (mh.channel_layout_thd_stream2) if (mh.channel_layout_thd_stream2)
m->substream[2].mask = mh.channel_layout_thd_stream2; m->substream[2].mask = mh.channel_layout_thd_stream2;
else else
m->substream[2].mask = mh.channel_layout_thd_stream1; m->substream[2].mask = mh.channel_layout_thd_stream1;
if (mh.num_substreams == 2 && (!m->downmix_layout.nb_channels || if (m->avctx->ch_layout.nb_channels > 2)
m->downmix_layout.nb_channels > 2)) if (mh.num_substreams > 2)
m->substream[1].mask = mh.channel_layout_thd_stream2; m->substream[1].mask = mh.channel_layout_thd_stream1;
else
m->substream[mh.num_substreams > 1].mask = mh.channel_layout_thd_stream2;
} }
m->needs_reordering = mh.channel_arrangement >= 18 && mh.channel_arrangement <= 20; m->needs_reordering = mh.channel_arrangement >= 18 && mh.channel_arrangement <= 20;

View File

@ -1167,10 +1167,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
AVPacket *out_pkt = si->parse_pkt; AVPacket *out_pkt = si->parse_pkt;
AVStream *st = s->streams[stream_index]; AVStream *st = s->streams[stream_index];
FFStream *const sti = ffstream(st); FFStream *const sti = ffstream(st);
const AVPacketSideData *sd = NULL;
const uint8_t *data = pkt->data; const uint8_t *data = pkt->data;
uint8_t *extradata = sti->avctx->extradata;
int extradata_size = sti->avctx->extradata_size;
int size = pkt->size; int size = pkt->size;
int ret = 0, got_output = flush; int ret = 0, got_output = flush;
@ -1187,16 +1184,6 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
} }
} }
if (pkt->side_data_elems)
sd = av_packet_side_data_get(pkt->side_data, pkt->side_data_elems,
AV_PKT_DATA_NEW_EXTRADATA);
if (sd) {
av_assert1(size && !flush);
sti->avctx->extradata = sd->data;
sti->avctx->extradata_size = sd->size;
}
while (size > 0 || (flush && got_output)) { while (size > 0 || (flush && got_output)) {
int64_t next_pts = pkt->pts; int64_t next_pts = pkt->pts;
int64_t next_dts = pkt->dts; int64_t next_dts = pkt->dts;
@ -1290,11 +1277,6 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
} }
fail: fail:
if (sd) {
sti->avctx->extradata = extradata;
sti->avctx->extradata_size = extradata_size;
}
if (ret < 0) if (ret < 0)
av_packet_unref(out_pkt); av_packet_unref(out_pkt);
av_packet_unref(pkt); av_packet_unref(pkt);
@ -1388,11 +1370,6 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
st->event_flags |= AVSTREAM_EVENT_FLAG_NEW_PACKETS; st->event_flags |= AVSTREAM_EVENT_FLAG_NEW_PACKETS;
int new_extradata = !!av_packet_side_data_get(pkt->side_data, pkt->side_data_elems,
AV_PKT_DATA_NEW_EXTRADATA);
if (new_extradata)
sti->need_context_update = 1;
/* update context if required */ /* update context if required */
if (sti->need_context_update) { if (sti->need_context_update) {
if (avcodec_is_open(sti->avctx)) { if (avcodec_is_open(sti->avctx)) {
@ -1403,9 +1380,8 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
return ret; return ret;
} }
/* close parser, because it depends on the codec and extradata */ /* close parser, because it depends on the codec */
if (sti->parser && if (sti->parser && sti->avctx->codec_id != st->codecpar->codec_id) {
(sti->avctx->codec_id != st->codecpar->codec_id || new_extradata)) {
av_parser_close(sti->parser); av_parser_close(sti->parser);
sti->parser = NULL; sti->parser = NULL;
} }