Commit 4707ee96 authored by Jan Gerber's avatar Jan Gerber
Browse files

use av_samples_alloc, avg_frame_rate

parent 5c26d333
......@@ -366,7 +366,7 @@ static void json_stream_format(FILE *output, AVFormatContext *ic, int i, int ind
json_add_key_value(output, "framerate", buf1, JSON_STRING, 0, indent + 1);
} else {
snprintf(buf1, sizeof(buf1), "%d:%d",
st->r_frame_rate.num, st->r_frame_rate.den);
st->avg_frame_rate.num, st->avg_frame_rate.den);
json_add_key_value(output, "framerate", buf1, JSON_STRING, 0, indent + 1);
}
if (st->sample_aspect_ratio.num && // default
......
......@@ -604,8 +604,8 @@ void ff2theora_output(ff2theora this) {
vstream_fps.num = venc->time_base.den;
vstream_fps.den = venc->time_base.num * venc->ticks_per_frame;
}
if (av_q2d(vstream->r_frame_rate) < av_q2d(vstream_fps)) {
vstream_fps = vstream->r_frame_rate;
if (av_q2d(vstream->avg_frame_rate) < av_q2d(vstream_fps)) {
vstream_fps = vstream->avg_frame_rate;
}
this->fps = fps = av_q2d(vstream_fps);
......@@ -982,11 +982,11 @@ void ff2theora_output(ff2theora this) {
av_opt_set_int(swr_ctx, "in_channel_layout", av_get_default_channel_layout(aenc->channels), 0);
}
av_opt_set_int(swr_ctx, "in_sample_rate", aenc->sample_rate, 0);
av_opt_set_sample_fmt(swr_ctx, "in_sample_fmt", aenc->sample_fmt, 0);
av_opt_set_int(swr_ctx, "in_sample_fmt", aenc->sample_fmt, 0);
av_opt_set_int(swr_ctx, "out_channel_layout", av_get_default_channel_layout(this->channels), 0);
av_opt_set_int(swr_ctx, "out_sample_rate", this->sample_rate, 0);
av_opt_set_sample_fmt(swr_ctx, "out_sample_fmt", AV_SAMPLE_FMT_FLTP, 0);
av_opt_set_int(swr_ctx, "out_sample_fmt", AV_SAMPLE_FMT_FLTP, 0);
/* initialize the resampling context */
if (swr_init(swr_ctx) < 0) {
......@@ -997,8 +997,8 @@ void ff2theora_output(ff2theora this) {
max_dst_nb_samples = dst_nb_samples =
av_rescale_rnd(src_nb_samples, this->sample_rate, sample_rate, AV_ROUND_UP);
if (av_samples_alloc_array_and_samples(&dst_audio_data, &dst_linesize, this->channels,
dst_nb_samples, AV_SAMPLE_FMT_FLTP, 0) < 0) {
if (av_samples_alloc(dst_audio_data, &dst_linesize, this->channels,
dst_nb_samples, AV_SAMPLE_FMT_FLTP, 0) < 0) {
fprintf(stderr, "Could not allocate destination samples\n");
exit(1);
}
......
......@@ -7,6 +7,7 @@
#else
#include <libavresample/avresample.h>
#include <libavutil/mathematics.h>
#define SwrContext AVAudioResampleContext
#define swr_init(ctx) avresample_open(ctx)
......
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