summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-26 05:50:25 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-27 04:01:38 +0100
commit9971af3aa8351bd3890ec7155f717f79a2fd19ed (patch)
tree90ed2e0011af5d3b3500c49f8e5a9074e4e68d0d /ffmpeg.c
parent49b909b980eb18f1049d9b31ee99f177c58165ae (diff)
ffmpeg: add remaining hunks to enable dr1 support
Author: Anton Khirnov Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index b9c15981fc..5e137c61bd 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2049,7 +2049,22 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
if (!frame_sample_aspect->num)
*frame_sample_aspect = ist->st->sample_aspect_ratio;
decoded_frame->pts = ist->pts;
-
+ if (ist->st->codec->codec->capabilities & CODEC_CAP_DR1) {
+ FrameBuffer *buf = decoded_frame->opaque;
+ AVFilterBufferRef *fb = avfilter_get_video_buffer_ref_from_arrays(
+ decoded_frame->data, decoded_frame->linesize,
+ AV_PERM_READ | AV_PERM_PRESERVE,
+ ist->st->codec->width, ist->st->codec->height,
+ ist->st->codec->pix_fmt);
+
+ avfilter_copy_frame_props(fb, decoded_frame);
+ fb->pts = ist->pts;
+ fb->buf->priv = buf;
+ fb->buf->free = filter_release_buffer;
+
+ buf->refcount++;
+ av_buffersrc_buffer(ost->input_video_filter, fb);
+ } else
if((av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame, AV_VSRC_BUF_FLAG_OVERWRITE)) < 0){
av_log(0, AV_LOG_FATAL, "Failed to inject frame into filter network\n");
exit_program(1);
@@ -2275,6 +2290,13 @@ static int init_input_stream(int ist_index, OutputStream *output_streams, int nb
avcodec_get_name(ist->st->codec->codec_id), ist->file_index, ist->st->index);
return AVERROR(EINVAL);
}
+
+ if (codec->type == AVMEDIA_TYPE_VIDEO && codec->capabilities & CODEC_CAP_DR1) {
+ ist->st->codec->get_buffer = codec_get_buffer;
+ ist->st->codec->release_buffer = codec_release_buffer;
+ ist->st->codec->opaque = ist;
+ }
+
if (avcodec_open2(ist->st->codec, codec, &ist->opts) < 0) {
snprintf(error, error_len, "Error while opening decoder for input stream #%d:%d",
ist->file_index, ist->st->index);