summaryrefslogtreecommitdiffstats
path: root/stream/stream.h
diff options
context:
space:
mode:
Diffstat (limited to 'stream/stream.h')
-rw-r--r--stream/stream.h33
1 files changed, 19 insertions, 14 deletions
diff --git a/stream/stream.h b/stream/stream.h
index e281a266f3..03d7431df2 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -93,7 +93,7 @@
#include "network.h"
#endif
-struct stream_st;
+struct stream;
typedef struct stream_info_st {
const char *info;
const char *name;
@@ -102,7 +102,7 @@ typedef struct stream_info_st {
/// mode isn't used atm (ie always READ) but it shouldn't be ignored
/// opts is at least in it's defaults settings and may have been
/// altered by url parsing if enabled and the options string parsing.
- int (*open)(struct stream_st* st, int mode, void* opts, int* file_format);
+ int (*open)(struct stream* st, int mode, void* opts, int* file_format);
const char* protocols[MAX_STREAM_PROTOCOLS];
const void* opts;
int opts_url; /* If this is 1 we will parse the url as an option string
@@ -110,19 +110,19 @@ typedef struct stream_info_st {
* options string given to open_stream_plugin */
} stream_info_t;
-typedef struct stream_st {
+typedef struct stream {
// Read
- int (*fill_buffer)(struct stream_st *s, char* buffer, int max_len);
+ int (*fill_buffer)(struct stream *s, char* buffer, int max_len);
// Write
- int (*write_buffer)(struct stream_st *s, char* buffer, int len);
+ int (*write_buffer)(struct stream *s, char* buffer, int len);
// Seek
- int (*seek)(struct stream_st *s,off_t pos);
+ int (*seek)(struct stream *s,off_t pos);
// Control
// Will be later used to let streams like dvd and cdda report
// their structure (ie tracks, chapters, etc)
- int (*control)(struct stream_st *s,int cmd,void* arg);
+ int (*control)(struct stream *s,int cmd,void* arg);
// Close
- void (*close)(struct stream_st *s);
+ void (*close)(struct stream *s);
int fd; // file descriptor, see man open(2)
int type; // see STREAMTYPE_*
@@ -136,20 +136,21 @@ typedef struct stream_st {
void* cache_data;
void* priv; // used for DVD, TV, RTSP etc
char* url; // strdup() of filename/url
+ struct MPOpts *opts;
#ifdef CONFIG_NETWORK
streaming_ctrl_t *streaming_ctrl;
#endif
unsigned char buffer[STREAM_BUFFER_SIZE>VCD_SECTOR_SIZE?STREAM_BUFFER_SIZE:VCD_SECTOR_SIZE];
} stream_t;
+int stream_fill_buffer(stream_t *s);
+int stream_seek_long(stream_t *s,off_t pos);
#ifdef CONFIG_STREAM_CACHE
int stream_enable_cache(stream_t *stream,int size,int min,int prefill);
int cache_stream_fill_buffer(stream_t *s);
int cache_stream_seek_long(stream_t *s,off_t pos);
#else
// no cache, define wrappers:
-int stream_fill_buffer(stream_t *s);
-int stream_seek_long(stream_t *s,off_t pos);
#define cache_stream_fill_buffer(x) stream_fill_buffer(x)
#define cache_stream_seek_long(x,y) stream_seek_long(x,y)
#define stream_enable_cache(x,y,z,w) 1
@@ -288,6 +289,7 @@ inline static int stream_seek(stream_t *s,off_t pos){
off_t x=pos-(s->pos-s->buf_len);
if(x>=0){
s->buf_pos=x;
+ s->eof = 0;
// putchar('*');fflush(stdout);
return 1;
}
@@ -314,17 +316,20 @@ inline static int stream_skip(stream_t *s,off_t len){
return 1;
}
+struct MPOpts;
void stream_reset(stream_t *s);
int stream_control(stream_t *s, int cmd, void *arg);
stream_t* new_stream(int fd,int type);
void free_stream(stream_t *s);
stream_t* new_memory_stream(unsigned char* data,int len);
-stream_t* open_stream(char* filename,char** options,int* file_format);
-stream_t* open_stream_full(char* filename,int mode, char** options, int* file_format);
-stream_t* open_output_stream(char* filename,char** options);
+stream_t* open_stream(char* filename, struct MPOpts *options,int* file_format);
+stream_t* open_stream_full(char* filename,int mode, struct MPOpts *options, int* file_format);
+stream_t* open_output_stream(char* filename,struct MPOpts *options);
/// Set the callback to be used by libstream to check for user
/// interruption during long blocking operations (cache filling, etc).
-void stream_set_interrupt_callback(int (*cb)(int));
+struct input_ctx;
+void stream_set_interrupt_callback(int (*cb)(struct input_ctx*, int),
+ struct input_ctx *ctx);
/// Call the interrupt checking callback if there is one.
int stream_check_interrupt(int time);