[FFmpeg-cvslog] ffmpeg: add remaining hunks to enable dr1 support
Michael Niedermayer
git at videolan.org
Tue Dec 27 06:07:17 CET 2011
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Dec 26 05:50:25 2011 +0100| [9971af3aa8351bd3890ec7155f717f79a2fd19ed] | committer: Michael Niedermayer
ffmpeg: add remaining hunks to enable dr1 support
Author: Anton Khirnov
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9971af3aa8351bd3890ec7155f717f79a2fd19ed
---
ffmpeg.c | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/ffmpeg.c b/ffmpeg.c
index b9c1598..5e137c6 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);
More information about the ffmpeg-cvslog
mailing list