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.
Showing the changes to avserver.c (1 of 3 files). Show all
Unified · Split
| @@ -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 | ||
| 324 | static FILE *logfile = NULL; | 325 | static FILE *logfile = NULL; |
| 325 | 326 | ||
| 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 | |||
| 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 */ |
| 328 | static int resolve_host(struct in_addr *sin_addr, const char *hostname) | 360 | static int resolve_host(struct in_addr *sin_addr, const char *hostname) |