avconv: K&R cosmetics
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
parent
cf4afe0be6
commit
7636c8c6a3
31
avconv.c
31
avconv.c
@ -818,7 +818,8 @@ static void choose_pixel_fmt(AVStream *st, AVCodec *codec)
|
||||
if (st->codec->codec_id == CODEC_ID_MJPEG) {
|
||||
p = (const enum PixelFormat[]) { PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE };
|
||||
} else if (st->codec->codec_id == CODEC_ID_LJPEG) {
|
||||
p= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE};
|
||||
p = (const enum PixelFormat[]) { PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P,
|
||||
PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE };
|
||||
}
|
||||
}
|
||||
for (; *p != PIX_FMT_NONE; p++) {
|
||||
@ -845,7 +846,8 @@ get_sync_ipts(const OutputStream *ost)
|
||||
return (double)(ist->pts - of->start_time) / AV_TIME_BASE;
|
||||
}
|
||||
|
||||
static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx, AVBitStreamFilterContext *bsfc){
|
||||
static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx, AVBitStreamFilterContext *bsfc)
|
||||
{
|
||||
int ret;
|
||||
|
||||
while (bsfc) {
|
||||
@ -984,8 +986,8 @@ need_realloc:
|
||||
}
|
||||
|
||||
if (audio_sync_method) {
|
||||
double delta = get_sync_ipts(ost) * enc->sample_rate - ost->sync_opts
|
||||
- av_fifo_size(ost->fifo)/(enc->channels * osize);
|
||||
double delta = get_sync_ipts(ost) * enc->sample_rate - ost->sync_opts -
|
||||
av_fifo_size(ost->fifo) / (enc->channels * osize);
|
||||
int idelta = delta * dec->sample_rate / enc->sample_rate;
|
||||
int byte_delta = idelta * isize * dec->channels;
|
||||
|
||||
@ -1027,8 +1029,8 @@ need_realloc:
|
||||
}
|
||||
}
|
||||
} else
|
||||
ost->sync_opts= lrintf(get_sync_ipts(ost) * enc->sample_rate)
|
||||
- av_fifo_size(ost->fifo)/(enc->channels * osize); //FIXME wrong
|
||||
ost->sync_opts = lrintf(get_sync_ipts(ost) * enc->sample_rate) -
|
||||
av_fifo_size(ost->fifo) / (enc->channels * osize); // FIXME wrong
|
||||
|
||||
if (ost->audio_resample) {
|
||||
buftmp = audio_buf;
|
||||
@ -1431,7 +1433,8 @@ static void do_video_out(AVFormatContext *s,
|
||||
}
|
||||
}
|
||||
|
||||
static double psnr(double d){
|
||||
static double psnr(double d)
|
||||
{
|
||||
return -10.0 * log(d) / log(10.0);
|
||||
}
|
||||
|
||||
@ -1551,7 +1554,8 @@ static void print_report(OutputFile *output_files,
|
||||
error = enc->coded_frame->error[j];
|
||||
scale = enc->width * enc->height * 255.0 * 255.0;
|
||||
}
|
||||
if(j) scale/=4;
|
||||
if (j)
|
||||
scale /= 4;
|
||||
error_sum += error;
|
||||
scale_sum += scale;
|
||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%c:%2.2f ", type[j], psnr(error / scale));
|
||||
@ -2609,7 +2613,8 @@ static int transcode(OutputFile *output_files,
|
||||
if (!input_files[ist->file_index].eof_reached) {
|
||||
if (ipts < ipts_min) {
|
||||
ipts_min = ipts;
|
||||
if(input_sync ) file_index = ist->file_index;
|
||||
if (input_sync)
|
||||
file_index = ist->file_index;
|
||||
}
|
||||
if (opts < opts_min) {
|
||||
opts_min = opts;
|
||||
@ -2676,14 +2681,18 @@ static int transcode(OutputFile *output_files,
|
||||
if (pkt.dts != AV_NOPTS_VALUE)
|
||||
pkt.dts *= ist->ts_scale;
|
||||
|
||||
// fprintf(stderr, "next:%"PRId64" dts:%"PRId64" off:%"PRId64" %d\n", ist->next_pts, pkt.dts, input_files[ist->file_index].ts_offset, ist->st->codec->codec_type);
|
||||
//fprintf(stderr, "next:%"PRId64" dts:%"PRId64" off:%"PRId64" %d\n",
|
||||
// ist->next_pts,
|
||||
// pkt.dts, input_files[ist->file_index].ts_offset,
|
||||
// ist->st->codec->codec_type);
|
||||
if (pkt.dts != AV_NOPTS_VALUE && ist->next_pts != AV_NOPTS_VALUE
|
||||
&& (is->iformat->flags & AVFMT_TS_DISCONT)) {
|
||||
int64_t pkt_dts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
|
||||
int64_t delta = pkt_dts - ist->next_pts;
|
||||
if ((FFABS(delta) > 1LL * dts_delta_threshold * AV_TIME_BASE || pkt_dts + 1 < ist->pts) && !copy_ts) {
|
||||
input_files[ist->file_index].ts_offset -= delta;
|
||||
av_log(NULL, AV_LOG_DEBUG, "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
|
||||
av_log(NULL, AV_LOG_DEBUG,
|
||||
"timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
|
||||
delta, input_files[ist->file_index].ts_offset);
|
||||
pkt.dts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
|
||||
if (pkt.pts != AV_NOPTS_VALUE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user