annotate Plugins/Input/wma/wma.c @ 300:e35b0290f77c trunk

[svn] Squash 3 warnings by compiling as C99 code. Remove round_trick kludge.
author chainsaw
date Fri, 16 Dec 2005 18:25:18 -0800
parents 38892498a565
children edc22c4569ad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
1 /*
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
2 * Audacious WMA input support
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
3 * (C) 2005 Audacious development team
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
4 *
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
5 * Based on:
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
6 * xmms-wma - WMA player for BMP
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
7 * Copyright (C) 2004,2005 McMCC <mcmcc@mail.ru>
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
8 *
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
12 * (at your option) any later version.
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
13 *
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
17 * GNU General Public License for more details.
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
18 *
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
22 */
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
23 #ifndef __XMMS_WMA_C__
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
24 #define __XMMS_WMA_C__
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
25
244
38892498a565 [svn] C99 compliance issues inside wma.c.
nenolod
parents: 218
diff changeset
26 #include <stdlib.h>
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
27 #include <math.h>
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
28 #include <stdbool.h>
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
29 #include <stdio.h>
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
30 #include <string.h>
300
e35b0290f77c [svn] Squash 3 warnings by compiling as C99 code. Remove round_trick kludge.
chainsaw
parents: 244
diff changeset
31 #include <strings.h>
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
32
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
33 #include <audacious/plugin.h>
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
34 #include <libaudacious/configfile.h>
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
35 #include <libaudacious/util.h>
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
36 #include <libaudacious/titlestring.h>
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
37
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
38 #include "avcodec.h"
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
39 #include "avformat.h"
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
40 #include "iir.h"
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
41
218
0bea7509d6ba [svn] Working WMA support. I never said it would be pretty, neno, I should said it would play.
chainsaw
parents: 210
diff changeset
42 #define ABOUT_TXT "Adapted for use in audacious by Tony Vroon (chainsaw@gentoo.org) from\n \
0bea7509d6ba [svn] Working WMA support. I never said it would be pretty, neno, I should said it would play.
chainsaw
parents: 210
diff changeset
43 the BEEP-WMA plugin which is Copyright (C) 2004,2005 Mokrushin I.V. aka McMCC (mcmcc@mail.ru).\n \
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
44 This plugin based on source code " LIBAVCODEC_IDENT "\nby Fabrice Bellard from \
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
45 http://ffmpeg.sourceforge.net.\n\n \
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
46 This program is free software; you can redistribute it and/or modify \n \
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
47 it under the terms of the GNU General Public License as published by \n \
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
48 the Free Software Foundation; either version 2 of the License, or \n \
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
49 (at your option) any later version. \n\n \
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
50 This program is distributed in the hope that it will be useful, \n \
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
51 but WITHOUT ANY WARRANTY; without even the implied warranty of \n \
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
52 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \n \
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
53 See the GNU General Public License for more details.\n"
218
0bea7509d6ba [svn] Working WMA support. I never said it would be pretty, neno, I should said it would play.
chainsaw
parents: 210
diff changeset
54 #define PLUGIN_NAME "Audacious-WMA"
0bea7509d6ba [svn] Working WMA support. I never said it would be pretty, neno, I should said it would play.
chainsaw
parents: 210
diff changeset
55 #define PLUGIN_VERSION "v.1.0.5"
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
56 #define ST_BUFF 1024
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
57
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
58 static GtkWidget *dialog1, *button1, *label1;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
59 static GtkWidget *dialog, *button, *label;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
60 static gboolean wma_decode = 0;
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
61 static gboolean wma_pause = 0;
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
62 static gboolean wma_eq_on = 0;
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
63 static int wma_seekpos = -1;
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
64 static int wma_st_buff, wma_idx;
179
15c2210499ea [svn] Use GThread instead of pthread.
chainsaw
parents: 138
diff changeset
65 static GThread *wma_decode_thread;
15c2210499ea [svn] Use GThread instead of pthread.
chainsaw
parents: 138
diff changeset
66 GStaticMutex wma_mutex = G_STATIC_MUTEX_INIT;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
67 static AVCodecContext *c = NULL;
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
68 static AVFormatContext *ic = NULL;
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
69 static uint8_t *wma_outbuf, *wma_s_outbuf;
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
70
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
71 char description[64];
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
72 static void wma_about(void);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
73 static void wma_init(void);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
74 static int wma_is_our_file(char *filename);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
75 static void wma_play_file(char *filename);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
76 static void wma_stop(void);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
77 static void wma_seek(int time);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
78 static void wma_do_pause(short p);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
79 static int wma_get_time(void);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
80 static void wma_get_song_info(char *filename, char **title, int *length);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
81 static void wma_file_info_box(char *filename);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
82 static void wma_set_eq(int q_on, float q_preamp, float *q_bands);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
83 static char *wsong_title;
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
84 static int wsong_time;
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
85
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
86 InputPlugin *get_iplugin_info(void);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
87
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
88 InputPlugin wma_ip =
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
89 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
90 NULL, // Filled in by xmms
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
91 NULL, // Filled in by xmms
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
92 description, // The description that is shown in the preferences box
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
93 wma_init, // Called when the plugin is loaded
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
94 wma_about, // Show the about box
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
95 NULL, // Show the configure box
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
96 wma_is_our_file, // Return 1 if the plugin can handle the file
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
97 NULL, // Scan dir
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
98 wma_play_file, // Play file
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
99 wma_stop, // Stop
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
100 wma_do_pause, // Pause
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
101 wma_seek, // Seek
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
102 wma_set_eq, // Set the equalizer, most plugins won't be able to do this
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
103 wma_get_time, // Get the time, usually returns the output plugins output time
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
104 NULL, // Get volume
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
105 NULL, // Set volume
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
106 NULL, // OBSOLETE!
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
107 NULL, // OBSOLETE!
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
108 NULL, // Send data to the visualization plugins
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
109 NULL, // Fill in the stuff that is shown in the player window
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
110 NULL, // Show some text in the song title box. Filled in by xmms
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
111 wma_get_song_info, // Function to grab the title string
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
112 wma_file_info_box, // Bring up an info window for the filename passed in
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
113 NULL // Handle to the current output plugin. Filled in by xmms
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
114 };
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
115
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
116 InputPlugin *get_iplugin_info(void)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
117 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
118 memset(description, 0, 64);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
119 wma_ip.description = g_strdup_printf("WMA Player %s", VERSION);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
120 return &wma_ip;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
121 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
122
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
123 static gchar *str_twenty_to_space(gchar * str)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
124 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
125 gchar *match, *match_end;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
126
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
127 g_return_val_if_fail(str != NULL, NULL);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
128
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
129 while ((match = strstr(str, "%20"))) {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
130 match_end = match + 3;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
131 *match++ = ' ';
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
132 while (*match_end)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
133 *match++ = *match_end++;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
134 *match = 0;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
135 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
136
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
137 return str;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
138 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
139
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
140 static void wma_about(void)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
141 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
142 char *title;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
143 char *message;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
144
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
145 if (dialog1) return;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
146
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
147 title = (char *)g_malloc(80);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
148 message = (char *)g_malloc(1000);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
149 memset(title, 0, 80);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
150 memset(message, 0, 1000);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
151
218
0bea7509d6ba [svn] Working WMA support. I never said it would be pretty, neno, I should said it would play.
chainsaw
parents: 210
diff changeset
152 sprintf(title, "About %s", PLUGIN_NAME);
0bea7509d6ba [svn] Working WMA support. I never said it would be pretty, neno, I should said it would play.
chainsaw
parents: 210
diff changeset
153 sprintf(message, "%s %s\n\n%s", PLUGIN_NAME, PLUGIN_VERSION, ABOUT_TXT);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
154
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
155 dialog1 = gtk_dialog_new();
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
156 gtk_signal_connect(GTK_OBJECT(dialog1), "destroy",
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
157 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dialog1);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
158 gtk_window_set_title(GTK_WINDOW(dialog1), title);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
159 gtk_window_set_policy(GTK_WINDOW(dialog1), FALSE, FALSE, FALSE);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
160 gtk_container_border_width(GTK_CONTAINER(dialog1), 5);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
161 label1 = gtk_label_new(message);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
162 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog1)->vbox), label1, TRUE, TRUE, 0);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
163 gtk_widget_show(label1);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
164
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
165 button1 = gtk_button_new_with_label(" Close ");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
166 gtk_signal_connect_object(GTK_OBJECT(button1), "clicked",
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
167 GTK_SIGNAL_FUNC(gtk_widget_destroy),
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
168 GTK_OBJECT(dialog1));
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
169 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog1)->action_area), button1,
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
170 FALSE, FALSE, 0);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
171
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
172 gtk_widget_show(button1);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
173 gtk_widget_show(dialog1);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
174 gtk_widget_grab_focus(button1);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
175 g_free(title);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
176 g_free(message);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
177 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
178
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
179 static void wma_init(void)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
180 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
181 avcodec_init();
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
182 avcodec_register_all();
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
183 av_register_all();
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
184 init_iir();
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
185 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
186
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
187 static int wma_is_our_file(char *filename)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
188 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
189 gchar *ext;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
190 ext = strrchr(filename, '.');
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
191 if(ext)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
192 if(!strcasecmp(ext, ".wma"))
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
193 return 1;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
194 return 0;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
195 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
196
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
197 static void wma_do_pause(short p)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
198 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
199 wma_pause = p;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
200 wma_ip.output->pause(wma_pause);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
201 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
202
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
203 static void wma_seek(int time)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
204 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
205 wma_seekpos = time;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
206 if(wma_pause) wma_ip.output->pause(0);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
207 while(wma_decode && wma_seekpos!=-1) xmms_usleep(10000);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
208 if(wma_pause) wma_ip.output->pause(1);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
209 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
210
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
211 static int wma_get_time(void)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
212 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
213 wma_ip.output->buffer_free();
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
214 if(wma_decode) return wma_ip.output->output_time();
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
215 return -1;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
216 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
217
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
218 static void wma_set_eq(int q_on, float q_preamp, float *q_bands)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
219 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
220 int chn;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
221 int index;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
222 float value;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
223
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
224 wma_eq_on = q_on;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
225 if(wma_eq_on)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
226 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
227 q_preamp = q_preamp/1.6;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
228 for(chn = 0; chn < c->channels; chn++)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
229 preamp[chn] = 1.0 + 0.0932471 * q_preamp + 0.00279033 * q_preamp * q_preamp;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
230 for(index = 0; index < 10; index++)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
231 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
232 value = q_bands[index]/1.2;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
233 for(chn = 0; chn < c->channels; chn++)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
234 gain[index][chn] = 0.03 * value + 0.000999999 * value * value;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
235 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
236 }
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
237 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
238
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
239 static gchar *extname(const char *filename)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
240 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
241 gchar *ext = strrchr(filename, '.');
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
242 if(ext != NULL) ++ext;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
243 return ext;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
244 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
245
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
246 static char *slashkill(gchar *fullname)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
247 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
248 gchar *splitname = strrchr(fullname, '/');
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
249 if(splitname != NULL) ++splitname;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
250 return splitname;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
251 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
252
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
253 static char* w_getstr(char* str)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
254 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
255 if(str && strlen(str) > 0) return str;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
256 return NULL;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
257 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
258
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
259 static gchar *get_song_title(AVFormatContext *in, gchar * filename)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
260 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
261 gchar *ret = NULL;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
262 TitleInput *input;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
263
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
264 input = bmp_title_input_new();
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
265
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
266 if((in->title[0] != '\0') || (in->author[0] != '\0') || (in->album[0] != '\0') ||
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
267 (in->comment[0] != '\0') || (in->genre[0] != '\0') || (in->year != 0) || (in->track != 0))
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
268 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
269 input->performer = w_getstr(in->author);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
270 input->album_name = w_getstr(in->album);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
271 input->track_name = w_getstr(in->title);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
272 input->year = in->year;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
273 input->track_number = in->track;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
274 input->genre = w_getstr(in->genre);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
275 input->comment = w_getstr(in->comment);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
276 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
277 input->file_name = g_path_get_basename(filename);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
278 input->file_path = g_path_get_dirname(filename);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
279 input->file_ext = extname(filename);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
280 ret = xmms_get_titlestring(xmms_get_gentitle_format(), input);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
281 if(input) g_free(input);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
282
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
283 if(!ret)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
284 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
285 ret = g_strdup(input->file_name);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
286 if (extname(ret) != NULL)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
287 *(extname(ret) - 1) = '\0';
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
288 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
289 return ret;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
290 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
291
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
292 static guint get_song_time(AVFormatContext *in)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
293 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
294 if(in->duration)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
295 return in->duration/1000;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
296 else
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
297 return 0;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
298 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
299
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
300 static void wma_get_song_info(char *filename, char **title_real, int *len_real)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
301 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
302 AVFormatContext *in = NULL;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
303
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
304 (*len_real) = -1;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
305 (*title_real) = NULL;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
306
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
307 if (av_open_input_file(&in, str_twenty_to_space(filename), NULL, 0, NULL) < 0)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
308 return;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
309
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
310 av_find_stream_info(in);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
311 (*len_real) = get_song_time(in);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
312 (*title_real) = get_song_title(in, filename);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
313 av_close_input_file(in);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
314 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
315
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
316 static void wma_playbuff(int out_size)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
317 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
318 FifoBuffer f;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
319 int sst_buff;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
320
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
321 fifo_init(&f, out_size*2);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
322 fifo_write(&f, wma_outbuf, out_size, &f.wptr);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
323 while(!fifo_read(&f, wma_s_outbuf, wma_st_buff, &f.rptr) && wma_decode)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
324 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
325 if(wma_eq_on)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
326 sst_buff = iir((gpointer)&wma_s_outbuf, wma_st_buff);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
327 else
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
328 sst_buff = wma_st_buff;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
329 if(wma_pause) memset(wma_s_outbuf, 0, sst_buff);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
330 while(wma_ip.output->buffer_free() < wma_st_buff) xmms_usleep(20000);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
331 if(wma_seekpos == -1)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
332 wma_ip.add_vis_pcm(wma_ip.output->written_time(), FMT_S16_NE,
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
333 c->channels, sst_buff, (short *)wma_s_outbuf);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
334 wma_ip.output->write_audio((short *)wma_s_outbuf, sst_buff);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
335 memset(wma_s_outbuf, 0, sst_buff);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
336 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
337 fifo_free(&f);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
338 return;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
339 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
340
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
341 static void *wma_play_loop(void *arg)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
342 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
343 uint8_t *inbuf_ptr;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
344 int out_size, size, len;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
345 AVPacket pkt;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
346
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
347 g_static_mutex_lock(&wma_mutex);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
348 while(wma_decode){
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
349
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
350 if(wma_seekpos != -1)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
351 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
352 av_seek_frame(ic, wma_idx, wma_seekpos * 1000000LL);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
353 wma_ip.output->flush(wma_seekpos * 1000);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
354 wma_seekpos = -1;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
355 }
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
356
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
357 if(av_read_frame(ic, &pkt) < 0) break;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
358
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
359 size = pkt.size;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
360 inbuf_ptr = pkt.data;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
361
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
362 if(size == 0) break;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
363
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
364 while(size > 0){
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
365 len = avcodec_decode_audio(c, (short *)wma_outbuf, &out_size,
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
366 inbuf_ptr, size);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
367 if(len < 0) break;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
368
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
369 if(out_size <= 0) continue;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
370
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
371 wma_playbuff(out_size);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
372
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
373 size -= len;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
374 inbuf_ptr += len;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
375 if(pkt.data) av_free_packet(&pkt);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
376 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
377 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
378 while(wma_decode && wma_ip.output->buffer_playing()) xmms_usleep(30000);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
379 wma_decode = 0;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
380 if(wma_s_outbuf) g_free(wma_s_outbuf);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
381 if(wma_outbuf) g_free(wma_outbuf);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
382 if(pkt.data) av_free_packet(&pkt);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
383 if(c) avcodec_close(c);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
384 if(ic) av_close_input_file(ic);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
385 g_static_mutex_unlock(&wma_mutex);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
386 g_thread_exit(NULL);
218
0bea7509d6ba [svn] Working WMA support. I never said it would be pretty, neno, I should said it would play.
chainsaw
parents: 210
diff changeset
387 return(NULL);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
388 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
389
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
390 static void wma_play_file(char *filename)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
391 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
392 AVCodec *codec;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
393
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
394 if(av_open_input_file(&ic, str_twenty_to_space(filename), NULL, 0, NULL) < 0) return;
218
0bea7509d6ba [svn] Working WMA support. I never said it would be pretty, neno, I should said it would play.
chainsaw
parents: 210
diff changeset
395
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
396 for(wma_idx = 0; wma_idx < ic->nb_streams; wma_idx++) {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
397 c = &ic->streams[wma_idx]->codec;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
398 if(c->codec_type == CODEC_TYPE_AUDIO) break;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
399 }
179
15c2210499ea [svn] Use GThread instead of pthread.
chainsaw
parents: 138
diff changeset
400
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
401 av_find_stream_info(ic);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
402
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
403 codec = avcodec_find_decoder(c->codec_id);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
404
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
405 if(!codec) return;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
406
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
407 if(avcodec_open(c, codec) < 0) return;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
408
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
409 wsong_title = get_song_title(ic, filename);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
410 wsong_time = get_song_time(ic);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
411
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
412 if(wma_ip.output->open_audio( FMT_S16_NE, c->sample_rate, c->channels) <= 0) return;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
413
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
414 wma_st_buff = ST_BUFF;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
415
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
416 wma_ip.set_info(wsong_title, wsong_time, c->bit_rate, c->sample_rate, c->channels);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
417
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
418 wma_s_outbuf = g_malloc0(wma_st_buff);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
419 wma_outbuf = g_malloc0(AVCODEC_MAX_AUDIO_FRAME_SIZE);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
420 wma_seekpos = -1;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
421 wma_decode = 1;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
422 wma_decode_thread = g_thread_create((GThreadFunc)wma_play_loop, NULL, TRUE, NULL);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
423 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
424
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
425 static void wma_stop(void)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
426 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
427 wma_decode = 0;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
428 if(wma_pause) wma_do_pause(0);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
429 g_thread_join(wma_decode_thread);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
430 wma_ip.output->close_audio();
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
431 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
432
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
433 static void wma_file_info_box (char *filename)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
434 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
435 char *title;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
436 char *tmp;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
437 char *message;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
438 AVFormatContext *in = NULL;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
439 AVCodecContext *s = NULL;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
440 AVCodec *codec;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
441 int tns, thh, tmm, tss, i;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
442
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
443 if(dialog) return;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
444
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
445 if(av_open_input_file(&in, str_twenty_to_space(filename), NULL, 0, NULL) < 0) return;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
446
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
447 for(i = 0; i < in->nb_streams; i++) {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
448 s = &in->streams[i]->codec;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
449 if(s->codec_type == CODEC_TYPE_AUDIO) break;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
450 }
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
451
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
452 av_find_stream_info(in);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
453 codec = avcodec_find_decoder(s->codec_id);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
454
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
455 title = (char *)g_malloc(15);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
456 message = (char *)g_malloc(10000);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
457 tmp = (char *)g_malloc(256);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
458 memset(tmp, 0, 256);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
459 memset(title, 0, 15);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
460 memset(message, 0, 10000);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
461
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
462 strcpy(message, "\n\n\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
463 strcat(message, "File Name: ");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
464 strcat(message, slashkill(filename));
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
465 strcat(message, "\n\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
466 strcat(message, "Audio Info:\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
467 strcat(message, "WMA Version: ");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
468 strcat(message, codec->name);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
469 strcat(message, "\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
470 strcat(message, "Bitrate: ");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
471 sprintf(tmp, "%d", s->bit_rate / 1000);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
472 strcat(message, tmp);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
473 memset(tmp, 0, 256);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
474 strcat(message, " kb/s");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
475 strcat(message, "\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
476 strcat(message, "Samplerate: ");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
477 sprintf(tmp, "%d", s->sample_rate);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
478 strcat(message, tmp);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
479 memset(tmp, 0, 256);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
480 strcat(message, " Hz");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
481 strcat(message, "\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
482 strcat(message, "Channels: ");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
483 if(s->channels == 1)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
484 strcat(message, "MONO\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
485 else
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
486 strcat(message, "STEREO\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
487 if (in->duration != 0)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
488 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
489 tns = in->duration/1000000LL;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
490 thh = tns/3600;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
491 tmm = (tns%3600)/60;
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
492 tss = (tns%60);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
493 strcat(message, "Play Time: ");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
494 sprintf(tmp, "%2d:%02d:%02d",thh, tmm, tss);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
495 strcat(message, tmp);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
496 memset(tmp, 0, 256);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
497 strcat(message, "\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
498 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
499 strcat(message, "\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
500 strcat(message, "Text Info:\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
501 if (in->title[0] != '\0')
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
502 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
503 strcat(message, "Title: ");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
504 strcat(message, in->title);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
505 strcat(message, "\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
506 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
507 if (in->author[0] != '\0')
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
508 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
509 strcat(message, "Author: ");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
510 strcat(message, in->author);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
511 strcat(message, "\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
512 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
513 if (in->album[0] != '\0')
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
514 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
515 strcat(message, "Album: ");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
516 strcat(message, in->album);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
517 strcat(message, "\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
518 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
519 if (in->year != 0)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
520 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
521 strcat(message, "Year: ");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
522 sprintf(tmp, "%d", in->year);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
523 strcat(message, tmp);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
524 memset(tmp, 0, 256);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
525 strcat(message, "\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
526 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
527 if (in->track != 0)
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
528 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
529 strcat(message, "Track: ");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
530 sprintf(tmp, "%d", in->track);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
531 strcat(message, tmp);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
532 memset(tmp, 0, 256);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
533 strcat(message, "\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
534 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
535 if (in->genre[0] != '\0')
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
536 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
537 strcat(message, "Genre: ");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
538 strcat(message, in->genre);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
539 strcat(message, "\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
540 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
541 if (in->comment[0] != '\0')
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
542 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
543 strcat(message, "Comments: ");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
544 strcat(message, in->comment);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
545 strcat(message, "\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
546 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
547 if (in->copyright[0] != '\0')
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
548 {
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
549 strcat(message, "Copyright: ");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
550 strcat(message, in->copyright);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
551 strcat(message, "\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
552 }
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
553 strcat(message, "\n\n");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
554 strcpy(title, "WMA file info:");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
555
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
556 if(tmp) g_free(tmp);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
557 if(in) av_close_input_file(in);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
558
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
559 dialog = gtk_dialog_new();
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
560 gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
561 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dialog);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
562 gtk_window_set_title(GTK_WINDOW(dialog), title);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
563 gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, FALSE);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
564 gtk_container_border_width(GTK_CONTAINER(dialog), 5);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
565 label = gtk_label_new(message);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
566 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), label, TRUE, TRUE, 0);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
567 gtk_widget_show(label);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
568
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
569 button = gtk_button_new_with_label(" Close ");
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
570 gtk_signal_connect_object(GTK_OBJECT(button), "clicked",
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
571 GTK_SIGNAL_FUNC(gtk_widget_destroy),
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
572 GTK_OBJECT(dialog));
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
573 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), button,
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
574 FALSE, FALSE, 0);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
575
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
576 gtk_widget_show(button);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
577 gtk_widget_show(dialog);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
578 gtk_widget_grab_focus(button);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
579 g_free(title);
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
580 g_free(message);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
581 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
582
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
583 #endif