annotate src/flacng/flacng.h @ 2494:862477de235b

Automated merge with ssh://hg.atheme.org//hg/audacious-plugins
author William Pitcock <nenolod@atheme.org>
date Mon, 31 Mar 2008 04:45:30 -0500
parents ead24454f4b7
children 194c2f8c2a92
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>
1435
654aa79e43ef flacng: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents: 1401
diff changeset
25 #include <audacious/main.h>
1318
a9a97179a1f9 I will be ready for Audacious 2...
Stany HENRY <StrassBoy@gmail.com>
parents: 1041
diff changeset
26 #include <audacious/i18n.h>
930
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
27
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
28 #define OUTPUT_BLOCK_SIZE (1024u)
930
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
29 #define MAX_SUPPORTED_CHANNELS (2u)
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
30 #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
31 #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
32
2360
ead24454f4b7 native 24bit output for FLAC
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 2244
diff changeset
33 #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
34 #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
35
930
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
36 /*
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
37 * 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
38 * the metadata header
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
39 */
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
40 struct stream_info {
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
41 guint bits_per_sample;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
42 guint samplerate;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
43 guint channels;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
44 gulong samples;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
45 gboolean has_seektable;
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 /*
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
49 * Information about the last decoded audio frame.
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
50 * Also describes the format of the audio currently contained
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
51 * in the stream buffer.
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
52 */
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
53 struct frame_info {
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
54 guint bits_per_sample;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
55 guint samplerate;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
56 guint channels;
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 /*
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
60 * Information about the stream content, from the metadata
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
61 */
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
62 struct stream_comment {
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
63 gchar* artist;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
64 gchar* album;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
65 gchar* title;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
66 gchar* tracknumber;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
67 gchar* genre;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
68 gchar* date;
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 /*
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
72 * Replaygain information, from the metadata
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
73 */
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
74 struct stream_replaygain {
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
75 gboolean has_rg;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
76 gchar* ref_loud;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
77 gchar* track_gain;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
78 gchar* track_peak;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
79 gchar* album_gain;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
80 gchar* album_peak;
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
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
84 typedef struct callback_info {
1401
263d72004333 - Introduce a mutex for test_info and lock appropriately
Ralf Ertzinger <ralf@skytale.net>
parents: 1318
diff changeset
85 GMutex* mutex;
930
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
86 gint32* output_buffer;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
87 gint32* write_pointer;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
88 guint buffer_free;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
89 guint buffer_used;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
90 VFSFile* input_stream;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
91 struct stream_info stream;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
92 struct stream_comment comment;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
93 struct stream_replaygain replaygain;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
94 gboolean metadata_changed;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
95 struct frame_info frame;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
96 glong read_max;
1041
ertzing
parents: 930
diff changeset
97 gboolean testing;
930
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
98 gchar* name;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
99 } callback_info;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
100
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
101 #endif