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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
1 /*
440
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
4 *
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
5 * Based on:
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
6 * xmms-wma - WMA player for BMP
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
7 * Copyright (C) 2004,2005 McMCC <mcmcc@mail.ru>
440
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
8 * bmp-wma - WMA player for BMP
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
9 * Copyright (C) 2004 Roman Bogorodskiy <bogorodskiy@inbox.ru>
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
10 *
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
14 * (at your option) any later version.
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
15 *
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
19 * GNU General Public License for more details.
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
20 *
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
24 */
244
38892498a565 [svn] C99 compliance issues inside wma.c.
nenolod
parents: 218
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
f13ab2d8e9cf [svn] various fixes :(
nenolod
parents: 351
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
36
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
37 #include "avcodec.h"
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
38 #include "avformat.h"
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
41 the BEEP-WMA plugin which is Copyright (C) 2004,2005 Mokrushin I.V. aka McMCC (mcmcc@mail.ru)\n \
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
55 #define ST_BUFF 1024
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
56
440
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
59
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
60 static int wma_decode = 0;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
61 static gboolean wma_pause = 0;
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
62 static int wma_seekpos = -1;
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
63 static int wma_st_buff, wma_idx;
179
15c2210499ea [svn] Use GThread instead of pthread.
chainsaw
parents: 138
diff changeset
64 static GThread *wma_decode_thread;
15c2210499ea [svn] Use GThread instead of pthread.
chainsaw
parents: 138
diff changeset
65 GStaticMutex wma_mutex = G_STATIC_MUTEX_INIT;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
66 static AVCodecContext *c = NULL;
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
67 static AVFormatContext *ic = NULL;
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
68 static uint8_t *wma_outbuf, *wma_s_outbuf;
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
69
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
70 char description[64];
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
71 static void wma_about(void);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
72 static void wma_init(void);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
73 static int wma_is_our_file(char *filename);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
74 static void wma_play_file(char *filename);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
75 static void wma_stop(void);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
76 static void wma_seek(int time);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
77 static void wma_do_pause(short p);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
78 static int wma_get_time(void);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
79 static void wma_get_song_info(char *filename, char **title, int *length);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
80 static void wma_file_info_box(char *filename);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
81 static char *wsong_title;
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
82 static int wsong_time;
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
83
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
84 InputPlugin *get_iplugin_info(void);
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
85
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
86 InputPlugin wma_ip =
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
87 {
440
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
88 NULL, // Filled in by xmms
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
91 wma_init, // Called when the plugin is loaded
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
102 NULL, // Get volume
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
103 NULL, // Set volume
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
104 NULL, // OBSOLETE!
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
105 NULL, // OBSOLETE!
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
106 NULL, // Send data to the visualization plugins
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
107 NULL, // Fill in the stuff that is shown in the player window
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
111 NULL // Handle to the current output plugin. Filled in by xmms
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
112 };
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
113
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
114 InputPlugin *get_iplugin_info(void)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
121 static void wma_about(void)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
148 GTK_SIGNAL_FUNC(gtk_widget_destroy),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
158 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
159
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
160 static void wma_init(void)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
165 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
166
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
167 static int wma_is_our_file(char *filename)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
172 if(!strcasecmp(ext, ".wma"))
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
175 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
176
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
177 static void wma_do_pause(short p)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
181 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
182
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
183 static void wma_seek(int time)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
189 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
190
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
191 static int wma_get_time(void)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
196 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
197
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
198 static gchar *extname(const char *filename)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
205 static char* w_getstr(char* str)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
209 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
210
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
211 static gchar *get_song_title(AVFormatContext *in, gchar * filename)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
212 {
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
213 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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
238 if (extname(ret) != NULL)
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
242 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
243
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
244 static guint get_song_time(AVFormatContext *in)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
250 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
251
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
252 static void wma_get_song_info(char *filename, char **title_real, int *len_real)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
258
440
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
266 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
267
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
268 static void wma_playbuff(int out_size)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
274
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
275 while(!fifo_read(&f, wma_s_outbuf, wma_st_buff, &f.rptr) && wma_decode) {
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
276 if (wma_pause)
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
277 memset(wma_s_outbuf, 0, wma_st_buff);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
278
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
279 while (wma_ip.output->buffer_free() < wma_st_buff)
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
280 xmms_usleep(20000);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
281
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
282 if (wma_seekpos == -1)
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
283 produce_audio(wma_ip.output->written_time(), FMT_S16_NE,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
284 c->channels, wma_st_buff, (short *)wma_s_outbuf, &wma_decode);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
285
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
291 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
292
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
293 static void *wma_play_loop(void *arg)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
301
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
302 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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
308
440
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
309 if(av_read_frame(ic, &pkt) < 0) break;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
310
440
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
311 size = pkt.size;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
312 inbuf_ptr = pkt.data;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
313
440
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
314 if(size == 0) break;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
315
440
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
316 while(size > 0){
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
317 len = avcodec_decode_audio(c, (short *)wma_outbuf, &out_size,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
325 size -= len;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
326 inbuf_ptr += len;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
327 if(pkt.data) av_free_packet(&pkt);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
340 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
341
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
342 static void wma_play_file(char *filename)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
349 c = &ic->streams[wma_idx]->codec;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
15c2210499ea [svn] Use GThread instead of pthread.
chainsaw
parents: 138
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
356
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
357 if(!codec) return;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
358
210
12004b385a96 [svn] Sync with xmms-wma instead of bmp-wma & GThreadify. Does not explode, but does not play either.
chainsaw
parents: 179
diff changeset
359 if(avcodec_open(c, codec) < 0) return;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
364 if(wma_ip.output->open_audio(FMT_S16_NE, c->sample_rate, c->channels) <= 0) return;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
375 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
376
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
377 static void wma_stop(void)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
383 }
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
384
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
385 static void wma_file_info_box (char *filename)
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
386 {
440
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
387 GtkWidget *dialog_vbox1;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
388 GtkWidget *vbox1;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
389 GtkWidget *hbox1;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
390 GtkWidget *label_name;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
391 GtkWidget *entry_filename;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
392 GtkWidget *hbox2;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
393 GtkWidget *frame_wma_info;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
394 GtkWidget *alignment1;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
395 GtkWidget *table1;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
396 GtkWidget *label_album;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
397 GtkWidget *label_year;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
398 GtkWidget *label_track;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
399 GtkWidget *label_genre;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
400 GtkWidget *label_comments;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
401 GtkWidget *label_wma_version;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
402 GtkWidget *label_bitrate;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
403 GtkWidget *label_rate;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
404 GtkWidget *label_chans;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
405 GtkWidget *label_play_time;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
406 GtkWidget *label_filesize;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
407 GtkWidget *label_wma_vers_val;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
408 GtkWidget *label_bitrate_val;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
409 GtkWidget *label_rate_val;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
410 GtkWidget *label_chans_val;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
411 GtkWidget *label_playtime_val;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
412 GtkWidget *label_filesize_val;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
413 GtkWidget *label4;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
414 GtkWidget *frame_tags;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
415 GtkWidget *alignment2;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
416 GtkWidget *table2;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
417 GtkWidget *label_artist;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
418 GtkWidget *label_title;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
419 GtkWidget *entry_artist;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
420 GtkWidget *entry_album;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
421 GtkWidget *entry_year;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
422 GtkWidget *entry_title;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
423 GtkWidget *entry_track;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
424 GtkWidget *entry_genre;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
425 GtkWidget *entry_comments;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
426 GtkWidget *label5;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
427 GtkWidget *dialog_action_area1;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
428 GtkWidget *okbutton;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
433 gint tns, thh, tmm, tss;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
434 gint i;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
435 gchar *title,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
436 *channels,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
437 *bitrate,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
438 *playtime,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
439 *samplerate,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
440 *filesize;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
441 FILE *f;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
442 if (dialog) {
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
443 (void)printf("Info dialog is already opened!\n");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
444 return;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
445 }
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
446
440
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
447 if(av_open_input_file(&in, filename, NULL, 0, NULL) < 0)
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
448 return;
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
452 if(s->codec_type == CODEC_TYPE_AUDIO)
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
458
440
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
459 /* window title */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
460 title = g_strdup_printf("File Info - %s", g_basename(filename));
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
461 /* channels */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
462 if (s->channels == 1)
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
463 channels = g_strdup("MONO");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
464 else
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
465 channels = g_strdup("STEREO");
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
466
440
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
467 /* bitrate */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
468 bitrate = g_strdup_printf("%d Kb/s", (s->bit_rate / 1000));
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
469
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
470 /* playtime */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
476 playtime = g_strdup_printf("%02d:%02d:%02d", thh, tmm, tss);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
477 } else
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
478 playtime = g_strdup("N/A");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
479
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
480 /* samplerate */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
481 samplerate = g_strdup_printf("%d Hz", s->sample_rate);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
482
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
483 /* filesize */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
484 f = fopen(filename, "rb");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
485
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
486 if (f == NULL)
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
487 return;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
488
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
489 fseek(f, 0, SEEK_END);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
490 filesize = g_strdup_printf("%lu Bytes", ftell(f));
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
491 fclose(f);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
496 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dialog);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
501
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
502 dialog_vbox1 = GTK_DIALOG(dialog)->vbox;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
503 gtk_widget_show(dialog_vbox1);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
504
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
505 vbox1 = gtk_vbox_new(FALSE, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
506 gtk_widget_show(vbox1);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
507 gtk_box_pack_start(GTK_BOX(dialog_vbox1), vbox1, TRUE, TRUE, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
508
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
509 hbox1 = gtk_hbox_new (FALSE, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
510 gtk_widget_show (hbox1);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
511 gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
512
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
513 label_name = gtk_label_new("<b>Name:</b>");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
514 gtk_widget_show(label_name);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
515 gtk_box_pack_start(GTK_BOX (hbox1), label_name, FALSE, FALSE, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
516 gtk_misc_set_alignment(GTK_MISC (label_name), 0.48, 0.51);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
517 gtk_misc_set_padding(GTK_MISC (label_name), 10, 10);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
518 gtk_label_set_use_markup(GTK_LABEL(label_name), TRUE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
519
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
520 entry_filename = gtk_entry_new();
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
521 gtk_widget_show(entry_filename);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
522 gtk_box_pack_start(GTK_BOX(hbox1), entry_filename, TRUE, TRUE, 4);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
523 gtk_editable_set_editable(GTK_EDITABLE(entry_filename), FALSE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
524 gtk_entry_set_text(GTK_ENTRY(entry_filename), filename);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
525
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
526 hbox2 = gtk_hbox_new(FALSE, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
527 gtk_widget_show(hbox2);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
528 gtk_box_pack_start(GTK_BOX(vbox1), hbox2, TRUE, TRUE, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
529
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
530 frame_wma_info = gtk_frame_new(NULL);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
531 gtk_widget_show(frame_wma_info);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
532 gtk_box_pack_start(GTK_BOX(hbox2), frame_wma_info, TRUE, TRUE, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
533 gtk_frame_set_shadow_type(GTK_FRAME (frame_wma_info), GTK_SHADOW_ETCHED_IN);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
534 gtk_container_set_border_width (GTK_CONTAINER(frame_wma_info), 10);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
535
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
536 alignment1 = gtk_alignment_new(0.5, 0.5, 1, 1);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
537 gtk_widget_show(alignment1);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
538 gtk_container_add(GTK_CONTAINER(frame_wma_info), alignment1);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
539 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment1), 0, 0, 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
540 gtk_container_set_border_width(GTK_CONTAINER(alignment1), 2);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
541
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
542 table1 = gtk_table_new(6, 2, FALSE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
543 gtk_widget_show(table1);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
544 gtk_container_add(GTK_CONTAINER(alignment1), table1);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
545 gtk_container_set_border_width(GTK_CONTAINER(table1), 6);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
546 gtk_table_set_row_spacings(GTK_TABLE(table1), 3);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
547 gtk_table_set_col_spacings(GTK_TABLE(table1), 8);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
548 /* WMA Version label */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
549 label_wma_version = gtk_label_new("<b>WMA Version:</b>");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
550 gtk_widget_show(label_wma_version);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
551 gtk_table_attach(GTK_TABLE(table1), label_wma_version, 0, 1, 0, 1,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
552 (GtkAttachOptions) (GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
553 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
554 gtk_misc_set_alignment(GTK_MISC(label_wma_version), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
555 gtk_label_set_use_markup(GTK_LABEL(label_wma_version), TRUE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
556
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
557 /* Bitrate */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
558 label_bitrate = gtk_label_new("<b>Bitrate:</b>");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
559 gtk_widget_show(label_bitrate);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
560 gtk_table_attach(GTK_TABLE(table1), label_bitrate, 0, 1, 1, 2,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
561 (GtkAttachOptions) (GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
562 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
563 gtk_misc_set_alignment(GTK_MISC(label_bitrate), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
564 gtk_label_set_use_markup(GTK_LABEL(label_bitrate), TRUE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
565
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
566 /* Samplerate */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
567 label_rate = gtk_label_new("<b>Samplerate:</b>");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
568 gtk_widget_show(label_rate);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
569 gtk_table_attach(GTK_TABLE(table1), label_rate, 0, 1, 2, 3,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
570 (GtkAttachOptions) (GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
571 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
572 gtk_misc_set_alignment(GTK_MISC(label_rate), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
573 gtk_label_set_use_markup(GTK_LABEL(label_rate), TRUE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
574
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
575 /* Channels */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
576 label_chans = gtk_label_new("<b>Channels:</b>");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
577 gtk_widget_show(label_chans);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
578 gtk_table_attach(GTK_TABLE (table1), label_chans, 0, 1, 3, 4,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
579 (GtkAttachOptions) (GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
580 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
581 gtk_misc_set_alignment(GTK_MISC(label_chans), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
582 gtk_label_set_use_markup(GTK_LABEL(label_chans), TRUE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
583
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
584 /* Play time */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
585 label_play_time = gtk_label_new("<b>Play time:</b>");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
586 gtk_widget_show(label_play_time);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
587 gtk_table_attach(GTK_TABLE (table1), label_play_time, 0, 1, 4, 5,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
588 (GtkAttachOptions) (GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
589 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
590 gtk_misc_set_alignment(GTK_MISC(label_play_time), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
591 gtk_label_set_use_markup(GTK_LABEL(label_play_time), TRUE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
592
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
593 /* Filesize */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
594 label_filesize = gtk_label_new("<b>Filesize:</b>");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
595 gtk_widget_show(label_filesize);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
596 gtk_table_attach(GTK_TABLE(table1), label_filesize, 0, 1, 5, 6,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
597 (GtkAttachOptions) (GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
598 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
599 gtk_misc_set_alignment(GTK_MISC(label_filesize), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
600 gtk_label_set_use_markup(GTK_LABEL(label_filesize), TRUE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
601
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
602
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
603 label_wma_vers_val = gtk_label_new(codec->name);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
604 gtk_widget_show(label_wma_vers_val);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
605 gtk_table_attach(GTK_TABLE(table1), label_wma_vers_val, 1, 2, 0, 1,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
606 (GtkAttachOptions)(GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
607 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
608 gtk_misc_set_alignment(GTK_MISC(label_wma_vers_val), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
609
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
610 label_bitrate_val = gtk_label_new(bitrate);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
611 gtk_widget_show(label_bitrate_val);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
612 gtk_table_attach(GTK_TABLE(table1), label_bitrate_val, 1, 2, 1, 2,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
613 (GtkAttachOptions)(GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
614 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
615 gtk_misc_set_alignment(GTK_MISC(label_bitrate_val), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
616
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
617 label_rate_val = gtk_label_new(samplerate);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
618 gtk_widget_show(label_rate_val);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
619 gtk_table_attach(GTK_TABLE(table1), label_rate_val, 1, 2, 2, 3,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
620 (GtkAttachOptions)(GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
621 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
622 gtk_misc_set_alignment(GTK_MISC(label_rate_val), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
623
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
624 label_chans_val = gtk_label_new(channels);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
625 gtk_widget_show(label_chans_val);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
626 gtk_table_attach(GTK_TABLE(table1), label_chans_val, 1, 2, 3, 4,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
627 (GtkAttachOptions)(GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
628 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
629 gtk_misc_set_alignment(GTK_MISC (label_chans_val), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
630
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
631 label_playtime_val = gtk_label_new(playtime);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
632 gtk_widget_show(label_playtime_val);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
633 gtk_table_attach(GTK_TABLE(table1), label_playtime_val, 1, 2, 4, 5,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
634 (GtkAttachOptions)(GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
635 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
636 gtk_misc_set_alignment(GTK_MISC(label_playtime_val), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
637
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
638 label_filesize_val = gtk_label_new(filesize);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
639 gtk_widget_show(label_filesize_val);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
640 gtk_table_attach(GTK_TABLE (table1), label_filesize_val, 1, 2, 5, 6,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
641 (GtkAttachOptions)(GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
642 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
643 gtk_misc_set_alignment(GTK_MISC(label_filesize_val), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
644
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
645 label4 = gtk_label_new ("WMA Info");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
646 gtk_widget_show(label4);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
647 gtk_frame_set_label_widget(GTK_FRAME(frame_wma_info), label4);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
648 frame_tags = gtk_frame_new (NULL);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
649 gtk_widget_show (frame_tags);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
650 gtk_box_pack_start (GTK_BOX (hbox2), frame_tags, TRUE, TRUE, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
651 gtk_frame_set_shadow_type (GTK_FRAME (frame_tags), GTK_SHADOW_ETCHED_IN);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
652 gtk_container_set_border_width (GTK_CONTAINER (frame_tags), 10);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
653
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
654
440
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
655 alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
656 gtk_widget_show (alignment2);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
657 gtk_container_add (GTK_CONTAINER (frame_tags), alignment2);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
658 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment2), 0, 0, 12, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
659 gtk_container_set_border_width (GTK_CONTAINER (alignment2), 2);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
660
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
661
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
662 table2 = gtk_table_new(8, 2, FALSE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
663 gtk_widget_show(table2);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
664 gtk_container_add(GTK_CONTAINER(alignment2), table2);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
665 gtk_container_set_border_width(GTK_CONTAINER(table2), 6);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
666 gtk_table_set_row_spacings(GTK_TABLE(table2), 3);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
667 gtk_table_set_col_spacings(GTK_TABLE(table2), 8);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
668
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
669 /* Artist */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
670 label_artist = gtk_label_new("<b>Artist:</b>");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
671 gtk_widget_show(label_artist);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
672 gtk_table_attach(GTK_TABLE (table2), label_artist, 0, 1, 0, 1,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
673 (GtkAttachOptions) (GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
674 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
675 gtk_misc_set_alignment(GTK_MISC(label_artist), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
676 gtk_label_set_use_markup(GTK_LABEL(label_artist), TRUE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
677
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
678 /* Title */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
679 label_title = gtk_label_new("<b>Title:</b>");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
680 gtk_widget_show(label_title);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
681 gtk_table_attach(GTK_TABLE (table2), label_title, 0, 1, 1, 2,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
682 (GtkAttachOptions) (GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
683 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
684 gtk_misc_set_alignment(GTK_MISC(label_title), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
685 gtk_label_set_use_markup(GTK_LABEL(label_title), TRUE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
686
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
687 /* Album */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
688 label_album = gtk_label_new("<b>Album:</b>");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
689 gtk_widget_show(label_album);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
690 gtk_table_attach(GTK_TABLE (table2), label_album, 0, 1, 2, 3,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
691 (GtkAttachOptions) (GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
692 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
693 gtk_misc_set_alignment(GTK_MISC(label_album), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
694 gtk_label_set_use_markup(GTK_LABEL(label_album), TRUE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
695
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
696 /* Comments */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
697 label_comments = gtk_label_new("<b>Comments:</b>");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
698 gtk_widget_show(label_comments);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
699 gtk_table_attach(GTK_TABLE(table2), label_comments, 0, 1, 3, 4,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
700 (GtkAttachOptions) (GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
701 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
702 gtk_misc_set_alignment(GTK_MISC(label_comments), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
703 gtk_label_set_use_markup(GTK_LABEL(label_comments), TRUE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
704
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
705 /* Year */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
706 label_year = gtk_label_new("<b>Year:</b>");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
707 gtk_widget_show(label_year);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
708 gtk_table_attach(GTK_TABLE (table2), label_year, 0, 1, 4, 5,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
709 (GtkAttachOptions) (GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
710 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
711 gtk_misc_set_alignment(GTK_MISC(label_year), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
712 gtk_label_set_use_markup(GTK_LABEL(label_year), TRUE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
713
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
714 /* Track */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
715 label_track = gtk_label_new("<b>Track:</b>");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
716 gtk_widget_show(label_track);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
717 gtk_table_attach(GTK_TABLE (table2), label_track, 0, 1, 5, 6,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
718 (GtkAttachOptions) (GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
719 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
720 gtk_misc_set_alignment(GTK_MISC(label_track), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
721 gtk_label_set_use_markup(GTK_LABEL(label_track), TRUE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
722
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
723 /* Genre */
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
724 label_genre = gtk_label_new("<b>Genre:</b>");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
725 gtk_widget_show(label_genre);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
726 gtk_table_attach(GTK_TABLE (table2), label_genre, 0, 1, 6, 7,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
727 (GtkAttachOptions) (GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
728 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
729 gtk_misc_set_alignment(GTK_MISC (label_genre), 0, 0.5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
730 gtk_label_set_use_markup(GTK_LABEL(label_genre), TRUE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
731
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
732
440
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
733 entry_artist = gtk_entry_new();
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
734 gtk_widget_show (entry_artist);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
735 gtk_table_attach (GTK_TABLE (table2), entry_artist, 1, 2, 0, 1,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
736 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
737 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
738 gtk_editable_set_editable (GTK_EDITABLE (entry_artist), FALSE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
739 gtk_entry_set_text(GTK_ENTRY(entry_artist), in->author);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
740
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
741 entry_title = gtk_entry_new();
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
742 gtk_widget_show(entry_title);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
743 gtk_table_attach (GTK_TABLE (table2), entry_title, 1, 2, 1, 2,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
744 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
745 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
746 gtk_editable_set_editable(GTK_EDITABLE (entry_title), FALSE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
747 gtk_entry_set_text(GTK_ENTRY(entry_title), in->title);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
748
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
749 entry_album = gtk_entry_new();
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
750 gtk_widget_show(entry_album);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
751 gtk_table_attach(GTK_TABLE (table2), entry_album, 1, 2, 2, 3,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
752 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
753 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
754 gtk_editable_set_editable(GTK_EDITABLE (entry_album), FALSE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
755 gtk_entry_set_text(GTK_ENTRY(entry_album), in->album);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
756
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
757 entry_comments = gtk_entry_new();
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
758 gtk_widget_show(entry_comments);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
759 gtk_table_attach(GTK_TABLE (table2), entry_comments, 1, 2, 3, 4,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
760 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
761 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
762 gtk_editable_set_editable(GTK_EDITABLE (entry_comments), FALSE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
763 gtk_entry_set_text(GTK_ENTRY(entry_comments), in->comment);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
764
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
765 entry_year = gtk_entry_new();
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
766 gtk_widget_show(entry_year);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
767 gtk_table_attach(GTK_TABLE (table2), entry_year, 1, 2, 4, 5,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
768 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
769 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
770 gtk_editable_set_editable(GTK_EDITABLE (entry_year), FALSE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
771 gtk_entry_set_text(GTK_ENTRY(entry_year), g_strdup_printf("%d", in->year));
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
772
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
773 entry_track = gtk_entry_new();
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
774 gtk_widget_show(entry_track);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
775 gtk_table_attach(GTK_TABLE (table2), entry_track, 1, 2, 5, 6,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
776 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
777 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
778 gtk_editable_set_editable(GTK_EDITABLE (entry_track), FALSE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
779 gtk_entry_set_text(GTK_ENTRY(entry_track), g_strdup_printf("%d", in->track));
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
780
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
781 entry_genre = gtk_entry_new();
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
782 gtk_widget_show(entry_genre);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
783 gtk_table_attach(GTK_TABLE (table2), entry_genre, 1, 2, 6, 7,
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
784 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
785 (GtkAttachOptions) (0), 0, 0);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
786 gtk_editable_set_editable(GTK_EDITABLE (entry_genre), FALSE);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
787 gtk_entry_set_text(GTK_ENTRY(entry_genre), in->genre);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
788
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
789
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
790 label5 = gtk_label_new("Tags");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
791 gtk_widget_show(label5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
792 gtk_frame_set_label_widget(GTK_FRAME(frame_tags), label5);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
793
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
794
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
795 dialog_action_area1 = GTK_DIALOG(dialog)->action_area;
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
796 gtk_widget_show(dialog_action_area1);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
797 gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
798
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
799 okbutton = gtk_button_new_from_stock("gtk-ok");
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
800 gtk_widget_show(okbutton);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
801 gtk_dialog_add_action_widget(GTK_DIALOG(dialog), okbutton, GTK_RESPONSE_OK);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
802 GTK_WIDGET_SET_FLAGS(okbutton, GTK_CAN_DEFAULT);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
803
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
804 gtk_signal_connect_object(GTK_OBJECT(okbutton), "clicked",
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
805 GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(dialog));
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
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
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
810 g_free(channels);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
811 g_free(bitrate);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
812 g_free(playtime);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
813 g_free(samplerate);
73de03e5c9dc [svn] Pinch nicer file info dialog from BMP-WMA.
chainsaw
parents: 427
diff changeset
814 g_free(filesize);
137
b8d4c1faa6d7 [svn] Import WMA decoder into SVN.
nenolod
parents:
diff changeset
815 }