*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
psz_foo2[ 4 * i_level ] = '+';
psz_foo2[ 4 * i_level + 1 ] = ' ';
strcpy( &psz_foo2[ 4 * i_level + 2 ], psz_format );
- __msg_GenericVa( VLC_OBJECT(&demuxer), VLC_MSG_DBG, "mkv", psz_foo2, args );
+ __msg_GenericVa( VLC_OBJECT(&demuxer), MSG_QUEUE_NORMAL, VLC_MSG_DBG, "mkv", psz_foo2, args );
free( psz_foo2 );
va_end( args );
}
float f_fps;
es_out_id_t *p_es;
+ /* audio */
+ unsigned int i_original_rate;
+
vlc_bool_t b_inited;
/* data to be send first */
int i_data_init;
{
delete tracks[i_track]->p_compression_data;
}
- if( tracks[i_track]->fmt.psz_description )
- {
- free( tracks[i_track]->fmt.psz_description );
- }
+ es_format_Clean( &tracks[i_track]->fmt );
+ if( tracks[i_track]->p_extra_data )
+ free( tracks[i_track]->p_extra_data );
if( tracks[i_track]->psz_codec )
- {
free( tracks[i_track]->psz_codec );
- }
- if( tracks[i_track]->fmt.psz_language )
- {
- free( tracks[i_track]->fmt.psz_language );
- }
delete tracks[i_track];
}
-
+
if( psz_writing_application )
{
free( psz_writing_application );
delete opened_segments[i];
for ( i=0; i<used_segments.size(); i++ )
delete used_segments[i];
+ if( meta ) vlc_meta_Delete( meta );
+
+ while( titles.size() )
+ { vlc_input_title_Delete( titles.back() ); titles.pop_back();}
+
vlc_mutex_destroy( &lock_demuxer );
}
else if( !strncmp( tracks[i_track]->psz_codec, "A_AAC/MPEG2/", strlen( "A_AAC/MPEG2/" ) ) ||
!strncmp( tracks[i_track]->psz_codec, "A_AAC/MPEG4/", strlen( "A_AAC/MPEG4/" ) ) )
{
- int i_profile, i_srate;
+ int i_profile, i_srate, sbr = 0;
static unsigned int i_sample_rates[] =
{
96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050,
{
i_profile = 2;
}
+ else if( !strcmp( &tracks[i_track]->psz_codec[12], "LC/SBR" ) )
+ {
+ i_profile = 1;
+ sbr = 1;
+ }
else
{
i_profile = 3;
for( i_srate = 0; i_srate < 13; i_srate++ )
{
- if( i_sample_rates[i_srate] == tracks[i_track]->fmt.audio.i_rate )
+ if( i_sample_rates[i_srate] == tracks[i_track]->i_original_rate )
{
break;
}
}
msg_Dbg( &sys.demuxer, "profile=%d srate=%d", i_profile, i_srate );
- tracks[i_track]->fmt.i_extra = 2;
+ tracks[i_track]->fmt.i_extra = sbr ? 5 : 2;
tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->fmt.i_extra );
((uint8_t*)tracks[i_track]->fmt.p_extra)[0] = ((i_profile + 1) << 3) | ((i_srate&0xe) >> 1);
((uint8_t*)tracks[i_track]->fmt.p_extra)[1] = ((i_srate & 0x1) << 7) | (tracks[i_track]->fmt.audio.i_channels << 3);
+ if (sbr != 0)
+ {
+ int syncExtensionType = 0x2B7;
+ int iDSRI;
+ for (iDSRI=0; iDSRI<13; iDSRI++)
+ if( i_sample_rates[iDSRI] == tracks[i_track]->fmt.audio.i_rate )
+ break;
+ ((uint8_t*)tracks[i_track]->fmt.p_extra)[2] = (syncExtensionType >> 3) & 0xFF;
+ ((uint8_t*)tracks[i_track]->fmt.p_extra)[3] = ((syncExtensionType & 0x7) << 5) | 5;
+ ((uint8_t*)tracks[i_track]->fmt.p_extra)[4] = ((1 & 0x1) << 7) | (iDSRI << 3);
+ }
}
else if( !strcmp( tracks[i_track]->psz_codec, "A_AAC" ) )
{
tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'm', 'p', '4', 'a' );
tracks[i_track]->fmt.i_extra = tracks[i_track]->i_extra_data;
tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->i_extra_data );
+ memcpy( tracks[i_track]->fmt.p_extra, tracks[i_track]->p_extra_data, tracks[i_track]->i_extra_data );
}
else if( !strcmp( tracks[i_track]->psz_codec, "A_PCM/INT/BIG" ) ||
!strcmp( tracks[i_track]->psz_codec, "A_PCM/INT/LIT" ) ||
{
tracks[i_track]->fmt.i_codec = VLC_FOURCC( 's', 's', 'a', ' ' );
tracks[i_track]->fmt.subs.psz_encoding = strdup( "UTF-8" );
+ if( tracks[i_track]->i_extra_data )
+ {
+ tracks[i_track]->fmt.i_extra = tracks[i_track]->i_extra_data;
+ tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->i_extra_data );
+ memcpy( tracks[i_track]->fmt.p_extra, tracks[i_track]->p_extra_data, tracks[i_track]->i_extra_data );
+ }
}
else if( !strcmp( tracks[i_track]->psz_codec, "S_VOBSUB" ) )
{
{
KaxAudioSamplingFreq &afreq = *(KaxAudioSamplingFreq*)l;
- tk->fmt.audio.i_rate = (int)float( afreq );
+ tk->i_original_rate = tk->fmt.audio.i_rate = (int)float( afreq );
msg_Dbg( &sys.demuxer, "| | | | + afreq=%d", tk->fmt.audio.i_rate );
}
+ else if( MKV_IS_ID( l, KaxAudioOutputSamplingFreq ) )
+ {
+ KaxAudioOutputSamplingFreq &afreq = *(KaxAudioOutputSamplingFreq*)l;
+
+ tk->fmt.audio.i_rate = (int)float( afreq );
+ msg_Dbg( &sys.demuxer, "| | | | + aoutfreq=%d", tk->fmt.audio.i_rate );
+ }
else if( MKV_IS_ID( l, KaxAudioChannels ) )
{
KaxAudioChannels &achan = *(KaxAudioChannels*)l;
// create a name if there is none
if ( p_title->psz_name == NULL )
{
- sz_name = N_("Segment ");
+ sz_name = N_("Segment");
char psz_str[6];
- sprintf( psz_str, "%d", (int)i );
+ sprintf( psz_str, " %d", (int)i );
sz_name += psz_str;
p_title->psz_name = strdup( sz_name.c_str() );
}