History

avserver: move avserver-specific code from ffmdec.c to avserver.c

This way avserver only depends on the data structures of the ffm demuxer, which it already does, and not also on private functions being exported by the library.

Mans Rullgard committed 14 years ago

Commit 3b20eb21 parent 07b37903 files · +32 −37Browse files

Showing the changes to avserver.c (1 of 3 files). Show all

Unified · Split

avserver.c+32−0
@@ -39,6 +39,7 @@ · 38 unmodified lines
3939 #include "libavutil/avstring.h"
4040 #include "libavutil/lfg.h"
4141 #include "libavutil/dict.h"
42+#include "libavutil/intreadwrite.h"
4243 #include "libavutil/mathematics.h"
4344 #include "libavutil/random_seed.h"
4445 #include "libavutil/parseutils.h"
@@ -323,6 +324,37 @@ static AVLFG random_state; · 278 unmodified lines
323324
324325 static FILE *logfile = NULL;
325326
327+static int64_t ffm_read_write_index(int fd)
328+{
329+ uint8_t buf[8];
330+
331+ lseek(fd, 8, SEEK_SET);
332+ if (read(fd, buf, 8) != 8)
333+ return AVERROR(EIO);
334+ return AV_RB64(buf);
335+}
336+
337+static int ffm_write_write_index(int fd, int64_t pos)
338+{
339+ uint8_t buf[8];
340+ int i;
341+
342+ for(i=0;i<8;i++)
343+ buf[i] = (pos >> (56 - i * 8)) & 0xff;
344+ lseek(fd, 8, SEEK_SET);
345+ if (write(fd, buf, 8) != 8)
346+ return AVERROR(EIO);
347+ return 8;
348+}
349+
350+static void ffm_set_write_index(AVFormatContext *s, int64_t pos,
351+ int64_t file_size)
352+{
353+ FFMContext *ffm = s->priv_data;
354+ ffm->write_index = pos;
355+ ffm->file_size = file_size;
356+}
357+
326358 /* FIXME: make avserver work with IPv6 */
327359 /* resolve host with also IP address parsing */
328360 static int resolve_host(struct in_addr *sin_addr, const char *hostname)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t