[vlc-devel] [PATCH 1/4] avcodec: va: rename the ES format to fmt_in

Steve Lhomme robux4 at ycbcr.xyz
Fri Oct 25 12:20:41 CEST 2019


To avoid confusion with the output format of the VA.
---
 modules/codec/avcodec/d3d11va.c |  5 +++--
 modules/codec/avcodec/dxva2.c   |  5 +++--
 modules/codec/avcodec/va.c      |  4 ++--
 modules/codec/avcodec/vaapi.c   | 12 ++++++------
 modules/hw/vdpau/avcodec.c      |  4 ++--
 5 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 3540b2769da..9c1d9418068 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -251,7 +251,7 @@ static const struct vlc_va_operations ops = { Get, Close, };
 
 static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *desc,
                 enum PixelFormat pix_fmt,
-                const es_format_t *fmt, vlc_decoder_device *dec_device,
+                const es_format_t *fmt_in, vlc_decoder_device *dec_device,
                 vlc_video_context **vtcx_out)
 {
     int err = VLC_EGENERIC;
@@ -322,7 +322,8 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *des
 
     video_format_t fmt_out;
     static const directx_sys_t dx_sys = { DxGetInputList, DxSetupOutput };
-    sys->selected_decoder = directx_va_Setup(va, &dx_sys, ctx, desc, fmt, isXboxHardware(sys->d3d_dev.d3ddevice), &fmt_out, &sys->hw.surface_count);
+    sys->selected_decoder = directx_va_Setup(va, &dx_sys, ctx, desc, fmt_in, isXboxHardware(sys->d3d_dev.d3ddevice),
+                                             &fmt_out, &sys->hw.surface_count);
     if (sys->selected_decoder == NULL)
     {
         err = VLC_EGENERIC;
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 927a2a6d7bb..bb0b821e69c 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -249,7 +249,7 @@ static const struct vlc_va_operations ops = { Get, Close, };
 
 static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *desc,
                 enum PixelFormat pix_fmt,
-                const es_format_t *fmt, vlc_decoder_device *dec_device,
+                const es_format_t *fmt_in, vlc_decoder_device *dec_device,
                 vlc_video_context **vtcx_out)
 {
     int err = VLC_EGENERIC;
@@ -319,7 +319,8 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *des
 
     video_format_t fmt_out;
     static const directx_sys_t dx_sys = { DxGetInputList, DxSetupOutput };
-    sys->selected_decoder = directx_va_Setup(va, &dx_sys, ctx, desc, fmt, 0, &fmt_out, &sys->hw.surface_count);
+    sys->selected_decoder = directx_va_Setup(va, &dx_sys, ctx, desc, fmt_in, 0,
+                                             &fmt_out, &sys->hw.surface_count);
     if (sys->selected_decoder == NULL)
     {
         err = VLC_EGENERIC;
diff --git a/modules/codec/avcodec/va.c b/modules/codec/avcodec/va.c
index 23db69b6051..e500544fe0b 100644
--- a/modules/codec/avcodec/va.c
+++ b/modules/codec/avcodec/va.c
@@ -101,13 +101,13 @@ static int vlc_va_Start(void *func, bool forced, va_list ap)
     AVCodecContext *ctx = va_arg(ap, AVCodecContext *);
     const AVPixFmtDescriptor *src_desc = va_arg(ap, const AVPixFmtDescriptor *);
     enum PixelFormat pix_fmt = va_arg(ap, enum PixelFormat);
-    const es_format_t *fmt = va_arg(ap, const es_format_t *);
+    const es_format_t *fmt_in = va_arg(ap, const es_format_t *);
     vlc_decoder_device *device = va_arg(ap, vlc_decoder_device *);
     vlc_video_context **vtcx_out = va_arg(ap, vlc_video_context **);
     vlc_va_open open = func;
 
     (void) forced;
-    return open(va, ctx, src_desc, pix_fmt, fmt, device, vtcx_out);
+    return open(va, ctx, src_desc, pix_fmt, fmt_in, device, vtcx_out);
 }
 
 vlc_va_t *vlc_va_New(vlc_object_t *obj,
diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index 8da4179a4c9..f058884ba60 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -57,7 +57,7 @@ struct vlc_va_sys_t
     VASurfaceID render_targets[MAX_SURFACE_COUNT];
 };
 
-static int GetVaProfile(const AVCodecContext *ctx, const es_format_t *fmt,
+static int GetVaProfile(const AVCodecContext *ctx, const es_format_t *fmt_in,
                         VAProfile *va_profile, int *vlc_chroma,
                         unsigned *pic_count)
 {
@@ -86,9 +86,9 @@ static int GetVaProfile(const AVCodecContext *ctx, const es_format_t *fmt,
         count = 18;
         break;
     case AV_CODEC_ID_HEVC:
-        if (fmt->i_profile == FF_PROFILE_HEVC_MAIN)
+        if (fmt_in->i_profile == FF_PROFILE_HEVC_MAIN)
             i_profile = VAProfileHEVCMain;
-        else if (fmt->i_profile == FF_PROFILE_HEVC_MAIN_10)
+        else if (fmt_in->i_profile == FF_PROFILE_HEVC_MAIN_10)
         {
             i_profile = VAProfileHEVCMain10;
             i_vlc_chroma = VLC_CODEC_VAAPI_420_10BPP;
@@ -237,7 +237,7 @@ static void VAAPISetupAVCodecContext(void *opaque, AVCodecContext *avctx)
 
 static int Create(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *desc,
                   enum PixelFormat pix_fmt,
-                  const es_format_t *fmt, vlc_decoder_device *dec_device,
+                  const es_format_t *fmt_in, vlc_decoder_device *dec_device,
                   vlc_video_context **vtcx_out)
 {
     VLC_UNUSED(desc);
@@ -259,7 +259,7 @@ static int Create(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *d
     VAProfile i_profile;
     unsigned count;
     int i_vlc_chroma;
-    if (GetVaProfile(ctx, fmt, &i_profile, &i_vlc_chroma, &count) != VLC_SUCCESS)
+    if (GetVaProfile(ctx, fmt_in, &i_profile, &i_vlc_chroma, &count) != VLC_SUCCESS)
         goto error;
 
     /* */
@@ -268,7 +268,7 @@ static int Create(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *d
     sys->hw_ctx.context_id = VA_INVALID_ID;
     va->sys = sys;
 
-    video_format_t fmt_video = fmt->video;
+    video_format_t fmt_video = fmt_in->video;
     fmt_video.i_chroma = i_vlc_chroma;
 
     struct va_pool_cfg pool_cfg = {
diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c
index a84f3f3b558..dd4c754e3d1 100644
--- a/modules/hw/vdpau/avcodec.c
+++ b/modules/hw/vdpau/avcodec.c
@@ -158,14 +158,14 @@ const struct vlc_video_context_operations vdpau_vctx_ops = {
 
 static int Open(vlc_va_t *va, AVCodecContext *avctx, const AVPixFmtDescriptor *desc,
                 enum PixelFormat pix_fmt,
-                const es_format_t *fmt, vlc_decoder_device *dec_device,
+                const es_format_t *fmt_in, vlc_decoder_device *dec_device,
                 vlc_video_context **vtcx_out)
 {
     if (pix_fmt != AV_PIX_FMT_VDPAU|| dec_device == NULL ||
         GetVDPAUOpaqueDevice(dec_device) == NULL)
         return VLC_EGENERIC;
 
-    (void) fmt;
+    (void) fmt_in;
     (void) desc;
     void *func;
     VdpStatus err;
-- 
2.17.1



More information about the vlc-devel mailing list