[vlc-commits] [Git][videolan/vlc][master] mux: asf: header: set correct number of sub objects

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Aug 11 07:11:30 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
0f51e327 by Sebastian Gross at 2024-08-11T06:58:12+00:00
mux: asf: header: set correct number of sub objects

The Microsoft ASF spec states

```
Number of Header Objects
Specifies the number of objects contained within the Header Object, not
including this one. In addition, the Header Extension Object (sections 3.4
and 4) is counted as exactly one object regardless of the number of
subobjects contained within it.
```

This means `i_cm_size` should not contribute to the number of sub objects.
As a result VLC generated ASF files could not be demuxed by gstreamer's
`asfdemux`.

Fix the number and while at it give some semantic meaning to the magic
numbers in the code regarding the header sub object.

Though technically we write an unsigned value use int to stay consistent
with the other size values

Closes #28714

Signed-off-by: Sebastian Gross <sgross at emlix.com>

- - - - -


1 changed file:

- modules/mux/asf.c


Changes:

=====================================
modules/mux/asf.c
=====================================
@@ -840,6 +840,7 @@ static block_t *asf_header_create( sout_mux_t *p_mux, bool b_broadcast )
     vlc_tick_t i_duration = 0;
     int i_size, i_header_ext_size;
     int i_ci_size, i_cm_size = 0, i_cd_size = 0;
+    int i_subo_count = 0; /* header sub object count */
     block_t *out;
     bo_t bo;
 
@@ -912,11 +913,17 @@ static block_t *asf_header_create( sout_mux_t *p_mux, bool b_broadcast )
         bo_init( &bo, out->p_buffer, i_size + 50 );
     }
 
+    /* calculate header sub object count */
+    i_subo_count += 1; /* file properties */
+    i_subo_count += 1; /* header extension */
+    i_subo_count += vlc_array_count( &p_sys->tracks ); /* stream info */
+    i_subo_count += 1; /* codec info */
+    i_subo_count += (i_cd_size ? 1 : 0); /* content description if any */
+
     /* header object */
     bo_add_guid ( &bo, &asf_object_header_guid );
     bo_addle_u64( &bo, i_size );
-    bo_addle_u32( &bo, 2 + vlc_array_count( &p_sys->tracks ) + 1 +
-                  (i_cd_size ? 1 : 0) + (i_cm_size ? 1 : 0) );
+    bo_addle_u32( &bo, i_subo_count );
     bo_add_u8   ( &bo, 1 );
     bo_add_u8   ( &bo, 2 );
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/0f51e3277ef7820555ba11b4406db7f8574cc709

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/0f51e3277ef7820555ba11b4406db7f8574cc709
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