[vlc-commits] mux: mp4: compress stsz entries
Francois Cartegnie
git at videolan.org
Mon Jun 2 21:35:08 CEST 2014
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Jun 2 21:26:22 2014 +0200| [dbbb8dd1f53db78f8c8563712bb352ea750ed75e] | committer: Francois Cartegnie
mux: mp4: compress stsz entries
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dbbb8dd1f53db78f8c8563712bb352ea750ed75e
---
modules/mux/mp4.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/modules/mux/mp4.c b/modules/mux/mp4.c
index 8deb715..207f71c 100644
--- a/modules/mux/mp4.c
+++ b/modules/mux/mp4.c
@@ -1411,10 +1411,24 @@ static bo_t *GetStblBox(sout_mux_t *p_mux, mp4_stream_t *p_stream)
/* FIXME add ctts ?? FIXME */
bo_t *stsz = box_full_new("stsz", 0, 0);
- bo_add_32be(stsz, 0); // sample-size
- bo_add_32be(stsz, p_stream->i_entry_count); // sample-count
+ int i_size = 0;
for (unsigned i = 0; i < p_stream->i_entry_count; i++)
- bo_add_32be(stsz, p_stream->entry[i].i_size); // sample-size
+ {
+ if ( i == 0 )
+ i_size = p_stream->entry[i].i_size;
+ else if ( p_stream->entry[i].i_size != i_size )
+ {
+ i_size = 0;
+ break;
+ }
+ }
+ bo_add_32be(stsz, i_size); // sample-size
+ bo_add_32be(stsz, p_stream->i_entry_count); // sample-count
+ if ( i_size == 0 ) // all samples have different size
+ {
+ for (unsigned i = 0; i < p_stream->i_entry_count; i++)
+ bo_add_32be(stsz, p_stream->entry[i].i_size); // sample-size
+ }
/* create stss table */
bo_t *stss = NULL;
More information about the vlc-commits
mailing list