Skip to content

Commit

Permalink
ffserver: Use singlejpeg muxer for jpeg
Browse files Browse the repository at this point in the history
Fixes Ticket4218

Based on patch by: Otávio Ribeiro
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
  • Loading branch information
Caligula useraccount authored and michaelni committed Jun 8, 2015
1 parent 51ac1f6 commit 3b89a67
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ffserver.c
Expand Up @@ -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 */
Expand Down
6 changes: 4 additions & 2 deletions ffserver_config.c
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions ffserver_config.h
Expand Up @@ -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 */
Expand Down

0 comments on commit 3b89a67

Please sign in to comment.