comparison src/madplug/plugin.h @ 610:862190d39e00 trunk

[svn] - add madplug. It is not yet hooked up, I'll do that later.
author nenolod
date Mon, 05 Feb 2007 12:28:01 -0800
parents
children 3f7a52adfe0e
comparison
equal deleted inserted replaced
609:9b73eb35f4ff 610:862190d39e00
1 /*
2 * mad plugin for audacious
3 * Copyright (C) 2005-2007 William Pitcock, Yoshiki Yazawa
4 *
5 * Portions derived from xmms-mad:
6 * Copyright (C) 2001-2002 Sam Clegg - See COPYING
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; under version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22 #ifndef AUD_MAD_H
23 #define AUD_MAD_H
24
25 //#define DEBUG 1
26 #undef DEBUG
27
28 #undef G_LOG_DOMAIN
29 #define G_LOG_DOMAIN "MADPlug"
30
31 #include "config.h"
32
33 #undef PACKAGE
34 #define PACKAGE "audacious-plugins"
35
36 #include <stdlib.h>
37 #include <stdio.h>
38 #include <string.h>
39 #include <unistd.h>
40 #include <audacious/plugin.h>
41 #include <audacious/titlestring.h>
42 #include <audacious/strings.h>
43 #include <audacious/i18n.h>
44 #include <id3tag.h>
45 #include <mad.h>
46
47 #include "xing.h"
48
49 struct mad_info_t
50 {
51 InputPlayback *playback;
52 int seek;
53
54 /* state */
55 guint current_frame;/**< current mp3 frame */
56 mad_timer_t pos; /**< current play position */
57
58 /* song info */
59 guint vbr; /**< bool: is vbr? */
60 guint bitrate; /**< avg. bitrate */
61 guint freq; /**< sample freq. */
62 guint mpeg_layer; /**< mpeg layer */
63 guint mode; /**< mpeg stereo mode */
64 guint channels;
65 gint frames; /**< total mp3 frames or -1 */
66 gint fmt; /**< sample format */
67 gint size; /**< file size in bytes or -1 */
68 gchar *title; /**< title for xmms */
69 mad_timer_t duration;
70 /**< total play time */
71 struct id3_tag *tag;
72 struct id3_file *id3file;
73 struct xing xing;
74 TitleInput *tuple; /* audacious tuple data */
75
76 /* replay parameters */
77 gboolean has_replaygain;
78 double replaygain_album_scale; // -1 if not set
79 double replaygain_track_scale;
80 gchar *replaygain_album_str;
81 gchar *replaygain_track_str;
82 double replaygain_album_peak; // -1 if not set
83 double replaygain_track_peak;
84 gchar *replaygain_album_peak_str;
85 gchar *replaygain_track_peak_str;
86 double mp3gain_undo; // -1 if not set
87 double mp3gain_minmax;
88 gchar *mp3gain_undo_str;
89 gchar *mp3gain_minmax_str;
90
91 /* data access */
92 gchar *url;
93 gchar *filename;
94 VFSFile *infile;
95 gint offset;
96
97 gint remote;
98 struct streamdata_t *sdata;
99 /**< stream data for remote connections */
100 };
101
102 struct audmad_config_t
103 {
104 gint http_buffer_size;
105 gboolean fast_play_time_calc;
106 gboolean use_xing;
107 gboolean dither;
108 gboolean hard_limit;
109 gchar *pregain_db; // gain applied to samples at decoding stage.
110 gdouble pregain_scale; // pow(10, pregain/20)
111 struct
112 {
113 gboolean enable;
114 gboolean track_mode;
115 gchar *default_db; // gain used if no RG.
116 gdouble default_scale;
117 } replaygain;
118 gboolean title_override;
119 gchar *id3_format;
120 };
121
122 void audmad_config_compute(struct audmad_config_t *config);
123 // compute scale values from "_db" strings
124
125 extern gpointer decode_loop(gpointer arg);
126 extern void audmad_error(gchar * fmt, ...);
127 extern void audmad_configure();
128 extern InputPlugin *mad_plugin;
129 extern struct audmad_config_t audmad_config;
130
131 #endif /* !AUD_MAD_H */