mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-06-30 12:56:44 +08:00
avconv: cosmetics, reformat transcode_init()
Fix spacing, vertically align, break some long lines, add some empty lines for readability.
This commit is contained in:
17
avconv.c
17
avconv.c
@ -2014,9 +2014,9 @@ static int transcode_init(OutputFile *output_files,
|
||||
codec->codec_type = icodec->codec_type;
|
||||
|
||||
if (!codec->codec_tag) {
|
||||
if( !oc->oformat->codec_tag
|
||||
|| av_codec_get_id (oc->oformat->codec_tag, icodec->codec_tag) == codec->codec_id
|
||||
|| av_codec_get_tag(oc->oformat->codec_tag, icodec->codec_id) <= 0)
|
||||
if (!oc->oformat->codec_tag ||
|
||||
av_codec_get_id (oc->oformat->codec_tag, icodec->codec_tag) == codec->codec_id ||
|
||||
av_codec_get_tag(oc->oformat->codec_tag, icodec->codec_id) <= 0)
|
||||
codec->codec_tag = icodec->codec_tag;
|
||||
}
|
||||
|
||||
@ -2029,13 +2029,16 @@ static int transcode_init(OutputFile *output_files,
|
||||
}
|
||||
memcpy(codec->extradata, icodec->extradata, icodec->extradata_size);
|
||||
codec->extradata_size = icodec->extradata_size;
|
||||
if(!copy_tb && av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/500){
|
||||
if (!copy_tb &&
|
||||
av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) &&
|
||||
av_q2d(ist->st->time_base) < 1.0/500) {
|
||||
codec->time_base = icodec->time_base;
|
||||
codec->time_base.num *= icodec->ticks_per_frame;
|
||||
av_reduce(&codec->time_base.num, &codec->time_base.den,
|
||||
codec->time_base.num, codec->time_base.den, INT_MAX);
|
||||
} else
|
||||
codec->time_base = ist->st->time_base;
|
||||
|
||||
switch(codec->codec_type) {
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
if(audio_volume != 256) {
|
||||
@ -2075,8 +2078,10 @@ static int transcode_init(OutputFile *output_files,
|
||||
} else {
|
||||
if (!ost->enc)
|
||||
ost->enc = avcodec_find_encoder(ost->st->codec->codec_id);
|
||||
|
||||
ist->decoding_needed = 1;
|
||||
ost->encoding_needed = 1;
|
||||
|
||||
switch(codec->codec_type) {
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
ost->fifo = av_fifo_alloc(1024);
|
||||
@ -2084,18 +2089,22 @@ static int transcode_init(OutputFile *output_files,
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
ost->reformat_pair = MAKE_SFMT_PAIR(AV_SAMPLE_FMT_NONE,AV_SAMPLE_FMT_NONE);
|
||||
|
||||
if (!codec->sample_rate)
|
||||
codec->sample_rate = icodec->sample_rate;
|
||||
choose_sample_rate(ost->st, ost->enc);
|
||||
codec->time_base = (AVRational){1, codec->sample_rate};
|
||||
|
||||
if (codec->sample_fmt == AV_SAMPLE_FMT_NONE)
|
||||
codec->sample_fmt = icodec->sample_fmt;
|
||||
choose_sample_fmt(ost->st, ost->enc);
|
||||
|
||||
if (!codec->channels)
|
||||
codec->channels = icodec->channels;
|
||||
codec->channel_layout = icodec->channel_layout;
|
||||
if (av_get_channel_layout_nb_channels(codec->channel_layout) != codec->channels)
|
||||
codec->channel_layout = 0;
|
||||
|
||||
ost->audio_resample = codec-> sample_rate != icodec->sample_rate || audio_sync_method > 1;
|
||||
icodec->request_channels = codec-> channels;
|
||||
ost->resample_sample_fmt = icodec->sample_fmt;
|
||||
|
Reference in New Issue
Block a user