[vlc-devel] [PATCH] specify initial MJPEG frame size estimate on the command line

David R Robison drrobison at openroadsconsulting.com
Tue Jul 30 13:26:31 CEST 2013


I have attached a proposed patch that allows the initial MJPEG frame 
size estimate to be set on the command line. We have some MJPEG cameras 
that send images that are around 140K. By setting the initial size on 
the command line we can reduce the amount of memory reallocation.
Thanks, David

-- 

David R Robison
Open Roads Consulting, Inc.
103 Watson Road, Chesapeake, VA 23320
phone: (757) 546-3401
e-mail: drrobison at openroadsconsulting.com
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: 
http://www.xulonpress.com/bookstore/bookdetail.php?PB_ISBN=9781597816526




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.
-------------- next part --------------
>From b15482ecdd1aa82c88f70fff7d8941ff3c73eee3 Mon Sep 17 00:00:00 2001
From: David Robison <kc7bfi at debian>
Date: Mon, 29 Jul 2013 16:05:04 -0400
Subject: [PATCH] Allow initial frame size to be set on command line

---
 modules/demux/mjpeg.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mjpeg.c b/modules/demux/mjpeg.c
index 8def7f8..62905db 100644
--- a/modules/demux/mjpeg.c
+++ b/modules/demux/mjpeg.c
@@ -48,6 +48,9 @@ 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 FRAMESIZE_TEXT N_("Frame Size Estimate in kb")
+#define FRAMESIZE_LONGTEXT N_("This is the initial frame size estimate in killobytes.")
+
 vlc_module_begin ()
     set_shortname( "MJPEG")
     set_description( N_("M-JPEG camera demuxer") )
@@ -56,6 +59,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_integer( "mjpeg-framesize", 15, FRAMESIZE_TEXT, FRAMESIZE_LONGTEXT, false )
 vlc_module_end ()
 
 /*****************************************************************************
@@ -312,8 +316,9 @@ static int Open( vlc_object_t * p_this )
     p_sys->i_time       = VLC_TS_0;
     p_sys->i_level      = 0;
 
+    int framesize = var_InheritInteger(p_demux, "mjpeg-framesize");
     p_sys->psz_separator = NULL;
-    p_sys->i_frame_size_estimate = 15 * 1024;
+    p_sys->i_frame_size_estimate = framesize * 1024;
 
     char *content_type = stream_ContentType( p_demux->s );
     if ( content_type )
-- 
1.7.10.4




More information about the vlc-devel mailing list