- MALLOC_ERR( p_demux->p_sys, demux_sys_t ); \
- memset( p_demux->p_sys, 0, sizeof( demux_sys_t ) ); } while(0)
-
-#define STANDARD_DEMUX_INIT_MSG( msg ) do { \
- DEMUX_INIT_COMMON(); \
- msg_Dbg( p_demux, msg ); } while(0)
-
-#define DEMUX_BY_EXTENSION( ext ) \
- demux_t *p_demux = (demux_t *)p_this; \
- if( !demux2_IsPathExtension( p_demux, ext ) ) \
- return VLC_EGENERIC; \
- DEMUX_INIT_COMMON();
-
-#define DEMUX_BY_EXTENSION_MSG( ext, msg ) \
- demux_t *p_demux = (demux_t *)p_this; \
- if( !demux2_IsPathExtension( p_demux, ext ) ) \
- return VLC_EGENERIC; \
- STANDARD_DEMUX_INIT_MSG( msg );
-
-#define DEMUX_BY_EXTENSION_OR_FORCED( ext, module ) \
- demux_t *p_demux = (demux_t *)p_this; \
- if( !demux2_IsPathExtension( p_demux, ext ) && !demux2_IsForced( p_demux, module ) ) \
- return VLC_EGENERIC; \
- DEMUX_INIT_COMMON();
-
-#define DEMUX_BY_EXTENSION_OR_FORCED_MSG( ext, module, msg ) \
- demux_t *p_demux = (demux_t *)p_this; \
- if( !demux2_IsPathExtension( p_demux, ext ) && !demux2_IsForced( p_demux, module ) ) \
- return VLC_EGENERIC; \
- STANDARD_DEMUX_INIT_MSG( msg );
-
-#define CHECK_PEEK( zepeek, size ) \
- if( stream_Peek( p_demux->s , &zepeek, size ) < size ){ \
- msg_Dbg( p_demux, "not enough data" ); return VLC_EGENERIC; }
-
-#define CHECK_PEEK_GOTO( zepeek, size ) \
- if( stream_Peek( p_demux->s , &zepeek, size ) < size ) { \
- msg_Dbg( p_demux, "not enough data" ); goto error; }
-
-#define POKE( peek, stuff, size ) (strncasecmp( (const char *)peek, stuff, size )==0)
-
-#define COMMON_INIT_PACKETIZER( location ) \
- location = vlc_object_create( p_demux, VLC_OBJECT_PACKETIZER ); \
- location->pf_decode_audio = 0; \
- location->pf_decode_video = 0; \
- location->pf_decode_sub = 0; \
- location->pf_packetize = 0; \
-
-#define INIT_APACKETIZER( location, a,b,c,d ) \
- COMMON_INIT_PACKETIZER(location ); \
- es_format_Init( &location->fmt_in, AUDIO_ES, \
- VLC_FOURCC( a, b, c, d ) );
-
-#define INIT_VPACKETIZER( location, a,b,c,d ) \
- COMMON_INIT_PACKETIZER(location ); \
- es_format_Init( &location->fmt_in, VIDEO_ES, \
- VLC_FOURCC( a, b, c, d ) );
-
-/* BEWARE ! This can lead to memory leaks ! */
-#define LOAD_PACKETIZER_OR_FAIL( location, msg ) \
- location->p_module = \
- module_Need( location, "packetizer", NULL, 0 ); \
- if( location->p_module == NULL ) \
- { \
- vlc_object_destroy( location ); \
- msg_Err( p_demux, "cannot find packetizer for " # msg ); \
- free( p_sys ); \
- return VLC_EGENERIC; \
- }
-
-#define DESTROY_PACKETIZER( location ) \
- if( location->p_module ) module_Unneed( location, location->p_module ); \
- vlc_object_destroy( location );