[PATCH] additional syntaxes for still images=0A=

Joseph Tulou brezhoneg1 at yahoo.fr
Sat Jan 10 21:04:01 CET 2009


=0A=
   vlc image.ext=0A=
   vlc fake://image.ext=0A=
are made equivalent to existing :=0A=
   vlc fake:// --fake-file=3Dimage.ext=0A=
---=0A=
 modules/access/fake.c |   29 ++++++++++++++++++++++++++---=0A=
 1 files changed, 26 insertions(+), 3 deletions(-)=0A=
=0A=
diff --git a/modules/access/fake.c b/modules/access/fake.c=0A=
index 2e0d990..75dbed0 100644=0A=
--- a/modules/access/fake.c=0A=
+++ b/modules/access/fake.c=0A=
@@ -33,6 +33,8 @@=0A=
 #include <vlc_plugin.h>=0A=
 #include <vlc_access.h>=0A=
 #include <vlc_demux.h>=0A=
+#include <vlc_image.h>=0A=
+#include <assert.h>=0A=
 =0A=
 =
/************************************************************************=
*****=0A=
  * Module descriptior=0A=
@@ -70,7 +72,7 @@ vlc_module_begin ()=0A=
                  true );=0A=
 =0A=
     add_shortcut( "fake" )=0A=
-    set_capability( "access_demux", 0 )=0A=
+    set_capability( "access_demux", 10 )=0A=
     set_callbacks( Open, Close )=0A=
 vlc_module_end ()=0A=
 =0A=
@@ -97,10 +99,31 @@ static int Open( vlc_object_t *p_this )=0A=
     demux_sys_t *p_sys;=0A=
     es_format_t fmt;=0A=
 =0A=
-    /* Only when selected */=0A=
-    if( *p_demux->psz_access =3D=3D '\0' )=0A=
+    /* if access is provided, it is expected to be "fake" */=0A=
+    if( *p_demux->psz_access !=3D '\0' && strcmp( p_demux->psz_access, =
"fake" ) )=0A=
         return VLC_EGENERIC;=0A=
 =0A=
+   /**=0A=
+    * if path is provided, let's see if it could be an image=0A=
+    *   "vlc fake://image.ext" or "vlc image.ext" are made=0A=
+    *   equivalent to a "vlc fake:// :fake-file=3Dimage.ext"=0A=
+    *=0A=
+    **/=0A=
+    if( p_demux->psz_path && *p_demux->psz_path )=0A=
+    {=0A=
+        vlc_fourcc_t i_codec =3D image_Ext2Fourcc( p_demux->psz_path );=0A=
+        if( !i_codec )=0A=
+            return VLC_EGENERIC;=0A=
+    =0A=
+        msg_Dbg( p_demux, "still image detected with %4.4s format",=0A=
+                          (const char*) &i_codec );=0A=
+=0A=
+        /* set up fake-file on the fly (attached to the input object) */=0A=
+        assert( p_demux->p_parent );=0A=
+        var_Create( p_demux->p_parent, "fake-file", VLC_VAR_STRING );=0A=
+        var_SetString( p_demux->p_parent, "fake-file", =
p_demux->psz_path );=0A=
+    }=0A=
+    =0A=
     /* Set up p_demux */=0A=
     DEMUX_INIT_COMMON(); p_sys =3D p_demux->p_sys;=0A=
     p_demux->info.i_update =3D 0;=0A=
-- =0A=
1.5.2.5=0A=
=0A=

------=_NextPart_000_0007_01C973FB.F1232E50
Content-Type: application/octet-stream;
	name="0002-directory.c-now-takes-into-account-still-images-with.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="0002-directory.c-now-takes-into-account-still-images-with.patch"



More information about the vlc-devel mailing list