Add Russian translation provided by Валерий Крувялис <valkru@mail.ru>
[xiph-mirror.git] / vorbis-tools / ogg123 / format.h
blobda920b667b8693c5caf94ed6886439d9fffe0e31
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 __FORMAT_H__
19 #define __FORMAT_H__
21 #include "audio.h"
22 #include "transport.h"
23 #include "ogg123.h"
26 typedef struct decoder_stats_t {
27 double total_time; /* seconds */
28 double current_time; /* seconds */
29 long instant_bitrate;
30 long avg_bitrate;
31 } decoder_stats_t;
34 /* Severity constants */
35 enum { ERROR, WARNING, INFO };
37 typedef struct decoder_callbacks_t {
38 void (* printf_error) (void *arg, int severity, char *message, ...);
39 void (* printf_metadata) (void *arg, int verbosity, char *message, ...);
40 } decoder_callbacks_t;
43 struct format_t;
45 typedef struct decoder_t {
46 data_source_t *source;
47 audio_format_t request_fmt;
48 audio_format_t actual_fmt;
49 struct format_t *format;
50 decoder_callbacks_t *callbacks;
51 void *callback_arg;
52 void *private;
53 } decoder_t;
55 /* whence constants */
56 #define DECODER_SEEK_NONE 0
57 #define DECODER_SEEK_START 1
58 #define DECODER_SEEK_CUR 2
60 typedef struct format_t {
61 char *name;
63 int (* can_decode) (data_source_t *source);
64 decoder_t* (* init) (data_source_t *source, ogg123_options_t *ogg123_opts,
65 audio_format_t *audio_fmt,
66 decoder_callbacks_t *callbacks, void *callback_arg);
67 int (* read) (decoder_t *decoder, void *ptr, int nbytes, int *eos,
68 audio_format_t *audio_fmt);
69 int (* seek) (decoder_t *decoder, double offset, int whence);
70 decoder_stats_t* (* statistics) (decoder_t *decoder);
71 void (* cleanup) (decoder_t *decoder);
72 } format_t;
74 format_t *get_format_by_name (char *name);
75 format_t *select_format (data_source_t *source);
77 decoder_stats_t *malloc_decoder_stats (decoder_stats_t *to_copy);
79 #endif /* __FORMAT_H__ */