X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Finput%2Fdemux.c;h=712bfd2276ef87173b2c08acfd0da14ad32be87c;hb=528f0214d6cd1acfcf915f7f6f001a30622903b4;hp=a260058da62bca88650e1b3b61be4c6ffba128c9;hpb=d3fe7f28797d4dba65ffcdd60bf932e758a48a9e;p=vlc diff --git a/src/input/demux.c b/src/input/demux.c index a260058da6..712bfd2276 100644 --- a/src/input/demux.c +++ b/src/input/demux.c @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ -#include #include #include "input_internal.h" @@ -51,7 +50,9 @@ demux_t *__demux2_New( vlc_object_t *p_obj, 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 ) @@ -80,7 +81,7 @@ demux_t *__demux2_New( vlc_object_t *p_obj, * 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" }, @@ -99,15 +100,15 @@ demux_t *__demux2_New( vlc_object_t *p_obj, { "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; @@ -115,7 +116,7 @@ demux_t *__demux2_New( vlc_object_t *p_obj, 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 ) ) { @@ -126,7 +127,7 @@ demux_t *__demux2_New( vlc_object_t *p_obj, } 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 ) ) { @@ -269,6 +270,7 @@ int demux2_vaControlHelper( stream_t *s, case DEMUX_SET_NEXT_DEMUX_TIME: case DEMUX_GET_TITLE_INFO: case DEMUX_SET_GROUP: + case DEMUX_GET_ATTACHMENTS: return VLC_EGENERIC; default: @@ -296,7 +298,7 @@ typedef struct } 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 * ); @@ -310,8 +312,7 @@ stream_t *__stream_DemuxNew( vlc_object_t *p_obj, const char *psz_demux, 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; @@ -359,8 +360,9 @@ void stream_DemuxDelete( stream_t *s ) 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 ); @@ -417,7 +419,7 @@ static int DStreamRead( stream_t *s, void *p_read, int i_read ) 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; @@ -534,7 +536,7 @@ static int DStreamThread( stream_t *s ) if( p_demux->pf_demux( p_demux ) <= 0 ) break; } - p_demux->b_die = VLC_TRUE; + vlc_object_kill( p_demux ); return VLC_SUCCESS; } @@ -543,7 +545,7 @@ static int DStreamThread( stream_t *s ) ****************************************************************************/ 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;