Commit fc9a0d16 authored by Joseph Tulou's avatar Joseph Tulou Committed by Antoine Cellerier

a straighforward still image demuxer with 100% compatibility with fake:// --fake-file=...

Signed-off-by: default avatarAntoine Cellerier <dionoea@videolan.org>
parent c803a550
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_access.h> #include <vlc_access.h>
#include <vlc_demux.h> #include <vlc_demux.h>
#include <vlc_image.h>
/***************************************************************************** /*****************************************************************************
* Module descriptior * Module descriptior
...@@ -70,7 +71,7 @@ vlc_module_begin () ...@@ -70,7 +71,7 @@ vlc_module_begin ()
true ); true );
add_shortcut( "fake" ) add_shortcut( "fake" )
set_capability( "access_demux", 0 ) set_capability( "access_demux", 100 )
set_callbacks( Open, Close ) set_callbacks( Open, Close )
vlc_module_end () vlc_module_end ()
...@@ -97,10 +98,43 @@ static int Open( vlc_object_t *p_this ) ...@@ -97,10 +98,43 @@ static int Open( vlc_object_t *p_this )
demux_sys_t *p_sys; demux_sys_t *p_sys;
es_format_t fmt; es_format_t fmt;
/* Only when selected */ if( *p_demux->psz_access != '\0' )
if( *p_demux->psz_access == '\0' ) {
/* if an access is provided, then it has to be "fake" */
if( strcmp( p_demux->psz_access, "fake" ) != 0 )
return VLC_EGENERIC;
msg_Dbg( p_demux, "fake:// access_demux detected" );
}
else
{
/**
* access is not provided,
* then let's see if path could be an image
**/
if( !p_demux->psz_path || !*p_demux->psz_path )
return VLC_EGENERIC; return VLC_EGENERIC;
vlc_fourcc_t i_codec = image_Ext2Fourcc( p_demux->psz_path );
if( !i_codec )
return VLC_EGENERIC;
char* p_codec = (char*) &i_codec;
msg_Dbg( p_demux, "still image detected with codec format %c%c%c%c",
p_codec[0], p_codec[1], p_codec[2], p_codec[3] );
vlc_object_t* p_input = vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT );
if( !p_input )
return VLC_EGENERIC;
/* set up fake-file on the fly */
var_Create( p_input, "fake-file", VLC_VAR_STRING );
var_SetString( p_input, "fake-file", p_demux->psz_path );
vlc_object_release( p_input );
}
/* Set up p_demux */ /* Set up p_demux */
DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys; DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys;
p_demux->info.i_update = 0; p_demux->info.i_update = 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