summaryrefslogtreecommitdiff
path: root/ffserver.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-17 14:17:55 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-17 14:17:55 +0200
commitd6e87190fd0725f3517493f67dca6f8f264bb370 (patch)
tree05a0a27c98a183c9210a0233860702a90701d977 /ffserver.c
parent1ade37ae9c2b1e4e68948af2474698ad45d504f4 (diff)
parenta25d912dca9cd553440167e0476c47581359c0fc (diff)
downloadffmpeg-d6e87190fd0725f3517493f67dca6f8f264bb370.tar.gz
Merge commit 'a25d912dca9cd553440167e0476c47581359c0fc'
* commit 'a25d912dca9cd553440167e0476c47581359c0fc': avcodec_encode_audio(): fix invalid free pcm-mpeg: correct bitrate calculation ffv1: K&R formatting cosmetics fate: Add rangecoder test network: #include stdint.h in network.h nut: export codec_tag provided by rawvideo avserver: move avserver-specific code from ffmdec.c to avserver.c Conflicts: ffserver.c libavcodec/ffv1.c libavformat/ffmdec.c libavformat/nutenc.c tests/ref/lavfi/crop tests/ref/lavfi/crop_scale tests/ref/lavfi/crop_scale_vflip tests/ref/lavfi/crop_vflip tests/ref/lavfi/null tests/ref/lavfi/pixdesc tests/ref/lavfi/pixfmts_copy tests/ref/lavfi/pixfmts_crop tests/ref/lavfi/pixfmts_hflip tests/ref/lavfi/pixfmts_null tests/ref/lavfi/pixfmts_pad tests/ref/lavfi/pixfmts_scale tests/ref/lavfi/pixfmts_vflip tests/ref/lavfi/scale200 tests/ref/lavfi/scale500 tests/ref/lavfi/vflip tests/ref/lavfi/vflip_crop tests/ref/lavfi/vflip_vflip Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffserver.c')
-rw-r--r--ffserver.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/ffserver.c b/ffserver.c
index 4dd0ae24c8..f98ee821bb 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -44,6 +44,7 @@
#include "libavutil/avstring.h"
#include "libavutil/lfg.h"
#include "libavutil/dict.h"
+#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "libavutil/random_seed.h"
#include "libavutil/parseutils.h"
@@ -328,6 +329,37 @@ static AVLFG random_state;
static FILE *logfile = NULL;
+static int64_t ffm_read_write_index(int fd)
+{
+ uint8_t buf[8];
+
+ lseek(fd, 8, SEEK_SET);
+ if (read(fd, buf, 8) != 8)
+ return AVERROR(EIO);
+ return AV_RB64(buf);
+}
+
+static int ffm_write_write_index(int fd, int64_t pos)
+{
+ uint8_t buf[8];
+ int i;
+
+ for(i=0;i<8;i++)
+ buf[i] = (pos >> (56 - i * 8)) & 0xff;
+ lseek(fd, 8, SEEK_SET);
+ if (write(fd, buf, 8) != 8)
+ return AVERROR(EIO);
+ return 8;
+}
+
+static void ffm_set_write_index(AVFormatContext *s, int64_t pos,
+ int64_t file_size)
+{
+ FFMContext *ffm = s->priv_data;
+ ffm->write_index = pos;
+ ffm->file_size = file_size;
+}
+
/* FIXME: make ffserver work with IPv6 */
/* resolve host with also IP address parsing */
static int resolve_host(struct in_addr *sin_addr, const char *hostname)