Add Russian translation provided by Валерий Крувялис <valkru@mail.ru>
[xiph-mirror.git] / vorbis-tools / ogg123 / transport.h
blob11921ef7f11b27002ab88f85dffa8037cfed430f
1 /********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
5 * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
6 * PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7 * *
8 * THE Ogg123 SOURCE CODE IS (C) COPYRIGHT 2000-2001 *
9 * by Stan Seibert <volsung@xiph.org> AND OTHER CONTRIBUTORS *
10 * http://www.xiph.org/ *
11 * *
12 ********************************************************************
14 last mod: $Id$
16 ********************************************************************/
18 #ifndef __TRANSPORT_H__
19 #define __TRANSPORT_H__
21 #include <sys/types.h>
22 #include <unistd.h>
23 #include "ogg/os_types.h"
24 #include "buffer.h"
25 #include "ogg123.h"
27 typedef struct data_source_stats_t {
28 ogg_int64_t bytes_read;
29 int input_buffer_used; /* flag to show if this data_source uses an
30 input buffer. Ignore the contents of
31 input_buffer and transfer rate if it is
32 false. */
33 long transfer_rate;
34 buffer_stats_t input_buffer;
35 } data_source_stats_t;
37 struct transport_t;
39 typedef struct data_source_t {
40 char *source_string;
41 struct transport_t *transport;
42 void *private;
43 } data_source_t;
45 typedef struct transport_t {
46 char *name;
47 int (* can_transport)(char *source_string);
48 data_source_t* (* open) (char *source_string, ogg123_options_t *ogg123_opts);
49 int (* peek) (data_source_t *source, void *ptr, size_t size, size_t nmemb);
50 int (* read) (data_source_t *source, void *ptr, size_t size, size_t nmemb);
51 int (* seek) (data_source_t *source, long offset, int whence);
52 data_source_stats_t * (* statistics) (data_source_t *source);
53 long (* tell) (data_source_t *source);
54 void (* close) (data_source_t *source);
55 } transport_t;
57 transport_t *get_transport_by_name (char *name);
58 transport_t *select_transport (char *source);
60 data_source_stats_t *malloc_data_source_stats (data_source_stats_t *to_copy);
62 #endif /* __TRANSPORT_H__ */