Commit 166f2c52 authored by Hendrik Leppkes's avatar Hendrik Leppkes

Merge commit 'b55566db'

* commit 'b55566db':
  avconv: use avcodec_parameters_copy() with streamcopy

The fate-aac-autobsf-adtstoasc changes from writing an audio bitdepth
based on the sample format, which is now available.
Merged-by: 's avatarHendrik Leppkes <h.leppkes@gmail.com>
parents 06136275 b55566db
...@@ -2881,7 +2881,7 @@ static int init_output_stream_streamcopy(OutputStream *ost) ...@@ -2881,7 +2881,7 @@ static int init_output_stream_streamcopy(OutputStream *ost)
AVCodecParameters *par_src = ost->ref_par; AVCodecParameters *par_src = ost->ref_par;
AVRational sar; AVRational sar;
int i, ret; int i, ret;
uint64_t extra_size; uint32_t codec_tag = par_dst->codec_tag;
av_assert0(ist && !ost->filter); av_assert0(ist && !ost->filter);
...@@ -2894,38 +2894,19 @@ static int init_output_stream_streamcopy(OutputStream *ost) ...@@ -2894,38 +2894,19 @@ static int init_output_stream_streamcopy(OutputStream *ost)
} }
avcodec_parameters_from_context(par_src, ost->enc_ctx); avcodec_parameters_from_context(par_src, ost->enc_ctx);
extra_size = (uint64_t)par_src->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE; if (!codec_tag) {
unsigned int codec_tag_tmp;
if (extra_size > INT_MAX) {
return AVERROR(EINVAL);
}
/* if stream_copy is selected, no need to decode or encode */
par_dst->codec_id = par_src->codec_id;
par_dst->codec_type = par_src->codec_type;
if (!par_dst->codec_tag) {
unsigned int codec_tag;
if (!of->ctx->oformat->codec_tag || if (!of->ctx->oformat->codec_tag ||
av_codec_get_id (of->ctx->oformat->codec_tag, par_src->codec_tag) == par_dst->codec_id || av_codec_get_id (of->ctx->oformat->codec_tag, par_src->codec_tag) == par_src->codec_id ||
!av_codec_get_tag2(of->ctx->oformat->codec_tag, par_src->codec_id, &codec_tag)) !av_codec_get_tag2(of->ctx->oformat->codec_tag, par_src->codec_id, &codec_tag_tmp))
par_dst->codec_tag = par_src->codec_tag; codec_tag = par_src->codec_tag;
} }
par_dst->bit_rate = par_src->bit_rate; ret = avcodec_parameters_copy(par_dst, par_src);
par_dst->field_order = par_src->field_order; if (ret < 0)
par_dst->chroma_location = par_src->chroma_location; return ret;
if (par_src->extradata_size) { par_dst->codec_tag = codec_tag;
par_dst->extradata = av_mallocz(extra_size);
if (!par_dst->extradata) {
return AVERROR(ENOMEM);
}
memcpy(par_dst->extradata, par_src->extradata, par_src->extradata_size);
par_dst->extradata_size = par_src->extradata_size;
}
par_dst->bits_per_coded_sample = par_src->bits_per_coded_sample;
par_dst->bits_per_raw_sample = par_src->bits_per_raw_sample;
if (!ost->frame_rate.num) if (!ost->frame_rate.num)
ost->frame_rate = ist->framerate; ost->frame_rate = ist->framerate;
...@@ -2976,29 +2957,12 @@ static int init_output_stream_streamcopy(OutputStream *ost) ...@@ -2976,29 +2957,12 @@ static int init_output_stream_streamcopy(OutputStream *ost)
av_log(NULL, AV_LOG_FATAL, "-acodec copy and -vol are incompatible (frames are not decoded)\n"); av_log(NULL, AV_LOG_FATAL, "-acodec copy and -vol are incompatible (frames are not decoded)\n");
exit_program(1); exit_program(1);
} }
par_dst->channel_layout = par_src->channel_layout;
par_dst->sample_rate = par_src->sample_rate;
par_dst->channels = par_src->channels;
par_dst->frame_size = par_src->frame_size;
par_dst->block_align = par_src->block_align;
par_dst->initial_padding = par_src->initial_padding;
par_dst->trailing_padding = par_src->trailing_padding;
par_dst->profile = par_src->profile;
if((par_dst->block_align == 1 || par_dst->block_align == 1152 || par_dst->block_align == 576) && par_dst->codec_id == AV_CODEC_ID_MP3) if((par_dst->block_align == 1 || par_dst->block_align == 1152 || par_dst->block_align == 576) && par_dst->codec_id == AV_CODEC_ID_MP3)
par_dst->block_align= 0; par_dst->block_align= 0;
if(par_dst->codec_id == AV_CODEC_ID_AC3) if(par_dst->codec_id == AV_CODEC_ID_AC3)
par_dst->block_align= 0; par_dst->block_align= 0;
break; break;
case AVMEDIA_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
par_dst->format = par_src->format;
par_dst->color_space = par_src->color_space;
par_dst->color_range = par_src->color_range;
par_dst->color_primaries = par_src->color_primaries;
par_dst->color_trc = par_src->color_trc;
par_dst->width = par_src->width;
par_dst->height = par_src->height;
par_dst->video_delay = par_src->video_delay;
par_dst->profile = par_src->profile;
if (ost->frame_aspect_ratio.num) { // overridden by the -aspect cli option if (ost->frame_aspect_ratio.num) { // overridden by the -aspect cli option
sar = sar =
av_mul_q(ost->frame_aspect_ratio, av_mul_q(ost->frame_aspect_ratio,
...@@ -3014,16 +2978,6 @@ static int init_output_stream_streamcopy(OutputStream *ost) ...@@ -3014,16 +2978,6 @@ static int init_output_stream_streamcopy(OutputStream *ost)
ost->st->avg_frame_rate = ist->st->avg_frame_rate; ost->st->avg_frame_rate = ist->st->avg_frame_rate;
ost->st->r_frame_rate = ist->st->r_frame_rate; ost->st->r_frame_rate = ist->st->r_frame_rate;
break; break;
case AVMEDIA_TYPE_SUBTITLE:
par_dst->width = par_src->width;
par_dst->height = par_src->height;
break;
case AVMEDIA_TYPE_UNKNOWN:
case AVMEDIA_TYPE_DATA:
case AVMEDIA_TYPE_ATTACHMENT:
break;
default:
abort();
} }
return 0; return 0;
......
...@@ -243,7 +243,7 @@ fate-aac-latm_stereo_to_51: REF = $(SAMPLES)/aac/latm_stereo_to_51_ref.s16 ...@@ -243,7 +243,7 @@ fate-aac-latm_stereo_to_51: REF = $(SAMPLES)/aac/latm_stereo_to_51_ref.s16
fate-aac-autobsf-adtstoasc: CMD = md5 -i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts -acodec copy -fflags +bitexact -f matroska fate-aac-autobsf-adtstoasc: CMD = md5 -i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts -acodec copy -fflags +bitexact -f matroska
fate-aac-autobsf-adtstoasc: CMP = oneline fate-aac-autobsf-adtstoasc: CMP = oneline
fate-aac-autobsf-adtstoasc: REF = 8c6fbebb64ebbe9e01b345d77844d7cd fate-aac-autobsf-adtstoasc: REF = 8c76732bd04d9eb3468f9f842439774d
FATE_AAC-$(call DEMDEC, AAC, AAC) += $(FATE_AAC_CT_RAW) FATE_AAC-$(call DEMDEC, AAC, AAC) += $(FATE_AAC_CT_RAW)
FATE_AAC-$(call DEMDEC, MOV, AAC) += $(FATE_AAC) FATE_AAC-$(call DEMDEC, MOV, AAC) += $(FATE_AAC)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment