Commit 1ddac121 authored by Gildas Bazin's avatar Gildas Bazin

* modules/misc/dummy/*: new --dummy-save-es option to specify if we want the dummy
decoder to save the raw codec data to a file. This is disabled by default (while
it was always on before).
* src/input/es_out.c: bug fix for ES autoselection.
parent 32639eac
......@@ -2,7 +2,7 @@
* decoder.c: dummy decoder plugin for vlc.
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: decoder.c,v 1.8 2003/11/16 21:07:31 gbazin Exp $
* $Id: decoder.c,v 1.9 2003/12/08 18:42:07 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -65,6 +65,7 @@ int E_(OpenDecoder) ( vlc_object_t *p_this )
decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys;
char psz_file[ PATH_MAX ];
vlc_value_t val;
/* Allocate the memory needed to store the decoder's structure */
if( ( p_dec->p_sys = p_sys =
......@@ -77,6 +78,10 @@ int E_(OpenDecoder) ( vlc_object_t *p_this )
sprintf( psz_file, "stream.%i", p_dec->i_object_id );
#ifndef UNDER_CE
var_Create( p_dec, "dummy-save-es", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Get( p_dec, "dummy-save-es", &val );
if( val.b_bool )
{
p_sys->i_fd = open( psz_file, O_WRONLY | O_CREAT | O_TRUNC, 00644 );
if( p_sys->i_fd == -1 )
......@@ -84,9 +89,14 @@ int E_(OpenDecoder) ( vlc_object_t *p_this )
msg_Err( p_dec, "cannot create `%s'", psz_file );
return VLC_EGENERIC;
}
#endif
msg_Dbg( p_dec, "dumping stream to file `%s'", psz_file );
}
else
#endif
{
p_sys->i_fd = -1;
}
/* Set callbacks */
p_dec->pf_decode_video = (picture_t *(*)(decoder_t *, block_t **))
......@@ -110,7 +120,7 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( !pp_block || !*pp_block ) return NULL;
p_block = *pp_block;
if( p_block->i_buffer )
if( p_sys->i_fd >= 0 && p_block->i_buffer )
{
#ifndef UNDER_CE
write( p_sys->i_fd, p_block->p_buffer, p_block->i_buffer );
......@@ -132,7 +142,7 @@ void E_(CloseDecoder) ( vlc_object_t *p_this )
decoder_sys_t *p_sys = p_dec->p_sys;
#ifndef UNDER_CE
close( p_sys->i_fd );
if( p_sys->i_fd >= 0 ) close( p_sys->i_fd );
#endif
free( p_sys );
......
......@@ -2,7 +2,7 @@
* dummy.c : dummy plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: dummy.c,v 1.10 2003/11/16 21:07:31 gbazin Exp $
* $Id: dummy.c,v 1.11 2003/12/08 18:42:08 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -40,6 +40,11 @@
"format instead of trying to improve performances by using the most " \
"efficient one.")
#define SAVE_TEXT N_("Save raw codec data")
#define SAVE_LONGTEXT N_( \
"This option allows you to save the raw codec data if you have " \
"selected/forced the dummy decoder in the main options." )
#ifdef WIN32
#define QUIET_TEXT N_("Don't open a dos command box interface")
#define QUIET_LONGTEXT N_( \
......@@ -70,6 +75,7 @@ vlc_module_begin();
set_description( _("dummy decoder function") );
set_capability( "decoder", 0 );
set_callbacks( E_(OpenDecoder), E_(CloseDecoder) );
add_bool( "dummy-save-es", 0, NULL, SAVE_TEXT, SAVE_LONGTEXT, VLC_FALSE );
add_submodule();
set_description( _("dummy encoder function") );
set_capability( "encoder", 0 );
......
......@@ -2,7 +2,7 @@
* es_out.c: Es Out handler for input.
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: es_out.c,v 1.8 2003/12/07 17:17:04 gbazin Exp $
* $Id: es_out.c,v 1.9 2003/12/08 18:42:08 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -519,6 +519,10 @@ static void EsOutDel( es_out_t *out, es_out_id_t *es )
}
input_DelES( p_sys->p_input, es->p_es );
if( p_sys->p_es_audio == es ) p_sys->p_es_audio = NULL;
if( p_sys->p_es_video == es ) p_sys->p_es_video = NULL;
if( p_sys->p_es_sub == es ) p_sys->p_es_sub = NULL;
vlc_mutex_unlock( &p_sys->p_input->stream.stream_lock );
free( es );
......
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