summaryrefslogtreecommitdiffstats
path: root/video/decode/lavc_dr1.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-12-12 00:43:50 +0100
committerwm4 <wm4@nowhere>2013-01-13 17:39:32 +0100
commit881f82dd33fe8d13e731bfe04077d3abcd149fa3 (patch)
tree8d252a933f51523a73cc93a06af40b515e671bbb /video/decode/lavc_dr1.c
parent65a0b5fdc609dac739f6ad1681f845b78589777b (diff)
downloadmpv-881f82dd33fe8d13e731bfe04077d3abcd149fa3.tar.bz2
mpv-881f82dd33fe8d13e731bfe04077d3abcd149fa3.tar.xz
vd_lavc: use refcounting
Note that if the codec doesn't support DR1, the image has to be copied. There is no other way to guarantee that the image will be valid after decoding the next image. The only important codec that doesn't support DR1 yet is rawvideo. It's likely that ffmpeg/Libav will fix this at some time. For now, this decoder uses an evil hack and puts pointers to the packet data into the returned frame. This means the image will actually get invalid as soon as the corresponding video packet is free'd, so copying the image is the only reasonable thing anyway.
Diffstat (limited to 'video/decode/lavc_dr1.c')
-rw-r--r--video/decode/lavc_dr1.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/video/decode/lavc_dr1.c b/video/decode/lavc_dr1.c
index 1049b6105a..34aad2e030 100644
--- a/video/decode/lavc_dr1.c
+++ b/video/decode/lavc_dr1.c
@@ -190,6 +190,11 @@ void mp_buffer_unref(struct FrameBuffer *buf)
mp_buffer_pool_free(&pool);
}
+bool mp_buffer_is_unique(struct FrameBuffer *buf)
+{
+ return buf->refcount == 1;
+}
+
void mp_codec_release_buffer(AVCodecContext *s, AVFrame *frame)
{
FrameBuffer *buf = frame->opaque;