merge down from merged-API-layer branch: cvs -q up -dP -j API_LAYER_MERGING_BASELINE...
[platform/upstream/flac.git] / src / plugin_winamp2 / playback.h
1 /* in_flac - Winamp2 FLAC input plugin\r
2  * Copyright (C) 2000,2001,2002,2003,2004,2005,2006  Josh Coalson\r
3  *\r
4  * This program is free software; you can redistribute it and/or\r
5  * modify it under the terms of the GNU General Public License\r
6  * as published by the Free Software Foundation; either version 2\r
7  * of the License, or (at your option) any later version.\r
8  *\r
9  * This program is distributed in the hope that it will be useful,\r
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
12  * GNU General Public License for more details.\r
13  *\r
14  * You should have received a copy of the GNU General Public License\r
15  * along with this program; if not, write to the Free Software\r
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
17  */\r
18 \r
19 #include "FLAC/all.h"\r
20 #include "share/replaygain_synthesis.h"\r
21 #include "plugin_common/all.h"\r
22 \r
23 /*\r
24  *  constants\r
25  */\r
26 \r
27 #define SAMPLES_PER_WRITE           576\r
28 \r
29 #define BITRATE_HIST_SEGMENT_MSEC   500\r
30 #define BITRATE_HIST_SIZE           64\r
31 \r
32 /*\r
33  *  common structures\r
34  */\r
35 \r
36 typedef struct {\r
37         volatile FLAC__bool is_playing;\r
38         volatile FLAC__bool abort_flag;\r
39         volatile FLAC__bool eof;\r
40         volatile int seek_to;\r
41         FLAC__uint64 total_samples;\r
42         unsigned bits_per_sample;\r
43         unsigned output_bits_per_sample;\r
44         unsigned channels;\r
45         unsigned sample_rate;\r
46         int length_in_msec; /* int (instead of FLAC__uint64) only because that's what Winamp uses; seeking won't work right if this maxes out */\r
47         unsigned average_bps;\r
48         FLAC__bool has_replaygain;\r
49         double replay_scale;\r
50         DitherContext dither_context;\r
51 } stream_data_struct;\r
52 \r
53 \r
54 typedef struct {\r
55         struct {\r
56                 FLAC__bool enable;\r
57                 FLAC__bool album_mode;\r
58                 int  preamp;\r
59                 FLAC__bool hard_limit;\r
60         } replaygain;\r
61         struct {\r
62                 struct {\r
63                         FLAC__bool dither_24_to_16;\r
64                 } normal;\r
65                 struct {\r
66                         FLAC__bool dither;\r
67                         int  noise_shaping; /* value must be one of NoiseShaping enum, see plugin_common/replaygain_synthesis.h */\r
68                         int  bps_out;\r
69                 } replaygain;\r
70         } resolution;\r
71         struct {\r
72                 FLAC__bool stop_err;\r
73         } misc;\r
74 } output_config_t;\r
75 \r
76 /*\r
77  *  protopytes\r
78  */\r
79 \r
80 FLAC__bool FLAC_plugin__decoder_init(FLAC__StreamDecoder *decoder, const char *filename, FLAC__int64 filesize, stream_data_struct *stream_data, output_config_t *config);\r
81 void FLAC_plugin__decoder_finish(FLAC__StreamDecoder *decoder);\r
82 void FLAC_plugin__decoder_delete(FLAC__StreamDecoder *decoder);\r
83 \r
84 int FLAC_plugin__seek(FLAC__StreamDecoder *decoder, stream_data_struct *stream_data);\r
85 unsigned FLAC_plugin__decode(FLAC__StreamDecoder *decoder, stream_data_struct *stream_data, char *sample_buffer);\r
86 int FLAC_plugin__get_rate(unsigned written_time, unsigned output_time, stream_data_struct *stream_data);\r
87 \r
88 /*\r
89  *  these should be defined in plug-in\r
90  */\r
91 \r
92 extern void FLAC_plugin__show_error(const char *message,...);\r