Commit bf0b74d1 authored by Julian Rother's avatar Julian Rother

transcode: Refactured setup_output_stream using av_buffersink_get_* functions

parent 5e784411
......@@ -149,25 +149,24 @@ static void setup_output_stream(char *stream, AVStream *st, AVCodecContext *enc,
AVFilterContext *sink)
{
int err;
AVFilterLink *l;
AVDictionary *opts;
l = sink->inputs[0];
if (enc->codec_type == AVMEDIA_TYPE_VIDEO)
{
/* Why not use av_buffersink_get_* here? */
enc->height = l->h;
enc->width = l->w;
enc->sample_aspect_ratio = l->sample_aspect_ratio;
enc->pix_fmt = l->format;
enc->height = av_buffersink_get_h(sink);
enc->width = av_buffersink_get_w(sink);
enc->sample_aspect_ratio = av_buffersink_get_sample_aspect_ratio(sink);
enc->pix_fmt = av_buffersink_get_format(sink);
enc->framerate = av_buffersink_get_frame_rate(sink);
}
else if (enc->codec_type == AVMEDIA_TYPE_AUDIO)
{
enc->sample_rate = l->sample_rate;
enc->channel_layout = l->channel_layout;
enc->channels = l->channels;
enc->sample_fmt = l->format;
enc->sample_rate = av_buffersink_get_sample_rate(sink);
enc->channel_layout = av_buffersink_get_channel_layout(sink);
enc->channels = av_buffersink_get_channels(sink);
enc->sample_fmt = av_buffersink_get_format(sink);
}
enc->time_base = l->time_base;
enc->time_base = av_buffersink_get_time_base(sink);
opts = 0;
parse_dict(&opts, jlookup(stream, "options"));
if ((err = avcodec_open2(enc, enc->codec, &opts)) < 0)
......
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