Commit c89488f5 authored by Gildas Bazin's avatar Gildas Bazin

* include/stream_output.h, src/stream_output/stream_output.c: added a...

* include/stream_output.h, src/stream_output/stream_output.c: added a SOUT_MUX_CAP_GET_ADD_STREAM_WAIT muxer capability to specify that a muxer prefers to wait all ES before starting muxing.
* modules/mux/ogg.c: use SOUT_MUX_CAP_GET_ADD_STREAM_WAIT.
* modules/stream_out/transcode.c: fix for video stream header generation (theora).
* modules/codec/theora.c: don't overwrite headers.
parent 3e59b60f
......@@ -2,7 +2,7 @@
* stream_output.h : stream output module
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: stream_output.h,v 1.17 2003/11/22 17:03:57 fenrir Exp $
* $Id: stream_output.h,v 1.18 2003/12/07 17:09:33 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Laurent Aimar <fenrir@via.ecp.fr>
......@@ -124,6 +124,7 @@ struct sout_access_out_t
int (* pf_write )( sout_access_out_t *,
sout_buffer_t * );
};
/*
* i_query parameter of pf_mux_capacity
*/
......@@ -131,6 +132,9 @@ struct sout_access_out_t
#define SOUT_MUX_CAP_GET_ADD_STREAM_ANY_TIME 0x01
/* SOUT_MUX_CAP_GET_STREAMABLE: p_args=NULL, p_answer=&boolean */
#define SOUT_MUX_CAP_GET_STREAMABLE 0x02
/* SOUT_MUX_CAP_GET_ADD_STREAM_WAIT: p_args=NULL, p_answer=&boolean */
#define SOUT_MUX_CAP_GET_ADD_STREAM_WAIT 0x03
/*
* return error code
*/
......
......@@ -2,7 +2,7 @@
* theora.c: theora decoder module making use of libtheora.
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: theora.c,v 1.15 2003/11/22 23:39:14 fenrir Exp $
* $Id: theora.c,v 1.16 2003/12/07 17:09:33 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -26,6 +26,7 @@
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/decoder.h>
#include "input_ext-plugins.h"
#include <ogg/ogg.h>
......@@ -514,19 +515,27 @@ static block_t *Headers( encoder_t *p_enc )
/* Create theora headers */
if( !p_sys->b_headers )
{
ogg_packet oggpackets[3];
ogg_packet oggpackets;
int i;
theora_encode_header( &p_sys->td, &oggpackets[0] );
theora_encode_comment( &p_sys->tc, &oggpackets[1] );
theora_encode_tables( &p_sys->td, &oggpackets[2] );
/* Ogg packet to block */
for( i = 0; i < 3; i++ )
{
block_t *p_block = block_New( p_enc, oggpackets[i].bytes );
memcpy( p_block->p_buffer, oggpackets[i].packet,
oggpackets[i].bytes );
switch( i )
{
case 0:
theora_encode_header( &p_sys->td, &oggpackets );
break;
case 1:
theora_encode_comment( &p_sys->tc, &oggpackets );
break;
case 2:
theora_encode_tables( &p_sys->td, &oggpackets );
break;
}
block_t *p_block = block_New( p_enc, oggpackets.bytes );
memcpy( p_block->p_buffer, oggpackets.packet, oggpackets.bytes );
p_block->i_dts = p_block->i_pts = p_block->i_length = 0;
block_ChainAppend( &p_chain, p_block );
}
......
......@@ -2,7 +2,7 @@
* ogg.c: ogg muxer module for vlc
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: ogg.c,v 1.24 2003/12/04 22:37:02 gbazin Exp $
* $Id: ogg.c,v 1.25 2003/12/07 17:09:33 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -321,6 +321,9 @@ static int Capability( sout_mux_t *p_mux, int i_query, void *p_args,
case SOUT_MUX_CAP_GET_ADD_STREAM_ANY_TIME:
*(vlc_bool_t*)p_answer = VLC_TRUE;
return( SOUT_MUX_CAP_ERR_OK );
case SOUT_MUX_CAP_GET_ADD_STREAM_WAIT:
*(vlc_bool_t*)p_answer = VLC_TRUE;
return( SOUT_MUX_CAP_ERR_OK );
default:
return( SOUT_MUX_CAP_ERR_UNIMPLEMENTED );
}
......
......@@ -2,7 +2,7 @@
* transcode.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: transcode.c,v 1.60 2003/12/07 12:11:13 gbazin Exp $
* $Id: transcode.c,v 1.61 2003/12/07 17:09:33 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -1261,16 +1261,25 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
return VLC_EGENERIC;
}
while( id->p_encoder->pf_header &&
(p_block = id->p_encoder->pf_header( id->p_encoder )) )
if( id->p_encoder->pf_header )
{
sout_buffer_t *p_out;
p_out = sout_BufferNew( p_stream->p_sout, p_block->i_buffer );
memcpy( p_out->p_buffer, p_block->p_buffer, p_block->i_buffer);
p_out->i_dts = in->i_dts;
p_out->i_pts = in->i_dts;
p_out->i_length = 0;
sout_BufferChain( out, p_out );
p_block = id->p_encoder->pf_header( id->p_encoder );
while( p_block )
{
sout_buffer_t *p_out;
block_t *p_prev_block = p_block;
p_out = sout_BufferNew( p_stream->p_sout,
p_block->i_buffer );
memcpy( p_out->p_buffer, p_block->p_buffer,
p_block->i_buffer);
p_out->i_dts = p_out->i_pts = in->i_dts;
p_out->i_length = 0;
sout_BufferChain( out, p_out );
p_block = p_block->p_next;
block_Release( p_prev_block );
}
}
id->i_inter_pixfmt =
......
......@@ -2,7 +2,7 @@
* stream_output.c : stream output module
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: stream_output.c,v 1.35 2003/11/21 15:32:09 fenrir Exp $
* $Id: stream_output.c,v 1.36 2003/12/07 17:09:33 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Laurent Aimar <fenrir@via.ecp.fr>
......@@ -382,8 +382,8 @@ sout_mux_t * sout_MuxNew ( sout_instance_t *p_sout,
{
int b_answer;
if( p_mux->pf_capacity( p_mux,
SOUT_MUX_CAP_GET_ADD_STREAM_ANY_TIME,
NULL, (void*)&b_answer ) != SOUT_MUX_CAP_ERR_OK )
SOUT_MUX_CAP_GET_ADD_STREAM_ANY_TIME, NULL,
(void*)&b_answer ) != SOUT_MUX_CAP_ERR_OK )
{
b_answer = VLC_FALSE;
}
......@@ -392,6 +392,19 @@ sout_mux_t * sout_MuxNew ( sout_instance_t *p_sout,
msg_Dbg( p_sout, "muxer support adding stream at any time" );
p_mux->b_add_stream_any_time = VLC_TRUE;
p_mux->b_waiting_stream = VLC_FALSE;
if( p_mux->pf_capacity( p_mux,
SOUT_MUX_CAP_GET_ADD_STREAM_WAIT, NULL,
(void*)&b_answer ) != SOUT_MUX_CAP_ERR_OK )
{
b_answer = VLC_FALSE;
}
if( b_answer )
{
msg_Dbg( p_sout, "muxer prefers waiting for all ES before "
"starting muxing" );
p_mux->b_waiting_stream = VLC_TRUE;
}
}
else
{
......@@ -409,7 +422,7 @@ sout_mux_t * sout_MuxNew ( sout_instance_t *p_sout,
return p_mux;
}
void sout_MuxDelete ( sout_mux_t *p_mux )
void sout_MuxDelete( sout_mux_t *p_mux )
{
if( p_mux->p_module )
{
......@@ -422,14 +435,14 @@ void sout_MuxDelete ( sout_mux_t *p_mux )
vlc_object_destroy( p_mux );
}
sout_input_t *sout_MuxAddStream( sout_mux_t *p_mux,
es_format_t *p_fmt )
sout_input_t *sout_MuxAddStream( sout_mux_t *p_mux, es_format_t *p_fmt )
{
sout_input_t *p_input;
if( !p_mux->b_add_stream_any_time && !p_mux->b_waiting_stream)
if( !p_mux->b_add_stream_any_time && !p_mux->b_waiting_stream )
{
msg_Err( p_mux, "cannot add a new stream (unsuported while muxing for this format)" );
msg_Err( p_mux, "cannot add a new stream (unsuported while muxing "
"for this format)" );
return NULL;
}
if( p_mux->i_add_stream_start < 0 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment