[vlc-commits] demux: mp4: really fix Qt v=0 sample_size=1
Francois Cartegnie
git at videolan.org
Mon Apr 13 18:13:56 CEST 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Apr 13 17:55:39 2015 +0200| [2c2fc407b4beacfba423783dc611fd6a15f80193] | committer: Francois Cartegnie
demux: mp4: really fix Qt v=0 sample_size=1
also reverts dad98149cbe5b600429d0e59217ad328b9ee6efa
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2c2fc407b4beacfba423783dc611fd6a15f80193
---
modules/demux/mp4/mp4.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 2044e65..642c3ab 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -3006,7 +3006,24 @@ static int MP4_TrackSeek( demux_t *p_demux, mp4_track_t *p_track,
* 3 types: for audio
*
*/
-#define QT_V0_MAX_SAMPLES 2048
+static inline uint32_t MP4_GetFixedSampleSize( const mp4_track_t *p_track,
+ const MP4_Box_data_sample_soun_t *p_soun )
+{
+ uint32_t i_size = 0;
+
+ assert( p_track->i_sample_size != 0 );
+
+ /* broken stsz sample size == 1 */
+ if ( p_track->fmt.i_cat == AUDIO_ES &&
+ p_track->i_sample_size == 1 && p_soun->i_samplesize > p_track->i_sample_size * 8 )
+ i_size = p_soun->i_samplesize * p_soun->i_channelcount / 8;
+ else
+ i_size = p_track->i_sample_size;
+
+ return i_size;
+}
+
+#define QT_V0_MAX_SAMPLES 1024
static uint32_t MP4_TrackGetReadSize( mp4_track_t *p_track, uint32_t *pi_nb_samples )
{
uint32_t i_size = 0;
@@ -3097,11 +3114,8 @@ static uint32_t MP4_TrackGetReadSize( mp4_track_t *p_track, uint32_t *pi_nb_samp
(*pi_nb_samples)++;
if ( p_track->i_sample_size == 0 )
i_size += p_track->p_sample_size[i];
- /* broken stsz sample size == 1 */
- else if ( p_track->i_sample_size == 1 && p_soun->i_samplesize > p_track->i_sample_size * 8 )
- i_size += p_soun->i_samplesize * p_soun->i_channelcount / 8;
else
- i_size += p_track->i_sample_size;
+ i_size += MP4_GetFixedSampleSize( p_track, p_soun );
/* Try to detect compression in ISO */
if(p_soun->i_compressionid != 0)
@@ -3137,7 +3151,7 @@ static uint64_t MP4_TrackGetPos( mp4_track_t *p_track )
{
i_pos += ( p_track->i_sample -
p_track->chunk[p_track->i_chunk].i_sample_first ) *
- p_track->i_sample_size;
+ MP4_GetFixedSampleSize( p_track, p_soun );
}
else
{
More information about the vlc-commits
mailing list