annotate src/aac/src/libmp4.c @ 692:a77e766e332d trunk

[svn] - fix another potential synchronization problem - be more efficient wrt fds
author nenolod
date Tue, 20 Feb 2007 07:00:10 -0800
parents 0305b3165a01
children a7ba9d27c7b5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1 #include <glib.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
2 #include <gtk/gtk.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
3 #include <string.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
4 #include <stdlib.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
5 #include "faad.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
6 #include "mp4ff.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
7 #include "tagging.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
8
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
9 #include <audacious/plugin.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
10 #include <audacious/output.h>
4
0ad4849f6219 [svn] - the first pass missed some libaudacious references, this fixes them
nenolod
parents: 0
diff changeset
11 #include <audacious/util.h>
0ad4849f6219 [svn] - the first pass missed some libaudacious references, this fixes them
nenolod
parents: 0
diff changeset
12 #include <audacious/titlestring.h>
0ad4849f6219 [svn] - the first pass missed some libaudacious references, this fixes them
nenolod
parents: 0
diff changeset
13 #include <audacious/vfs.h>
527
d124034ebea3 [svn] - glib/gi18n.h -> audacious/i18n.h for automatic dgettext support
nenolod
parents: 393
diff changeset
14 #include <audacious/i18n.h>
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
15
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
16 #define MP4_VERSION VERSION
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
17
684
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
18 #define SBR_DEC
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
19
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
20 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
21 * BUFFER_SIZE is the highest amount of memory that can be pulled.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
22 * We use this for sanity checks, among other things, as mp4ff needs
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
23 * a labotomy sometimes.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
24 */
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
25 #define BUFFER_SIZE FAAD_MIN_STREAMSIZE*64
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
26
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
27 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
28 * AAC_MAGIC is the pattern that marks the beginning of an MP4 container.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
29 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
30 #define AAC_MAGIC (unsigned char [4]) { 0xFF, 0xF9, 0x5C, 0x80 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
31
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
32 static void mp4_init(void);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
33 static void mp4_about(void);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
34 static int mp4_is_our_file(char *);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
35 static void mp4_play(InputPlayback *);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
36 static void mp4_stop(InputPlayback *);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
37 static void mp4_pause(InputPlayback *, short);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
38 static void mp4_seek(InputPlayback *, int);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
39 static int mp4_get_time(InputPlayback *);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
40 static void mp4_cleanup(void);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
41 static void mp4_get_song_title_len(char *filename, char **, int *);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
42 static TitleInput* mp4_get_song_tuple(char *);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
43 static int mp4_is_our_fd(char *, VFSFile *);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
44
374
7d7d66d0b2c3 [svn] - fix MP4 extension table
nenolod
parents: 372
diff changeset
45 gchar *mp4_fmts[] = { "m4a", "mp4", "aac", NULL };
7d7d66d0b2c3 [svn] - fix MP4 extension table
nenolod
parents: 372
diff changeset
46
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
47 static void * mp4_decode(void *);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
48 static gchar * mp4_get_song_title(char *filename);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
49 static void audmp4_file_info_box(gchar *);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
50 gboolean buffer_playing;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
51
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
52 InputPlugin mp4_ip =
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
53 {
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
54 NULL, // handle
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
55 NULL, // filename
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
56 "MP4 Audio Plugin",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
57 mp4_init,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
58 mp4_about,
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
59 NULL, // configuration
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
60 mp4_is_our_file,
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
61 NULL, //scandir
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
62 mp4_play,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
63 mp4_stop,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
64 mp4_pause,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
65 mp4_seek,
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
66 NULL, // set equalizer
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
67 mp4_get_time,
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
68 NULL, // get volume
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
69 NULL,
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
70 mp4_cleanup,
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
71 NULL, // obsolete
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
72 NULL, // send visualisation data
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
73 NULL, // set player window info
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
74 NULL, // set song title text
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
75 mp4_get_song_title_len, // get song title text
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
76 NULL, // info box
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
77 NULL, // to output plugin
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
78 mp4_get_song_tuple,
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
79 NULL,
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
80 NULL,
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
81 mp4_is_our_fd,
374
7d7d66d0b2c3 [svn] - fix MP4 extension table
nenolod
parents: 372
diff changeset
82 mp4_fmts,
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
83 };
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
84
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
85 typedef struct _mp4cfg
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
86 {
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
87 #define FILE_UNKNOWN 0
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
88 #define FILE_MP4 1
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
89 #define FILE_AAC 2
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
90 gshort file_type;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
91 } Mp4Config;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
92
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
93 static Mp4Config mp4cfg;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
94 static GThread *decodeThread;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
95 GStaticMutex mutex = G_STATIC_MUTEX_INIT;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
96 static int seekPosition = -1;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
97
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
98 void getMP4info(char*);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
99 int getAACTrack(mp4ff_t *);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
100
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
101 static guint32 mp4_read_callback(void *data, void *buffer, guint32 len)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
102 {
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
103 if (data == NULL || buffer == NULL)
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
104 return -1;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
105
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
106 return vfs_fread(buffer, 1, len, (VFSFile *) data);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
107 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
108
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
109 static guint32 mp4_seek_callback(void *data, guint64 pos)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
110 {
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
111 if (data == NULL)
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
112 return -1;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
113
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
114 return vfs_fseek((VFSFile *) data, pos, SEEK_SET);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
115 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
116
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
117 static gchar *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
118 extname(const char *filename)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
119 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
120 gchar *ext = strrchr(filename, '.');
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
121
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
122 if (ext != NULL)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
123 ++ext;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
124
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
125 return ext;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
126 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
127
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
128 InputPlugin *get_iplugin_info(void)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
129 {
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
130 return(&mp4_ip);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
131 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
132
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
133 static void mp4_init(void)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
134 {
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
135 mp4cfg.file_type = FILE_UNKNOWN;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
136 seekPosition = -1;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
137 return;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
138 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
139
561
914c96de3244 [svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents: 559
diff changeset
140 static void mp4_play(InputPlayback *playback)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
141 {
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
142 buffer_playing = TRUE;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
143 decodeThread = g_thread_create((GThreadFunc)mp4_decode, playback, TRUE, NULL);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
144 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
145
561
914c96de3244 [svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents: 559
diff changeset
146 static void mp4_stop(InputPlayback *playback)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
147 {
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
148 if (buffer_playing)
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
149 {
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
150 buffer_playing = FALSE;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
151 g_thread_join(decodeThread);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
152 playback->output->close_audio();
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
153 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
154 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
155
678
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
156 /*
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
157 * These routines are derived from MPlayer.
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
158 */
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
159
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
160 /// \param srate (out) sample rate
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
161 /// \param num (out) number of audio frames in this ADTS frame
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
162 /// \return size of the ADTS frame in bytes
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
163 /// aac_parse_frames needs a buffer at least 8 bytes long
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
164 int aac_parse_frame(guchar *buf, int *srate, int *num)
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
165 {
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
166 int i = 0, sr, fl = 0, id;
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
167 static int srates[] = {96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 0, 0, 0};
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
168
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
169 if((buf[i] != 0xFF) || ((buf[i+1] & 0xF6) != 0xF0))
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
170 return 0;
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
171
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
172 id = (buf[i+1] >> 3) & 0x01; //id=1 mpeg2, 0: mpeg4
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
173 sr = (buf[i+2] >> 2) & 0x0F;
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
174 if(sr > 11)
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
175 return 0;
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
176 *srate = srates[sr];
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
177
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
178 fl = ((buf[i+3] & 0x03) << 11) | (buf[i+4] << 3) | ((buf[i+5] >> 5) & 0x07);
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
179 *num = (buf[i+6] & 0x02) + 1;
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
180
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
181 return fl;
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
182 }
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
183
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
184 static gboolean parse_aac_stream(VFSFile *stream)
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
185 {
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
186 int cnt = 0, c, len, srate, num;
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
187 off_t init, probed;
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
188 static guchar buf[8];
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
189
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
190 init = probed = vfs_ftell(stream);
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
191 while(probed-init <= 32768 && cnt < 8)
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
192 {
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
193 c = 0;
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
194 while(probed-init <= 32768 && c != 0xFF)
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
195 {
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
196 c = vfs_getc(stream);
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
197 if(c < 0)
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
198 return FALSE;
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
199 probed = vfs_ftell(stream);
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
200 }
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
201 buf[0] = 0xFF;
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
202 if(vfs_fread(&(buf[1]), 1, 7, stream) < 7)
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
203 return FALSE;
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
204
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
205 len = aac_parse_frame(buf, &srate, &num);
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
206 if(len > 0)
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
207 {
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
208 cnt++;
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
209 vfs_fseek(stream, len - 8, SEEK_CUR);
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
210 }
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
211 probed = vfs_ftell(stream);
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
212 }
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
213
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
214 if(cnt < 8)
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
215 return FALSE;
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
216
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
217 return TRUE;
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
218 }
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
219
684
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
220 static int aac_probe(unsigned char *buffer, int len)
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
221 {
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
222 int i = 0, pos = 0;
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
223 g_print("\nAAC_PROBE: %d bytes\n", len);
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
224 while(i <= len-4) {
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
225 if(
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
226 ((buffer[i] == 0xff) && ((buffer[i+1] & 0xf6) == 0xf0)) ||
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
227 (buffer[i] == 'A' && buffer[i+1] == 'D' && buffer[i+2] == 'I' && buffer[i+3] == 'F')
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
228 ) {
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
229 pos = i;
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
230 break;
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
231 }
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
232 g_print("AUDIO PAYLOAD: %x %x %x %x\n",
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
233 buffer[i], buffer[i+1], buffer[i+2], buffer[i+3]);
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
234 i++;
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
235 }
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
236 g_print("\nAAC_PROBE: ret %d\n", pos);
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
237 return pos;
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
238 }
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
239
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
240 static int mp4_is_our_file(char *filename)
262
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
241 {
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
242 VFSFile *file;
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
243 gchar* extension;
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
244 gchar magic[8];
393
6987b5334081 [svn] Fix:
nenolod
parents: 374
diff changeset
245
6987b5334081 [svn] Fix:
nenolod
parents: 374
diff changeset
246 memset(magic, '\0', 8);
6987b5334081 [svn] Fix:
nenolod
parents: 374
diff changeset
247
262
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
248 extension = strrchr(filename, '.');
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
249 if ((file = vfs_fopen(filename, "rb"))) {
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
250 vfs_fread(magic, 1, 8, file);
678
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
251 vfs_rewind(file);
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
252 if (parse_aac_stream(file) == TRUE) {
262
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
253 vfs_fclose(file);
678
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
254 return TRUE;
262
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
255 }
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
256 if (!memcmp(magic, "ID3", 3)) { // ID3 tag bolted to the front, obfuscated magic bytes
262
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
257 vfs_fclose(file);
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
258 if (extension &&(
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
259 !strcasecmp(extension, ".mp4") || // official extension
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
260 !strcasecmp(extension, ".m4a") || // Apple mp4 extension
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
261 !strcasecmp(extension, ".aac") // old MPEG2/4-AAC extension
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
262 ))
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
263 return 1;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
264 else
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
265 return 0;
262
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
266 }
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
267 if (!memcmp(&magic[4], "ftyp", 4)) {
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
268 vfs_fclose(file);
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
269 return 1;
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
270 }
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
271 vfs_fclose(file);
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
272 }
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
273 return 0;
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
274 }
f653f1219db2 [svn] So input.c wants to have the old-style function available...
chainsaw
parents: 255
diff changeset
275
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
276 static int mp4_is_our_fd(char *filename, VFSFile* file)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
277 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
278 gchar* extension;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
279 gchar magic[8];
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
280
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
281 extension = strrchr(filename, '.');
255
902605dec467 [svn] Port to NewVFS probe function.
chainsaw
parents: 12
diff changeset
282 vfs_fread(magic, 1, 8, file);
678
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
283 vfs_rewind(file);
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
284 if (parse_aac_stream(file) == TRUE)
255
902605dec467 [svn] Port to NewVFS probe function.
chainsaw
parents: 12
diff changeset
285 return 1;
902605dec467 [svn] Port to NewVFS probe function.
chainsaw
parents: 12
diff changeset
286 if (!memcmp(&magic[4], "ftyp", 4))
902605dec467 [svn] Port to NewVFS probe function.
chainsaw
parents: 12
diff changeset
287 return 1;
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
288 if (!memcmp(magic, "ID3", 3)) { // ID3 tag bolted to the front, obfuscated magic bytes
255
902605dec467 [svn] Port to NewVFS probe function.
chainsaw
parents: 12
diff changeset
289 if (extension &&(
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
290 !strcasecmp(extension, ".mp4") || // official extension
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
291 !strcasecmp(extension, ".m4a") || // Apple mp4 extension
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
292 !strcasecmp(extension, ".aac") // old MPEG2/4-AAC extension
255
902605dec467 [svn] Port to NewVFS probe function.
chainsaw
parents: 12
diff changeset
293 ))
902605dec467 [svn] Port to NewVFS probe function.
chainsaw
parents: 12
diff changeset
294 return 1;
902605dec467 [svn] Port to NewVFS probe function.
chainsaw
parents: 12
diff changeset
295 else
902605dec467 [svn] Port to NewVFS probe function.
chainsaw
parents: 12
diff changeset
296 return 0;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
297 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
298 return 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
299 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
300
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
301 static void mp4_about(void)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
302 {
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
303 static GtkWidget *aboutbox = NULL;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
304 aboutbox = xmms_show_message("About MP4 AAC player plugin",
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
305 "Using libfaad2-" FAAD2_VERSION " for decoding.\n"
680
3a06665a810e [svn] - satisfy Nero AG attribution requirement for FAAD 2.5 code import
nenolod
parents: 679
diff changeset
306 "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Nero AG, www.nero.com\n"
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
307 "Copyright (c) 2005-2006 Audacious team",
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
308 "Ok", FALSE, NULL, NULL);
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
309 g_signal_connect(G_OBJECT(aboutbox), "destroy",
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
310 G_CALLBACK(gtk_widget_destroyed),
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
311 &aboutbox);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
312 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
313
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
314 static void mp4_pause(InputPlayback *playback, short flag)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
315 {
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
316 playback->output->pause(flag);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
317 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
318
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
319 static void mp4_seek(InputPlayback *data, int time)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
320 {
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
321 seekPosition = time;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
322 while(buffer_playing && seekPosition != -1)
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
323 xmms_usleep(10000);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
324 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
325
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
326 static int mp4_get_time(InputPlayback *playback)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
327 {
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
328 if(!buffer_playing)
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
329 return (-1);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
330 else
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
331 return (playback->output->output_time());
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
332 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
333
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
334 static void mp4_cleanup(void)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
335 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
336 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
337
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
338 static TitleInput *mp4_get_song_tuple(char *fn)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
339 {
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
340 mp4ff_callback_t *mp4cb = g_malloc0(sizeof(mp4ff_callback_t));
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
341 VFSFile *mp4fh;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
342 mp4ff_t *mp4file;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
343 TitleInput *input = NULL;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
344 gchar *filename = g_strdup(fn);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
345
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
346 mp4fh = vfs_fopen(filename, "rb");
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
347 mp4cb->read = mp4_read_callback;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
348 mp4cb->seek = mp4_seek_callback;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
349 mp4cb->user_data = mp4fh;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
350
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
351 if (!(mp4file = mp4ff_open_read(mp4cb))) {
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
352 g_free(mp4cb);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
353 vfs_fclose(mp4fh);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
354 } else {
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
355 gint mp4track= getAACTrack(mp4file);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
356 gint numSamples = mp4ff_num_samples(mp4file, mp4track);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
357 guint framesize = 1024;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
358 gulong samplerate;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
359 guchar channels;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
360 gint msDuration;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
361 mp4AudioSpecificConfig mp4ASC;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
362 gchar *tmpval;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
363 guchar *buffer = NULL;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
364 guint bufferSize = 0;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
365 faacDecHandle decoder;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
366
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
367 if (mp4track == -1)
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
368 return NULL;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
369
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
370 decoder = faacDecOpen();
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
371 mp4ff_get_decoder_config(mp4file, mp4track, &buffer, &bufferSize);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
372
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
373 if ( !buffer ) {
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
374 faacDecClose(decoder);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
375 return FALSE;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
376 }
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
377 if ( faacDecInit2(decoder, buffer, bufferSize,
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
378 &samplerate, &channels) < 0 ) {
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
379 faacDecClose(decoder);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
380
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
381 return FALSE;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
382 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
383
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
384 /* Add some hacks for SBR profile */
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
385 if (AudioSpecificConfig(buffer, bufferSize, &mp4ASC) >= 0) {
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
386 if (mp4ASC.frameLengthFlag == 1) framesize = 960;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
387 if (mp4ASC.sbr_present_flag == 1) framesize *= 2;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
388 }
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
389
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
390 g_free(buffer);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
391
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
392 faacDecClose(decoder);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
393
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
394 msDuration = ((float)numSamples * (float)(framesize - 1.0)/(float)samplerate) * 1000;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
395
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
396 input = bmp_title_input_new();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
397
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
398 mp4ff_meta_get_title(mp4file, &input->track_name);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
399 mp4ff_meta_get_album(mp4file, &input->album_name);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
400 mp4ff_meta_get_artist(mp4file, &input->performer);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
401 mp4ff_meta_get_date(mp4file, &tmpval);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
402 mp4ff_meta_get_genre(mp4file, &input->genre);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
403
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
404 if (tmpval)
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
405 {
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
406 input->year = atoi(tmpval);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
407 free(tmpval);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
408 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
409
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
410 input->file_name = g_path_get_basename(filename);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
411 input->file_path = g_path_get_dirname(filename);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
412 input->file_ext = extname(filename);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
413 input->length = msDuration;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
414
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
415 free (mp4cb);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
416 vfs_fclose(mp4fh);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
417 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
418
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
419 return input;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
420 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
421
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
422 static void mp4_get_song_title_len(char *filename, char **title, int *len)
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
423 {
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
424 (*title) = mp4_get_song_title(filename);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
425 (*len) = -1;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
426 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
427
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
428 static gchar *mp4_get_song_title(char *filename)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
429 {
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
430 mp4ff_callback_t *mp4cb = g_malloc0(sizeof(mp4ff_callback_t));
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
431 VFSFile *mp4fh;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
432 mp4ff_t *mp4file;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
433 gchar *title = NULL;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
434
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
435 mp4fh = vfs_fopen(filename, "rb");
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
436 mp4cb->read = mp4_read_callback;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
437 mp4cb->seek = mp4_seek_callback;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
438 mp4cb->user_data = mp4fh;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
439
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
440 if (!(mp4file = mp4ff_open_read(mp4cb))) {
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
441 g_free(mp4cb);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
442 vfs_fclose(mp4fh);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
443 } else {
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
444 TitleInput *input;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
445 gchar *tmpval;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
446
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
447 input = bmp_title_input_new();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
448
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
449 mp4ff_meta_get_title(mp4file, &input->track_name);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
450 mp4ff_meta_get_album(mp4file, &input->album_name);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
451 mp4ff_meta_get_artist(mp4file, &input->performer);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
452 mp4ff_meta_get_date(mp4file, &tmpval);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
453 mp4ff_meta_get_genre(mp4file, &input->genre);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
454
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
455 if (tmpval)
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
456 {
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
457 input->year = atoi(tmpval);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
458 free(tmpval);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
459 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
460
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
461 input->file_name = g_path_get_basename(filename);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
462 input->file_path = g_path_get_dirname(filename);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
463 input->file_ext = extname(filename);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
464
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
465 title = xmms_get_titlestring(xmms_get_gentitle_format(), input);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
466
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
467 free (input->track_name);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
468 free (input->album_name);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
469 free (input->performer);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
470 free (input->genre);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
471 free (input->file_name);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
472 free (input->file_path);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
473 free (input);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
474
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
475 free (mp4cb);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
476 vfs_fclose(mp4fh);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
477 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
478
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
479 if (!title)
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
480 {
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
481 title = g_path_get_basename(filename);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
482 if (extname(title))
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
483 *(extname(title) - 1) = '\0';
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
484 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
485
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
486 return title;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
487 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
488
561
914c96de3244 [svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents: 559
diff changeset
489 static int my_decode_mp4( InputPlayback *playback, char *filename, mp4ff_t *mp4file )
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
490 {
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
491 // We are reading an MP4 file
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
492 gint mp4track= getAACTrack(mp4file);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
493
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
494 if (mp4track < 0)
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
495 {
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
496 g_print("Unsupported Audio track type\n");
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
497 return TRUE;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
498 }
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
499
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
500 faacDecHandle decoder;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
501 mp4AudioSpecificConfig mp4ASC;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
502 guchar *buffer = NULL;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
503 guint bufferSize = 0;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
504 gulong samplerate;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
505 guchar channels;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
506 gulong msDuration;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
507 gulong numSamples;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
508 gulong sampleID = 1;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
509 guint framesize = 1024;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
510
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
511 gchar *xmmstitle = NULL;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
512 xmmstitle = mp4_get_song_title(filename);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
513 if(xmmstitle == NULL)
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
514 xmmstitle = g_strdup(filename);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
515
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
516 decoder = faacDecOpen();
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
517 mp4ff_get_decoder_config(mp4file, mp4track, &buffer, &bufferSize);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
518 if ( !buffer ) {
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
519 faacDecClose(decoder);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
520 return FALSE;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
521 }
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
522 if ( faacDecInit2(decoder, buffer, bufferSize,
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
523 &samplerate, &channels) < 0 ) {
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
524 faacDecClose(decoder);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
525
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
526 return FALSE;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
527 }
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
528
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
529 /* Add some hacks for SBR profile */
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
530 if (AudioSpecificConfig(buffer, bufferSize, &mp4ASC) >= 0) {
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
531 if (mp4ASC.frameLengthFlag == 1) framesize = 960;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
532 if (mp4ASC.sbr_present_flag == 1) framesize *= 2;
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
533 }
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
534
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
535 g_free(buffer);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
536 if( !channels ) {
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
537 faacDecClose(decoder);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
538
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
539 return FALSE;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
540 }
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
541 numSamples = mp4ff_num_samples(mp4file, mp4track);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
542 msDuration = ((float)numSamples * (float)(framesize - 1.0)/(float)samplerate) * 1000;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
543 playback->output->open_audio(FMT_S16_NE, samplerate, channels);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
544 playback->output->flush(0);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
545
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
546 mp4_ip.set_info(xmmstitle, msDuration,
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
547 mp4ff_get_avg_bitrate( mp4file, mp4track ),
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
548 samplerate,channels);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
549
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
550 while ( buffer_playing ) {
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
551 void* sampleBuffer;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
552 faacDecFrameInfo frameInfo;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
553 gint rc;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
554
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
555 /* Seek if seek position has changed */
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
556 if ( seekPosition!=-1 ) {
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
557 sampleID = (float)seekPosition*(float)samplerate/(float)(framesize - 1.0);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
558 playback->output->flush(seekPosition*1000);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
559 seekPosition = -1;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
560 }
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
561
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
562 /* Otherwise continue playing */
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
563 buffer=NULL;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
564 bufferSize=0;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
565
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
566 /* If we've run to the end of the file, we're done. */
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
567 if(sampleID >= numSamples){
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
568 /* Finish playing before we close the
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
569 output. */
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
570 while ( playback->output->buffer_playing() ) {
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
571 xmms_usleep(10000);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
572 }
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
573
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
574 playback->output->flush(seekPosition*1000);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
575 playback->output->close_audio();
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
576 faacDecClose(decoder);
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
577
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
578 g_static_mutex_lock(&mutex);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
579 buffer_playing = FALSE;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
580 g_static_mutex_unlock(&mutex);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
581 g_thread_exit(NULL);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
582
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
583 return FALSE;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
584 }
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
585 rc= mp4ff_read_sample(mp4file, mp4track,
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
586 sampleID++, &buffer, &bufferSize);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
587
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
588 /*g_print(":: %d/%d\n", sampleID-1, numSamples);*/
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
589
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
590 /* If we can't read the file, we're done. */
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
591 if((rc == 0) || (buffer== NULL) || (bufferSize == 0) || (bufferSize > BUFFER_SIZE)){
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
592 g_print("MP4: read error\n");
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
593 sampleBuffer = NULL;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
594 sampleID=0;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
595 playback->output->buffer_free();
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
596 playback->output->close_audio();
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
597
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
598 faacDecClose(decoder);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
599
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
600 return FALSE;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
601 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
602
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
603 /* g_print(" :: %d/%d\n", bufferSize, BUFFER_SIZE); */
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
604
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
605 sampleBuffer= faacDecDecode(decoder,
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
606 &frameInfo,
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
607 buffer,
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
608 bufferSize);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
609
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
610 /* If there was an error decoding, we're done. */
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
611 if(frameInfo.error > 0){
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
612 g_print("MP4: %s\n",
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
613 faacDecGetErrorMessage(frameInfo.error));
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
614 playback->output->close_audio();
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
615 faacDecClose(decoder);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
616
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
617 return FALSE;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
618 }
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
619 if(buffer){
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
620 g_free(buffer);
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
621 buffer=NULL;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
622 bufferSize=0;
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
623 }
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
624 if (buffer_playing == FALSE)
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
625 {
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
626 playback->output->close_audio();
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
627 return FALSE;
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
628 }
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
629 produce_audio(playback->output->written_time(),
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
630 FMT_S16_NE,
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
631 channels,
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
632 frameInfo.samples<<1,
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
633 sampleBuffer, &buffer_playing);
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
634 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
635
584
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
636 playback->output->close_audio();
5e2b137a24fe [svn] - Cleaned up AAC plugin a bit more, but still couldn't fix the bug
mf0102
parents: 583
diff changeset
637 faacDecClose(decoder);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
638
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
639 return TRUE;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
640 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
641
692
a77e766e332d [svn] - fix another potential synchronization problem
nenolod
parents: 690
diff changeset
642 static void my_decode_aac( InputPlayback *playback, char *filename, VFSFile *file )
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
643 {
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
644 faacDecHandle decoder = 0;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
645 guchar *buffer = 0;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
646 gulong bufferconsumed = 0;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
647 gulong samplerate = 0;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
648 guchar channels;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
649 gulong buffervalid = 0;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
650 TitleInput* input;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
651 gchar *temp = g_strdup(filename);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
652 gchar *ext = strrchr(temp, '.');
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
653 gchar *xmmstitle = NULL;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
654 faacDecConfigurationPtr config;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
655
692
a77e766e332d [svn] - fix another potential synchronization problem
nenolod
parents: 690
diff changeset
656 vfs_rewind(file);
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
657 if((decoder = faacDecOpen()) == NULL){
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
658 g_print("AAC: Open Decoder Error\n");
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
659 vfs_fclose(file);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
660 buffer_playing = FALSE;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
661 g_static_mutex_unlock(&mutex);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
662 g_thread_exit(NULL);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
663 }
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
664 if((buffer = g_malloc(BUFFER_SIZE)) == NULL){
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
665 g_print("AAC: error g_malloc\n");
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
666 vfs_fclose(file);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
667 buffer_playing = FALSE;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
668 faacDecClose(decoder);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
669 g_static_mutex_unlock(&mutex);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
670 g_thread_exit(NULL);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
671 }
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
672 if((buffervalid = vfs_fread(buffer, 1, BUFFER_SIZE, file))==0){
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
673 g_print("AAC: Error reading file\n");
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
674 g_free(buffer);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
675 vfs_fclose(file);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
676 buffer_playing = FALSE;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
677 faacDecClose(decoder);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
678 g_static_mutex_unlock(&mutex);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
679 g_thread_exit(NULL);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
680 }
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
681 if(!strncmp((char*)buffer, "ID3", 3)){
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
682 gint size = 0;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
683
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
684 vfs_fseek(file, 0, SEEK_SET);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
685 size = (buffer[6]<<21) | (buffer[7]<<14) | (buffer[8]<<7) | buffer[9];
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
686 size+=10;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
687 vfs_fread(buffer, 1, size, file);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
688 buffervalid = vfs_fread(buffer, 1, BUFFER_SIZE, file);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
689 }
682
de446ca64592 [svn] - i really hate this plugin
nenolod
parents: 680
diff changeset
690 xmmstitle = g_strdup(g_basename(temp));
679
c8dc00a58f0d [svn] - remove a bunch of pointless code. we don't do ID3 for raw AAC files at this time.
nenolod
parents: 678
diff changeset
691
684
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
692 bufferconsumed = aac_probe(buffer, buffervalid);
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
693 if(bufferconsumed) {
690
0305b3165a01 [svn] - ringbuffering underrun fixups -- found with purify
nenolod
parents: 689
diff changeset
694 memmove(buffer, &buffer[bufferconsumed], buffervalid);
684
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
695 buffervalid -= bufferconsumed;
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
696 buffervalid += vfs_fread(&buffer[buffervalid], 1,
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
697 BUFFER_SIZE-buffervalid, file);
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
698 bufferconsumed = 0;
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
699 }
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
700
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
701 bufferconsumed = faacDecInit(decoder,
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
702 buffer,
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
703 buffervalid,
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
704 &samplerate,
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
705 &channels);
684
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
706 g_print("samplerate: %d, channels: %d\n", samplerate, channels);
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
707 if(playback->output->open_audio(FMT_S16_NE,samplerate,channels) == FALSE){
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
708 g_print("AAC: Output Error\n");
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
709 g_free(buffer); buffer=0;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
710 faacDecClose(decoder);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
711 vfs_fclose(file);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
712 playback->output->close_audio();
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
713 g_free(xmmstitle);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
714 buffer_playing = FALSE;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
715 g_static_mutex_unlock(&mutex);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
716 g_thread_exit(NULL);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
717 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
718
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
719 mp4_ip.set_info(xmmstitle, -1, -1, samplerate, channels);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
720 playback->output->flush(0);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
721
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
722 while(buffer_playing && buffervalid > 0){
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
723 faacDecFrameInfo finfo;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
724 unsigned long samplesdecoded;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
725 char* sample_buffer = NULL;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
726
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
727 if(bufferconsumed > 0){
690
0305b3165a01 [svn] - ringbuffering underrun fixups -- found with purify
nenolod
parents: 689
diff changeset
728 memmove(buffer, &buffer[bufferconsumed], buffervalid);
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
729 buffervalid -= bufferconsumed;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
730 buffervalid += vfs_fread(&buffer[buffervalid], 1,
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
731 BUFFER_SIZE-buffervalid, file);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
732 bufferconsumed = 0;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
733 }
688
43c77973e494 [svn] - some ringbuffering fixes -- aac+ shouldn't crash now, but more
nenolod
parents: 686
diff changeset
734
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
735 sample_buffer = faacDecDecode(decoder, &finfo, buffer, buffervalid);
688
43c77973e494 [svn] - some ringbuffering fixes -- aac+ shouldn't crash now, but more
nenolod
parents: 686
diff changeset
736
43c77973e494 [svn] - some ringbuffering fixes -- aac+ shouldn't crash now, but more
nenolod
parents: 686
diff changeset
737 bufferconsumed += finfo.bytesconsumed;
43c77973e494 [svn] - some ringbuffering fixes -- aac+ shouldn't crash now, but more
nenolod
parents: 686
diff changeset
738 samplesdecoded = finfo.samples;
43c77973e494 [svn] - some ringbuffering fixes -- aac+ shouldn't crash now, but more
nenolod
parents: 686
diff changeset
739
684
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
740 if(finfo.error > 0){
686
0d098b87207a [svn] - remove some pointless bloat
nenolod
parents: 684
diff changeset
741 buffervalid--;
0d098b87207a [svn] - remove some pointless bloat
nenolod
parents: 684
diff changeset
742 memmove(buffer, &buffer[1], buffervalid);
688
43c77973e494 [svn] - some ringbuffering fixes -- aac+ shouldn't crash now, but more
nenolod
parents: 686
diff changeset
743 if(buffervalid < BUFFER_SIZE) {
43c77973e494 [svn] - some ringbuffering fixes -- aac+ shouldn't crash now, but more
nenolod
parents: 686
diff changeset
744 buffervalid +=
43c77973e494 [svn] - some ringbuffering fixes -- aac+ shouldn't crash now, but more
nenolod
parents: 686
diff changeset
745 vfs_fread(&buffer[buffervalid], 1, BUFFER_SIZE-buffervalid, file);
43c77973e494 [svn] - some ringbuffering fixes -- aac+ shouldn't crash now, but more
nenolod
parents: 686
diff changeset
746 }
686
0d098b87207a [svn] - remove some pointless bloat
nenolod
parents: 684
diff changeset
747 bufferconsumed = aac_probe(buffer, buffervalid);
0d098b87207a [svn] - remove some pointless bloat
nenolod
parents: 684
diff changeset
748 if(bufferconsumed) {
689
9e85901ac6c0 [svn] - some additional cleanups
nenolod
parents: 688
diff changeset
749 memmove(buffer, &buffer[bufferconsumed], buffervalid);
686
0d098b87207a [svn] - remove some pointless bloat
nenolod
parents: 684
diff changeset
750 buffervalid -= bufferconsumed;
0d098b87207a [svn] - remove some pointless bloat
nenolod
parents: 684
diff changeset
751 bufferconsumed = 0;
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
752 }
686
0d098b87207a [svn] - remove some pointless bloat
nenolod
parents: 684
diff changeset
753 continue;
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
754 }
688
43c77973e494 [svn] - some ringbuffering fixes -- aac+ shouldn't crash now, but more
nenolod
parents: 686
diff changeset
755
684
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
756 if((samplesdecoded <= 0) && !sample_buffer){
c9eaa64b92b3 [svn] - aacplus shoutcast support. prepare for segfaults.
nenolod
parents: 682
diff changeset
757 g_print("AAC: decoded %d samples!\n", samplesdecoded);
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
758 continue;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
759 }
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
760 produce_audio(playback->output->written_time(),
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
761 FMT_S16_LE, channels,
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
762 samplesdecoded<<1, sample_buffer, &buffer_playing);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
763 }
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
764 playback->output->buffer_free();
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
765 playback->output->close_audio();
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
766 buffer_playing = FALSE;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
767 g_free(buffer);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
768 faacDecClose(decoder);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
769 g_free(xmmstitle);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
770 vfs_fclose(file);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
771 seekPosition = -1;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
772
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
773 buffer_playing = FALSE;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
774 g_static_mutex_unlock(&mutex);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
775 g_thread_exit(NULL);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
776 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
777
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
778 static void *mp4_decode( void *args )
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
779 {
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
780 mp4ff_callback_t *mp4cb = g_malloc0(sizeof(mp4ff_callback_t));
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
781 VFSFile *mp4fh;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
782 mp4ff_t *mp4file;
678
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
783 gboolean ret;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
784
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
785 InputPlayback *playback = args;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
786 char *filename = playback->filename;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
787
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
788 mp4fh = vfs_fopen(filename, "rb");
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
789 mp4cb->read = mp4_read_callback;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
790 mp4cb->seek = mp4_seek_callback;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
791 mp4cb->user_data = mp4fh;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
792
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
793 g_static_mutex_lock(&mutex);
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
794 seekPosition= -1;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
795 buffer_playing= TRUE;
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
796 g_static_mutex_unlock(&mutex);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
797
692
a77e766e332d [svn] - fix another potential synchronization problem
nenolod
parents: 690
diff changeset
798 if (mp4fh == NULL)
a77e766e332d [svn] - fix another potential synchronization problem
nenolod
parents: 690
diff changeset
799 g_thread_exit(NULL);
a77e766e332d [svn] - fix another potential synchronization problem
nenolod
parents: 690
diff changeset
800
678
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
801 ret = parse_aac_stream(mp4fh);
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
802 vfs_rewind(mp4fh);
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
803 mp4file= mp4ff_open_read(mp4cb);
678
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
804
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
805 if( ret == TRUE ) {
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
806 g_free(mp4cb);
692
a77e766e332d [svn] - fix another potential synchronization problem
nenolod
parents: 690
diff changeset
807 my_decode_aac( playback, filename, mp4fh );
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
808 }
678
9e4145566248 [svn] - allow static AAC files to play. working on AACplus, but this brings us closer.
nenolod
parents: 595
diff changeset
809 else
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
810 my_decode_mp4( playback, filename, mp4file );
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
811
583
dad887da4642 [svn] - Fixed crash at opening AAC files
mf0102
parents: 561
diff changeset
812 return NULL;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
813 }