[vlc-devel] [PATCH] Allow the image separator to be specified on the command line

David R Robison drrobison at openroadsconsulting.com
Thu Aug 22 16:18:32 CEST 2013


I have found that some MJPEG cameras, such as the IQEye cameras, while 
playing with VLC 2.0.7, do not play with 2.1.0. The problem seems to be 
that the cameras send an incorrect image separator. For example, the 
IQEye sends

HTTP/1.0 200 OK
Cache-Control: no-cache
Content-Type: multipart/x-mixed-replace; boundary=--ImageSeparator

--ImageSeparator

instead of

HTTP/1.0 200 OK
Cache-Control: no-cache
Content-Type: multipart/x-mixed-replace; boundary=ImageSeparator

--ImageSeparator

This patch allows the user to specify the image separator on the command 
line to allow these cameras to be played with 2.1.0.
David

---
  modules/demux/mjpeg.c |   33 +++++++++++++++++++++------------
  1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/modules/demux/mjpeg.c b/modules/demux/mjpeg.c
index 8def7f8..fd12973 100644
--- a/modules/demux/mjpeg.c
+++ b/modules/demux/mjpeg.c
@@ -48,6 +48,10 @@ static void Close( vlc_object_t * );
      "playing MJPEG from a file. Use 0 (this is the default value) for 
a " \
      "live stream (from a camera).")

+#define SEPARATOR_TEXT N_("Image Separator")
+#define SEPARATOR_LONGTEXT N_("This is used to manually set the image 
separator " \
+    "for cameras that do not comply with RFC2046")
+
  vlc_module_begin ()
      set_shortname( "MJPEG")
      set_description( N_("M-JPEG camera demuxer") )
@@ -56,6 +60,7 @@ vlc_module_begin ()
      set_category( CAT_INPUT )
      set_subcategory( SUBCAT_INPUT_DEMUX )
      add_float( "mjpeg-fps", 0.0, FPS_TEXT, FPS_LONGTEXT, false )
+    add_string( "mjpeg-separator", NULL, SEPARATOR_TEXT, 
SEPARATOR_LONGTEXT, false )
  vlc_module_end ()

  /*****************************************************************************
@@ -322,19 +327,23 @@ static int Open( vlc_object_t * p_this )
          char* boundary = strstr( content_type, "boundary=" );
          if( boundary )
          {
-        boundary += strlen( "boundary=" );
-        size_t len = strlen( boundary );
-        if( len > 2 && boundary[0] == '"'
-            && boundary[len-1] == '"' )
-        {
-            boundary[len-1] = '\0';
-            boundary++;
-        }
-            p_sys->psz_separator = strdup( boundary );
-            if( !p_sys->psz_separator )
+            p_sys->psz_separator = var_InheritString(p_demux, 
"mjpeg-separator");
+            if (p_sys->psz_separator == NULL)
              {
-                free( content_type );
-                goto error;
+            boundary += strlen( "boundary=" );
+            size_t len = strlen( boundary );
+            if( len > 2 && boundary[0] == '"'
+                && boundary[len-1] == '"' )
+                {
+                boundary[len-1] = '\0';
+                boundary++;
+                }
+                p_sys->psz_separator = strdup( boundary );
+                if( !p_sys->psz_separator )
+                {
+                    free( content_type );
+                    goto error;
+                }
              }
          }
          free( content_type );
-- 
1.7.9.5




This email communication (including any attachments) may contain confidential and/or privileged material intended solely for the individual or entity to which it is addressed.
If you are not the intended recipient, please delete this email immediately.




More information about the vlc-devel mailing list