[vlc-commits] [Git][videolan/vlc][master] 5 commits: dmo: use BITMAPINFOHEADER from Windows headers

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Jan 31 10:16:44 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
1e6152ef by Steve Lhomme at 2023-01-31T09:45:08+00:00
dmo: use BITMAPINFOHEADER from Windows headers

It's available in mingw-w64 5+. dmo.c is a Windows only file, unlike the code
suggested.

- - - - -
a2947255 by Steve Lhomme at 2023-01-31T09:45:08+00:00
vlc_codec: remove unused RECT32

- - - - -
73b0a8bd by Steve Lhomme at 2023-01-31T09:45:08+00:00
vlc_codec: remove unused VLC_BITMAPINFO

- - - - -
96f9688a by Steve Lhomme at 2023-01-31T09:45:08+00:00
vlc_codec: remove video structures only used on Windows

They are defined in the Windows SDK.

- - - - -
9cb9df50 by Steve Lhomme at 2023-01-31T09:45:08+00:00
vlc_codec: use the preferred toolchain packing mode with MSVC

The Windows SDK and mingw-w64 5+ have a clean way to group packing blocks
together. mingw-w64 generates some bogus warning (clang) when using
packing from a header, so keep it to MSVC for now.

- - - - -


3 changed files:

- include/vlc_codecs.h
- modules/codec/dmo/dmo.c
- modules/codec/mft.cpp


Changes:

=====================================
include/vlc_codecs.h
=====================================
@@ -46,9 +46,12 @@ typedef GUID vlc_guid_t;
 
 #ifdef HAVE_ATTRIBUTE_PACKED
 #   define ATTR_PACKED __attribute__((__packed__))
-#elif defined(__SUNPRO_C) || defined(_MSC_VER)
+#elif defined(__SUNPRO_C)
 #   pragma pack(1)
 #   define ATTR_PACKED
+#elif defined(_MSC_VER)
+#   include <pshpack1.h>
+#   define ATTR_PACKED
 #elif defined(__APPLE__)
 #   pragma pack(push, 1)
 #   define ATTR_PACKED
@@ -140,45 +143,12 @@ ATTR_PACKED
     uint32_t   biClrUsed;
     uint32_t   biClrImportant;
 } VLC_BITMAPINFOHEADER, *VLC_PBITMAPINFOHEADER, *VLC_LPBITMAPINFOHEADER;
-
-typedef struct
-ATTR_PACKED
-{
-    VLC_BITMAPINFOHEADER bmiHeader;
-    int                  bmiColors[1];
-} VLC_BITMAPINFO, *VLC_LPBITMAPINFO;
-#endif
-
-#ifndef _RECT32_
-#define _RECT32_
-typedef struct
-ATTR_PACKED
-{
-    int left, top, right, bottom;
-} RECT32;
-#endif
-
-#ifndef _REFERENCE_TIME_
-#define _REFERENCE_TIME_
-typedef int64_t REFERENCE_TIME;
-#endif
-
-#ifndef _VIDEOINFOHEADER_
-#define _VIDEOINFOHEADER_
-typedef struct
-ATTR_PACKED
-{
-    RECT32                  rcSource;
-    RECT32                  rcTarget;
-    uint32_t                dwBitRate;
-    uint32_t                dwBitErrorRate;
-    REFERENCE_TIME          AvgTimePerFrame;
-    VLC_BITMAPINFOHEADER    bmiHeader;
-} VIDEOINFOHEADER;
 #endif
 
-#if defined(__SUNPRO_C) || defined(_MSC_VER)
+#if defined(__SUNPRO_C)
 #   pragma pack()
+#elif defined(_MSC_VER)
+#   include <poppack.h>
 #elif defined(__APPLE__) && !defined(HAVE_ATTRIBUTE_PACKED)
 #   pragma pack(pop)
 #endif


=====================================
modules/codec/dmo/dmo.c
=====================================
@@ -36,9 +36,9 @@
 #include <vlc_codec.h>
 #include <vlc_codecs.h>
 
