This is a pretty old patch created by "Otávio Ribeiro"
<ota...@otavio.eng.br> in Jun 2006. You can read the original submission
at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=374931

I haven't tested it myself, but forward ported it to current svn. The
original report says:

> When i try to show an image from a ffserver single jpeg output stream
> the client browser keep downloading it forever. That's because ffserver
> doesn't support a single jpeg stream and treat it as a multipart jpeg
> sequence.
> 
> So i've made the follow path to correct the problem.
> I've corrected the mime-type to image/jpeg as well.
> 
> The idea is just to close the connection after a jpeg frame has been
> sent to client.

Patch attached:

Index: ffserver.c
===================================================================
--- ffserver.c	(revision 16768)
+++ ffserver.c	(working copy)
@@ -227,6 +227,8 @@
     int multicast_ttl;
     int loop; /* if true, send the stream in loops (only meaningful if file) */
 
+    char single_frame; /*only a single frame must be send*/
+
     /* feed specific */
     int feed_opened;     /* true if someone is writing to the feed */
     int is_feed;         /* true if it is a feed */
@@ -926,6 +928,10 @@
         /* close connection if trailer sent */
         if (c->state == HTTPSTATE_SEND_DATA_TRAILER)
             return -1;
+
+        if(c->stream->single_frame && c->data_count > c->cur_frame_bytes && c->cur_frame_bytes > 0)
+            return -1;
+
         break;
     case HTTPSTATE_RECEIVE_DATA:
         /* no need to read if no events */
@@ -4003,7 +4009,7 @@
                     stream->stream_type = STREAM_TYPE_LIVE;
                     /* jpeg cannot be used here, so use single frame jpeg */
                     if (!strcmp(arg, "jpeg"))
-                        strcpy(arg, "mjpeg");
+                        stream->single_frame=1;
                     stream->fmt = guess_stream_format(arg, NULL, NULL);
                     if (!stream->fmt) {
                         fprintf(stderr, "%s:%d: Unknown Format: %s\n",



-- 
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4

Reply via email to