Commit 231d0470 authored by gbazin's avatar gbazin

* include/vlc_common.h: include stdlib.h
* include/ninput.h, src/input/stream.c, src/input/input.c:
    new stream_Block() function to read a block_t from the input.
    es_out_Send() takes a block_t as input, for PES (deprecated) use es_out_SendPES().
* modules/demux/*: changed to new es_out_Send(). asf.c and avi.c still use es_out_SendPES() though.
parent 571f69ba
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ninput.h * ninput.h
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: ninput.h,v 1.17 2003/11/20 22:10:55 fenrir Exp $ * $Id: ninput.h,v 1.18 2003/11/21 00:38:01 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -35,7 +35,8 @@ enum es_out_query_e ...@@ -35,7 +35,8 @@ enum es_out_query_e
struct es_out_t struct es_out_t
{ {
es_out_id_t *(*pf_add) ( es_out_t *, es_format_t * ); es_out_id_t *(*pf_add) ( es_out_t *, es_format_t * );
int (*pf_send) ( es_out_t *, es_out_id_t *, pes_packet_t * ); int (*pf_send) ( es_out_t *, es_out_id_t *, block_t * );
int (*pf_send_pes)( es_out_t *, es_out_id_t *, pes_packet_t * );
void (*pf_del) ( es_out_t *, es_out_id_t * ); void (*pf_del) ( es_out_t *, es_out_id_t * );
int (*pf_control)( es_out_t *, int i_query, va_list ); int (*pf_control)( es_out_t *, int i_query, va_list );
...@@ -50,9 +51,15 @@ static inline void es_out_Del( es_out_t *out, es_out_id_t *id ) ...@@ -50,9 +51,15 @@ static inline void es_out_Del( es_out_t *out, es_out_id_t *id )
{ {
out->pf_del( out, id ); out->pf_del( out, id );
} }
static inline int es_out_Send( es_out_t *out, es_out_id_t *id, pes_packet_t *p_pes ) static inline int es_out_Send( es_out_t *out, es_out_id_t *id,
block_t *p_block )
{ {
return out->pf_send( out, id, p_pes ); return out->pf_send( out, id, p_block );
}
static inline int es_out_SendPES( es_out_t *out, es_out_id_t *id,
pes_packet_t *p_pes )
{
return out->pf_send_pes( out, id, p_pes );
} }
static inline int es_out_vaControl( es_out_t *out, int i_query, va_list args ) static inline int es_out_vaControl( es_out_t *out, int i_query, va_list args )
{ {
...@@ -101,6 +108,7 @@ VLC_EXPORT( int, stream_Read, ( stream_t *, void *p_read, ...@@ -101,6 +108,7 @@ VLC_EXPORT( int, stream_Read, ( stream_t *, void *p_read,
VLC_EXPORT( int, stream_Peek, ( stream_t *, uint8_t **pp_peek, int i_peek ) ); VLC_EXPORT( int, stream_Peek, ( stream_t *, uint8_t **pp_peek, int i_peek ) );
VLC_EXPORT( data_packet_t *,stream_DataPacket, ( stream_t *, int i_size, vlc_bool_t b_force ) ); VLC_EXPORT( data_packet_t *,stream_DataPacket, ( stream_t *, int i_size, vlc_bool_t b_force ) );
VLC_EXPORT( pes_packet_t *, stream_PesPacket, ( stream_t *, int i_size ) ); VLC_EXPORT( pes_packet_t *, stream_PesPacket, ( stream_t *, int i_size ) );
VLC_EXPORT( block_t *, stream_Block, ( stream_t *, int i_size ) );
static int64_t inline stream_Tell( stream_t *s ) static int64_t inline stream_Tell( stream_t *s )
{ {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions * Collection of useful common types and macros definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.86 2003/11/16 21:07:30 gbazin Exp $ * $Id: vlc_common.h,v 1.87 2003/11/21 00:38:01 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@via.ecp.fr> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
/***************************************************************************** /*****************************************************************************
* Required system headers * Required system headers
*****************************************************************************/ *****************************************************************************/
#include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* a52.c : Raw a52 Stream input module for vlc * a52.c : Raw a52 Stream input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: a52sys.c,v 1.9 2003/11/16 21:07:31 gbazin Exp $ * $Id: a52sys.c,v 1.10 2003/11/21 00:38:00 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -177,7 +177,7 @@ error: ...@@ -177,7 +177,7 @@ error:
static int Demux( input_thread_t * p_input ) static int Demux( input_thread_t * p_input )
{ {
demux_sys_t *p_sys = p_input->p_demux_data; demux_sys_t *p_sys = p_input->p_demux_data;
pes_packet_t *p_pes; block_t *p_block;
int i_channels, i_sample_rate, i_frame_size; int i_channels, i_sample_rate, i_frame_size;
...@@ -227,18 +227,18 @@ static int Demux( input_thread_t * p_input ) ...@@ -227,18 +227,18 @@ static int Demux( input_thread_t * p_input )
p_input->stream.p_selected_program, p_input->stream.p_selected_program,
p_sys->i_time * 9 / 100 ); p_sys->i_time * 9 / 100 );
if( ( p_pes = stream_PesPacket( p_input->s, i_frame_size ) ) == NULL ) if( ( p_block = stream_Block( p_input->s, i_frame_size ) ) == NULL )
{ {
msg_Warn( p_input, "cannot read data" ); msg_Warn( p_input, "cannot read data" );
return 0; return 0;
} }
p_pes->i_dts = p_block->i_dts =
p_pes->i_pts = input_ClockGetTS( p_input, p_block->i_pts = input_ClockGetTS( p_input,
p_input->stream.p_selected_program, p_input->stream.p_selected_program,
p_sys->i_time * 9 / 100 ); p_sys->i_time * 9 / 100 );
es_out_Send( p_input->p_es_out, p_sys->p_es, p_pes ); es_out_Send( p_input->p_es_out, p_sys->p_es, p_block );
p_sys->i_time += (mtime_t)1000000 * p_sys->i_time += (mtime_t)1000000 *
(mtime_t)1536 / (mtime_t)1536 /
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aac.c : Raw aac Stream input module for vlc * aac.c : Raw aac Stream input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: aac.c,v 1.7 2003/11/16 21:07:31 gbazin Exp $ * $Id: aac.c,v 1.8 2003/11/21 00:38:01 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -194,7 +194,7 @@ error: ...@@ -194,7 +194,7 @@ error:
static int Demux( input_thread_t * p_input ) static int Demux( input_thread_t * p_input )
{ {
demux_sys_t *p_sys = p_input->p_demux_data; demux_sys_t *p_sys = p_input->p_demux_data;
pes_packet_t *p_pes; block_t *p_block;
uint8_t h[8]; uint8_t h[8];
uint8_t *p_peek; uint8_t *p_peek;
...@@ -243,18 +243,18 @@ static int Demux( input_thread_t * p_input ) ...@@ -243,18 +243,18 @@ static int Demux( input_thread_t * p_input )
p_input->stream.p_selected_program, p_input->stream.p_selected_program,
p_sys->i_time * 9 / 100 ); p_sys->i_time * 9 / 100 );
if( ( p_pes = stream_PesPacket( p_input->s, AAC_FRAME_SIZE( h ) ) )==NULL ) if( ( p_block = stream_Block( p_input->s, AAC_FRAME_SIZE( h ) ) ) == NULL )
{ {
msg_Warn( p_input, "cannot read data" ); msg_Warn( p_input, "cannot read data" );
return 0; return 0;
} }
p_pes->i_dts = p_block->i_dts =
p_pes->i_pts = input_ClockGetTS( p_input, p_block->i_pts = input_ClockGetTS( p_input,
p_input->stream.p_selected_program, p_input->stream.p_selected_program,
p_sys->i_time * 9 / 100 ); p_sys->i_time * 9 / 100 );
es_out_Send( p_input->p_es_out, p_sys->p_es, p_pes ); es_out_Send( p_input->p_es_out, p_sys->p_es, p_block );
p_sys->i_time += (mtime_t)1000000 * p_sys->i_time += (mtime_t)1000000 *
(mtime_t)AAC_FRAME_SAMPLES( h ) / (mtime_t)AAC_FRAME_SAMPLES( h ) /
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* asf.c : ASFv01 file input module for vlc * asf.c : ASFv01 file input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: asf.c,v 1.43 2003/11/20 22:10:56 fenrir Exp $ * $Id: asf.c,v 1.44 2003/11/21 00:38:01 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -716,7 +716,7 @@ static int DemuxPacket( input_thread_t *p_input, vlc_bool_t b_play_audio ) ...@@ -716,7 +716,7 @@ static int DemuxPacket( input_thread_t *p_input, vlc_bool_t b_play_audio )
/* send complete packet to decoder */ /* send complete packet to decoder */
if( p_stream->p_pes->i_pes_size > 0 ) if( p_stream->p_pes->i_pes_size > 0 )
{ {
es_out_Send( p_input->p_es_out, p_stream->p_es, p_stream->p_pes ); es_out_SendPES( p_input->p_es_out, p_stream->p_es, p_stream->p_pes );
p_stream->p_pes = NULL; p_stream->p_pes = NULL;
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* au.c : au file input module for vlc * au.c : au file input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2003 VideoLAN * Copyright (C) 2001-2003 VideoLAN
* $Id: au.c,v 1.10 2003/11/16 22:54:12 gbazin Exp $ * $Id: au.c,v 1.11 2003/11/21 00:38:01 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -325,7 +325,7 @@ error: ...@@ -325,7 +325,7 @@ error:
static int DemuxPCM( input_thread_t *p_input ) static int DemuxPCM( input_thread_t *p_input )
{ {
demux_sys_t *p_sys = p_input->p_demux_data; demux_sys_t *p_sys = p_input->p_demux_data;
pes_packet_t *p_pes; block_t *p_block;
if( p_input->stream.p_selected_program->i_synchro_state == SYNCHRO_REINIT ) if( p_input->stream.p_selected_program->i_synchro_state == SYNCHRO_REINIT )
{ {
...@@ -345,17 +345,17 @@ static int DemuxPCM( input_thread_t *p_input ) ...@@ -345,17 +345,17 @@ static int DemuxPCM( input_thread_t *p_input )
p_input->stream.p_selected_program, p_input->stream.p_selected_program,
p_sys->i_time * 9 / 100 ); p_sys->i_time * 9 / 100 );
if( ( p_pes = stream_PesPacket( p_input->s, p_sys->i_frame_size ) )==NULL ) if( ( p_block = stream_Block( p_input->s, p_sys->i_frame_size ) ) == NULL )
{ {
msg_Warn( p_input, "cannot read data" ); msg_Warn( p_input, "cannot read data" );
return 0; return 0;
} }
p_pes->i_dts = p_block->i_dts =
p_pes->i_pts = input_ClockGetTS( p_input, p_block->i_pts = input_ClockGetTS( p_input,
p_input->stream.p_selected_program, p_input->stream.p_selected_program,
p_sys->i_time * 9 / 100 ); p_sys->i_time * 9 / 100 );
es_out_Send( p_input->p_es_out, p_sys->p_es, p_pes ); es_out_Send( p_input->p_es_out, p_sys->p_es, p_block );
p_sys->i_time += p_sys->i_frame_length; p_sys->i_time += p_sys->i_frame_length;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc * avi.c : AVI file Stream input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.71 2003/11/20 22:10:56 fenrir Exp $ * $Id: avi.c,v 1.72 2003/11/21 00:38:01 gbazin Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -776,7 +776,7 @@ static int Demux_Seekable( input_thread_t *p_input ) ...@@ -776,7 +776,7 @@ static int Demux_Seekable( input_thread_t *p_input )
p_pes->i_rate = p_input->stream.control.i_rate; p_pes->i_rate = p_input->stream.control.i_rate;
if( b_play_audio || tk->i_cat != AUDIO_ES ) if( b_play_audio || tk->i_cat != AUDIO_ES )
{ {
es_out_Send( p_input->p_es_out, tk->p_es, p_pes ); es_out_SendPES( p_input->p_es_out, tk->p_es, p_pes );
} }
else else
{ {
...@@ -902,7 +902,7 @@ static int Demux_UnSeekable( input_thread_t *p_input ) ...@@ -902,7 +902,7 @@ static int Demux_UnSeekable( input_thread_t *p_input )
AVI_GetPTS( p_stream ) * 9/100); AVI_GetPTS( p_stream ) * 9/100);
p_pes->i_rate = p_input->stream.control.i_rate; p_pes->i_rate = p_input->stream.control.i_rate;
es_out_Send( p_input->p_es_out, p_stream->p_es, p_pes ); es_out_SendPES( p_input->p_es_out, p_stream->p_es, p_pes );
} }
else else
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* live.cpp : live.com support. * live.cpp : live.com support.
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: livedotcom.cpp,v 1.9 2003/11/20 23:13:28 sigmunau Exp $ * $Id: livedotcom.cpp,v 1.10 2003/11/21 00:38:01 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -854,10 +854,9 @@ static void StreamRead( void *p_private, unsigned int i_size, struct timeval pts ...@@ -854,10 +854,9 @@ static void StreamRead( void *p_private, unsigned int i_size, struct timeval pts
live_track_t *tk = (live_track_t*)p_private; live_track_t *tk = (live_track_t*)p_private;
input_thread_t *p_input = tk->p_input; input_thread_t *p_input = tk->p_input;
demux_sys_t *p_sys = p_input->p_demux_data; demux_sys_t *p_sys = p_input->p_demux_data;
pes_packet_t *p_pes; block_t *p_block;
data_packet_t *p_data;
mtime_t i_pts = (mtime_t)pts.tv_sec * 1000000LL + (mtime_t)pts.tv_usec; mtime_t i_pts = (mtime_t)pts.tv_sec * 1000000LL + (mtime_t)pts.tv_usec;
if( tk->b_quicktime && tk->p_es == NULL ) if( tk->b_quicktime && tk->p_es == NULL )
{ {
...@@ -888,41 +887,31 @@ static void StreamRead( void *p_private, unsigned int i_size, struct timeval pts ...@@ -888,41 +887,31 @@ static void StreamRead( void *p_private, unsigned int i_size, struct timeval pts
i_size, i_size,
pts.tv_sec * 1000000LL + pts.tv_usec ); pts.tv_sec * 1000000LL + pts.tv_usec );
#endif #endif
/* Create a PES */
if( ( p_pes = input_NewPES( p_input->p_method_data ) ) == NULL )
{
return;
}
if( i_size > 65536 ) if( i_size > 65536 )
{ {
msg_Warn( p_input, "buffer overflow" ); msg_Warn( p_input, "buffer overflow" );
} }
/* FIXME could i_size be > buffer size ? */ /* FIXME could i_size be > buffer size ? */
p_data = input_NewPacket( p_input->p_method_data, i_size ); p_block = block_New( p_input, i_size );
memcpy( p_data->p_payload_start, tk->buffer, i_size );
p_data->p_payload_end = p_data->p_payload_start + i_size;
p_pes->p_first = p_pes->p_last = p_data; memcpy( p_block->p_buffer, tk->buffer, i_size );
p_pes->i_nb_data = 1; //p_block->i_rate = p_input->stream.control.i_rate;
p_pes->i_pes_size = i_size;
p_pes->i_rate = p_input->stream.control.i_rate;
if( i_pts != tk->i_pts ) if( i_pts != tk->i_pts )
{ {
p_pes->i_dts = p_block->i_dts =
p_pes->i_pts = input_ClockGetTS( p_input, p_block->i_pts = input_ClockGetTS( p_input,
p_input->stream.p_selected_program, p_input->stream.p_selected_program,
i_pts * 9 / 100 ); i_pts * 9 / 100 );
} }
else else
{ {
p_pes->i_dts = 0; p_block->i_dts = 0;
p_pes->i_pts = 0; p_block->i_pts = 0;
} }
//fprintf( stderr, "tk -> dpts=%lld\n", i_pts - tk->i_pts ); //fprintf( stderr, "tk -> dpts=%lld\n", i_pts - tk->i_pts );
es_out_Send( p_input->p_es_out, tk->p_es, p_pes ); es_out_Send( p_input->p_es_out, tk->p_es, p_block );
/* warm that's ok */ /* warm that's ok */
p_sys->event = 0xff; p_sys->event = 0xff;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mkv.cpp : matroska demuxer * mkv.cpp : matroska demuxer
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: mkv.cpp,v 1.42 2003/11/20 22:10:55 fenrir Exp $ * $Id: mkv.cpp,v 1.43 2003/11/21 00:38:01 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -1369,27 +1369,13 @@ static int BlockGet( input_thread_t *p_input, KaxBlock **pp_block, int64_t *pi_r ...@@ -1369,27 +1369,13 @@ static int BlockGet( input_thread_t *p_input, KaxBlock **pp_block, int64_t *pi_r
} }
} }
static pes_packet_t *MemToPES( input_thread_t *p_input, uint8_t *p_mem, int i_mem ) static block_t *MemToBlock( input_thread_t *p_input, uint8_t *p_mem, int i_mem)
{ {
pes_packet_t *p_pes; block_t *p_block;
data_packet_t *p_data; if( !(p_block = block_New( p_input, i_mem ) ) ) return NULL;
memcpy( p_block->p_buffer, p_mem, i_mem );
if( ( p_pes = input_NewPES( p_input->p_method_data ) ) == NULL ) //p_block->i_rate = p_input->stream.control.i_rate;
{ return p_block;
return NULL;
}
p_data = input_NewPacket( p_input->p_method_data, i_mem);
memcpy( p_data->p_payload_start, p_mem, i_mem );
p_data->p_payload_end = p_data->p_payload_start + i_mem;
p_pes->p_first = p_pes->p_last = p_data;
p_pes->i_nb_data = 1;
p_pes->i_pes_size = i_mem;
p_pes->i_rate = p_input->stream.control.i_rate;
return p_pes;
} }
static void BlockDecode( input_thread_t *p_input, KaxBlock *block, mtime_t i_pts, mtime_t i_duration ) static void BlockDecode( input_thread_t *p_input, KaxBlock *block, mtime_t i_pts, mtime_t i_duration )
...@@ -1430,7 +1416,7 @@ static void BlockDecode( input_thread_t *p_input, KaxBlock *block, mtime_t i_pts ...@@ -1430,7 +1416,7 @@ static void BlockDecode( input_thread_t *p_input, KaxBlock *block, mtime_t i_pts
/* First send init data */ /* First send init data */
if( !tk.b_inited && tk.i_data_init > 0 ) if( !tk.b_inited && tk.i_data_init > 0 )
{ {
pes_packet_t *p_init; block_t *p_init;
msg_Dbg( p_input, "sending header (%d bytes)", tk.i_data_init ); msg_Dbg( p_input, "sending header (%d bytes)", tk.i_data_init );
...@@ -1462,17 +1448,17 @@ static void BlockDecode( input_thread_t *p_input, KaxBlock *block, mtime_t i_pts ...@@ -1462,17 +1448,17 @@ static void BlockDecode( input_thread_t *p_input, KaxBlock *block, mtime_t i_pts
i_size[1] = __MIN( i_size[1], tk.i_data_init - i_offset - i_size[0] ); i_size[1] = __MIN( i_size[1], tk.i_data_init - i_offset - i_size[0] );
i_size[2] = tk.i_data_init - i_offset - i_size[0] - i_size[1]; i_size[2] = tk.i_data_init - i_offset - i_size[0] - i_size[1];
p_init = MemToPES( p_input, &tk.p_data_init[i_offset], i_size[0] ); p_init = MemToBlock( p_input, &tk.p_data_init[i_offset], i_size[0] );
if( p_init ) if( p_init )
{ {
es_out_Send( p_input->p_es_out, tk.p_es, p_init ); es_out_Send( p_input->p_es_out, tk.p_es, p_init );
} }
p_init = MemToPES( p_input, &tk.p_data_init[i_offset+i_size[0]], i_size[1] ); p_init = MemToBlock( p_input, &tk.p_data_init[i_offset+i_size[0]], i_size[1] );
if( p_init ) if( p_init )
{ {
es_out_Send( p_input->p_es_out, tk.p_es, p_init ); es_out_Send( p_input->p_es_out, tk.p_es, p_init );
} }
p_init = MemToPES( p_input, &tk.p_data_init[i_offset+i_size[0]+i_size[1]], i_size[2] ); p_init = MemToBlock( p_input, &tk.p_data_init[i_offset+i_size[0]+i_size[1]], i_size[2] );
if( p_init ) if( p_init )
{ {
es_out_Send( p_input->p_es_out, tk.p_es, p_init ); es_out_Send( p_input->p_es_out, tk.p_es, p_init );
...@@ -1480,7 +1466,7 @@ static void BlockDecode( input_thread_t *p_input, KaxBlock *block, mtime_t i_pts ...@@ -1480,7 +1466,7 @@ static void BlockDecode( input_thread_t *p_input, KaxBlock *block, mtime_t i_pts
} }
else else
{ {
p_init = MemToPES( p_input, tk.p_data_init, tk.i_data_init ); p_init = MemToBlock( p_input, tk.p_data_init, tk.i_data_init );
if( p_init ) if( p_init )
{ {
es_out_Send( p_input->p_es_out, tk.p_es, p_init ); es_out_Send( p_input->p_es_out, tk.p_es, p_init );
...@@ -1492,35 +1478,35 @@ static void BlockDecode( input_thread_t *p_input, KaxBlock *block, mtime_t i_pts ...@@ -1492,35 +1478,35 @@ static void BlockDecode( input_thread_t *p_input, KaxBlock *block, mtime_t i_pts
for( i = 0; i < block->NumberFrames(); i++ ) for( i = 0; i < block->NumberFrames(); i++ )
{ {
pes_packet_t *p_pes; block_t *p_block;
DataBuffer &data = block->GetBuffer(i); DataBuffer &data = block->GetBuffer(i);
p_pes = MemToPES( p_input, data.Buffer(), data.Size() ); p_block = MemToBlock( p_input, data.Buffer(), data.Size() );
if( p_pes == NULL ) if( p_block == NULL )
{ {
break; break;
} }
p_pes->i_pts = i_pts; p_block->i_pts = i_pts;
p_pes->i_dts = i_pts; p_block->i_dts = i_pts;
if( tk.fmt.i_cat == SPU_ES && strcmp( tk.psz_codec, "S_VOBSUB" ) ) if( tk.fmt.i_cat == SPU_ES && strcmp( tk.psz_codec, "S_VOBSUB" ) )
{ {
if( i_duration > 0 ) if( i_duration > 0 )
{ {
p_pes->i_dts += i_duration * 1000; p_block->i_dts += i_duration * 1000;
} }
else else
{ {
p_pes->i_dts = 0; p_block->i_dts = 0;
} }
if( p_pes->p_first && p_pes->i_pes_size > 0 ) if( p_block->i_buffer > 0 )
{ {
p_pes->p_first->p_payload_end[0] = '\0'; p_block->p_buffer[p_block->i_buffer-1] = '\0';
} }
} }
es_out_Send( p_input->p_es_out, tk.p_es, p_pes ); es_out_Send( p_input->p_es_out, tk.p_es, p_block );
/* use time stamp only for first block */ /* use time stamp only for first block */
i_pts = 0; i_pts = 0;
......