/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <stdlib.h> /* malloc(), free() */
#include <vlc/vlc.h>
-#include <vlc/input.h>
-#include "vlc_codec.h"
-#include "vlc_meta.h"
+#include <vlc_demux.h>
+#include <vlc_codec.h>
+#include <vlc_input.h>
#define MPGA_PACKET_SIZE 1024
struct demux_sys_t
{
es_out_id_t *p_es;
- vlc_meta_t *meta;
vlc_bool_t b_start;
decoder_t *p_packetizer;
vlc_bool_t b_forced = VLC_FALSE;
uint32_t header;
- uint8_t *p_peek;
- module_t *p_id3;
+ const uint8_t *p_peek;
block_t *p_block_in, *p_block_out;
- if( p_demux->psz_path )
- {
- int i_len = strlen( p_demux->psz_path );
- if( i_len > 4 && !strcasecmp( &p_demux->psz_path[i_len - 4], ".mp3" ) )
- {
- b_forced = VLC_TRUE;
- }
- }
+ if( demux2_IsPathExtension( p_demux, ".mp3" ) )
+ b_forced = VLC_TRUE;
if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) return VLC_EGENERIC;
if( !b_ok && !p_demux->b_force ) return VLC_EGENERIC;
}
- STANDARD_DEMUX_INIT; p_sys = p_demux->p_sys;
+ DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys;
memset( p_sys, 0, sizeof( demux_sys_t ) );
p_sys->p_es = 0;
p_sys->b_start = VLC_TRUE;
- p_sys->meta = 0;
/* Load the mpeg audio packetizer */
INIT_APACKETIZER( p_sys->p_packetizer, 'm', 'p', 'g', 'a' );
if( HeaderCheck( header ) )
{
int i_xing, i_skip;
- uint8_t *p_xing;
+ const uint8_t *p_xing;
if( ( i_xing = stream_Peek( p_demux->s, &p_xing, 1024 ) ) < 21 )
return VLC_SUCCESS; /* No header */
else
p_sys->b_initial_sync_failed = VLC_FALSE;
- p_sys->p_packetizer->fmt_out.b_packetized = VLC_TRUE;
- p_sys->p_es = es_out_Add( p_demux->out,
- &p_sys->p_packetizer->fmt_out);
p_sys->i_bitrate_avg = p_sys->p_packetizer->fmt_out.i_bitrate;
if( p_sys->i_xing_bytes && p_sys->i_xing_frames &&
p_sys->p_block_in = p_block_in;
p_sys->p_block_out = p_block_out;
- /* Parse possible id3 header */
- if( ( p_id3 = module_Need( p_demux, "meta reader", NULL, 0 ) ) )
- {
- p_sys->meta = (vlc_meta_t *)p_demux->p_private;
- p_demux->p_private = NULL;
- module_Unneed( p_demux, p_id3 );
- }
-
+ /* */
+ p_sys->p_packetizer->fmt_out.b_packetized = VLC_TRUE;
+ p_sys->p_es = es_out_Add( p_demux->out,
+ &p_sys->p_packetizer->fmt_out);
return VLC_SUCCESS;
}
{
p_sys->b_start = VLC_FALSE;
p_block_in = p_sys->p_block_in;
+ p_sys->p_block_in = NULL;
p_block_out = p_sys->p_block_out;
+ p_sys->p_block_out = NULL;
}
else
{
demux_sys_t *p_sys = p_demux->p_sys;
DESTROY_PACKETIZER( p_sys->p_packetizer );
- if( p_sys->meta ) vlc_meta_Delete( p_sys->meta );
+ if( p_sys->p_block_out ) block_Release( p_sys->p_block_out );
free( p_sys );
}
{
demux_sys_t *p_sys = p_demux->p_sys;
int64_t *pi64;
- vlc_meta_t *p_meta;
+ vlc_bool_t *pb_bool;
int i_ret;
switch( i_query )
{
- case DEMUX_GET_META:
- p_meta = (vlc_meta_t *)va_arg( args, vlc_meta_t* );
- vlc_meta_Merge( p_meta, p_sys->meta );
+ case DEMUX_HAS_UNSUPPORTED_META:
+ pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
+ *pb_bool = VLC_TRUE;
return VLC_SUCCESS;
case DEMUX_GET_TIME: