annotate src/flacng/flacng.h @ 2498:194c2f8c2a92

Include cleanups, part #3.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 31 Mar 2008 15:11:29 +0300
parents ead24454f4b7
children f1b6f1b2cdb3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
930
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
1 /*
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
2 * A FLAC decoder plugin for the Audacious Media Player
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
3 * Copyright (C) 2005 Ralf Ertzinger
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
4 *
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
7 * the Free Software Foundation; either version 2 of the License, or
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
8 * (at your option) any later version.
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
9 *
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
13 * GNU General Public License for more details.
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
14 *
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
18 */
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
19 #ifndef FLACNG_H
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
20 #define FLACNG_H
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
21
1961
e8ea3a76a84e Various #include cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1435
diff changeset
22 #include "config.h"
930
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
23 #include <glib.h>
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
24 #include <audacious/plugin.h>
1318
a9a97179a1f9 I will be ready for Audacious 2...
Stany HENRY <StrassBoy@gmail.com>
parents: 1041
diff changeset
25 #include <audacious/i18n.h>
930
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
26
2244
1268886f37ee flacng: write only 1024 samples at a time to allow visualization plugins to work more efficiently.
William Pitcock <nenolod@atheme.org>
parents: 1961
diff changeset
27 #define OUTPUT_BLOCK_SIZE (1024u)
930
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
28 #define MAX_SUPPORTED_CHANNELS (2u)
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
29 #define BUFFER_SIZE_SAMP (FLAC__MAX_BLOCK_SIZE * FLAC__MAX_CHANNELS)
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
30 #define BUFFER_SIZE_BYTE (BUFFER_SIZE_SAMP * (FLAC__MAX_BITS_PER_SAMPLE/8))
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
31
2360
ead24454f4b7 native 24bit output for FLAC
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 2244
diff changeset
32 #define SAMPLE_SIZE(a) (a == 8 ? sizeof(guint8) : (a == 16 ? sizeof(guint16) : sizeof(guint32)))
ead24454f4b7 native 24bit output for FLAC
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 2244
diff changeset
33 #define SAMPLE_FMT(a) (a == 8 ? FMT_S8 : (a == 16 ? FMT_S16_NE : (a == 24 ? FMT_S24_NE : FMT_S32_NE)))
ead24454f4b7 native 24bit output for FLAC
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 2244
diff changeset
34
930
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
35 /*
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
36 * Audio information about the stream as a whole, gathered from
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
37 * the metadata header
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
38 */
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
39 struct stream_info {
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
40 guint bits_per_sample;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
41 guint samplerate;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
42 guint channels;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
43 gulong samples;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
44 gboolean has_seektable;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
45 };
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
46
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
47 /*
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
48 * Information about the last decoded audio frame.
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
49 * Also describes the format of the audio currently contained
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
50 * in the stream buffer.
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
51 */
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
52 struct frame_info {
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
53 guint bits_per_sample;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
54 guint samplerate;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
55 guint channels;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
56 };
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
57
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
58 /*
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
59 * Information about the stream content, from the metadata
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
60 */
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
61 struct stream_comment {
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
62 gchar* artist;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
63 gchar* album;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
64 gchar* title;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
65 gchar* tracknumber;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
66 gchar* genre;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
67 gchar* date;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
68 };
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
69
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
70 /*
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
71 * Replaygain information, from the metadata
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
72 */
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
73 struct stream_replaygain {
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
74 gboolean has_rg;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
75 gchar* ref_loud;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
76 gchar* track_gain;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
77 gchar* track_peak;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
78 gchar* album_gain;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
79 gchar* album_peak;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
80 };
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
81
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
82
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
83 typedef struct callback_info {
1401
263d72004333 - Introduce a mutex for test_info and lock appropriately
Ralf Ertzinger <ralf@skytale.net>
parents: 1318
diff changeset
84 GMutex* mutex;
930
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
85 gint32* output_buffer;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
86 gint32* write_pointer;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
87 guint buffer_free;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
88 guint buffer_used;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
89 VFSFile* input_stream;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
90 struct stream_info stream;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
91 struct stream_comment comment;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
92 struct stream_replaygain replaygain;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
93 gboolean metadata_changed;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
94 struct frame_info frame;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
95 glong read_max;
1041
ertzing
parents: 930
diff changeset
96 gboolean testing;
930
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
97 gchar* name;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
98 } callback_info;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
99
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
100 #endif