- /* Data buffer */
- vlc_mutex_t lock;
- int i_buffer;
- int i_buffer_size;
- uint8_t *p_buffer;
-
- int64_t i_pos;
-
- /* Demuxer */
- char *psz_name;
- es_out_t *out;
- demux_t *p_demux;
-
-} 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 DStreamControl( stream_t *, int i_query, va_list );
-static int DStreamThread ( stream_t * );
-
-
-stream_t *__stream_DemuxNew( vlc_object_t *p_obj, char *psz_demux,
- es_out_t *out )
-{
- /* We create a stream reader, and launch a thread */
- stream_t *s;
- d_stream_sys_t *p_sys;
-
- if( psz_demux == NULL || *psz_demux == '\0' ) return NULL;
-
- s = vlc_object_create( p_obj, VLC_OBJECT_STREAM );
- s->pf_block = NULL;
- s->pf_read = DStreamRead;
- s->pf_peek = DStreamPeek;
- s->pf_control= DStreamControl;
-
- s->p_sys = malloc( sizeof( d_stream_sys_t) );
- p_sys = (d_stream_sys_t*)s->p_sys;
-
- vlc_mutex_init( s, &p_sys->lock );
- p_sys->i_buffer = 0;
- p_sys->i_buffer_size = 1000000;
- p_sys->p_buffer = malloc( p_sys->i_buffer_size );
- p_sys->i_pos = 0;
- p_sys->psz_name = strdup( psz_demux );
- p_sys->out = out;
- p_sys->p_demux = NULL;
-
- if( vlc_thread_create( s, "stream out", DStreamThread,
- VLC_THREAD_PRIORITY_INPUT, VLC_FALSE ) )
+ decoder_t *p_packetizer;
+ p_packetizer = vlc_custom_create( p_demux, sizeof( *p_packetizer ),
+ VLC_OBJECT_GENERIC, "demux packetizer" );
+ if( !p_packetizer )