* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-#include <stdlib.h>
#include <vlc/vlc.h>
#include "input_internal.h"
if( *p_demux->psz_demux == '\0' )
{
free( p_demux->psz_demux );
- p_demux->psz_demux = var_GetString( p_obj, "demux" );
+ p_demux->psz_demux = var_GetNonEmptyString( p_obj, "demux" );
+ if( p_demux->psz_demux == NULL )
+ p_demux->psz_demux = strdup( "" );
}
if( !b_quick )
* anyway
* - wav can't be added 'cause of a52 and dts in them as raw audio
*/
- static struct { const char *ext; const char *demux; } exttodemux[] =
+ static const struct { char ext[5]; char demux[9]; } exttodemux[] =
{
{ "aac", "aac" },
{ "aiff", "aiff" },
{ "rm", "rm" },
{ "m4v", "m4v" },
{ "h264", "h264" },
- { NULL, NULL },
+ { "", "" },
};
/* Here, we don't mind if it does not work, it must be quick */
- static struct { const char *ext; const char *demux; } exttodemux_quick[] =
+ static const struct { char ext[4]; char demux[5]; } exttodemux_quick[] =
{
{ "mp3", "mpga" },
{ "ogg", "ogg" },
{ "wma", "asf" },
- { NULL, NULL }
+ { "", "" }
};
const char *psz_ext = strrchr( p_demux->psz_path, '.' ) + 1;
if( !b_quick )
{
- for( i = 0; exttodemux[i].ext != NULL; i++ )
+ for( i = 0; exttodemux[i].ext[0]; i++ )
{
if( !strcasecmp( psz_ext, exttodemux[i].ext ) )
{
}
else
{
- for( i = 0; exttodemux_quick[i].ext != NULL; i++ )
+ for( i = 0; exttodemux_quick[i].ext[0]; i++ )
{
if( !strcasecmp( psz_ext, exttodemux_quick[i].ext ) )
{
case DEMUX_SET_NEXT_DEMUX_TIME:
case DEMUX_GET_TITLE_INFO:
case DEMUX_SET_GROUP:
+ case DEMUX_GET_ATTACHMENTS:
return VLC_EGENERIC;
default:
} d_stream_sys_t;
static int DStreamRead ( stream_t *, void *p_read, int i_read );
-static int DStreamPeek ( stream_t *, uint8_t **pp_peek, int i_peek );
+static int DStreamPeek ( stream_t *, const uint8_t **pp_peek, int i_peek );
static int DStreamControl( stream_t *, int i_query, va_list );
static int DStreamThread ( stream_t * );
if( psz_demux == NULL || *psz_demux == '\0' ) return NULL;
- s = vlc_object_create( p_obj, VLC_OBJECT_STREAM );
- s->pf_block = NULL;
+ s = vlc_stream_create( p_obj );
s->pf_read = DStreamRead;
s->pf_peek = DStreamPeek;
s->pf_control= DStreamControl;
d_stream_sys_t *p_sys = (d_stream_sys_t*)s->p_sys;
block_t *p_empty;
- s->b_die = VLC_TRUE;
- if( p_sys->p_demux ) p_sys->p_demux->b_die = VLC_TRUE;
+ vlc_object_kill( s );
+ if( p_sys->p_demux )
+ vlc_object_kill( p_sys->p_demux );
p_empty = block_New( s, 1 ); p_empty->i_buffer = 0;
block_FifoPut( p_sys->p_fifo, p_empty );
vlc_thread_join( s );
return i_out;
}
-static int DStreamPeek( stream_t *s, uint8_t **pp_peek, int i_peek )
+static int DStreamPeek( stream_t *s, const uint8_t **pp_peek, int i_peek )
{
d_stream_sys_t *p_sys = (d_stream_sys_t*)s->p_sys;
block_t **pp_block = &p_sys->p_block;
return VLC_SUCCESS;
case STREAM_CONTROL_ACCESS:
+ case STREAM_GET_CONTENT_TYPE:
return VLC_EGENERIC;
default:
if( p_demux->pf_demux( p_demux ) <= 0 ) break;
}
- p_demux->b_die = VLC_TRUE;
+ vlc_object_kill( p_demux );
return VLC_SUCCESS;
}
****************************************************************************/
static void SkipID3Tag( demux_t *p_demux )
{
- uint8_t *p_peek;
+ const uint8_t *p_peek;
uint8_t version, revision;
int i_size;
int b_footer;