[vlc-commits] [Git][videolan/vlc][master] 7 commits: demux: adaptive: use size_t format specifier

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Aug 27 06:43:51 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
3e23f5dd by Johannes Kauffmann at 2022-08-27T06:32:36+00:00
demux: adaptive: use size_t format specifier

- - - - -
1c8c2850 by Johannes Kauffmann at 2022-08-27T06:32:36+00:00
qt: navigation_history: make assert consistent

Mirror NavigationHistory::addLeaf, by using size(), and moving the call
into the assert statement.

It also fixes an unused variable warning.

- - - - -
a9d82155 by Johannes Kauffmann at 2022-08-27T06:32:36+00:00
demux: adaptive: remove dead stores

Found by clang-tidy.

- - - - -
d67387a0 by Johannes Kauffmann at 2022-08-27T06:32:36+00:00
packetizer: flac: don't shadow local variable

modules/packetizer/flac.c: In function 'Packetize':
modules/packetizer/flac.c:423:40: warning: declaration of 'streaminfo' shadows a previous local [-Wshadow=compatible-local]
  423 |         const struct flac_stream_info *streaminfo =
      |                                        ^~~~~~~~~~
modules/packetizer/flac.c:371:40: note: shadowed declaration is here
  371 |         const struct flac_stream_info *streaminfo =
      |                                        ^~~~~~~~~~

- - - - -
ebd2f0ca by Johannes Kauffmann at 2022-08-27T06:32:36+00:00
aribcam: remove duplicate const

modules/stream_filter/aribcam.c:54:38: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
   54 | static const struct error_messages_s const b25_errors[] =
      |                                      ^~~~~
modules/stream_filter/aribcam.c:75:38: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
   75 | static const struct error_messages_s const bcas_errors[] =
      |                                      ^~~~~
modules/stream_filter/aribcam.c:99:62: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
   99 |                                const struct error_messages_s const *p_errors_messages )
      |                                                              ^~~~~

- - - - -
c76ffccb by Johannes Kauffmann at 2022-08-27T06:32:36+00:00
direct3d9/interop_dxva2: remove unused HRESULT

They were never checked anyway.

- - - - -
fbd9bf7c by Johannes Kauffmann at 2022-08-27T06:32:36+00:00
test: concatenate string literals outside array

src/video_output/video_output.c:302:44: warning: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Wstring-concatenation]
        "--no-auto-preparse", "--dec-dev=" MODULE_STRING,
                                           ^
                                          ,
modules/stream_out/transcode.c:370:44: warning: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Wstring-concatenation]
        "--no-auto-preparse", "--dec-dev=" MODULE_STRING,
                                           ^
                                          ,

- - - - -


10 changed files:

- modules/demux/adaptive/http/HTTPConnection.cpp
- modules/demux/adaptive/logic/Representationselectors.cpp
- modules/demux/adaptive/plumbing/SourceStream.cpp
- modules/gui/qt/util/navigation_history.cpp
- modules/packetizer/flac.c
- modules/stream_filter/aribcam.c
- modules/video_output/opengl/interop_dxva2.c
- modules/video_output/win32/direct3d9.c
- test/modules/stream_out/transcode.c
- test/src/video_output/video_output.c


Changes:

