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
39#include "libavutil/avstring.h"39#include "libavutil/avstring.h"
40#include "libavutil/lfg.h"40#include "libavutil/lfg.h"
41#include "libavutil/dict.h"41#include "libavutil/dict.h"
42#include "libavutil/intreadwrite.h"
42#include "libavutil/mathematics.h"43#include "libavutil/mathematics.h"
43#include "libavutil/random_seed.h"44#include "libavutil/random_seed.h"
44#include "libavutil/parseutils.h"45#include "libavutil/parseutils.h"
@@ -323,6 +324,37 @@ static AVLFG random_state; · 278 unmodified lines
323 324
324static FILE *logfile = NULL;325static FILE *logfile = NULL;
325 326
327static 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
337static 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
350static 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
326/* FIXME: make avserver work with IPv6 */358/* FIXME: make avserver work with IPv6 */
327/* resolve host with also IP address parsing */359/* resolve host with also IP address parsing */
328static int resolve_host(struct in_addr *sin_addr, const char *hostname)360static 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