<html><head></head><body>VDPAU buffers are tied to a VDPAU device instance. You cannot use them across different VLC video contexts. I doubt you can do that with NVDEC either.<br><br>It might be possible with DRM or maybe not, but even then I doubt that the similarity callback can actually be implemented...<br><br>So I don't really see the point over a straight pointer equality test.<br><br><div class="gmail_quote">Le 12 novembre 2019 09:32:13 GMT+02:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">On 2019-11-09 3:52, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">Le vendredi 8 novembre 2019, 16:40:07 EET Steve Lhomme a écrit :<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;">If they are not similar a converter from one to the other should be used.<br></blockquote>What is the definition of similar ? For non-serial objects, the idea seems<br>rather fishy.<br></blockquote><br>"Video Context are similar when they can use surfaces from one another."<br><br>This is used in places where the video_format_IsSimilar() is used. A <br>hardware decoder may push the same video format (same opaque chroma) but <br>using a different video context. In some cases (NVDEC/CUDA for example) <br>the new video context can be used without reconfiguring anything. In <br>some other cases they might not be (DXVA2 after a device reset has been <br>received).<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> A NULL callback is allowed, in which case only the type of the video context<br> is checked.<hr>   include/vlc_picture.h            | 11 +++++++++++<br>   modules/hw/vdpau/avcodec.c       |  2 +-<br>   modules/video_chroma/d3d11_fmt.c |  2 +-<br>   modules/video_chroma/d3d9_fmt.c  |  2 +-<br>   src/input/decoder_helpers.c      | 16 ++++++++++++++++<br>   src/libvlccore.sym               |  1 +<br>   6 files changed, 31 insertions(+), 3 deletions(-)<br><br> diff --git a/include/vlc_picture.h b/include/vlc_picture.h<br> index a5931ef67af..c9bf28a9ed8 100644<br> --- a/include/vlc_picture.h<br> +++ b/include/vlc_picture.h<br> @@ -85,6 +85,11 @@ typedef struct vlc_video_context vlc_video_context;<br>   struct vlc_video_context_operations<br>   {<br>       void (*destroy)(void *priv);<br> +    /**<br> +     * Check if two video context of the same type are similar.<br> +     * The callback can be NULL.<br> +     */<br> +    bool (*similar)(const vlc_video_context*, const vlc_video_context*);<br>   };<br><br>   /** Decoder device type */<br> @@ -110,6 +115,12 @@ VLC_API void<br> vlc_video_context_Release(vlc_video_context *); VLC_API enum<br> vlc_video_context_type vlc_video_context_GetType(const vlc_video_context<br> *); VLC_API void *vlc_video_context_GetPrivate(vlc_video_context *, enum<br> vlc_video_context_type); VLC_API vlc_video_context<br> *vlc_video_context_Hold(vlc_video_context *); +/**<br> + * Test if two video context are similar/compatible.<br> + *<br> + * Video Context are similar when they can use surfaces from one another.<br> + */<br> +VLC_API bool vlc_video_context_IsSimilar(const vlc_video_context *, const<br> vlc_video_context *);<br><br>   /**<br>    * Get the decoder device used by the device context.<br> diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c<br> index 74aa135f70c..6f9a75fd803 100644<br> --- a/modules/hw/vdpau/avcodec.c<br> +++ b/modules/hw/vdpau/avcodec.c<br> @@ -153,7 +153,7 @@ static void DestroyVDPAUVideoContext(void *private)<br>   }<br><br>   const struct vlc_video_context_operations vdpau_vctx_ops = {<br> -    DestroyVDPAUVideoContext,<br> +    DestroyVDPAUVideoContext, NULL // TODO<br>   };<br><br>   static int Open(vlc_va_t *va, AVCodecContext *avctx, const<br> AVPixFmtDescriptor *desc, diff --git a/modules/video_chroma/d3d11_fmt.c<br> b/modules/video_chroma/d3d11_fmt.c index 77156f509bb..edb39244a33 100644<br> --- a/modules/video_chroma/d3d11_fmt.c<br> +++ b/modules/video_chroma/d3d11_fmt.c<br> @@ -771,7 +771,7 @@ static void ReleaseD3D11ContextPrivate(void *private)<br>   }<br><br>   const struct vlc_video_context_operations d3d11_vctx_ops = {<br> -    ReleaseD3D11ContextPrivate,<br> +    ReleaseD3D11ContextPrivate, NULL // TODO<br>   };<br><br>   void d3d11_pic_context_destroy(picture_context_t *ctx)<br> diff --git a/modules/video_chroma/d3d9_fmt.c<br> b/modules/video_chroma/d3d9_fmt.c index 508bfc838f8..3a53484908e 100644<br> --- a/modules/video_chroma/d3d9_fmt.c<br> +++ b/modules/video_chroma/d3d9_fmt.c<br> @@ -293,7 +293,7 @@ static void ReleaseD3D9ContextPrivate(void *private)<br>   }<br><br>   const struct vlc_video_context_operations d3d9_vctx_ops = {<br> -    ReleaseD3D9ContextPrivate,<br> +    ReleaseD3D9ContextPrivate, NULL // TODO<br>   };<br><br>   void d3d9_pic_context_destroy(picture_context_t *ctx)<br> diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c<br> index 3ff71f49c23..e4b8f2797b6 100644<br> --- a/src/input/decoder_helpers.c<br> +++ b/src/input/decoder_helpers.c<br> @@ -294,3 +294,19 @@ vlc_decoder_device*<br> vlc_video_context_HoldDevice(vlc_video_context *vctx) return NULL;<br>       return vlc_decoder_device_Hold( vctx->device );<br>   }<br> +<br> +bool vlc_video_context_IsSimilar(const vlc_video_context *a, const<br> vlc_video_context *b) +{<br> +    if (!a && !b)<br> +        return true;<br> +    if (!a || !b)<br> +        return false;<br></blockquote>if (a == NULL || b == NULL)<br>     return a == b;<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;">+    if (a->private_type != b->private_type)<br>+        return false;<br>+    if (a->ops == NULL)<br>+    {<br>+        assert(b->ops == NULL);<br>+        return b->ops == NULL;<br>+    }<br>+    return a->ops->similar == NULL || a->ops->similar(a, b);<br>+}<br>diff --git a/src/libvlccore.sym b/src/libvlccore.sym<br>index 7dce1c2c25b..3ea59614722 100644<br>--- a/src/libvlccore.sym<br>+++ b/src/libvlccore.sym<br>@@ -952,3 +952,4 @@ vlc_video_context_GetType<br>  vlc_video_context_GetPrivate<br>  vlc_video_context_Hold<br>  vlc_video_context_HoldDevice<br>+vlc_video_context_IsSimilar<br></blockquote><br>-- <br>Rémi Denis-Courmont<hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>