=====================================
modules/demux/adaptive/http/HTTPConnection.cpp
=====================================
@@ -136,13 +136,13 @@ class adaptive::http::LibVLCHTTPSource : public adaptive::AbstractSource
             {
                 if(range.getEndByte() > 0)
                 {
-                    if (vlc_http_msg_add_header(req, "Range", "bytes=%" PRIuMAX "-%" PRIuMAX,
+                    if (vlc_http_msg_add_header(req, "Range", "bytes=%zu-%zu",
                                                 range.getStartByte(), range.getEndByte()))
                         return -1;
                 }
                 else
                 {
-                    if (vlc_http_msg_add_header(req, "Range", "bytes=%" PRIuMAX "-",
+                    if (vlc_http_msg_add_header(req, "Range", "bytes=%zu-",
                                                 range.getStartByte()))
                         return -1;
                 }


=====================================
modules/demux/adaptive/logic/Representationselectors.cpp
=====================================
@@ -109,8 +109,8 @@ BaseRepresentation * RepresentationSelector::select(const std::vector<BaseRepres
         }
     }
 
-    if (!candidate)
-        return candidate = lowest;
+    if (candidate == nullptr)
+        return lowest;
 
     return candidate;
 }


=====================================
modules/demux/adaptive/plumbing/SourceStream.cpp
=====================================
@@ -229,7 +229,6 @@ ssize_t BufferedChunksSourceStream::Read(uint8_t *buf, size_t i_toread)
         return i_read;
 
     i_bytestream_offset += i_read;
-    i_toread -= i_read;
 
     if(i_bytestream_offset > MAX_BACKEND)
     {


=====================================
modules/gui/qt/util/navigation_history.cpp
=====================================
@@ -156,8 +156,7 @@ void NavigationHistory::push(QVariantList itemList, NavigationHistory::PostActio
 
 void NavigationHistory::update(QVariantMap item)
 {
-    int length = m_history.length();
-    assert(length >= 1);
+    assert(m_history.size() >= 1);
     m_history.back() = item;
     updateViewPath();
 }


=====================================
modules/packetizer/flac.c
=====================================
@@ -363,6 +363,7 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
         /* fallthrough */
 
     case STATE_HEADER:
+    {
         /* Get FLAC frame header (MAX_FLAC_HEADER_SIZE bytes) */
         if (block_PeekBytes(&p_sys->bytestream, p_header, FLAC_HEADER_SIZE_MAX))
             return NULL; /* Need more data */
@@ -391,6 +392,7 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
          * The confusing part below is that sync code needs to be verified in case
          * it would appear in data, so we also need to check next frame header CRC
          */
+    }
         /* fallthrough */
 
     case STATE_NEXT_SYNC:


=====================================
modules/stream_filter/aribcam.c
=====================================
@@ -51,7 +51,7 @@ struct error_messages_s
     const char * const psz_error;
 };
 
-static const struct error_messages_s const b25_errors[] =
+static const struct error_messages_s b25_errors[] =
 {
     { ARIB_STD_B25_ERROR_INVALID_PARAM, "Invalid parameter" },
     { ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY , "Not enough memory" },
@@ -72,7 +72,7 @@ static const struct error_messages_s const b25_errors[] =
     { 0, NULL },
 };
 
-static const struct error_messages_s const bcas_errors[] =
+static const struct error_messages_s bcas_errors[] =
 {
     { B_CAS_CARD_ERROR_INVALID_PARAMETER, "Invalid parameter" },
     { B_CAS_CARD_ERROR_NOT_INITIALIZED, "Card not initialized" },
@@ -96,7 +96,7 @@ typedef struct
 } stream_sys_t;
 
 static const char * GetErrorMessage( const int i_error,
-                               const struct error_messages_s const *p_errors_messages )
+                               const struct error_messages_s *p_errors_messages )
 {
     int i = 0;
     while( p_errors_messages[i].psz_error )


=====================================
modules/video_output/opengl/interop_dxva2.c
=====================================
@@ -220,18 +220,17 @@ GLConvClose(vlc_object_t *obj)
 static void SetupProcessorInput(struct vlc_gl_interop *interop, const video_format_t *fmt, D3DFORMAT src_format)
 {
     struct glpriv *sys = interop->priv;
-    HRESULT hr;
     DXVAHD_STREAM_STATE_D3DFORMAT_DATA d3dformat = { src_format };
-    hr = IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_D3DFORMAT, sizeof(d3dformat), &d3dformat );
+    IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_D3DFORMAT, sizeof(d3dformat), &d3dformat );
 
     DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA frame_format = { DXVAHD_FRAME_FORMAT_PROGRESSIVE };
-    hr = IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_FRAME_FORMAT, sizeof(frame_format), &frame_format );
+    IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_FRAME_FORMAT, sizeof(frame_format), &frame_format );
 
     DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA colorspace = { 0 };
     colorspace.RGB_Range = fmt->color_range == COLOR_RANGE_FULL ? 0 : 1;
     colorspace.YCbCr_xvYCC = fmt->color_range == COLOR_RANGE_FULL ? 1 : 0;
     colorspace.YCbCr_Matrix = fmt->space == COLOR_SPACE_BT601 ? 0 : 1;
-    hr = IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE, sizeof(colorspace), &colorspace );
+    IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE, sizeof(colorspace), &colorspace );
 
     DXVAHD_STREAM_STATE_SOURCE_RECT_DATA srcRect;
     srcRect.Enable = TRUE;
@@ -241,7 +240,7 @@ static void SetupProcessorInput(struct vlc_gl_interop *interop, const video_form
         .top    = interop->fmt_in.i_y_offset,
         .bottom = interop->fmt_in.i_y_offset + interop->fmt_in.i_visible_height,
     };;
-    hr = IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_SOURCE_RECT, sizeof(srcRect), &srcRect );
+    IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_SOURCE_RECT, sizeof(srcRect), &srcRect );
 
     DXVAHD_BLT_STATE_TARGET_RECT_DATA dstRect;
     dstRect.Enable = TRUE;
@@ -251,7 +250,7 @@ static void SetupProcessorInput(struct vlc_gl_interop *interop, const video_form
         .top    = 0,
         .bottom = interop->fmt_in.i_visible_height,
     };
-    hr = IDXVAHD_VideoProcessor_SetVideoProcessBltState( sys->processor.proc, DXVAHD_BLT_STATE_TARGET_RECT, sizeof(dstRect), &dstRect);
+    IDXVAHD_VideoProcessor_SetVideoProcessBltState( sys->processor.proc, DXVAHD_BLT_STATE_TARGET_RECT, sizeof(dstRect), &dstRect);
 }
 
 static void GetFrameRate(DXVAHD_RATIONAL *r, const video_format_t *fmt)


