Mercurial > mplayer.hg
comparison libmpdemux/stream.h @ 7412:ecef4f2191b2
some cosmetics - reordering declarations, 10l for cache2
author | arpi |
---|---|
date | Sun, 15 Sep 2002 22:38:01 +0000 |
parents | 0c6948b8100f |
children | 4c51ce16c4a2 |
comparison
equal
deleted
inserted
replaced
7411:72a9bd0314a4 | 7412:ecef4f2191b2 |
---|---|
1 #ifndef __STREAM_H | 1 #ifndef __STREAM_H |
2 #define __STREAM_H | 2 #define __STREAM_H |
3 | 3 |
4 #include "mp_msg.h" | 4 #include "mp_msg.h" |
5 #include <string.h> | |
5 #include <inttypes.h> | 6 #include <inttypes.h> |
6 #include <sys/types.h> | 7 #include <sys/types.h> |
7 | |
8 #define STREAM_BUFFER_SIZE 2048 | |
9 | 8 |
10 #define STREAMTYPE_DUMMY -1 // for placeholders, when the actual reading is handled in the demuxer | 9 #define STREAMTYPE_DUMMY -1 // for placeholders, when the actual reading is handled in the demuxer |
11 #define STREAMTYPE_FILE 0 // read from seekable file | 10 #define STREAMTYPE_FILE 0 // read from seekable file |
12 #define STREAMTYPE_VCD 1 // raw mode-2 CDROM reading, 2324 bytes/sector | 11 #define STREAMTYPE_VCD 1 // raw mode-2 CDROM reading, 2324 bytes/sector |
13 #define STREAMTYPE_STREAM 2 // same as FILE but no seeking (for net/stdin) | 12 #define STREAMTYPE_STREAM 2 // same as FILE but no seeking (for net/stdin) |
15 #define STREAMTYPE_MEMORY 4 // read data from memory area | 14 #define STREAMTYPE_MEMORY 4 // read data from memory area |
16 #define STREAMTYPE_PLAYLIST 6 // FIXME!!! same as STREAMTYPE_FILE now | 15 #define STREAMTYPE_PLAYLIST 6 // FIXME!!! same as STREAMTYPE_FILE now |
17 #define STREAMTYPE_DS 8 // read from a demuxer stream | 16 #define STREAMTYPE_DS 8 // read from a demuxer stream |
18 #define STREAMTYPE_DVDNAV 9 // we cannot safely "seek" in this... | 17 #define STREAMTYPE_DVDNAV 9 // we cannot safely "seek" in this... |
19 #define STREAMTYPE_CDDA 10 // raw audio CD reader | 18 #define STREAMTYPE_CDDA 10 // raw audio CD reader |
19 | |
20 #define STREAM_BUFFER_SIZE 2048 | |
20 | 21 |
21 #define VCD_SECTOR_SIZE 2352 | 22 #define VCD_SECTOR_SIZE 2352 |
22 #define VCD_SECTOR_OFFS 24 | 23 #define VCD_SECTOR_OFFS 24 |
23 #define VCD_SECTOR_DATA 2324 | 24 #define VCD_SECTOR_DATA 2324 |
24 | 25 |
45 unsigned char buffer[STREAM_BUFFER_SIZE>VCD_SECTOR_SIZE?STREAM_BUFFER_SIZE:VCD_SECTOR_SIZE]; | 46 unsigned char buffer[STREAM_BUFFER_SIZE>VCD_SECTOR_SIZE?STREAM_BUFFER_SIZE:VCD_SECTOR_SIZE]; |
46 } stream_t; | 47 } stream_t; |
47 | 48 |
48 #ifdef USE_STREAM_CACHE | 49 #ifdef USE_STREAM_CACHE |
49 int stream_enable_cache(stream_t *stream,int size,int min,int prefill); | 50 int stream_enable_cache(stream_t *stream,int size,int min,int prefill); |
51 int cache_stream_fill_buffer(stream_t *s); | |
52 int cache_stream_seek_long(stream_t *s,off_t pos); | |
50 #else | 53 #else |
51 // no cache | 54 // no cache, define wrappers: |
52 #define cache_stream_fill_buffer(x) stream_fill_buffer(x) | 55 #define cache_stream_fill_buffer(x) stream_fill_buffer(x) |
53 #define cache_stream_seek_long(x,y) stream_seek_long(x,y) | 56 #define cache_stream_seek_long(x,y) stream_seek_long(x,y) |
54 #define stream_enable_cache(x,y,z,w) 1 | 57 #define stream_enable_cache(x,y,z,w) 1 |
55 #endif | 58 #endif |
56 | |
57 int cache_stream_fill_buffer(stream_t *s); | |
58 int cache_stream_seek_long(stream_t *s,off_t pos); | |
59 | |
60 #include <string.h> | |
61 | 59 |
62 inline static int stream_read_char(stream_t *s){ | 60 inline static int stream_read_char(stream_t *s){ |
63 return (s->buf_pos<s->buf_len)?s->buffer[s->buf_pos++]: | 61 return (s->buf_pos<s->buf_len)?s->buffer[s->buf_pos++]: |
64 (cache_stream_fill_buffer(s)?s->buffer[s->buf_pos++]:-256); | 62 (cache_stream_fill_buffer(s)?s->buffer[s->buf_pos++]:-256); |
65 // if(s->buf_pos<s->buf_len) return s->buffer[s->buf_pos++]; | 63 // if(s->buf_pos<s->buf_len) return s->buffer[s->buf_pos++]; |