[FFmpeg-cvslog] ffserver: Use singlejpeg muxer for jpeg

Caligula useraccount git at videolan.org
Mon Jun 8 03:54:53 CEST 2015


ffmpeg | branch: master | Caligula useraccount <caligula at sarijopen.student.utwente.nl> | Mon Jun  8 03:32:29 2015 +0200| [3b89a673155fa3863e13f3595d651f37b024e6c5] | committer: Michael Niedermayer

ffserver: Use singlejpeg muxer for jpeg

Fixes Ticket4218

Based on patch by: Otávio Ribeiro
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3b89a673155fa3863e13f3595d651f37b024e6c5
---

 ffserver.c        |    4 ++++
 ffserver_config.c |    6 ++++--
 ffserver_config.h |    1 +
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index 3cb29e4..2b19bba 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -967,6 +967,10 @@ static int handle_connection(HTTPContext *c)
         /* close connection if trailer sent */
         if (c->state == HTTPSTATE_SEND_DATA_TRAILER)
             return -1;
+        /* Check if it is a single jpeg frame 123 */
+        if (c->stream->single_frame && c->data_count > c->cur_frame_bytes && c->cur_frame_bytes > 0) {
+            close_connection(c);
+        }
         break;
     case HTTPSTATE_RECEIVE_DATA:
         /* no need to read if no events */
diff --git a/ffserver_config.c b/ffserver_config.c
index 017af48..06bd8ac 100644
--- a/ffserver_config.c
+++ b/ffserver_config.c
@@ -862,8 +862,10 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd,
         } else {
             stream->stream_type = STREAM_TYPE_LIVE;
             /* JPEG cannot be used here, so use single frame MJPEG */
-            if (!strcmp(arg, "jpeg"))
-                strcpy(arg, "mjpeg");
+            if (!strcmp(arg, "jpeg")) {
+                strcpy(arg, "singlejpeg");
+                stream->single_frame=1;
+            }
             stream->fmt = ffserver_guess_format(arg, NULL, NULL);
             if (!stream->fmt)
                 ERROR("Unknown Format: '%s'\n", arg);
diff --git a/ffserver_config.h b/ffserver_config.h
index bdeb3c9..1b12194 100644
--- a/ffserver_config.h
+++ b/ffserver_config.h
@@ -79,6 +79,7 @@ typedef struct FFServerStream {
     int multicast_port;           /* first port used for multicast */
     int multicast_ttl;
     int loop;                     /* if true, send the stream in loops (only meaningful if file) */
+    char single_frame;            /* only single frame */
 
     /* feed specific */
     int feed_opened;              /* true if someone is writing to the feed */



More information about the ffmpeg-cvslog mailing list