[vlc-devel] [PATCH 04/19] video context: add a function to test if 2 context are similar
Steve Lhomme
robux4 at ycbcr.xyz
Tue Nov 5 16:18:31 CET 2019
If they are not similar a converter from one to the other should be used.
NULL is allowed, in which case only the type of the video context is checked.
---
include/vlc_picture.h | 2 ++
modules/hw/vdpau/avcodec.c | 2 +-
modules/video_chroma/d3d11_fmt.c | 2 +-
modules/video_chroma/d3d9_fmt.c | 2 +-
src/input/decoder_helpers.c | 11 +++++++++++
src/libvlccore.sym | 1 +
6 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index e12df4a1f8d..e569fbadede 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -85,6 +85,7 @@ typedef struct vlc_video_context vlc_video_context;
struct vlc_video_context_operations
{
void (*destroy)(void *priv);
+ bool (*similar)(const vlc_video_context*, const vlc_video_context*);
};
/** Decoder device type */
@@ -110,6 +111,7 @@ VLC_API void vlc_video_context_Release(vlc_video_context *);
VLC_API enum vlc_video_context_type vlc_video_context_GetType(const vlc_video_context *);
VLC_API void *vlc_video_context_GetPrivate(vlc_video_context *, enum vlc_video_context_type);
VLC_API vlc_video_context *vlc_video_context_Hold(vlc_video_context *);
+VLC_API bool vlc_video_context_IsSimilar(const vlc_video_context *, const vlc_video_context *);
/**
* Get the decoder device used by the device context.
diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c
index 74aa135f70c..6f9a75fd803 100644
--- a/modules/hw/vdpau/avcodec.c
+++ b/modules/hw/vdpau/avcodec.c
@@ -153,7 +153,7 @@ static void DestroyVDPAUVideoContext(void *private)
}
const struct vlc_video_context_operations vdpau_vctx_ops = {
- DestroyVDPAUVideoContext,
+ DestroyVDPAUVideoContext, NULL // TODO
};
static int Open(vlc_va_t *va, AVCodecContext *avctx, const AVPixFmtDescriptor *desc,
diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index 77156f509bb..edb39244a33 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -771,7 +771,7 @@ static void ReleaseD3D11ContextPrivate(void *private)
}
const struct vlc_video_context_operations d3d11_vctx_ops = {
- ReleaseD3D11ContextPrivate,
+ ReleaseD3D11ContextPrivate, NULL // TODO
};
void d3d11_pic_context_destroy(picture_context_t *ctx)
diff --git a/modules/video_chroma/d3d9_fmt.c b/modules/video_chroma/d3d9_fmt.c
index 508bfc838f8..3a53484908e 100644
--- a/modules/video_chroma/d3d9_fmt.c
+++ b/modules/video_chroma/d3d9_fmt.c
@@ -293,7 +293,7 @@ static void ReleaseD3D9ContextPrivate(void *private)
}
const struct vlc_video_context_operations d3d9_vctx_ops = {
- ReleaseD3D9ContextPrivate,
+ ReleaseD3D9ContextPrivate, NULL // TODO
};
void d3d9_pic_context_destroy(picture_context_t *ctx)
diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index 3ff71f49c23..ca9d5a87890 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -294,3 +294,14 @@ vlc_decoder_device* vlc_video_context_HoldDevice(vlc_video_context *vctx)
return NULL;
return vlc_decoder_device_Hold( vctx->device );
}
+
+bool vlc_video_context_IsSimilar(const vlc_video_context *a, const vlc_video_context *b)
+{
+ if (!a && !b)
+ return true;
+ if (!a || !b)
+ return false;
+ if (a->private_type != b->private_type)
+ return false;
+ return a->ops->similar == NULL || a->ops->similar(a, b);
+}
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 7dce1c2c25b..3ea59614722 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -952,3 +952,4 @@ vlc_video_context_GetType
vlc_video_context_GetPrivate
vlc_video_context_Hold
vlc_video_context_HoldDevice
+vlc_video_context_IsSimilar
--
2.17.1
More information about the vlc-devel
mailing list