Mercurial > audlegacy
annotate Plugins/Input/wma/wma.c @ 420:44c513ae3527 trunk
[svn] Remove equalization code. We do this same processing in the core in 0.2.
author | nenolod |
---|---|
date | Fri, 13 Jan 2006 14:50:54 -0800 |
parents | f13ab2d8e9cf |
children | f61e69a1a376 |
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> |
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 | 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> |
352 | 34 #include <audacious/output.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
|
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 | 37 |
38 #include "avcodec.h" | |
39 #include "avformat.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 |
420
44c513ae3527
[svn] Remove equalization code. We do this same processing in the core in 0.2.
nenolod
parents:
352
diff
changeset
|
101 NULL, // We don't use this in audacious. |
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
|
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(); |
137 | 183 } |
184 | |
185 static int wma_is_our_file(char *filename) | |
186 { | |
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
|
187 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
|
188 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
|
189 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
|
190 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
|
191 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
|
192 return 0; |
137 | 193 } |
194 | |
195 static void wma_do_pause(short p) | |
196 { | |
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
|
197 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
|
198 wma_ip.output->pause(wma_pause); |
137 | 199 } |
200 | |
201 static void wma_seek(int time) | |
202 { | |
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
|
203 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
|
204 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
|
205 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
|
206 if(wma_pause) wma_ip.output->pause(1); |
137 | 207 } |
208 | |
209 static int wma_get_time(void) | |
210 { | |
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
|
211 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
|
212 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
|
213 return -1; |
137 | 214 } |
215 | |
216 static gchar *extname(const char *filename) | |
217 { | |
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
|
218 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
|
219 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
|
220 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
|
221 } |
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 |
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 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
|
224 { |
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 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
|
226 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
|
227 return splitname; |
137 | 228 } |
229 | |
230 static char* w_getstr(char* str) | |
231 { | |
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
|
232 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
|
233 return NULL; |
137 | 234 } |
235 | |
236 static gchar *get_song_title(AVFormatContext *in, gchar * filename) | |
237 { | |
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
|
238 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
|
239 TitleInput *input; |
137 | 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 input = bmp_title_input_new(); |
137 | 242 |
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
|
243 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
|
244 (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
|
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 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
|
247 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
|
248 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
|
249 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
|
250 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
|
251 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
|
252 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
|
253 } |
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 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
|
255 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
|
256 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
|
257 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
|
258 if(input) g_free(input); |
137 | 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 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
|
261 { |
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 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
|
263 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
|
264 *(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
|
265 } |
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 return ret; |
137 | 267 } |
268 | |
269 static guint get_song_time(AVFormatContext *in) | |
270 { | |
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
|
271 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
|
272 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
|
273 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
|
274 return 0; |
137 | 275 } |
276 | |
277 static void wma_get_song_info(char *filename, char **title_real, int *len_real) | |
278 { | |
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
|
279 AVFormatContext *in = NULL; |
137 | 280 |
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
|
281 (*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
|
282 (*title_real) = NULL; |
137 | 283 |
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
|
284 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
|
285 return; |
137 | 286 |
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
|
287 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
|
288 (*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
|
289 (*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
|
290 av_close_input_file(in); |
137 | 291 } |
292 | |
293 static void wma_playbuff(int out_size) | |
294 { | |
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
|
295 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
|
296 int sst_buff; |
137 | 297 |
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
|
298 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
|
299 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
|
300 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
|
301 { |
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 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
|
303 while(wma_ip.output->buffer_free() < wma_st_buff) xmms_usleep(20000); |
351 | 304 produce_audio(wma_ip.output->written_time(), FMT_S16_NE, |
305 c->channels, sst_buff, (short *)wma_s_outbuf, NULL); | |
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 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
|
307 } |
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 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
|
309 return; |
137 | 310 } |
311 | |
312 static void *wma_play_loop(void *arg) | |
313 { | |
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
|
314 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
|
315 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
|
316 AVPacket pkt; |
137 | 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 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
|
319 while(wma_decode){ |
137 | 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 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
|
322 { |
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 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
|
324 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
|
325 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
|
326 } |
137 | 327 |
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
|
328 if(av_read_frame(ic, &pkt) < 0) break; |
137 | 329 |
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
|
330 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
|
331 inbuf_ptr = pkt.data; |
137 | 332 |
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
|
333 if(size == 0) break; |
137 | 334 |
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
|
335 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
|
336 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
|
337 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
|
338 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
|
339 |
12004b385a96
[svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents:
179
diff
changeset
|
340 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
|
341 |
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 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
|
343 |
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 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 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
|
346 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
|
347 } |
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 } |
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 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
|
350 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
|
351 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
|
352 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
|
353 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
|
354 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
|
355 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
|
356 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
|
357 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
|
358 return(NULL); |
137 | 359 } |
360 | |
361 static void wma_play_file(char *filename) | |
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 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
|
364 |
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 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
|
366 |
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
|
367 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
|
368 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
|
369 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
|
370 } |
179 | 371 |
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
|
372 av_find_stream_info(ic); |
137 | 373 |
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
|
374 codec = avcodec_find_decoder(c->codec_id); |
137 | 375 |
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
|
376 if(!codec) return; |
137 | 377 |
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
|
378 if(avcodec_open(c, codec) < 0) return; |
137 | 379 |
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
|
380 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
|
381 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
|
382 |
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(wma_ip.output->open_audio( FMT_S16_NE, c->sample_rate, c->channels) <= 0) return; |
137 | 384 |
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
|
385 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
|
386 |
12004b385a96
[svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents:
179
diff
changeset
|
387 wma_ip.set_info(wsong_title, wsong_time, c->bit_rate, c->sample_rate, c->channels); |
137 | 388 |
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
|
389 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
|
390 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
|
391 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
|
392 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
|
393 wma_decode_thread = g_thread_create((GThreadFunc)wma_play_loop, NULL, TRUE, NULL); |
137 | 394 } |
395 | |
396 static void wma_stop(void) | |
397 { | |
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
|
398 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
|
399 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
|
400 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
|
401 wma_ip.output->close_audio(); |
137 | 402 } |
403 | |
404 static void wma_file_info_box (char *filename) | |
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 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
|
407 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
|
408 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
|
409 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
|
410 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
|
411 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
|
412 int tns, thh, tmm, tss, i; |
137 | 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 if(dialog) return; |
137 | 415 |
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
|
416 if(av_open_input_file(&in, str_twenty_to_space(filename), NULL, 0, NULL) < 0) return; |
137 | 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 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
|
419 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
|
420 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
|
421 } |
137 | 422 |
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
|
423 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
|
424 codec = avcodec_find_decoder(s->codec_id); |
137 | 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 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
|
427 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
|
428 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
|
429 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
|
430 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
|
431 memset(message, 0, 10000); |
137 | 432 |
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
|
433 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
|
434 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
|
435 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
|
436 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
|
437 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
|
438 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
|
439 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
|
440 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
|
441 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
|
442 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
|
443 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
|
444 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
|
445 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
|
446 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
|
447 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
|
448 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
|
449 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
|
450 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
|
451 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
|
452 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
|
453 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
|
454 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
|
455 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
|
456 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
|
457 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
|
458 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
|
459 { |
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 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
|
461 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
|
462 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
|
463 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
|
464 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
|
465 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
|
466 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
|
467 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
|
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 } |
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, "\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
|
471 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
|
472 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
|
473 { |
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, "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
|
475 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
|
476 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
|
477 } |
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 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
|
479 { |
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, "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
|
481 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
|
482 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
|
483 } |
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 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
|
485 { |
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, "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
|
487 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
|
488 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
|
489 } |
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 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
|
491 { |
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, "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
|
493 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
|
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 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
|
499 { |
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, "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
|
501 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
|
502 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
|
503 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
|
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->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
|
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, "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
|
509 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
|
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->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
|
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, "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
|
515 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
|
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->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
|
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, "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
|
521 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
|
522 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
|
523 } |
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\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 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
|
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(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
|
528 if(in) av_close_input_file(in); |
137 | 529 |
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
|
530 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
|
531 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
|
532 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
|
533 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
|
534 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
|
535 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
|
536 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
|
537 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
|
538 gtk_widget_show(label); |
137 | 539 |
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
|
540 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
|
541 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
|
542 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
|
543 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
|
544 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
|
545 FALSE, FALSE, 0); |
137 | 546 |
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
|
547 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
|
548 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
|
549 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
|
550 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
|
551 g_free(message); |
137 | 552 } |
553 | |
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
|
554 #endif |