static void do_video_stats(OutputStream *ost, int frame_size);
static int64_t getutime(void);
+static int64_t getmaxrss(void);
static int run_as_daemon = 0;
static int64_t video_size = 0;
{
int i, j;
+ if (do_benchmark) {
+ int maxrss = getmaxrss() / 1024;
+ printf("bench: maxrss=%ikB\n", maxrss);
+ }
+
for (i = 0; i < nb_filtergraphs; i++) {
avfilter_graph_free(&filtergraphs[i]->graph);
for (j = 0; j < filtergraphs[i]->nb_inputs; j++) {
avcodec_free_frame(&input_streams[i]->decoded_frame);
av_dict_free(&input_streams[i]->opts);
free_buffer_pool(&input_streams[i]->buffer_pool);
+ avsubtitle_free(&input_streams[i]->prev_sub.subtitle);
avfilter_unref_bufferp(&input_streams[i]->sub2video.ref);
av_freep(&input_streams[i]->filters);
av_freep(&input_streams[i]);
memcpy(t, new_pkt.data, new_pkt.size);
memset(t + new_pkt.size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
new_pkt.data = t;
+ new_pkt.buf = NULL;
a = 1;
} else
a = AVERROR(ENOMEM);
}
}
+#if FF_API_DEINTERLACE
static void pre_process_video_frame(InputStream *ist, AVPicture *picture, void **bufp)
{
AVCodecContext *dec;
dec = ist->st->codec;
/* deinterlace : must be done before any resize */
- if (do_deinterlace) {
+ if (FF_API_DEINTERLACE && do_deinterlace) {
int size;
/* create temporary picture */
*picture = *picture2;
*bufp = buf;
}
+#endif
static void do_subtitle_out(AVFormatContext *s,
OutputStream *ost,
p = psnr(error / scale);
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%c:%2.2f ", type[j], p);
av_bprintf(&buf_script, "stream_%d_%d_psnr_%c=%2.2f\n",
- ost->file_index, ost->index, type[i] | 32, p);
+ ost->file_index, ost->index, type[j] | 32, p);
}
p = psnr(error_sum / scale_sum);
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum / scale_sum));
av_bprintf(&buf_script, "drop_frames=%d\n", nb_frames_drop);
if (print_stats || is_last_report) {
- av_log(NULL, AV_LOG_INFO, "%s \r", buf);
+ if (print_stats==1 && AV_LOG_INFO > av_log_get_level()) {
+ fprintf(stderr, "%s \r", buf);
+ } else
+ av_log(NULL, AV_LOG_INFO, "%s \r", buf);
fflush(stderr);
}
}
pkt->size = 0;
+#if FF_API_DEINTERLACE
pre_process_video_frame(ist, (AVPicture *)decoded_frame, &buffer_to_free);
+#endif
rate_emu_sleep(ist);
return AVERROR(EINVAL);
}
- ist->dr1 = (codec->capabilities & CODEC_CAP_DR1) && !do_deinterlace;
+ ist->dr1 = (codec->capabilities & CODEC_CAP_DR1) && !(FF_API_DEINTERLACE && do_deinterlace);
if (codec->type == AVMEDIA_TYPE_VIDEO && ist->dr1) {
ist->st->codec->get_buffer = codec_get_buffer;
ist->st->codec->release_buffer = codec_release_buffer;
if (ost->st->codec->me_threshold)
input_streams[ost->source_index]->st->codec->debug |= FF_DEBUG_MV;
+ } else {
+ av_opt_set_dict(ost->st->codec, &ost->opts);
}
}
/* init input streams */
for (i = 0; i < nb_input_streams; i++)
- if ((ret = init_input_stream(i, error, sizeof(error))) < 0)
+ if ((ret = init_input_stream(i, error, sizeof(error))) < 0) {
+ for (i = 0; i < nb_output_streams; i++) {
+ ost = output_streams[i];
+ avcodec_close(ost->st->codec);
+ }
goto dump_format;
+ }
/* discard unused programs */
for (i = 0; i < nb_input_files; i++) {
av_freep(&ost->st->codec->subtitle_header);
av_free(ost->forced_kf_pts);
av_dict_free(&ost->opts);
+ av_dict_free(&ost->swr_opts);
+ av_dict_free(&ost->resample_opts);
}
}
}
exit(1);
ti = getutime() - ti;
if (do_benchmark) {
- int maxrss = getmaxrss() / 1024;
- printf("bench: utime=%0.3fs maxrss=%ikB\n", ti / 1000000.0, maxrss);
+ printf("bench: utime=%0.3fs\n", ti / 1000000.0);
}
exit(received_nb_signals ? 255 : 0);