-#ifdef _WIN32
-#   include <objbase.h>
-#endif
+#include <objbase.h>
+#include <strmif.h>
+#include <amvideo.h>
 
 #include <vlc_codecs.h>
 #include "dmo.h"
@@ -353,7 +353,7 @@ static int DecOpen( decoder_t *p_dec )
     }
     else
     {
-        VLC_BITMAPINFOHEADER *p_bih;
+        BITMAPINFOHEADER *p_bih;
 
         int i_size = sizeof(VIDEOINFOHEADER) + p_dec->fmt_in->i_extra;
         p_vih = malloc( i_size );
@@ -369,8 +369,7 @@ static int DecOpen( decoder_t *p_dec )
         p_bih->biHeight = p_dec->fmt_in->video.i_height;
         p_bih->biBitCount = p_dec->fmt_in->video.i_bits_per_pixel;
         p_bih->biPlanes = 1;
-        p_bih->biSize = i_size - sizeof(VIDEOINFOHEADER) +
-            sizeof(VLC_BITMAPINFOHEADER);
+        p_bih->biSize = i_size - sizeof(VIDEOINFOHEADER) + sizeof(*p_bih);
 
         p_vih->rcSource.left = p_vih->rcSource.top = 0;
         p_vih->rcSource.right = p_dec->fmt_in->video.i_width;
@@ -432,7 +431,7 @@ static int DecOpen( decoder_t *p_dec )
     }
     else
     {
-        VLC_BITMAPINFOHEADER *p_bih;
+        BITMAPINFOHEADER *p_bih;
         DMO_MEDIA_TYPE mt;
         unsigned i_chroma = VLC_CODEC_YUYV;
         int i_bpp = 16;
@@ -486,7 +485,7 @@ static int DecOpen( decoder_t *p_dec )
             (p_dec->fmt_in->video.i_bits_per_pixel + 7) / 8;
 
         p_bih->biPlanes = 1; /* http://msdn.microsoft.com/en-us/library/dd183376%28v=vs.85%29.aspx */
-        p_bih->biSize = sizeof(VLC_BITMAPINFOHEADER);
+        p_bih->biSize = sizeof(*p_bih);
 
         dmo_output_type.majortype = MEDIATYPE_Video;
         dmo_output_type.formattype = FORMAT_VideoInfo;
@@ -1062,7 +1061,7 @@ static int EncoderSetVideoType( encoder_t *p_enc, IMediaObject *p_dmo )
     int i, i_selected, i_err;
     DMO_MEDIA_TYPE dmo_type;
     VIDEOINFOHEADER vih, *p_vih;
-    VLC_BITMAPINFOHEADER *p_bih;
+    BITMAPINFOHEADER *p_bih;
 
     /* FIXME */
     p_enc->fmt_in.video.i_bits_per_pixel =
@@ -1096,7 +1095,7 @@ static int EncoderSetVideoType( encoder_t *p_enc, IMediaObject *p_dmo )
     p_bih->biSizeImage = p_enc->fmt_in.video.i_visible_width *
         p_enc->fmt_in.video.i_visible_height * p_enc->fmt_in.video.i_bits_per_pixel /8;
     p_bih->biPlanes = 3;
-    p_bih->biSize = sizeof(VLC_BITMAPINFOHEADER);
+    p_bih->biSize = sizeof(*p_bih);
 
     vih.rcSource.left = vih.rcSource.top = 0;
     vih.rcSource.right = p_enc->fmt_in.video.i_visible_width;


=====================================
modules/codec/mft.cpp
=====================================
@@ -47,7 +47,6 @@ extern "C" {
 #include <codecapi.h>
 
 
-#define _VIDEOINFOHEADER_
 #include <vlc_codecs.h>
 
 #include <algorithm>



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b2a7a5b3740b74bf3d124ff77e00b1cd14588e2d...9cb9df5097a47272cffdcf205a49c27c59ead18d

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b2a7a5b3740b74bf3d124ff77e00b1cd14588e2d...9cb9df5097a47272cffdcf205a49c27c59ead18d
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list