Commit 558f4d33 authored by Laurent Aimar's avatar Laurent Aimar

* mp4: fix playback of some stream with raw audio. I also split

big audio chunk. (Avoid 100000 samples at once :(
parent ef59c8fc
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mp4.c : MP4 file input module for vlc * mp4.c : MP4 file input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: mp4.c,v 1.26 2003/04/25 21:47:25 fenrir Exp $ * $Id: mp4.c,v 1.27 2003/04/30 21:45:52 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -1488,6 +1488,24 @@ static void MP4_TrackCreate( input_thread_t *p_input, ...@@ -1488,6 +1488,24 @@ static void MP4_TrackCreate( input_thread_t *p_input,
return; return;
} }
/* fxi i_timescale for AUDIO_ES with i_qt_version == 0 */
if( p_track->i_cat == AUDIO_ES ) //&& p_track->i_sample_size == 1 )
{
MP4_Box_t *p_sample;
p_sample = MP4_BoxGet( p_track->p_stsd, "[0]" );
if( p_sample )
{
MP4_Box_data_sample_soun_t *p_soun = p_sample->data.p_sample_soun;
if( p_soun->i_qt_version == 0 && p_track->i_timescale != p_soun->i_sampleratehi )
{
msg_Warn( p_input, "i_timescale != i_sampleratehi with qt_version == 0\nMaking both equal ? (report any problem)" );
p_track->i_timescale = p_soun->i_sampleratehi;
}
}
}
/* Create chunk index table */ /* Create chunk index table */
if( TrackCreateChunksIndex( p_input,p_track ) ) if( TrackCreateChunksIndex( p_input,p_track ) )
{ {
...@@ -1667,7 +1685,7 @@ static int MP4_TrackSeek ( input_thread_t *p_input, ...@@ -1667,7 +1685,7 @@ static int MP4_TrackSeek ( input_thread_t *p_input,
* 3 types: for audio * 3 types: for audio
* *
*/ */
#define QT_V0_MAX_SAMPLES 1500
static int MP4_TrackSampleSize( track_data_mp4_t *p_track ) static int MP4_TrackSampleSize( track_data_mp4_t *p_track )
{ {
int i_size; int i_size;
...@@ -1697,10 +1715,14 @@ static int MP4_TrackSampleSize( track_data_mp4_t *p_track ) ...@@ -1697,10 +1715,14 @@ static int MP4_TrackSampleSize( track_data_mp4_t *p_track )
} }
else else
{ {
//msg_Warn( p_input, "i_qt_version == 0" );
/* FIXME */ /* FIXME */
int i_samples = p_track->chunk[p_track->i_chunk].i_sample_count -
i_size = p_track->chunk[p_track->i_chunk].i_sample_count * p_soun->i_channelcount * p_soun->i_samplesize / 8; ( p_track->i_sample - p_track->chunk[p_track->i_chunk].i_sample_first );
if( i_samples > QT_V0_MAX_SAMPLES )
{
i_samples = QT_V0_MAX_SAMPLES;
}
i_size = i_samples * p_soun->i_channelcount * p_soun->i_samplesize / 8;
} }
//fprintf( stderr, "size=%d\n", i_size ); //fprintf( stderr, "size=%d\n", i_size );
...@@ -1718,13 +1740,18 @@ static uint64_t MP4_GetTrackPos( track_data_mp4_t *p_track ) ...@@ -1718,13 +1740,18 @@ static uint64_t MP4_GetTrackPos( track_data_mp4_t *p_track )
if( p_track->i_sample_size ) if( p_track->i_sample_size )
{ {
#if 0 MP4_Box_data_sample_soun_t *p_soun = p_track->p_sample->data.p_sample_soun;
i_pos += ( p_track->i_sample -
p_track->chunk[p_track->i_chunk].i_sample_first ) * if( p_soun->i_qt_version == 0 )
MP4_TrackSampleSize( p_track ); {
#endif i_pos += ( p_track->i_sample - p_track->chunk[p_track->i_chunk].i_sample_first ) *
/* we read chunk by chunk */ p_soun->i_channelcount * p_soun->i_samplesize / 8;
i_pos += 0; }
else
{
/* we read chunk by chunk */
i_pos += 0;
}
} }
else else
{ {
...@@ -1759,9 +1786,13 @@ static int MP4_TrackNextSample( input_thread_t *p_input, ...@@ -1759,9 +1786,13 @@ static int MP4_TrackNextSample( input_thread_t *p_input,
else else
{ {
/* FIXME */ /* FIXME */
p_track->i_sample = p_track->i_sample += QT_V0_MAX_SAMPLES;
p_track->chunk[p_track->i_chunk].i_sample_first + if( p_track->i_sample > p_track->chunk[p_track->i_chunk].i_sample_first + p_track->chunk[p_track->i_chunk].i_sample_count )
p_track->chunk[p_track->i_chunk].i_sample_count; {
p_track->i_sample =
p_track->chunk[p_track->i_chunk].i_sample_first +
p_track->chunk[p_track->i_chunk].i_sample_count;
}
} }
} }
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment