[vlc-commits] [Git][videolan/vlc][3.0.x] 4 commits: demux: mkv: add missing helpers from libebml 2.0

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Nov 15 10:00:23 UTC 2024



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
966518b2 by Steve Lhomme at 2024-11-15T08:53:19+00:00
demux: mkv: add missing helpers from libebml 2.0

The const versions are more versatile.

(cherry picked from commit 42945dadb88c72bd6b34a3468f4ac125d81198f1)

- - - - -
feba5f92 by Steve Lhomme at 2024-11-15T08:53:19+00:00
demux: mkv: read data from KaxBlockAdditions as const

We should not be able to modify what we read.

(cherry picked from commit c03249a02c2d1aa529c7c9a6de7545305b567860) (edited)
edited:
- 3.0 doesn't support VPx alpha

- - - - -
ae85a589 by Steve Lhomme at 2024-11-15T08:53:19+00:00
demux: mkv: don't expose local BlockDecode function

(cherry picked from commit e3adf1736cf32bba3db208cc5d0d18b23a7c17a5) (rebased)
rebased:
- the code around is different

- - - - -
9999ce93 by Steve Lhomme at 2024-11-15T08:53:19+00:00
demux: mkv: fix potential leak of KaxBlockAdditions when seeking

(cherry picked from commit f7c0d24733350e4c43a2dcb84e3106d9e2be9e7b)

- - - - -


3 changed files:

- modules/demux/mkv/matroska_segment_seeker.cpp
- modules/demux/mkv/mkv.cpp
- modules/demux/mkv/mkv.hpp


Changes:

=====================================
modules/demux/mkv/matroska_segment_seeker.cpp
=====================================
@@ -366,7 +366,11 @@ SegmentSeeker::index_unsearched_range( matroska_segment_c& ms, Range search_area
 
         if( ms.BlockGet( block, simpleblock, additions,
                          &b_key_picture, &b_discardable_picture, &i_block_duration ) )
+        {
+            delete additions;
             break;
+        }
+        delete additions;
 
         if( simpleblock ) {
             block_pos = simpleblock->GetElementPosition();


=====================================
modules/demux/mkv/mkv.cpp
=====================================
@@ -487,8 +487,8 @@ static int Seek( demux_t *p_demux, vlc_tick_t i_mk_date, double f_percent, virtu
 }
 
 /* Needed by matroska_segment::Seek() and Seek */
-void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock,
-                  KaxBlockAdditions *additions,
+static void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock,
+                  const KaxBlockAdditions *additions,
                   vlc_tick_t i_pts, int64_t i_duration, bool b_key_picture,
                   bool b_discardable_picture )
 {
@@ -613,10 +613,10 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
                 size_t i_addition = 0;
                 if(additions)
                 {
-                    KaxBlockMore *blockmore = FindChild<KaxBlockMore>(*additions);
+                    auto blockmore = FindChild<const KaxBlockMore>(*additions);
                     if(blockmore)
                     {
-                        KaxBlockAdditional *addition = FindChild<KaxBlockAdditional>(*blockmore);
+                        auto addition = FindChild<const KaxBlockAdditional>(*blockmore);
                         if(addition)
                         {
                             i_addition = static_cast<std::string::size_type>(addition->GetSize());


=====================================
modules/demux/mkv/mkv.hpp
=====================================
@@ -117,13 +117,21 @@ enum
 #define MKV_CHECKED_PTR_DECL( name, type, src ) type * name = MKV_IS_ID(src, type) ? static_cast<type*>(src) : NULL
 #define MKV_CHECKED_PTR_DECL_CONST( name, type, src ) const type * name = MKV_IS_ID(src, type) ? static_cast<const type*>(src) : NULL
 
+#if LIBEBML_VERSION < 0x020000
+template <typename Type>
+Type * FindChild(const EbmlMaster & Master)
+{
+  return static_cast<Type *>(Master.FindFirstElt(EBML_INFO(Type)));
+}
 
-using namespace LIBMATROSKA_NAMESPACE;
+template <typename Type>
+Type * FindNextChild(const EbmlMaster & Master, const Type & PastElt)
+{
+  return static_cast<Type *>(Master.FindNextElt(PastElt));
+}
+#endif
 
-void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock,
-                  KaxBlockAdditions *additions,
-                  vlc_tick_t i_pts, vlc_tick_t i_duration, bool b_key_picture,
-                  bool b_discardable_picture );
+using namespace LIBMATROSKA_NAMESPACE;
 
 class attachment_c
 {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/77a2c01e2dcb3474173904ce9fa761907cb10550...9999ce93eba814d9d92334322f64335693ccb78e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/77a2c01e2dcb3474173904ce9fa761907cb10550...9999ce93eba814d9d92334322f64335693ccb78e
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