else
{
// wait that all fifo have at least 3 packets (3 vorbis headers)
- return( -1 );
+ return -1;
}
}
if( pi_stream )
{
*pi_dts = i_dts;
}
- return( i_stream );
+ return i_stream;
}
/*****************************************************************************
};
static void OggSetDate( block_t *, mtime_t , mtime_t );
-static block_t *OggStreamFlush( sout_mux_t *, ogg_stream_state *,
- mtime_t );
+static block_t *OggStreamFlush( sout_mux_t *, ogg_stream_state *, mtime_t );
/*****************************************************************************
* Open: Open muxer
default:
FREE( p_input->p_sys );
- return( VLC_EGENERIC );
+ return VLC_EGENERIC;
}
break;
default:
FREE( p_input->p_sys );
- return( VLC_EGENERIC );
+ return VLC_EGENERIC;
}
break;
default:
FREE( p_input->p_sys );
- return( VLC_EGENERIC );
+ return VLC_EGENERIC;
}
break;
default:
FREE( p_input->p_sys );
- return( VLC_EGENERIC );
+ return VLC_EGENERIC;
}
p_stream->b_new = VLC_TRUE;
p_sys->i_add_streams++;
- return( VLC_SUCCESS );
+ return VLC_SUCCESS;
}
/*****************************************************************************
{
sout_mux_sys_t *p_sys = p_mux->p_sys;
ogg_stream_t *p_stream = (ogg_stream_t*)p_input->p_sys;
- block_t *p_og;
+ block_t *p_og;
msg_Dbg( p_mux, "removing input" );
else
{
/* Wasn't already added so get rid of it */
- ogg_stream_clear( &p_stream->os );
FREE( p_stream );
p_sys->i_add_streams--;
}
p_input->p_sys = NULL;
- return( 0 );
+ return 0;
}
/*****************************************************************************
* Ogg bitstream manipulation routines
*****************************************************************************/
static block_t *OggStreamFlush( sout_mux_t *p_mux,
- ogg_stream_state *p_os, mtime_t i_pts )
+ ogg_stream_state *p_os, mtime_t i_pts )
{
block_t *p_og, *p_og_first = NULL;
- ogg_page og;
+ ogg_page og;
- for( ;; )
+ while( ogg_stream_flush( p_os, &og ) )
{
- /* flush all data */
- int i_result;
- int i_size;
- if( ( i_result = ogg_stream_flush( p_os, &og ) ) == 0 )
- {
- break;
- }
-
- i_size = og.header_len + og.body_len;
- p_og = block_New( p_mux, i_size);
+ /* Flush all data */
+ p_og = block_New( p_mux, og.header_len + og.body_len );
memcpy( p_og->p_buffer, og.header, og.header_len );
memcpy( p_og->p_buffer + og.header_len, og.body, og.body_len );
p_og->i_pts = i_pts;
p_og->i_length = 0;
- i_pts = 0; // write it only once
+ i_pts = 0; // write it only once
block_ChainAppend( &p_og_first, p_og );
}
- return( p_og_first );
+ return p_og_first;
}
static block_t *OggStreamPageOut( sout_mux_t *p_mux,
- ogg_stream_state *p_os, mtime_t i_pts )
+ ogg_stream_state *p_os, mtime_t i_pts )
{
block_t *p_og, *p_og_first = NULL;
- ogg_page og;
+ ogg_page og;
- for( ;; )
+ while( ogg_stream_pageout( p_os, &og ) )
{
- /* flush all data */
- int i_result;
- int i_size;
- if( ( i_result = ogg_stream_pageout( p_os, &og ) ) == 0 )
- {
- break;
- }
-
- i_size = og.header_len + og.body_len;
- p_og = block_New( p_mux, i_size);
+ /* Flush all data */
+ p_og = block_New( p_mux, og.header_len + og.body_len );
memcpy( p_og->p_buffer, og.header, og.header_len );
memcpy( p_og->p_buffer + og.header_len, og.body, og.body_len );
p_og->i_pts = i_pts;
p_og->i_length = 0;
- i_pts = 0; // write them only once
+ i_pts = 0; // write them only once
block_ChainAppend( &p_og_first, p_og );
}
- return( p_og_first );
+ return p_og_first;
}
static block_t *OggCreateHeader( sout_mux_t *p_mux, mtime_t i_dts )
{
p_og->i_flags |= BLOCK_FLAG_HEADER;
}
- return( p_hdr );
+ return p_hdr;
}
static block_t *OggCreateFooter( sout_mux_t *p_mux, mtime_t i_dts )
ogg_stream_clear( &p_sys->pp_del_streams[i]->os );
}
- return( p_hdr );
+ return p_hdr;
}
static void OggSetDate( block_t *p_og, mtime_t i_dts, mtime_t i_length )
static int Mux( sout_mux_t *p_mux )
{
sout_mux_sys_t *p_sys = p_mux->p_sys;
- block_t *p_og = NULL;
+ block_t *p_og = NULL;
int i_stream;
mtime_t i_dts;
if( MuxGetStream( p_mux, &i_stream, &i_dts) < 0 )
{
msg_Dbg( p_mux, "waiting for data..." );
- return( VLC_SUCCESS );
+ return VLC_SUCCESS;
}
if( p_sys->i_streams )
for( ;; )
{
- sout_input_t *p_input;
- ogg_stream_t *p_stream;
+ sout_input_t *p_input;
+ ogg_stream_t *p_stream;
block_t *p_data;
- ogg_packet op;
+ ogg_packet op;
if( MuxGetStream( p_mux, &i_stream, &i_dts) < 0 )
{
- return( VLC_SUCCESS );
+ return VLC_SUCCESS;
}
p_input = p_mux->pp_inputs[i_stream];
p_stream->i_fourcc != VLC_FOURCC( 's', 'p', 'x', ' ' ) &&
p_stream->i_fourcc != VLC_FOURCC( 't', 'h', 'e', 'o' ) )
{
- p_data = block_Realloc( p_data, 1, 0 );
+ p_data = block_Realloc( p_data, 1, p_data->i_buffer );
p_data->p_buffer[0] = PACKET_IS_SYNCPOINT; // FIXME
}
{
/* Subtitles or Speex packets are quite small so they
* need to be flushed to be sent on time */
- block_ChainAppend( &p_og, OggStreamFlush( p_mux, &p_stream->os,
- p_data->i_dts ) );
+ p_og = OggStreamFlush( p_mux, &p_stream->os, p_data->i_dts );
}
else
{
- block_ChainAppend( &p_og, OggStreamPageOut( p_mux, &p_stream->os,
- p_data->i_dts ) );
+ p_og = OggStreamPageOut( p_mux, &p_stream->os, p_data->i_dts );
}
if( p_og )
p_stream->i_length = 0;
sout_AccessOutWrite( p_mux->p_access, p_og );
-
- p_og = NULL;
}
else
{