1 /********************************************************************
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. *
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/ *
12 ********************************************************************
16 ********************************************************************/
22 #include "transport.h"
26 typedef struct decoder_stats_t
{
27 double total_time
; /* seconds */
28 double current_time
; /* seconds */
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
;
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
;
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
{
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
);
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__ */