[vlc-commits] [Git][videolan/vlc][master] 2 commits: test: decoder: use an owner for the packetizer

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Fri Sep 13 10:01:21 UTC 2024



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
5f57257e by Thomas Guillem at 2024-09-13T09:49:49+00:00
test: decoder: use an owner for the packetizer

To access the fmt_in private member.

Regression from 08b24866dc443c30df8f9d5ee4f7e2045bf62956

Fixes #28770

- - - - -
0285de2a by Thomas Guillem at 2024-09-13T09:49:49+00:00
test: decoder: refactor decoder creation

- - - - -


1 changed file:

- test/src/input/decoder.c


Changes:

=====================================
test/src/input/decoder.c
=====================================
@@ -87,6 +87,14 @@ static void queue_sub(decoder_t *dec, subpicture_t *p_subpic)
     subpicture_Delete(p_subpic);
 }
 
+static decoder_t *decoder_create(vlc_object_t *parent)
+{
+    struct decoder_owner *owner = vlc_object_create(parent, sizeof(*owner));
+    if (unlikely(owner == NULL))
+        return NULL;
+    return &owner->dec;
+}
+
 static int decoder_load(decoder_t *decoder, bool is_packetizer,
                          const es_format_t *restrict fmt)
 {
@@ -130,19 +138,17 @@ void test_decoder_destroy(decoder_t *decoder)
 decoder_t *test_decoder_create(vlc_object_t *parent, const es_format_t *fmt)
 {
     assert(parent && fmt);
-    decoder_t *packetizer = NULL;
-    decoder_t *decoder = NULL;
+    decoder_t *packetizer = decoder_create(parent);
+    decoder_t *decoder = decoder_create(parent);
 
-    packetizer = vlc_object_create(parent, sizeof(*packetizer));
-    struct decoder_owner *owner = vlc_object_create(parent, sizeof(*owner));
-
-    if (packetizer == NULL || owner == NULL)
+    if (packetizer == NULL || decoder == NULL)
     {
         if (packetizer)
             vlc_object_delete(packetizer);
         return NULL;
     }
-    decoder = &owner->dec;
+
+    struct decoder_owner *owner = dec_get_owner(decoder);
     owner->packetizer = packetizer;
 
     static const struct decoder_owner_callbacks dec_video_cbs =



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0c0817fa7bb8d0ac6da51be4daa4f614be209135...0285de2a9ff669a30189d9c16dc8b951cbea4f38

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0c0817fa7bb8d0ac6da51be4daa4f614be209135...0285de2a9ff669a30189d9c16dc8b951cbea4f38
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