# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
#include "input_internal.h"
const char *psz_path,
stream_t *s, es_out_t *out, bool b_quick )
{
- demux_t *p_demux = vlc_object_create( p_obj, VLC_OBJECT_DEMUX );
+ static const char typename[] = "demux";
+ demux_t *p_demux = vlc_custom_create( p_obj, sizeof( *p_demux ),
+ VLC_OBJECT_GENERIC, typename );
const char *psz_module;
if( p_demux == NULL ) return NULL;
p_demux->psz_path = strdup( psz_path );
/* Take into account "demux" to be able to do :demux=dump */
- if( *p_demux->psz_demux == '\0' )
+ if( p_demux->psz_demux && *p_demux->psz_demux == '\0' )
{
free( p_demux->psz_demux );
p_demux->psz_demux = var_GetNonEmptyString( p_obj, "demux" );
pi64 = (int64_t*)va_arg( args, int64_t * );
if( i_bitrate > 0 && i_end > i_start )
{
- *pi64 = I64C(8000000) * (i_end - i_start) / i_bitrate;
+ *pi64 = INT64_C(8000000) * (i_end - i_start) / i_bitrate;
return VLC_SUCCESS;
}
return VLC_EGENERIC;
pi64 = (int64_t*)va_arg( args, int64_t * );
if( i_bitrate > 0 && i_end > i_start )
{
- *pi64 = I64C(8000000) * (i_tell - i_start) / i_bitrate;
+ *pi64 = INT64_C(8000000) * (i_tell - i_start) / i_bitrate;
return VLC_SUCCESS;
}
return VLC_EGENERIC;
i64 = (int64_t)va_arg( args, int64_t );
if( i_bitrate > 0 && i64 >= 0 )
{
- int64_t i_block = i64 * i_bitrate / I64C(8000000) / i_align;
+ int64_t i_block = i64 * i_bitrate / INT64_C(8000000) / i_align;
if( stream_Seek( s, i_start + i_block * i_align ) )
{
return VLC_EGENERIC;
if( psz_demux == NULL || *psz_demux == '\0' ) return NULL;
s = vlc_stream_create( p_obj );
+ if( s == NULL )
+ return NULL;
s->pf_read = DStreamRead;
s->pf_peek = DStreamPeek;
s->pf_control= DStreamControl;
s->b_little_endian = false;
s->p_sys = malloc( sizeof( d_stream_sys_t) );
+ if( s->p_sys == NULL )
+ {
+ vlc_object_release( s );
+ return NULL;
+ }
p_sys = (d_stream_sys_t*)s->p_sys;
p_sys->i_pos = 0;
p_sys->psz_name = strdup( psz_demux );
/* decoder fifo */
- if( ( p_sys->p_fifo = block_FifoNew( s ) ) == NULL )
+ if( ( p_sys->p_fifo = block_FifoNew() ) == NULL )
{
- msg_Err( s, "out of memory" );
vlc_object_release( s );
+ free( p_sys->psz_name );
free( p_sys );
return NULL;
}
VLC_THREAD_PRIORITY_INPUT, false ) )
{
vlc_object_release( s );
+ free( p_sys->psz_name );
free( p_sys );
return NULL;
}