So can the ffserver patch be committed?
>From 5b681fdaf7971f841b84cfe06412c67ba417fb00 Mon Sep 17 00:00:00 2001 From: Caligula useraccount <calig...@sarijopen.student.utwente.nl> Date: Mon, 11 May 2015 17:42:42 -0600 Subject: [PATCH] ffserver jpg patch --- ffserver.c | 4 ++++ ffserver_config.c | 6 ++++-- ffserver_config.h | 1 + libavformat/allformats.c | 1 + libavformat/rawenc.c | 12 ++++++++++++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ffserver.c b/ffserver.c index 4803b96..2b99241 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 */ diff --git a/libavformat/allformats.c b/libavformat/allformats.c index e6a9d01..2c78e39 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -273,6 +273,7 @@ void av_register_all(void) REGISTER_MUXER (SEGMENT, stream_segment); REGISTER_DEMUXER (SHORTEN, shorten); REGISTER_DEMUXER (SIFF, siff); + REGISTER_MUXER (SINGLEJPEG, singlejpeg); REGISTER_DEMUXER (SLN, sln); REGISTER_DEMUXER (SMACKER, smacker); REGISTER_MUXDEMUX(SMJPEG, smjpeg); diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c index 9b77cdc..9f1fab7 100644 --- a/libavformat/rawenc.c +++ b/libavformat/rawenc.c @@ -250,6 +250,18 @@ AVOutputFormat ff_mjpeg_muxer = { .write_packet = ff_raw_write_packet, .flags = AVFMT_NOTIMESTAMPS, }; + +AVOutputFormat ff_singlejpeg_muxer = { + .name = "singlejpeg", + .long_name = NULL_IF_CONFIG_SMALL("JPEG single image"), + .mime_type = "image/jpeg", + .extensions = "jpg,jpeg", + .audio_codec = AV_CODEC_ID_NONE, + .video_codec = AV_CODEC_ID_MJPEG, + .write_packet = ff_raw_write_packet, + .flags = AVFMT_NOTIMESTAMPS, + .write_header = force_one_stream, +}; #endif #if CONFIG_MLP_MUXER -- 2.1.4
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel