aboutsummaryrefslogtreecommitdiffstats
path: root/ffserver.c
diff options
context:
space:
mode:
authorPhilip Gladstone <philipjsg@users.sourceforge.net>2003-04-09 02:16:01 +0000
committerPhilip Gladstone <philipjsg@users.sourceforge.net>2003-04-09 02:16:01 +0000
commite322ea480b42e741ff49c827a298d5d26d0b5a25 (patch)
treef711305566ddf8c40685439a4d84d78d9ab12099 /ffserver.c
parent8553d9f4fdefdb24c2f7037881a829e831636b02 (diff)
downloadffmpeg-e322ea480b42e741ff49c827a298d5d26d0b5a25.tar.gz
* Add Video4MotionVector in a stream description to behave like the -4mv flag
* Add ReadOnlyFile which behaves like File, but does not permit changing of the file. This can be used to prevent deleting of saved ffm files. Originally committed as revision 1743 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffserver.c')
-rw-r--r--ffserver.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/ffserver.c b/ffserver.c
index e55169e164..8b220b48f6 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -208,6 +208,7 @@ typedef struct FFStream {
/* feed specific */
int feed_opened; /* true if someone is writing to the feed */
int is_feed; /* true if it is a feed */
+ int readonly; /* True if writing is prohibited to the file */
int conns_served;
int64_t bytes_served;
int64_t feed_max_size; /* maximum storage size */
@@ -2389,6 +2390,10 @@ static int http_start_receive_data(HTTPContext *c)
if (c->stream->feed_opened)
return -1;
+ /* Don't permit writing to this one */
+ if (c->stream->readonly)
+ return -1;
+
/* open feed */
fd = open(c->stream->feed_filename, O_RDWR);
if (fd < 0)
@@ -3455,12 +3460,24 @@ static void build_feed_streams(void)
printf("Deleting feed file '%s' as it appears to be corrupt\n",
feed->feed_filename);
}
- if (!matches)
+ if (!matches) {
+ if (feed->readonly) {
+ printf("Unable to delete feed file '%s' as it is marked readonly\n",
+ feed->feed_filename);
+ exit(1);
+ }
unlink(feed->feed_filename);
+ }
}
if (!url_exist(feed->feed_filename)) {
AVFormatContext s1, *s = &s1;
+ if (feed->readonly) {
+ printf("Unable to create feed file '%s' as it is marked readonly\n",
+ feed->feed_filename);
+ exit(1);
+ }
+
/* only write the header of the ffm file */
if (url_fopen(&s->pb, feed->feed_filename, URL_WRONLY) < 0) {
fprintf(stderr, "Could not open output feed file '%s'\n",
@@ -3815,6 +3832,13 @@ static int parse_ffconfig(const char *filename)
snprintf(feed->child_argv[i], 256, "http://127.0.0.1:%d/%s",
ntohs(my_http_addr.sin_port), feed->filename);
}
+ } else if (!strcasecmp(cmd, "ReadOnlyFile")) {
+ if (feed) {
+ get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p);
+ feed->readonly = 1;
+ } else if (stream) {
+ get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);
+ }
} else if (!strcasecmp(cmd, "File")) {
if (feed) {
get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p);
@@ -4053,6 +4077,11 @@ static int parse_ffconfig(const char *filename)
if (stream) {
video_enc.flags |= CODEC_FLAG_HQ;
}
+ } else if (!strcasecmp(cmd, "Video4MotionVector")) {
+ if (stream) {
+ video_enc.flags |= CODEC_FLAG_HQ;
+ video_enc.flags |= CODEC_FLAG_4MV;
+ }
} else if (!strcasecmp(cmd, "VideoQDiff")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {