* 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>
*
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 =
sprintf( psz_file, "stream.%i", p_dec->i_object_id );
#ifndef UNDER_CE
- p_sys->i_fd = open( psz_file, O_WRONLY | O_CREAT | O_TRUNC, 00644 );
-
- if( p_sys->i_fd == -1 )
+ 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 )
{
- msg_Err( p_dec, "cannot create `%s'", psz_file );
- return VLC_EGENERIC;
+ p_sys->i_fd = open( psz_file, O_WRONLY | O_CREAT | O_TRUNC, 00644 );
+
+ if( p_sys->i_fd == -1 )
+ {
+ msg_Err( p_dec, "cannot create `%s'", psz_file );
+ return VLC_EGENERIC;
+ }
+
+ msg_Dbg( p_dec, "dumping stream to file `%s'", psz_file );
}
+ else
#endif
-
- msg_Dbg( p_dec, "dumping stream to file `%s'", psz_file );
+ {
+ p_sys->i_fd = -1;
+ }
/* Set callbacks */
p_dec->pf_decode_video = (picture_t *(*)(decoder_t *, block_t **))
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 );
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 );
* 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>
*
"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_( \
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 );
* 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>
*
}
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 );