Commit 7518bb92 authored by Laurent Aimar's avatar Laurent Aimar

* ffmpeg/audio : removed an old error (anyway it was harmless).

 * mp4 : removed a bad initialisation. Erased all ending spaces.
 * mpeg/audio : send i_rate to decoder (not yet usefull but ...)
parent 0b8b405c
......@@ -2,7 +2,7 @@
* audio.c: audio decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: audio.c,v 1.13 2003/01/25 16:59:49 fenrir Exp $
* $Id: audio.c,v 1.14 2003/02/07 01:22:55 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -71,29 +71,6 @@ static unsigned int pi_channels_maps[6] =
/*****************************************************************************
* locales Functions
*****************************************************************************/
#if 0
static void ffmpeg_GetWaveFormatEx( waveformatex_t *p_wh,
u8 *p_data )
{
WAVEFORMATEX *p_wfdata = (WAVEFORMATEX*)p_data;
p_wh->i_formattag = p_wfdata->wFormatTag;
p_wh->i_nb_channels = p_wfdata->nChannels;
p_wh->i_samplespersec = p_wfdata->nSamplesPerSec;
p_wh->i_avgbytespersec= p_wfdata->nAvgBytesPerSec;
p_wh->i_blockalign = p_wfdata->nBlockAlign;
p_wh->i_bitspersample = p_wfdata->wBitsPerSample;
p_wh->i_size = p_wfdata->cbSize;
if( p_wh->i_size )
{
p_wh->p_data = malloc( p_wh->i_size );
memcpy( p_wh->p_data,
p_data + sizeof(WAVEFORMATEX) ,
p_wh->i_size );
}
}
#endif
/*****************************************************************************
*
......@@ -158,14 +135,14 @@ int E_( InitThread_Audio )( adec_thread_t *p_adec )
p_adec->psz_namecodec );
}
p_adec->p_output = malloc( AVCODEC_MAX_AUDIO_FRAME_SIZE );
p_adec->p_output = malloc( 3 * AVCODEC_MAX_AUDIO_FRAME_SIZE );
p_adec->output_format.i_format = AOUT_FMT_S16_NE;
p_adec->output_format.i_rate = p_wf->nSamplesPerSec;
p_adec->output_format.i_physical_channels
= p_adec->output_format.i_original_channels
= p_wf->nChannels;
= pi_channels_maps[p_wf->nChannels];
p_adec->p_aout = NULL;
p_adec->p_aout_input = NULL;
......
......@@ -2,7 +2,7 @@
* audio.h: video decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: audio.h,v 1.3 2003/01/25 16:59:49 fenrir Exp $
* $Id: audio.h,v 1.4 2003/02/07 01:22:55 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -22,20 +22,6 @@
*****************************************************************************/
/* for an audio stream */
typedef struct waveformatex_s
{
u16 i_formattag;
u16 i_nb_channels;
u32 i_samplespersec;
u32 i_avgbytespersec;
u16 i_blockalign;
u16 i_bitspersample;
u16 i_size; /* the extra size in bytes */
u8 *p_data; /* The extra data */
} waveformatex_t;
typedef struct adec_thread_s
{
DECODER_THREAD_COMMON
......
......@@ -2,7 +2,7 @@
* libmp4.c : LibMP4 library for mp4 module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: libmp4.c,v 1.13 2003/01/25 16:58:34 fenrir Exp $
* $Id: libmp4.c,v 1.14 2003/02/07 01:22:55 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -470,9 +470,8 @@ int MP4_ReadBoxCommon( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
/* FIXME how to write uint64_t ??? */
if( p_box->i_size )
{
msg_Dbg( p_stream->p_input, "Found Box: %c%c%c%c size %d",
(p_box->i_type)&0xff, (p_box->i_type>>8)&0xff,
(p_box->i_type>>16)&0xff, (p_box->i_type>>24)&0xff,
msg_Dbg( p_stream->p_input, "Found Box: %4.4s size %d",
(char*)&p_box->i_type,
(uint32_t)p_box->i_size );
}
#endif
......@@ -594,11 +593,8 @@ int MP4_ReadBoxSkip( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
/* Nothing to do */
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input, "Skip box: \"%c%c%c%c\"",
(p_box->i_type)&0xff,
(p_box->i_type>>8)&0xff,
(p_box->i_type>>16)&0xff,
(p_box->i_type>>24)&0xff );
msg_Dbg( p_stream->p_input, "Skip box: \"%4.4s\"",
(char*)&p_box->i_type );
#endif
return( 1 );
}
......@@ -861,11 +857,8 @@ int MP4_ReadBox_hdlr( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
memcpy( p_box->data.p_hdlr->psz_name, p_peek, i_read );
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input, "Read Box: \"hdlr\" hanler type %c%c%c%c name %s",
( p_box->data.p_hdlr->i_handler_type )&0xff,
( p_box->data.p_hdlr->i_handler_type >> 8 )&0xff,
( p_box->data.p_hdlr->i_handler_type >> 16 )&0xff,
( p_box->data.p_hdlr->i_handler_type >> 24 )&0xff,
msg_Dbg( p_stream->p_input, "Read Box: \"hdlr\" hanler type %4.4s name %s",
(char*)&p_box->data.p_hdlr->i_handler_type,
p_box->data.p_hdlr->psz_name );
#endif
......@@ -897,7 +890,6 @@ int MP4_ReadBox_vmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
p_box->data.p_vmhd->i_opcolor[0],
p_box->data.p_vmhd->i_opcolor[1],
p_box->data.p_vmhd->i_opcolor[2] );
#endif
MP4_READBOX_EXIT( 1 );
}
......@@ -917,7 +909,6 @@ int MP4_ReadBox_smhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input, "Read Box: \"smhd\" balance %f",
(float)p_box->data.p_smhd->i_balance / 256 );
#endif
MP4_READBOX_EXIT( 1 );
}
......@@ -943,7 +934,6 @@ int MP4_ReadBox_hmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
p_box->data.p_hmhd->i_avg_PDU_size,
p_box->data.p_hmhd->i_max_bitrate,
p_box->data.p_hmhd->i_avg_bitrate );
#endif
MP4_READBOX_EXIT( 1 );
}
......@@ -1031,7 +1021,6 @@ int MP4_ReadBox_stts( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET4BYTES( p_box->data.p_stts->i_sample_delta[i] );
}
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input, "Read Box: \"stts\" entry-count %d",
p_box->data.p_stts->i_entry_count );
......@@ -1044,7 +1033,6 @@ void MP4_FreeBox_stts( input_thread_t *p_input, MP4_Box_t *p_box )
{
FREE( p_box->data.p_stts->i_sample_count );
FREE( p_box->data.p_stts->i_sample_delta );
}
int MP4_ReadBox_ctts( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
......@@ -1067,7 +1055,6 @@ int MP4_ReadBox_ctts( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET4BYTES( p_box->data.p_ctts->i_sample_offset[i] );
}
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input, "Read Box: \"ctts\" entry-count %d",
p_box->data.p_ctts->i_entry_count );
......@@ -1365,7 +1352,6 @@ int MP4_ReadBox_stsz( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
}
}
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input, "Read Box: \"stsz\" sample-size %d sample-count %d",
p_box->data.p_stsz->i_sample_size,
......@@ -1404,7 +1390,6 @@ int MP4_ReadBox_stsc( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET4BYTES( p_box->data.p_stsc->i_sample_description_index[i] );
}
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input, "Read Box: \"stsc\" entry-count %d",
p_box->data.p_stsc->i_entry_count );
......@@ -1453,7 +1438,6 @@ int MP4_ReadBox_stco_co64( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
}
}
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input, "Read Box: \"co64\" entry-count %d",
p_box->data.p_co64->i_entry_count );
......@@ -1488,7 +1472,6 @@ int MP4_ReadBox_stss( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
p_box->data.p_stss->i_sample_number[i]--;
}
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input, "Read Box: \"stss\" entry-count %d",
p_box->data.p_stss->i_entry_count );
......@@ -1527,7 +1510,6 @@ int MP4_ReadBox_stsh( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET4BYTES( p_box->data.p_stsh->i_sync_sample_number[i] );
}
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input, "Read Box: \"stsh\" entry-count %d",
p_box->data.p_stsh->i_entry_count );
......@@ -1559,7 +1541,6 @@ int MP4_ReadBox_stdp( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET2BYTES( p_box->data.p_stdp->i_priority[i] );
}
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input, "Read Box: \"stdp\" entry-count "I64Fd,
i_read / 2 );
......@@ -1604,7 +1585,6 @@ int MP4_ReadBox_padb( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
p_peek += 1; i_read -= 1;
}
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input, "Read Box: \"stdp\" entry-count "I64Fd,
i_read / 2 );
......@@ -1663,7 +1643,6 @@ int MP4_ReadBox_elst( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
MP4_GET2BYTES( p_box->data.p_elst->i_media_rate_fraction[i] );
}
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input, "Read Box: \"elst\" entry-count "I64Fd,
i_read / 2 );
......@@ -1722,13 +1701,9 @@ int MP4_ReadBox_dcom( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
MP4_GETFOURCC( p_box->data.p_dcom->i_algorithm );
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input,
"Read Box: \"dcom\" compression algorithm : %c%c%c%c",
( p_box->data.p_dcom->i_algorithm )&0xff,
( p_box->data.p_dcom->i_algorithm >> 8 )&0xff,
( p_box->data.p_dcom->i_algorithm >> 16 )&0xff,
( p_box->data.p_dcom->i_algorithm >> 24 )&0xff );
"Read Box: \"dcom\" compression algorithm : %4.4s",
(char*)&p_box->data.p_dcom->i_algorithm );
#endif
MP4_READBOX_EXIT( 1 );
}
......@@ -1736,7 +1711,6 @@ int MP4_ReadBox_cmvd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_cmvd_t );
MP4_GET4BYTES( p_box->data.p_cmvd->i_uncompressed_size );
p_box->data.p_cmvd->i_compressed_size = i_read;
......@@ -1810,11 +1784,8 @@ int MP4_ReadBox_cmov( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
if( p_dcom->data.p_dcom->i_algorithm != FOURCC_zlib )
{
msg_Dbg( p_stream->p_input, "Read Box: \"cmov\" compression algorithm : %c%c%c%c not supported",
( p_dcom->data.p_dcom->i_algorithm )&0xff,
( p_dcom->data.p_dcom->i_algorithm >> 8 )&0xff,
( p_dcom->data.p_dcom->i_algorithm >> 16 )&0xff,
( p_dcom->data.p_dcom->i_algorithm >> 24 )&0xff );
msg_Dbg( p_stream->p_input, "Read Box: \"cmov\" compression algorithm : %4.4s not supported",
(char*)&p_dcom->data.p_dcom->i_algorithm );
return( 1 );
}
......@@ -1928,9 +1899,8 @@ int MP4_ReadBox_rdrf( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input,
"Read Box: \"rdrf\" type:%c%c%c%c ref %s",
p_box->data.p_rdrf->i_ref_type&0xff, (p_box->data.p_rdrf->i_ref_type>>8)&0xff,
(p_box->data.p_rdrf->i_ref_type>>16)&0xff, (p_box->data.p_rdrf->i_ref_type>>24)&0xff,
"Read Box: \"rdrf\" type:%4.4s ref %s",
(char*)&p_box->data.p_rdrf->i_ref_type,
p_box->data.p_rdrf->psz_ref );
#endif
......@@ -1984,9 +1954,8 @@ int MP4_ReadBox_rmvc( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
#ifdef MP4_VERBOSE
msg_Dbg( p_stream->p_input,
"Read Box: \"rmvc\" gestaltType:%c%c%c%c val1:0x%x val2:0x%x checkType:0x%x",
p_box->data.p_rmvc->i_gestaltType&0xff, (p_box->data.p_rmvc->i_gestaltType>>8)&0xff,
(p_box->data.p_rmvc->i_gestaltType>>16)&0xff,(p_box->data.p_rmvc->i_gestaltType>>24)&0xff,
"Read Box: \"rmvc\" gestaltType:%4.4s val1:0x%x val2:0x%x checkType:0x%x",
(char*)&p_box->data.p_rmvc->i_gestaltType,
p_box->data.p_rmvc->i_val1,p_box->data.p_rmvc->i_val2,
p_box->data.p_rmvc->i_checkType );
#endif
......@@ -2136,11 +2105,8 @@ int MP4_ReadBox( MP4_Stream_t *p_stream, MP4_Box_t *p_box, MP4_Box_t *p_father )
if( MP4_Box_Function[i_index].MP4_ReadBox_function == NULL )
{
msg_Warn( p_stream->p_input,
"Unknown box type %c%c%c%c (uncompletetly loaded)",
(p_box->i_type)&0xff,
(p_box->i_type>>8)&0xff,
(p_box->i_type>>16)&0xff,
(p_box->i_type>>24)&0xff );
"Unknown box type %4.4s (uncompletetly loaded)",
(char*)&p_box->i_type );
return( 1 );
}
else
......@@ -2302,11 +2268,8 @@ void MP4_BoxFree( input_thread_t *p_input, MP4_Box_t *p_box )
{
/* Should not happen */
msg_Warn( p_input,
"cannot free box %c%c%c%c, type unknown",
(p_box->i_type)&0xff,
(p_box->i_type >> 8)&0xff,
(p_box->i_type >> 16)&0xff,
(p_box->i_type >> 24)&0xff );
"cannot free box %4.4s, type unknown",
(char*)&p_box->i_type );
}
else
{
......@@ -2330,7 +2293,6 @@ void MP4_BoxFree( input_thread_t *p_input, MP4_Box_t *p_box )
*****************************************************************************/
int MP4_BoxGetRoot( input_thread_t *p_input, MP4_Box_t *p_root )
{
MP4_Stream_t *p_stream;
int i_result;
......@@ -2390,11 +2352,8 @@ static void __MP4_BoxDumpStructure( input_thread_t *p_input,
if( !i_level )
{
msg_Dbg( p_input, "Dumping root Box \"%c%c%c%c \"",
(p_box->i_type ) &0xff,
(p_box->i_type >>8 ) &0xff,
(p_box->i_type >>16 ) &0xff,
(p_box->i_type >>24) &0xff );
msg_Dbg( p_input, "Dumping root Box \"%4.4s\"",
(char*)&p_box->i_type );
}
else
{
......@@ -2405,11 +2364,8 @@ static void __MP4_BoxDumpStructure( input_thread_t *p_input,
{
str[i*5] = '|';
}
sprintf( str + i_level * 5, "+ %c%c%c%c size %d",
(p_box->i_type ) &0xff,
(p_box->i_type>>8 ) &0xff,
(p_box->i_type>>16 ) &0xff,
(p_box->i_type>>24 ) &0xff,
sprintf( str + i_level * 5, "+ %4.4s size %d",
(char*)&p_box->i_type,
(uint32_t)p_box->i_size );
msg_Dbg( p_input, "%s", str );
......@@ -2420,7 +2376,6 @@ static void __MP4_BoxDumpStructure( input_thread_t *p_input,
__MP4_BoxDumpStructure( p_input, p_child, i_level + 1 );
p_child = p_child->p_next;
}
}
void MP4_BoxDumpStructure( input_thread_t *p_input, MP4_Box_t *p_box )
......@@ -2495,7 +2450,6 @@ static void __MP4_BoxGet( MP4_Box_t **pp_result,
size_t i_size;
#endif
if( !p_box )
{
*pp_result = NULL;
......@@ -2627,7 +2581,6 @@ static void __MP4_BoxGet( MP4_Box_t **pp_result,
free( psz_token );
}
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* mp4.c : MP4 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: mp4.c,v 1.16 2003/01/28 16:57:28 sam Exp $
* $Id: mp4.c,v 1.17 2003/02/07 01:22:55 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -171,11 +171,8 @@ static int MP4Init( vlc_object_t * p_this )
break;
default:
msg_Dbg( p_input,
"unrecognized major file specification (%c%c%c%c).",
p_ftyp->data.p_ftyp->i_major_brand&0xff,
( p_ftyp->data.p_ftyp->i_major_brand >> 8)&0xff,
( p_ftyp->data.p_ftyp->i_major_brand >> 16 )&0xff,
( p_ftyp->data.p_ftyp->i_major_brand >> 24 )&0xff );
"unrecognized major file specification (%4.4s).",
(char*)&p_ftyp->data.p_ftyp->i_major_brand );
break;
}
}
......@@ -501,7 +498,6 @@ static int MP4_TrackSynchro( input_thread_t *p_input, track_data_mp4_t *p_track
{
p_track->i_chunk++;
}
}
if( p_track->i_sample >= p_track->i_sample_count )
{
......@@ -687,7 +683,6 @@ static void MP4_ParseTrack( input_thread_t *p_input,
}
/* now create basic chunk data, the rest will be filled by MP4_CreateSamplesIndex */
static int MP4_CreateChunksIndex( input_thread_t *p_input,
track_data_mp4_t *p_demux_track )
......@@ -698,7 +693,6 @@ static int MP4_CreateChunksIndex( input_thread_t *p_input,
unsigned int i_chunk;
unsigned int i_index, i_last;
if( ( !(p_co64 = MP4_BoxGet( p_demux_track->p_stbl, "stco" ) )&&
!(p_co64 = MP4_BoxGet( p_demux_track->p_stbl, "co64" ) ) )||
( !(p_stsc = MP4_BoxGet( p_demux_track->p_stbl, "stsc" ) ) ))
......@@ -747,13 +741,12 @@ static int MP4_CreateChunksIndex( input_thread_t *p_input,
i_last = p_stsc->data.p_stsc->i_first_chunk[i_index] - 1;
}
p_demux_track->chunk[i_chunk].i_sample_first = 0;
p_demux_track->chunk[0].i_sample_first = 0;
for( i_chunk = 1; i_chunk < p_demux_track->i_chunk_count; i_chunk++ )
{
p_demux_track->chunk[i_chunk].i_sample_first =
p_demux_track->chunk[i_chunk-1].i_sample_first +
p_demux_track->chunk[i_chunk-1].i_sample_count;
}
msg_Dbg( p_input,
......@@ -788,7 +781,6 @@ static int MP4_CreateSamplesIndex( input_thread_t *p_input,
p_stts = MP4_BoxGet( p_demux_track->p_stbl, "stts" );
p_stsz = MP4_BoxGet( p_demux_track->p_stbl, "stsz" ); /* FIXME and stz2 */
if( ( !p_stts )||( !p_stsz ) )
{
msg_Warn( p_input, "cannot read sample table" );
......@@ -1304,7 +1296,6 @@ static int MP4_DecodeSample( input_thread_t *p_input,
}
}
return( 1 );
}
......
......@@ -2,7 +2,7 @@
* audio.c : mpeg audio Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: audio.c,v 1.10 2003/01/20 13:06:34 fenrir Exp $
* $Id: audio.c,v 1.11 2003/02/07 01:22:55 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -694,6 +694,7 @@ static int Demux( input_thread_t * p_input )
return( -1 );
}
p_pes->i_rate = p_input->stream.control.i_rate;
p_pes->i_dts =
p_pes->i_pts = input_ClockGetTS( p_input,
p_input->stream.p_selected_program,
......
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