Mercurial > audlegacy
annotate Plugins/Input/wma/wma.c @ 244:38892498a565 trunk
[svn] C99 compliance issues inside wma.c.
author | nenolod |
---|---|
date | Wed, 30 Nov 2005 00:02:54 -0800 |
parents | 0bea7509d6ba |
children | e35b0290f77c |
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 | 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 | 8 * |
9 * This program is free software; you can redistribute it and/or modify | |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
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 | 25 |
244 | 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> |
137 | 31 |
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
|
32 #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
|
33 #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
|
34 #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
|
35 #include <libaudacious/titlestring.h> |
137 | 36 |
37 #include "avcodec.h" | |
38 #include "avformat.h" | |
39 #include "iir.h" | |
40 | |
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
|
41 #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
|
42 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
|
43 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
|
44 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
|
45 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
|
46 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
|
47 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
|
48 (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
|
49 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
|
50 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
|
51 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
|
52 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
|
53 #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
|
54 #define PLUGIN_VERSION "v.1.0.5" |
137 | 55 #define ST_BUFF 1024 |
56 | |
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
|
57 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
|
58 static GtkWidget *dialog, *button, *label; |
137 | 59 static gboolean wma_decode = 0; |
60 static gboolean wma_pause = 0; | |
61 static gboolean wma_eq_on = 0; | |
62 static int wma_seekpos = -1; | |
63 static int wma_st_buff, wma_idx; | |
179 | 64 static GThread *wma_decode_thread; |
65 GStaticMutex wma_mutex = G_STATIC_MUTEX_INIT; | |
137 | 66 static AVCodecContext *c = NULL; |
67 static AVFormatContext *ic = NULL; | |
68 static uint8_t *wma_outbuf, *wma_s_outbuf; | |
69 | |
70 char description[64]; | |
71 static void wma_about(void); | |
72 static void wma_init(void); | |
73 static int wma_is_our_file(char *filename); | |
74 static void wma_play_file(char *filename); | |
75 static void wma_stop(void); | |
76 static void wma_seek(int time); | |
77 static void wma_do_pause(short p); | |
78 static int wma_get_time(void); | |
79 static void wma_get_song_info(char *filename, char **title, int *length); | |
80 static void wma_file_info_box(char *filename); | |
81 static void wma_set_eq(int q_on, float q_preamp, float *q_bands); | |
82 static char *wsong_title; | |
83 static int wsong_time; | |
84 | |
85 InputPlugin *get_iplugin_info(void); | |
86 | |
87 InputPlugin wma_ip = | |
88 { | |
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
|
89 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
|
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 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 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
|
97 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
|
98 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
|
99 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
|
100 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
|
101 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
|
102 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
|
103 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
|
104 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
|
105 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
|
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, // 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
|
108 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
|
109 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
|
110 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
|
111 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
|
112 NULL // Handle to the current output plugin. Filled in by xmms |
137 | 113 }; |
114 | |
115 InputPlugin *get_iplugin_info(void) | |
116 { | |
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
|
117 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
|
118 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
|
119 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
|
120 } |
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 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
|
123 { |
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 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
|
125 |
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 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
|
127 |
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 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
|
129 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
|
130 *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
|
131 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
|
132 *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
|
133 *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
|
134 } |
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 return str; |
137 | 137 } |
138 | |
139 static void wma_about(void) | |
140 { | |
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
|
141 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
|
142 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
|
143 |
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 if (dialog1) return; |
137 | 145 |
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
|
146 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
|
147 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
|
148 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
|
149 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
|
150 |
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
|
151 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
|
152 sprintf(message, "%s %s\n\n%s", PLUGIN_NAME, PLUGIN_VERSION, ABOUT_TXT); |
137 | 153 |
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
|
154 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
|
155 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
|
156 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
|
157 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
|
158 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
|
159 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
|
160 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
|
161 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
|
162 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
|
163 |
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 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
|
165 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
|
166 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
|
167 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
|
168 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
|
169 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
|
170 |
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 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
|
172 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
|
173 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
|
174 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
|
175 g_free(message); |
137 | 176 } |
177 | |
178 static void wma_init(void) | |
179 { | |
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
|
180 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
|
181 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
|
182 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
|
183 init_iir(); |
137 | 184 } |
185 | |
186 static int wma_is_our_file(char *filename) | |
187 { | |
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
|
188 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
|
189 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
|
190 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
|
191 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
|
192 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
|
193 return 0; |
137 | 194 } |
195 | |
196 static void wma_do_pause(short p) | |
197 { | |
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
|
198 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
|
199 wma_ip.output->pause(wma_pause); |
137 | 200 } |
201 | |
202 static void wma_seek(int time) | |
203 { | |
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
|
204 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
|
205 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
|
206 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
|
207 if(wma_pause) wma_ip.output->pause(1); |
137 | 208 } |
209 | |
210 static int wma_get_time(void) | |
211 { | |
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
|
212 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
|
213 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
|
214 return -1; |
137 | 215 } |
216 | |
217 static void wma_set_eq(int q_on, float q_preamp, float *q_bands) | |
218 { | |
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
|
219 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
|
220 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
|
221 float value; |
137 | 222 |
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
|
223 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
|
224 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
|
225 { |
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 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
|
227 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
|
228 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
|
229 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
|
230 { |
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 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
|
232 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
|
233 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
|
234 } |
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 } |
137 | 236 } |
237 | |
238 static gchar *extname(const char *filename) | |
239 { | |
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
|
240 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
|
241 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
|
242 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
|
243 } |
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 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
|
246 { |
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 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
|
248 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
|
249 return splitname; |
137 | 250 } |
251 | |
252 static char* w_getstr(char* str) | |
253 { | |
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
|
254 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
|
255 return NULL; |
137 | 256 } |
257 | |
258 static gchar *get_song_title(AVFormatContext *in, gchar * filename) | |
259 { | |
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
|
260 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
|
261 TitleInput *input; |
137 | 262 |
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
|
263 input = bmp_title_input_new(); |
137 | 264 |
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
|
265 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
|
266 (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
|
267 { |
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 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
|
269 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
|
270 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
|
271 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
|
272 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
|
273 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
|
274 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
|
275 } |
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 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
|
277 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
|
278 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
|
279 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
|
280 if(input) g_free(input); |
137 | 281 |
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
|
282 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
|
283 { |
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 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
|
285 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
|
286 *(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
|
287 } |
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 return ret; |
137 | 289 } |
290 | |
291 static guint get_song_time(AVFormatContext *in) | |
292 { | |
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
|
293 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
|
294 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
|
295 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
|
296 return 0; |
137 | 297 } |
298 | |
299 static void wma_get_song_info(char *filename, char **title_real, int *len_real) | |
300 { | |
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
|
301 AVFormatContext *in = NULL; |
137 | 302 |
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
|
303 (*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
|
304 (*title_real) = NULL; |
137 | 305 |
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
|
306 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
|
307 return; |
137 | 308 |
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
|
309 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
|
310 (*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
|
311 (*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
|
312 av_close_input_file(in); |
137 | 313 } |
314 | |
315 static void wma_playbuff(int out_size) | |
316 { | |
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
|
317 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
|
318 int sst_buff; |
137 | 319 |
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
|
320 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
|
321 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
|
322 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
|
323 { |
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 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
|
325 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
|
326 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
|
327 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
|
328 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
|
329 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
|
330 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
|
331 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
|
332 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
|
333 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
|
334 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
|
335 } |
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 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
|
337 return; |
137 | 338 } |
339 | |
340 static void *wma_play_loop(void *arg) | |
341 { | |
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
|
342 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
|
343 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
|
344 AVPacket pkt; |
137 | 345 |
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
|
346 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
|
347 while(wma_decode){ |
137 | 348 |
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
|
349 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
|
350 { |
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 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
|
352 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
|
353 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
|
354 } |
137 | 355 |
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
|
356 if(av_read_frame(ic, &pkt) < 0) break; |
137 | 357 |
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
|
358 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
|
359 inbuf_ptr = pkt.data; |
137 | 360 |
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
|
361 if(size == 0) break; |
137 | 362 |
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
|
363 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
|
364 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
|
365 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
|
366 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
|
367 |
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 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
|
369 |
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 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
|
371 |
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 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
|
373 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
|
374 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
|
375 } |
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 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
|
378 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
|
379 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
|
380 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
|
381 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
|
382 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
|
383 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
|
384 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
|
385 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
|
386 return(NULL); |
137 | 387 } |
388 | |
389 static void wma_play_file(char *filename) | |
390 { | |
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
|
391 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
|
392 |
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 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
|
394 |
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
|
395 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
|
396 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
|
397 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
|
398 } |
179 | 399 |
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
|
400 av_find_stream_info(ic); |
137 | 401 |
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
|
402 codec = avcodec_find_decoder(c->codec_id); |
137 | 403 |
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
|
404 if(!codec) return; |
137 | 405 |
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
|
406 if(avcodec_open(c, codec) < 0) return; |
137 | 407 |
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
|
408 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
|
409 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
|
410 |
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 if(wma_ip.output->open_audio( FMT_S16_NE, c->sample_rate, c->channels) <= 0) return; |
137 | 412 |
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
|
413 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
|
414 |
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 wma_ip.set_info(wsong_title, wsong_time, c->bit_rate, c->sample_rate, c->channels); |
137 | 416 |
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
|
417 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
|
418 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
|
419 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
|
420 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
|
421 wma_decode_thread = g_thread_create((GThreadFunc)wma_play_loop, NULL, TRUE, NULL); |
137 | 422 } |
423 | |
424 static void wma_stop(void) | |
425 { | |
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
|
426 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
|
427 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
|
428 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
|
429 wma_ip.output->close_audio(); |
137 | 430 } |
431 | |
432 static void wma_file_info_box (char *filename) | |
433 { | |
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
|
434 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
|
435 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
|
436 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
|
437 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
|
438 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
|
439 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
|
440 int tns, thh, tmm, tss, i; |
137 | 441 |
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
|
442 if(dialog) return; |
137 | 443 |
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
|
444 if(av_open_input_file(&in, str_twenty_to_space(filename), NULL, 0, NULL) < 0) return; |
137 | 445 |
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
|
446 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
|
447 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
|
448 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
|
449 } |
137 | 450 |
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
|
451 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
|
452 codec = avcodec_find_decoder(s->codec_id); |
137 | 453 |
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
|
454 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
|
455 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
|
456 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
|
457 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
|
458 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
|
459 memset(message, 0, 10000); |
137 | 460 |
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
|
461 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
|
462 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
|
463 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
|
464 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
|
465 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
|
466 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
|
467 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
|
468 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
|
469 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
|
470 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
|
471 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
|
472 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
|
473 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
|
474 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
|
475 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
|
476 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
|
477 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
|
478 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
|
479 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
|
480 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
|
481 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
|
482 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
|
483 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
|
484 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
|
485 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
|
486 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
|
487 { |
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 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
|
489 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
|
490 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
|
491 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
|
492 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
|
493 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
|
494 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
|
495 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
|
496 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
|
497 } |
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 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
|
499 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
|
500 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
|
501 { |
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 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
|
503 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
|
504 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
|
505 } |
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 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
|
507 { |
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 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
|
509 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
|
510 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
|
511 } |
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 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
|
513 { |
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 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
|
515 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
|
516 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
|
517 } |
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 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
|
519 { |
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 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
|
521 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
|
522 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
|
523 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
|
524 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
|
525 } |
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 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
|
527 { |
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 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
|
529 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
|
530 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
|
531 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
|
532 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
|
533 } |
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 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
|
535 { |
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 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
|
537 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
|
538 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
|
539 } |
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 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
|
541 { |
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 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
|
543 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
|
544 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
|
545 } |
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 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
|
547 { |
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 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
|
549 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
|
550 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
|
551 } |
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 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
|
553 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
|
554 |
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 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
|
556 if(in) av_close_input_file(in); |
137 | 557 |
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
|
558 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
|
559 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
|
560 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
|
561 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
|
562 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
|
563 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
|
564 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
|
565 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
|
566 gtk_widget_show(label); |
137 | 567 |
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
|
568 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
|
569 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
|
570 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
|
571 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
|
572 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
|
573 FALSE, FALSE, 0); |
137 | 574 |
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
|
575 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
|
576 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
|
577 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
|
578 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
|
579 g_free(message); |
137 | 580 } |
581 | |
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
|
582 #endif |