annotate src/flacng/flacng.h @ 2284:d19b53359b24

cleaned up the sndfile wav plugin, currently limiting it ONLY TO WAV PLAYBACK. if somebody is more experienced with it and wants to restore the other formats, go ahead (maybe change the name of the plugin too?).
author mf0102 <0102@gmx.at>
date Wed, 09 Jan 2008 15:41:22 +0100
parents 1268886f37ee
children ead24454f4b7
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
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
33 /*
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
34 * 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
35 * the metadata header
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 struct stream_info {
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
38 guint bits_per_sample;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
39 guint samplerate;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
40 guint channels;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
41 gulong samples;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
42 gboolean has_seektable;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
43 };
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
44
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 * Information about the last decoded audio frame.
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
47 * Also describes the format of the audio currently contained
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
48 * in the stream buffer.
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
49 */
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
50 struct frame_info {
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
51 guint bits_per_sample;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
52 guint samplerate;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
53 guint channels;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
54 };
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
55
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 * Information about the stream content, from the metadata
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 struct stream_comment {
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
60 gchar* artist;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
61 gchar* album;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
62 gchar* title;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
63 gchar* tracknumber;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
64 gchar* genre;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
65 gchar* date;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
66 };
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
67
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 * Replaygain information, from the metadata
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 struct stream_replaygain {
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
72 gboolean has_rg;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
73 gchar* ref_loud;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
74 gchar* track_gain;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
75 gchar* track_peak;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
76 gchar* album_gain;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
77 gchar* album_peak;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
78 };
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
79
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 typedef struct callback_info {
1401
263d72004333 - Introduce a mutex for test_info and lock appropriately
Ralf Ertzinger <ralf@skytale.net>
parents: 1318
diff changeset
82 GMutex* mutex;
930
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
83 gint32* output_buffer;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
84 gint32* write_pointer;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
85 guint buffer_free;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
86 guint buffer_used;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
87 VFSFile* input_stream;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
88 struct stream_info stream;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
89 struct stream_comment comment;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
90 struct stream_replaygain replaygain;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
91 gboolean metadata_changed;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
92 struct frame_info frame;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
93 glong read_max;
1041
ertzing
parents: 930
diff changeset
94 gboolean testing;
930
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
95 gchar* name;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
96 } callback_info;
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
97
2f742d127b3e [svn] - initial import of flacng from audacious-flacng-0.012
nenolod
parents:
diff changeset
98 #endif