Mercurial > audlegacy
annotate Plugins/Input/wma/wma.c @ 440:73de03e5c9dc trunk
[svn] Pinch nicer file info dialog from BMP-WMA.
author | chainsaw |
---|---|
date | Sun, 15 Jan 2006 07:35:01 -0800 |
parents | f61e69a1a376 |
children | ffd68c74022b |
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 /* |
440 | 2 * Audacious WMA input plugin |
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
|
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> |
440 | 8 * bmp-wma - WMA player for BMP |
9 * Copyright (C) 2004 Roman Bogorodskiy <bogorodskiy@inbox.ru> | |
137 | 10 * |
11 * This program is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
24 */ | |
244 | 25 #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
|
26 #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
|
27 #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
|
28 #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
|
29 #include <string.h> |
300
e35b0290f77c
[svn] Squash 3 warnings by compiling as C99 code. Remove round_trick kludge.
chainsaw
parents:
244
diff
changeset
|
30 #include <strings.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> |
352 | 33 #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
|
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 | |
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
|
40 #define ABOUT_TXT "Adapted for use in audacious by Tony Vroon (chainsaw@gentoo.org) from\n \ |
440 | 41 the BEEP-WMA plugin which is Copyright (C) 2004,2005 Mokrushin I.V. aka McMCC (mcmcc@mail.ru)\n \ |
42 and the BMP-WMA plugin which is Copyright (C) 2004 Roman Bogorodskiy <bogorodskiy@inbox.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 | |
440 | 57 static GtkWidget *dialog; |
210
12004b385a96
[svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents:
179
diff
changeset
|
58 static GtkWidget *dialog1, *button1, *label1; |
440 | 59 |
60 static int wma_decode = 0; | |
137 | 61 static gboolean wma_pause = 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 char *wsong_title; | |
82 static int wsong_time; | |
83 | |
84 InputPlugin *get_iplugin_info(void); | |
85 | |
86 InputPlugin wma_ip = | |
87 { | |
440 | 88 NULL, // Filled in by xmms |
89 NULL, // Filled in by xmms | |
210
12004b385a96
[svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents:
179
diff
changeset
|
90 description, // The description that is shown in the preferences box |
440 | 91 wma_init, // Called when the plugin is loaded |
92 wma_about, // Show the about box | |
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
|
93 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
|
94 wma_is_our_file, // Return 1 if the plugin can handle the file |
440 | 95 NULL, // Scan dir |
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
|
96 wma_play_file, // Play file |
440 | 97 wma_stop, // Stop |
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
|
98 wma_do_pause, // Pause |
440 | 99 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
|
100 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
|
101 wma_get_time, // Get the time, usually returns the output plugins output time |
440 | 102 NULL, // Get volume |
103 NULL, // Set volume | |
104 NULL, // OBSOLETE! | |
105 NULL, // OBSOLETE! | |
106 NULL, // Send data to the visualization plugins | |
107 NULL, // Fill in the stuff that is shown in the player window | |
108 NULL, // Show some text in the song title box. Filled in by xmms | |
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
|
109 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
|
110 wma_file_info_box, // Bring up an info window for the filename passed in |
440 | 111 NULL // Handle to the current output plugin. Filled in by xmms |
137 | 112 }; |
113 | |
114 InputPlugin *get_iplugin_info(void) | |
115 { | |
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
|
116 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
|
117 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
|
118 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
|
119 } |
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 |
137 | 121 static void wma_about(void) |
122 { | |
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
|
123 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
|
124 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
|
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 if (dialog1) return; |
137 | 127 |
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
|
128 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
|
129 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
|
130 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
|
131 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
|
132 |
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
|
133 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
|
134 sprintf(message, "%s %s\n\n%s", PLUGIN_NAME, PLUGIN_VERSION, ABOUT_TXT); |
137 | 135 |
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
|
136 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
|
137 gtk_signal_connect(GTK_OBJECT(dialog1), "destroy", |
440 | 138 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dialog1); |
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
|
139 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
|
140 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
|
141 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
|
142 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
|
143 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
|
144 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
|
145 |
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 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
|
147 gtk_signal_connect_object(GTK_OBJECT(button1), "clicked", |
440 | 148 GTK_SIGNAL_FUNC(gtk_widget_destroy), |
149 GTK_OBJECT(dialog1)); | |
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
|
150 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog1)->action_area), button1, |
440 | 151 FALSE, FALSE, 0); |
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
|
152 |
12004b385a96
[svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents:
179
diff
changeset
|
153 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
|
154 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
|
155 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
|
156 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
|
157 g_free(message); |
137 | 158 } |
159 | |
160 static void wma_init(void) | |
161 { | |
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
|
162 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
|
163 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
|
164 av_register_all(); |
137 | 165 } |
166 | |
167 static int wma_is_our_file(char *filename) | |
168 { | |
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
|
169 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
|
170 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
|
171 if(ext) |
440 | 172 if(!strcasecmp(ext, ".wma")) |
173 return 1; | |
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
|
174 return 0; |
137 | 175 } |
176 | |
177 static void wma_do_pause(short p) | |
178 { | |
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
|
179 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
|
180 wma_ip.output->pause(wma_pause); |
137 | 181 } |
182 | |
183 static void wma_seek(int time) | |
184 { | |
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
|
185 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
|
186 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
|
187 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
|
188 if(wma_pause) wma_ip.output->pause(1); |
137 | 189 } |
190 | |
191 static int wma_get_time(void) | |
192 { | |
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
|
193 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
|
194 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
|
195 return -1; |
137 | 196 } |
197 | |
198 static gchar *extname(const char *filename) | |
199 { | |
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
|
200 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
|
201 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
|
202 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
|
203 } |
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 |
137 | 205 static char* w_getstr(char* str) |
206 { | |
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
|
207 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
|
208 return NULL; |
137 | 209 } |
210 | |
211 static gchar *get_song_title(AVFormatContext *in, gchar * filename) | |
212 { | |
210
12004b385a96
[svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents:
179
diff
changeset
|
213 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
|
214 TitleInput *input; |
137 | 215 |
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
|
216 input = bmp_title_input_new(); |
137 | 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 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
|
219 (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
|
220 { |
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 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
|
222 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
|
223 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
|
224 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
|
225 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
|
226 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
|
227 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
|
228 } |
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 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
|
230 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
|
231 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
|
232 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
|
233 if(input) g_free(input); |
137 | 234 |
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
|
235 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
|
236 { |
12004b385a96
[svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents:
179
diff
changeset
|
237 ret = g_strdup(input->file_name); |
440 | 238 if (extname(ret) != NULL) |
239 *(extname(ret) - 1) = '\0'; | |
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 } |
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 return ret; |
137 | 242 } |
243 | |
244 static guint get_song_time(AVFormatContext *in) | |
245 { | |
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
|
246 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
|
247 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
|
248 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
|
249 return 0; |
137 | 250 } |
251 | |
252 static void wma_get_song_info(char *filename, char **title_real, int *len_real) | |
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 AVFormatContext *in = NULL; |
137 | 255 |
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
|
256 (*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
|
257 (*title_real) = NULL; |
137 | 258 |
440 | 259 if (av_open_input_file(&in, filename, NULL, 0, NULL) < 0) |
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 return; |
137 | 261 |
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
|
262 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
|
263 (*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
|
264 (*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
|
265 av_close_input_file(in); |
137 | 266 } |
267 | |
268 static void wma_playbuff(int out_size) | |
269 { | |
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
|
270 FifoBuffer f; |
440 | 271 |
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
|
272 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
|
273 fifo_write(&f, wma_outbuf, out_size, &f.wptr); |
440 | 274 |
275 while(!fifo_read(&f, wma_s_outbuf, wma_st_buff, &f.rptr) && wma_decode) { | |
276 if (wma_pause) | |
277 memset(wma_s_outbuf, 0, wma_st_buff); | |
278 | |
279 while (wma_ip.output->buffer_free() < wma_st_buff) | |
280 xmms_usleep(20000); | |
281 | |
282 if (wma_seekpos == -1) | |
283 produce_audio(wma_ip.output->written_time(), FMT_S16_NE, | |
284 c->channels, wma_st_buff, (short *)wma_s_outbuf, &wma_decode); | |
285 | |
286 memset(wma_s_outbuf, 0, wma_st_buff); | |
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 } |
440 | 288 |
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
|
289 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
|
290 return; |
137 | 291 } |
292 | |
293 static void *wma_play_loop(void *arg) | |
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 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
|
296 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
|
297 AVPacket pkt; |
137 | 298 |
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
|
299 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
|
300 while(wma_decode){ |
137 | 301 |
210
12004b385a96
[svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents:
179
diff
changeset
|
302 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
|
303 { |
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 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
|
305 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
|
306 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
|
307 } |
137 | 308 |
440 | 309 if(av_read_frame(ic, &pkt) < 0) break; |
137 | 310 |
440 | 311 size = pkt.size; |
312 inbuf_ptr = pkt.data; | |
137 | 313 |
440 | 314 if(size == 0) break; |
137 | 315 |
440 | 316 while(size > 0){ |
317 len = avcodec_decode_audio(c, (short *)wma_outbuf, &out_size, | |
318 inbuf_ptr, size); | |
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
|
319 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
|
320 |
440 | 321 if(out_size <= 0) continue; |
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
|
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 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
|
324 |
440 | 325 size -= len; |
326 inbuf_ptr += len; | |
327 if(pkt.data) av_free_packet(&pkt); | |
328 } | |
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
|
329 } |
12004b385a96
[svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents:
179
diff
changeset
|
330 while(wma_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
|
331 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
|
332 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
|
333 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
|
334 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
|
335 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
|
336 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
|
337 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
|
338 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
|
339 return(NULL); |
137 | 340 } |
341 | |
342 static void wma_play_file(char *filename) | |
343 { | |
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
|
344 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
|
345 |
440 | 346 if(av_open_input_file(&ic, 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
|
347 |
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
|
348 for(wma_idx = 0; wma_idx < ic->nb_streams; wma_idx++) { |
440 | 349 c = &ic->streams[wma_idx]->codec; |
350 if(c->codec_type == CODEC_TYPE_AUDIO) break; | |
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
|
351 } |
179 | 352 |
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
|
353 av_find_stream_info(ic); |
137 | 354 |
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
|
355 codec = avcodec_find_decoder(c->codec_id); |
137 | 356 |
210
12004b385a96
[svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents:
179
diff
changeset
|
357 if(!codec) return; |
137 | 358 |
210
12004b385a96
[svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents:
179
diff
changeset
|
359 if(avcodec_open(c, codec) < 0) return; |
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 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
|
362 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
|
363 |
440 | 364 if(wma_ip.output->open_audio(FMT_S16_NE, c->sample_rate, c->channels) <= 0) return; |
137 | 365 |
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
|
366 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
|
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 wma_ip.set_info(wsong_title, wsong_time, c->bit_rate, c->sample_rate, c->channels); |
137 | 369 |
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
|
370 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
|
371 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
|
372 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
|
373 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
|
374 wma_decode_thread = g_thread_create((GThreadFunc)wma_play_loop, NULL, TRUE, NULL); |
137 | 375 } |
376 | |
377 static void wma_stop(void) | |
378 { | |
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
|
379 wma_decode = 0; |
12004b385a96
[svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents:
179
diff
changeset
|
380 if(wma_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
|
381 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
|
382 wma_ip.output->close_audio(); |
137 | 383 } |
384 | |
385 static void wma_file_info_box (char *filename) | |
386 { | |
440 | 387 GtkWidget *dialog_vbox1; |
388 GtkWidget *vbox1; | |
389 GtkWidget *hbox1; | |
390 GtkWidget *label_name; | |
391 GtkWidget *entry_filename; | |
392 GtkWidget *hbox2; | |
393 GtkWidget *frame_wma_info; | |
394 GtkWidget *alignment1; | |
395 GtkWidget *table1; | |
396 GtkWidget *label_album; | |
397 GtkWidget *label_year; | |
398 GtkWidget *label_track; | |
399 GtkWidget *label_genre; | |
400 GtkWidget *label_comments; | |
401 GtkWidget *label_wma_version; | |
402 GtkWidget *label_bitrate; | |
403 GtkWidget *label_rate; | |
404 GtkWidget *label_chans; | |
405 GtkWidget *label_play_time; | |
406 GtkWidget *label_filesize; | |
407 GtkWidget *label_wma_vers_val; | |
408 GtkWidget *label_bitrate_val; | |
409 GtkWidget *label_rate_val; | |
410 GtkWidget *label_chans_val; | |
411 GtkWidget *label_playtime_val; | |
412 GtkWidget *label_filesize_val; | |
413 GtkWidget *label4; | |
414 GtkWidget *frame_tags; | |
415 GtkWidget *alignment2; | |
416 GtkWidget *table2; | |
417 GtkWidget *label_artist; | |
418 GtkWidget *label_title; | |
419 GtkWidget *entry_artist; | |
420 GtkWidget *entry_album; | |
421 GtkWidget *entry_year; | |
422 GtkWidget *entry_title; | |
423 GtkWidget *entry_track; | |
424 GtkWidget *entry_genre; | |
425 GtkWidget *entry_comments; | |
426 GtkWidget *label5; | |
427 GtkWidget *dialog_action_area1; | |
428 GtkWidget *okbutton; | |
429 | |
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
|
430 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
|
431 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
|
432 AVCodec *codec; |
440 | 433 gint tns, thh, tmm, tss; |
434 gint i; | |
435 gchar *title, | |
436 *channels, | |
437 *bitrate, | |
438 *playtime, | |
439 *samplerate, | |
440 *filesize; | |
441 FILE *f; | |
442 if (dialog) { | |
443 (void)printf("Info dialog is already opened!\n"); | |
444 return; | |
445 } | |
137 | 446 |
440 | 447 if(av_open_input_file(&in, filename, NULL, 0, NULL) < 0) |
448 return; | |
137 | 449 |
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
|
450 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
|
451 s = &in->streams[i]->codec; |
440 | 452 if(s->codec_type == CODEC_TYPE_AUDIO) |
453 break; | |
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 } |
440 | 455 |
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
|
456 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
|
457 codec = avcodec_find_decoder(s->codec_id); |
137 | 458 |
440 | 459 /* window title */ |
460 title = g_strdup_printf("File Info - %s", g_basename(filename)); | |
461 /* channels */ | |
462 if (s->channels == 1) | |
463 channels = g_strdup("MONO"); | |
464 else | |
465 channels = g_strdup("STEREO"); | |
137 | 466 |
440 | 467 /* bitrate */ |
468 bitrate = g_strdup_printf("%d Kb/s", (s->bit_rate / 1000)); | |
469 | |
470 /* playtime */ | |
471 if (in->duration != 0) { | |
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
|
472 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
|
473 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
|
474 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
|
475 tss = (tns%60); |
440 | 476 playtime = g_strdup_printf("%02d:%02d:%02d", thh, tmm, tss); |
477 } else | |
478 playtime = g_strdup("N/A"); | |
479 | |
480 /* samplerate */ | |
481 samplerate = g_strdup_printf("%d Hz", s->sample_rate); | |
482 | |
483 /* filesize */ | |
484 f = fopen(filename, "rb"); | |
485 | |
486 if (f == NULL) | |
487 return; | |
488 | |
489 fseek(f, 0, SEEK_END); | |
490 filesize = g_strdup_printf("%lu Bytes", ftell(f)); | |
491 fclose(f); | |
137 | 492 |
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
|
493 dialog = gtk_dialog_new(); |
440 | 494 |
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
|
495 gtk_signal_connect(GTK_OBJECT(dialog), "destroy", |
440 | 496 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dialog); |
497 | |
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
|
498 gtk_window_set_title(GTK_WINDOW(dialog), title); |
440 | 499 gtk_window_set_type_hint(GTK_WINDOW(dialog), GDK_WINDOW_TYPE_HINT_DIALOG); |
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
|
500 gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, FALSE); |
440 | 501 |
502 dialog_vbox1 = GTK_DIALOG(dialog)->vbox; | |
503 gtk_widget_show(dialog_vbox1); | |
504 | |
505 vbox1 = gtk_vbox_new(FALSE, 0); | |
506 gtk_widget_show(vbox1); | |
507 gtk_box_pack_start(GTK_BOX(dialog_vbox1), vbox1, TRUE, TRUE, 0); | |
508 | |
509 hbox1 = gtk_hbox_new (FALSE, 0); | |
510 gtk_widget_show (hbox1); | |
511 gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 0); | |
512 | |
513 label_name = gtk_label_new("<b>Name:</b>"); | |
514 gtk_widget_show(label_name); | |
515 gtk_box_pack_start(GTK_BOX (hbox1), label_name, FALSE, FALSE, 0); | |
516 gtk_misc_set_alignment(GTK_MISC (label_name), 0.48, 0.51); | |
517 gtk_misc_set_padding(GTK_MISC (label_name), 10, 10); | |
518 gtk_label_set_use_markup(GTK_LABEL(label_name), TRUE); | |
519 | |
520 entry_filename = gtk_entry_new(); | |
521 gtk_widget_show(entry_filename); | |
522 gtk_box_pack_start(GTK_BOX(hbox1), entry_filename, TRUE, TRUE, 4); | |
523 gtk_editable_set_editable(GTK_EDITABLE(entry_filename), FALSE); | |
524 gtk_entry_set_text(GTK_ENTRY(entry_filename), filename); | |
525 | |
526 hbox2 = gtk_hbox_new(FALSE, 0); | |
527 gtk_widget_show(hbox2); | |
528 gtk_box_pack_start(GTK_BOX(vbox1), hbox2, TRUE, TRUE, 0); | |
529 | |
530 frame_wma_info = gtk_frame_new(NULL); | |
531 gtk_widget_show(frame_wma_info); | |
532 gtk_box_pack_start(GTK_BOX(hbox2), frame_wma_info, TRUE, TRUE, 0); | |
533 gtk_frame_set_shadow_type(GTK_FRAME (frame_wma_info), GTK_SHADOW_ETCHED_IN); | |
534 gtk_container_set_border_width (GTK_CONTAINER(frame_wma_info), 10); | |
535 | |
536 alignment1 = gtk_alignment_new(0.5, 0.5, 1, 1); | |
537 gtk_widget_show(alignment1); | |
538 gtk_container_add(GTK_CONTAINER(frame_wma_info), alignment1); | |
539 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment1), 0, 0, 0, 0); | |
540 gtk_container_set_border_width(GTK_CONTAINER(alignment1), 2); | |
541 | |
542 table1 = gtk_table_new(6, 2, FALSE); | |
543 gtk_widget_show(table1); | |
544 gtk_container_add(GTK_CONTAINER(alignment1), table1); | |
545 gtk_container_set_border_width(GTK_CONTAINER(table1), 6); | |
546 gtk_table_set_row_spacings(GTK_TABLE(table1), 3); | |
547 gtk_table_set_col_spacings(GTK_TABLE(table1), 8); | |
548 /* WMA Version label */ | |
549 label_wma_version = gtk_label_new("<b>WMA Version:</b>"); | |
550 gtk_widget_show(label_wma_version); | |
551 gtk_table_attach(GTK_TABLE(table1), label_wma_version, 0, 1, 0, 1, | |
552 (GtkAttachOptions) (GTK_FILL), | |
553 (GtkAttachOptions) (0), 0, 0); | |
554 gtk_misc_set_alignment(GTK_MISC(label_wma_version), 0, 0.5); | |
555 gtk_label_set_use_markup(GTK_LABEL(label_wma_version), TRUE); | |
556 | |
557 /* Bitrate */ | |
558 label_bitrate = gtk_label_new("<b>Bitrate:</b>"); | |
559 gtk_widget_show(label_bitrate); | |
560 gtk_table_attach(GTK_TABLE(table1), label_bitrate, 0, 1, 1, 2, | |
561 (GtkAttachOptions) (GTK_FILL), | |
562 (GtkAttachOptions) (0), 0, 0); | |
563 gtk_misc_set_alignment(GTK_MISC(label_bitrate), 0, 0.5); | |
564 gtk_label_set_use_markup(GTK_LABEL(label_bitrate), TRUE); | |
565 | |
566 /* Samplerate */ | |
567 label_rate = gtk_label_new("<b>Samplerate:</b>"); | |
568 gtk_widget_show(label_rate); | |
569 gtk_table_attach(GTK_TABLE(table1), label_rate, 0, 1, 2, 3, | |
570 (GtkAttachOptions) (GTK_FILL), | |
571 (GtkAttachOptions) (0), 0, 0); | |
572 gtk_misc_set_alignment(GTK_MISC(label_rate), 0, 0.5); | |
573 gtk_label_set_use_markup(GTK_LABEL(label_rate), TRUE); | |
574 | |
575 /* Channels */ | |
576 label_chans = gtk_label_new("<b>Channels:</b>"); | |
577 gtk_widget_show(label_chans); | |
578 gtk_table_attach(GTK_TABLE (table1), label_chans, 0, 1, 3, 4, | |
579 (GtkAttachOptions) (GTK_FILL), | |
580 (GtkAttachOptions) (0), 0, 0); | |
581 gtk_misc_set_alignment(GTK_MISC(label_chans), 0, 0.5); | |
582 gtk_label_set_use_markup(GTK_LABEL(label_chans), TRUE); | |
583 | |
584 /* Play time */ | |
585 label_play_time = gtk_label_new("<b>Play time:</b>"); | |
586 gtk_widget_show(label_play_time); | |
587 gtk_table_attach(GTK_TABLE (table1), label_play_time, 0, 1, 4, 5, | |
588 (GtkAttachOptions) (GTK_FILL), | |
589 (GtkAttachOptions) (0), 0, 0); | |
590 gtk_misc_set_alignment(GTK_MISC(label_play_time), 0, 0.5); | |
591 gtk_label_set_use_markup(GTK_LABEL(label_play_time), TRUE); | |
592 | |
593 /* Filesize */ | |
594 label_filesize = gtk_label_new("<b>Filesize:</b>"); | |
595 gtk_widget_show(label_filesize); | |
596 gtk_table_attach(GTK_TABLE(table1), label_filesize, 0, 1, 5, 6, | |
597 (GtkAttachOptions) (GTK_FILL), | |
598 (GtkAttachOptions) (0), 0, 0); | |
599 gtk_misc_set_alignment(GTK_MISC(label_filesize), 0, 0.5); | |
600 gtk_label_set_use_markup(GTK_LABEL(label_filesize), TRUE); | |
601 | |
602 | |
603 label_wma_vers_val = gtk_label_new(codec->name); | |
604 gtk_widget_show(label_wma_vers_val); | |
605 gtk_table_attach(GTK_TABLE(table1), label_wma_vers_val, 1, 2, 0, 1, | |
606 (GtkAttachOptions)(GTK_FILL), | |
607 (GtkAttachOptions) (0), 0, 0); | |
608 gtk_misc_set_alignment(GTK_MISC(label_wma_vers_val), 0, 0.5); | |
609 | |
610 label_bitrate_val = gtk_label_new(bitrate); | |
611 gtk_widget_show(label_bitrate_val); | |
612 gtk_table_attach(GTK_TABLE(table1), label_bitrate_val, 1, 2, 1, 2, | |
613 (GtkAttachOptions)(GTK_FILL), | |
614 (GtkAttachOptions) (0), 0, 0); | |
615 gtk_misc_set_alignment(GTK_MISC(label_bitrate_val), 0, 0.5); | |
616 | |
617 label_rate_val = gtk_label_new(samplerate); | |
618 gtk_widget_show(label_rate_val); | |
619 gtk_table_attach(GTK_TABLE(table1), label_rate_val, 1, 2, 2, 3, | |
620 (GtkAttachOptions)(GTK_FILL), | |
621 (GtkAttachOptions) (0), 0, 0); | |
622 gtk_misc_set_alignment(GTK_MISC(label_rate_val), 0, 0.5); | |
623 | |
624 label_chans_val = gtk_label_new(channels); | |
625 gtk_widget_show(label_chans_val); | |
626 gtk_table_attach(GTK_TABLE(table1), label_chans_val, 1, 2, 3, 4, | |
627 (GtkAttachOptions)(GTK_FILL), | |
628 (GtkAttachOptions) (0), 0, 0); | |
629 gtk_misc_set_alignment(GTK_MISC (label_chans_val), 0, 0.5); | |
630 | |
631 label_playtime_val = gtk_label_new(playtime); | |
632 gtk_widget_show(label_playtime_val); | |
633 gtk_table_attach(GTK_TABLE(table1), label_playtime_val, 1, 2, 4, 5, | |
634 (GtkAttachOptions)(GTK_FILL), | |
635 (GtkAttachOptions) (0), 0, 0); | |
636 gtk_misc_set_alignment(GTK_MISC(label_playtime_val), 0, 0.5); | |
637 | |
638 label_filesize_val = gtk_label_new(filesize); | |
639 gtk_widget_show(label_filesize_val); | |
640 gtk_table_attach(GTK_TABLE (table1), label_filesize_val, 1, 2, 5, 6, | |
641 (GtkAttachOptions)(GTK_FILL), | |
642 (GtkAttachOptions) (0), 0, 0); | |
643 gtk_misc_set_alignment(GTK_MISC(label_filesize_val), 0, 0.5); | |
644 | |
645 label4 = gtk_label_new ("WMA Info"); | |
646 gtk_widget_show(label4); | |
647 gtk_frame_set_label_widget(GTK_FRAME(frame_wma_info), label4); | |
648 frame_tags = gtk_frame_new (NULL); | |
649 gtk_widget_show (frame_tags); | |
650 gtk_box_pack_start (GTK_BOX (hbox2), frame_tags, TRUE, TRUE, 0); | |
651 gtk_frame_set_shadow_type (GTK_FRAME (frame_tags), GTK_SHADOW_ETCHED_IN); | |
652 gtk_container_set_border_width (GTK_CONTAINER (frame_tags), 10); | |
653 | |
137 | 654 |
440 | 655 alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1); |
656 gtk_widget_show (alignment2); | |
657 gtk_container_add (GTK_CONTAINER (frame_tags), alignment2); | |
658 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment2), 0, 0, 12, 0); | |
659 gtk_container_set_border_width (GTK_CONTAINER (alignment2), 2); | |
660 | |
661 | |
662 table2 = gtk_table_new(8, 2, FALSE); | |
663 gtk_widget_show(table2); | |
664 gtk_container_add(GTK_CONTAINER(alignment2), table2); | |
665 gtk_container_set_border_width(GTK_CONTAINER(table2), 6); | |
666 gtk_table_set_row_spacings(GTK_TABLE(table2), 3); | |
667 gtk_table_set_col_spacings(GTK_TABLE(table2), 8); | |
668 | |
669 /* Artist */ | |
670 label_artist = gtk_label_new("<b>Artist:</b>"); | |
671 gtk_widget_show(label_artist); | |
672 gtk_table_attach(GTK_TABLE (table2), label_artist, 0, 1, 0, 1, | |
673 (GtkAttachOptions) (GTK_FILL), | |
674 (GtkAttachOptions) (0), 0, 0); | |
675 gtk_misc_set_alignment(GTK_MISC(label_artist), 0, 0.5); | |
676 gtk_label_set_use_markup(GTK_LABEL(label_artist), TRUE); | |
677 | |
678 /* Title */ | |
679 label_title = gtk_label_new("<b>Title:</b>"); | |
680 gtk_widget_show(label_title); | |
681 gtk_table_attach(GTK_TABLE (table2), label_title, 0, 1, 1, 2, | |
682 (GtkAttachOptions) (GTK_FILL), | |
683 (GtkAttachOptions) (0), 0, 0); | |
684 gtk_misc_set_alignment(GTK_MISC(label_title), 0, 0.5); | |
685 gtk_label_set_use_markup(GTK_LABEL(label_title), TRUE); | |
686 | |
687 /* Album */ | |
688 label_album = gtk_label_new("<b>Album:</b>"); | |
689 gtk_widget_show(label_album); | |
690 gtk_table_attach(GTK_TABLE (table2), label_album, 0, 1, 2, 3, | |
691 (GtkAttachOptions) (GTK_FILL), | |
692 (GtkAttachOptions) (0), 0, 0); | |
693 gtk_misc_set_alignment(GTK_MISC(label_album), 0, 0.5); | |
694 gtk_label_set_use_markup(GTK_LABEL(label_album), TRUE); | |
695 | |
696 /* Comments */ | |
697 label_comments = gtk_label_new("<b>Comments:</b>"); | |
698 gtk_widget_show(label_comments); | |
699 gtk_table_attach(GTK_TABLE(table2), label_comments, 0, 1, 3, 4, | |
700 (GtkAttachOptions) (GTK_FILL), | |
701 (GtkAttachOptions) (0), 0, 0); | |
702 gtk_misc_set_alignment(GTK_MISC(label_comments), 0, 0.5); | |
703 gtk_label_set_use_markup(GTK_LABEL(label_comments), TRUE); | |
704 | |
705 /* Year */ | |
706 label_year = gtk_label_new("<b>Year:</b>"); | |
707 gtk_widget_show(label_year); | |
708 gtk_table_attach(GTK_TABLE (table2), label_year, 0, 1, 4, 5, | |
709 (GtkAttachOptions) (GTK_FILL), | |
710 (GtkAttachOptions) (0), 0, 0); | |
711 gtk_misc_set_alignment(GTK_MISC(label_year), 0, 0.5); | |
712 gtk_label_set_use_markup(GTK_LABEL(label_year), TRUE); | |
713 | |
714 /* Track */ | |
715 label_track = gtk_label_new("<b>Track:</b>"); | |
716 gtk_widget_show(label_track); | |
717 gtk_table_attach(GTK_TABLE (table2), label_track, 0, 1, 5, 6, | |
718 (GtkAttachOptions) (GTK_FILL), | |
719 (GtkAttachOptions) (0), 0, 0); | |
720 gtk_misc_set_alignment(GTK_MISC(label_track), 0, 0.5); | |
721 gtk_label_set_use_markup(GTK_LABEL(label_track), TRUE); | |
722 | |
723 /* Genre */ | |
724 label_genre = gtk_label_new("<b>Genre:</b>"); | |
725 gtk_widget_show(label_genre); | |
726 gtk_table_attach(GTK_TABLE (table2), label_genre, 0, 1, 6, 7, | |
727 (GtkAttachOptions) (GTK_FILL), | |
728 (GtkAttachOptions) (0), 0, 0); | |
729 gtk_misc_set_alignment(GTK_MISC (label_genre), 0, 0.5); | |
730 gtk_label_set_use_markup(GTK_LABEL(label_genre), TRUE); | |
731 | |
137 | 732 |
440 | 733 entry_artist = gtk_entry_new(); |
734 gtk_widget_show (entry_artist); | |
735 gtk_table_attach (GTK_TABLE (table2), entry_artist, 1, 2, 0, 1, | |
736 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), | |
737 (GtkAttachOptions) (0), 0, 0); | |
738 gtk_editable_set_editable (GTK_EDITABLE (entry_artist), FALSE); | |
739 gtk_entry_set_text(GTK_ENTRY(entry_artist), in->author); | |
740 | |
741 entry_title = gtk_entry_new(); | |
742 gtk_widget_show(entry_title); | |
743 gtk_table_attach (GTK_TABLE (table2), entry_title, 1, 2, 1, 2, | |
744 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), | |
745 (GtkAttachOptions) (0), 0, 0); | |
746 gtk_editable_set_editable(GTK_EDITABLE (entry_title), FALSE); | |
747 gtk_entry_set_text(GTK_ENTRY(entry_title), in->title); | |
748 | |
749 entry_album = gtk_entry_new(); | |
750 gtk_widget_show(entry_album); | |
751 gtk_table_attach(GTK_TABLE (table2), entry_album, 1, 2, 2, 3, | |
752 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), | |
753 (GtkAttachOptions) (0), 0, 0); | |
754 gtk_editable_set_editable(GTK_EDITABLE (entry_album), FALSE); | |
755 gtk_entry_set_text(GTK_ENTRY(entry_album), in->album); | |
756 | |
757 entry_comments = gtk_entry_new(); | |
758 gtk_widget_show(entry_comments); | |
759 gtk_table_attach(GTK_TABLE (table2), entry_comments, 1, 2, 3, 4, | |
760 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), | |
761 (GtkAttachOptions) (0), 0, 0); | |
762 gtk_editable_set_editable(GTK_EDITABLE (entry_comments), FALSE); | |
763 gtk_entry_set_text(GTK_ENTRY(entry_comments), in->comment); | |
764 | |
765 entry_year = gtk_entry_new(); | |
766 gtk_widget_show(entry_year); | |
767 gtk_table_attach(GTK_TABLE (table2), entry_year, 1, 2, 4, 5, | |
768 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), | |
769 (GtkAttachOptions) (0), 0, 0); | |
770 gtk_editable_set_editable(GTK_EDITABLE (entry_year), FALSE); | |
771 gtk_entry_set_text(GTK_ENTRY(entry_year), g_strdup_printf("%d", in->year)); | |
772 | |
773 entry_track = gtk_entry_new(); | |
774 gtk_widget_show(entry_track); | |
775 gtk_table_attach(GTK_TABLE (table2), entry_track, 1, 2, 5, 6, | |
776 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), | |
777 (GtkAttachOptions) (0), 0, 0); | |
778 gtk_editable_set_editable(GTK_EDITABLE (entry_track), FALSE); | |
779 gtk_entry_set_text(GTK_ENTRY(entry_track), g_strdup_printf("%d", in->track)); | |
780 | |
781 entry_genre = gtk_entry_new(); | |
782 gtk_widget_show(entry_genre); | |
783 gtk_table_attach(GTK_TABLE (table2), entry_genre, 1, 2, 6, 7, | |
784 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), | |
785 (GtkAttachOptions) (0), 0, 0); | |
786 gtk_editable_set_editable(GTK_EDITABLE (entry_genre), FALSE); | |
787 gtk_entry_set_text(GTK_ENTRY(entry_genre), in->genre); | |
788 | |
789 | |
790 label5 = gtk_label_new("Tags"); | |
791 gtk_widget_show(label5); | |
792 gtk_frame_set_label_widget(GTK_FRAME(frame_tags), label5); | |
793 | |
794 | |
795 dialog_action_area1 = GTK_DIALOG(dialog)->action_area; | |
796 gtk_widget_show(dialog_action_area1); | |
797 gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END); | |
798 | |
799 okbutton = gtk_button_new_from_stock("gtk-ok"); | |
800 gtk_widget_show(okbutton); | |
801 gtk_dialog_add_action_widget(GTK_DIALOG(dialog), okbutton, GTK_RESPONSE_OK); | |
802 GTK_WIDGET_SET_FLAGS(okbutton, GTK_CAN_DEFAULT); | |
803 | |
804 gtk_signal_connect_object(GTK_OBJECT(okbutton), "clicked", | |
805 GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(dialog)); | |
806 | |
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
|
807 gtk_widget_show(dialog); |
440 | 808 |
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
|
809 g_free(title); |
440 | 810 g_free(channels); |
811 g_free(bitrate); | |
812 g_free(playtime); | |
813 g_free(samplerate); | |
814 g_free(filesize); | |
137 | 815 } |