=====================================
modules/video_output/win32/direct3d9.c
=====================================
@@ -1413,18 +1413,17 @@ static const d3d9_format_t *Direct3DFindFormat(vout_display_t *vd, const video_f
 static void SetupProcessorInput(vout_display_t *vd, const video_format_t *fmt, const d3d9_format_t *d3dfmt)
 {
     vout_display_sys_t *sys = vd->sys;
-    HRESULT hr;
     DXVAHD_STREAM_STATE_D3DFORMAT_DATA d3dformat = { d3dfmt->format };
-    hr = IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_D3DFORMAT, sizeof(d3dformat), &d3dformat );
+    IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_D3DFORMAT, sizeof(d3dformat), &d3dformat );
 
     DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA frame_format = { DXVAHD_FRAME_FORMAT_PROGRESSIVE };
-    hr = IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_FRAME_FORMAT, sizeof(frame_format), &frame_format );
+    IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_FRAME_FORMAT, sizeof(frame_format), &frame_format );
 
     DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA colorspace = { 0 };
     colorspace.RGB_Range = fmt->color_range == COLOR_RANGE_FULL ? 0 : 1;
     colorspace.YCbCr_xvYCC = fmt->color_range == COLOR_RANGE_FULL ? 1 : 0;
     colorspace.YCbCr_Matrix = fmt->space == COLOR_SPACE_BT601 ? 0 : 1;
-    hr = IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE, sizeof(colorspace), &colorspace );
+    IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE, sizeof(colorspace), &colorspace );
 
     DXVAHD_STREAM_STATE_SOURCE_RECT_DATA srcRect;
     srcRect.Enable = TRUE;
@@ -1434,7 +1433,7 @@ static void SetupProcessorInput(vout_display_t *vd, const video_format_t *fmt, c
         .top    = vd->source->i_y_offset,
         .bottom = vd->source->i_y_offset + vd->source->i_visible_height,
     };;
-    hr = IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_SOURCE_RECT, sizeof(srcRect), &srcRect );
+    IDXVAHD_VideoProcessor_SetVideoProcessStreamState( sys->processor.proc, 0, DXVAHD_STREAM_STATE_SOURCE_RECT, sizeof(srcRect), &srcRect );
 
     DXVAHD_BLT_STATE_TARGET_RECT_DATA dstRect;
     dstRect.Enable = TRUE;
@@ -1444,7 +1443,7 @@ static void SetupProcessorInput(vout_display_t *vd, const video_format_t *fmt, c
         .top    = 0,
         .bottom = vd->source->i_visible_height,
     };
-    hr = IDXVAHD_VideoProcessor_SetVideoProcessBltState( sys->processor.proc, DXVAHD_BLT_STATE_TARGET_RECT, sizeof(dstRect), &dstRect);
+    IDXVAHD_VideoProcessor_SetVideoProcessBltState( sys->processor.proc, DXVAHD_BLT_STATE_TARGET_RECT, sizeof(dstRect), &dstRect);
 }
 
 static void GetFrameRate(DXVAHD_RATIONAL *r, const video_format_t *fmt)


=====================================
test/modules/stream_out/transcode.c
=====================================
@@ -29,6 +29,8 @@
 #define MODULE_STRING "test_transcode_mock"
 #undef __PLUGIN__
 
+static const char dec_dev_arg[] = "--dec-dev=" MODULE_STRING;
+
 const char vlc_module_name[] = MODULE_STRING;
 
 #include "../../libvlc/test.h"
@@ -408,7 +410,7 @@ int main( int argc, char **argv )
 
     const char * const args[] = {
         "-vvv", "--vout=dummy", "--aout=dummy", "--text-renderer=dummy",
-        "--no-auto-preparse", "--dec-dev=" MODULE_STRING,
+        "--no-auto-preparse", dec_dev_arg
     };
 
     libvlc_instance_t *vlc = libvlc_new(ARRAY_SIZE(args), args);


=====================================
test/src/video_output/video_output.c
=====================================
@@ -29,6 +29,8 @@
 #define MODULE_STRING "test_vout_mock"
 #undef __PLUGIN__
 
+static const char dec_dev_arg[] = "--dec-dev=" MODULE_STRING;
+
 const char vlc_module_name[] = MODULE_STRING;
 
 #include "../../libvlc/test.h"
@@ -299,7 +301,7 @@ int main( int argc, char **argv )
 
     const char * const args[] = {
         "-vvv", "--vout=dummy", "--aout=dummy", "--text-renderer=dummy",
-        "--no-auto-preparse", "--dec-dev=" MODULE_STRING,
+        "--no-auto-preparse", dec_dev_arg,
         "--no-spu", "--no-osd",
     };
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e0a1248f81c46f9125f86833e61ebc9112317075...fbd9bf7ccd49582d66233a0ba0ac035c24d3b7fa

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e0a1248f81c46f9125f86833e61ebc9112317075...fbd9bf7ccd49582d66233a0ba0ac035c24d3b7fa
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