Mercurial > audlegacy-plugins
annotate src/cdaudio-ng/cdaudio-ng.c @ 2512:1f6b5f5768e2
Remove some completely useless null-pointer checks, g_free() checks the pointer anyway.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 02 Apr 2008 22:58:35 +0300 |
parents | 7b284f323ad8 |
children | 769e17da93dd |
rev | line source |
---|---|
1508
a99d8f3b3e7c
Fixed some dos/windows eols
Calin Crisan ccrisan@gmail.com
parents:
1490
diff
changeset
|
1 /* |
a99d8f3b3e7c
Fixed some dos/windows eols
Calin Crisan ccrisan@gmail.com
parents:
1490
diff
changeset
|
2 * Audacious CD Digital Audio plugin |
a99d8f3b3e7c
Fixed some dos/windows eols
Calin Crisan ccrisan@gmail.com
parents:
1490
diff
changeset
|
3 * |
a99d8f3b3e7c
Fixed some dos/windows eols
Calin Crisan ccrisan@gmail.com
parents:
1490
diff
changeset
|
4 * Copyright (c) 2007 Calin Crisan <ccrisan@gmail.com> |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
5 * |
1508
a99d8f3b3e7c
Fixed some dos/windows eols
Calin Crisan ccrisan@gmail.com
parents:
1490
diff
changeset
|
6 * This program is free software; you can redistribute it and/or modify |
a99d8f3b3e7c
Fixed some dos/windows eols
Calin Crisan ccrisan@gmail.com
parents:
1490
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
a99d8f3b3e7c
Fixed some dos/windows eols
Calin Crisan ccrisan@gmail.com
parents:
1490
diff
changeset
|
8 * the Free Software Foundation; under version 3 of the License. |
a99d8f3b3e7c
Fixed some dos/windows eols
Calin Crisan ccrisan@gmail.com
parents:
1490
diff
changeset
|
9 * |
a99d8f3b3e7c
Fixed some dos/windows eols
Calin Crisan ccrisan@gmail.com
parents:
1490
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, |
a99d8f3b3e7c
Fixed some dos/windows eols
Calin Crisan ccrisan@gmail.com
parents:
1490
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
a99d8f3b3e7c
Fixed some dos/windows eols
Calin Crisan ccrisan@gmail.com
parents:
1490
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a99d8f3b3e7c
Fixed some dos/windows eols
Calin Crisan ccrisan@gmail.com
parents:
1490
diff
changeset
|
13 * GNU General Public License for more details. |
a99d8f3b3e7c
Fixed some dos/windows eols
Calin Crisan ccrisan@gmail.com
parents:
1490
diff
changeset
|
14 * |
a99d8f3b3e7c
Fixed some dos/windows eols
Calin Crisan ccrisan@gmail.com
parents:
1490
diff
changeset
|
15 * You should have received a copy of the GNU General Public License |
a99d8f3b3e7c
Fixed some dos/windows eols
Calin Crisan ccrisan@gmail.com
parents:
1490
diff
changeset
|
16 * along with this program. If not, see <http://www.gnu.org/licenses>. |
a99d8f3b3e7c
Fixed some dos/windows eols
Calin Crisan ccrisan@gmail.com
parents:
1490
diff
changeset
|
17 */ |
1490
032053ca08ab
Add CD menu entry is now created with the ui_plugin_menu functions
Calin Crisan ccrisan@gmail.com
parents:
1482
diff
changeset
|
18 |
2049
9550e809dc12
Added a short TODO comment section.
Matti Hamalainen <ccr@tnsp.org>
parents:
2048
diff
changeset
|
19 |
2443
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
20 /* |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
21 * todo : |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
22 * audacious -e cdda://track01.cda no longer works |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
23 * |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
24 * |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
25 */ |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
26 |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
27 |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
28 #include "config.h" |
1048 | 29 |
30 #include <string.h> | |
31 #include <stdlib.h> | |
32 #include <unistd.h> | |
33 #include <errno.h> | |
34 #include <libgen.h> | |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
35 #include <stdarg.h> |
1048 | 36 |
37 #include <cdio/cdio.h> | |
38 #include <cdio/cdtext.h> | |
39 #include <cdio/track.h> | |
40 #include <cdio/cdda.h> | |
41 #include <cdio/audio.h> | |
42 #include <cdio/sector.h> | |
43 #include <cdio/cd_types.h> | |
1282 | 44 #include <cddb/cddb.h> |
1048 | 45 |
46 #include <glib.h> | |
47 | |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
48 #include <audacious/plugin.h> |
1048 | 49 #include <audacious/i18n.h> |
1529 | 50 #include <audacious/output.h> |
51 #include <audacious/ui_plugin_menu.h> | |
1048 | 52 #include <audacious/util.h> |
53 | |
1189
af5bd4592100
Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
1125
diff
changeset
|
54 #include "cdaudio-ng.h" |
af5bd4592100
Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
1125
diff
changeset
|
55 #include "configure.h" |
1123 | 56 |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
57 |
2443
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
58 cdng_cfg_t cdng_cfg; |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
59 static gint firsttrackno = -1; |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
60 static gint lasttrackno = -1; |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
61 static CdIo_t *pcdio = NULL; |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
62 static trackinfo_t *trackinfo = NULL; |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
63 static gboolean is_paused = FALSE; |
2443
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
64 static gint playing_track = -1; |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
65 static dae_params_t *pdae_params = NULL; |
2443
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
66 static InputPlayback *pglobalinputplayback = NULL; |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
67 static GtkWidget *main_menu_item, *playlist_menu_item; |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
68 static GThread *scan_cd_thread = NULL; |
2453
e3225b9b3e59
Use glib types consistently.
Matti Hamalainen <ccr@tnsp.org>
parents:
2443
diff
changeset
|
69 static gint first_trackno_to_add_after_scan = -1; |
e3225b9b3e59
Use glib types consistently.
Matti Hamalainen <ccr@tnsp.org>
parents:
2443
diff
changeset
|
70 static gint last_trackno_to_add_after_scan = -1; |
1048 | 71 |
2047 | 72 static void cdaudio_init(void); |
73 static void cdaudio_about(void); | |
74 static void cdaudio_configure(void); | |
75 static gint cdaudio_is_our_file(gchar *filename); | |
76 static void cdaudio_play_file(InputPlayback *pinputplayback); | |
77 static void cdaudio_stop(InputPlayback *pinputplayback); | |
78 static void cdaudio_pause(InputPlayback *pinputplayback, gshort paused); | |
79 static void cdaudio_seek(InputPlayback *pinputplayback, gint time); | |
80 static gint cdaudio_get_time(InputPlayback *pinputplayback); | |
81 static gint cdaudio_get_volume(gint *l, gint *r); | |
82 static gint cdaudio_set_volume(gint l, gint r); | |
83 static void cdaudio_cleanup(void); | |
84 static void cdaudio_get_song_info(gchar *filename, gchar **title, gint *length); | |
2443
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
85 static Tuple *cdaudio_get_song_tuple(gchar *filename); |
1048 | 86 |
2047 | 87 static void menu_click(void); |
2467
13f021d53367
Added a plugin-services menu option to force re-scanning of CD, patch
Matti Hamalainen <ccr@tnsp.org>
parents:
2458
diff
changeset
|
88 static void rescan_menu_click(void); |
2443
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
89 static Tuple *create_tuple_from_trackinfo_and_filename(gchar *filename); |
2047 | 90 static void dae_play_loop(dae_params_t *pdae_params); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
91 static void *scan_cd(void *nothing); |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
92 static void scan_cd_threaded(int firsttrackno, int lasttrackno); |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
93 static void append_track_to_playlist(int trackno); |
2443
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
94 static gboolean show_noaudiocd_info(); |
2047 | 95 static gint calculate_track_length(gint startlsn, gint endlsn); |
96 static gint find_trackno_from_filename(gchar *filename); | |
97 static void cleanup_on_error(void); | |
1048 | 98 |
99 | |
100 static InputPlugin inputplugin = { | |
1624
db87d84ed8f3
cdaudio-ng: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1529
diff
changeset
|
101 .description = "CD Audio Plugin NG", |
db87d84ed8f3
cdaudio-ng: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1529
diff
changeset
|
102 .init = cdaudio_init, |
db87d84ed8f3
cdaudio-ng: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1529
diff
changeset
|
103 .about = cdaudio_about, |
db87d84ed8f3
cdaudio-ng: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1529
diff
changeset
|
104 .configure = cdaudio_configure, |
db87d84ed8f3
cdaudio-ng: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1529
diff
changeset
|
105 .is_our_file = cdaudio_is_our_file, |
db87d84ed8f3
cdaudio-ng: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1529
diff
changeset
|
106 .play_file = cdaudio_play_file, |
db87d84ed8f3
cdaudio-ng: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1529
diff
changeset
|
107 .stop = cdaudio_stop, |
db87d84ed8f3
cdaudio-ng: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1529
diff
changeset
|
108 .pause = cdaudio_pause, |
db87d84ed8f3
cdaudio-ng: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1529
diff
changeset
|
109 .seek = cdaudio_seek, |
db87d84ed8f3
cdaudio-ng: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1529
diff
changeset
|
110 .get_time = cdaudio_get_time, |
db87d84ed8f3
cdaudio-ng: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1529
diff
changeset
|
111 .get_volume = cdaudio_get_volume, |
db87d84ed8f3
cdaudio-ng: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1529
diff
changeset
|
112 .set_volume = cdaudio_set_volume, |
db87d84ed8f3
cdaudio-ng: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1529
diff
changeset
|
113 .cleanup = cdaudio_cleanup, |
db87d84ed8f3
cdaudio-ng: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1529
diff
changeset
|
114 .get_song_info = cdaudio_get_song_info, |
db87d84ed8f3
cdaudio-ng: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1529
diff
changeset
|
115 .get_song_tuple = cdaudio_get_song_tuple |
1048 | 116 }; |
117 | |
1098
334afe46961c
[svn] - cdaudio-ng (aka Zither's CD Audio Plugin): convert to plugin API v2
nenolod
parents:
1048
diff
changeset
|
118 InputPlugin *cdaudio_iplist[] = { &inputplugin, NULL }; |
1048 | 119 |
1395
761e17b23e0c
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
1389
diff
changeset
|
120 DECLARE_PLUGIN(cdaudio, NULL, NULL, cdaudio_iplist, NULL, NULL, NULL, NULL, NULL); |
1048 | 121 |
1123 | 122 |
2047 | 123 static void cdaudio_error(const char *fmt, ...) |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
124 { |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
125 va_list ap; |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
126 fprintf(stderr, "cdaudio-ng: "); |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
127 va_start(ap, fmt); |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
128 vfprintf(stderr, fmt, ap); |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
129 va_end(ap); |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
130 } |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
131 |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
132 |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
133 static void debug(const char *fmt, ...) |
1048 | 134 { |
2046 | 135 if (cdng_cfg.debug) { |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
136 va_list ap; |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
137 fprintf(stderr, "cdaudio-ng: "); |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
138 va_start(ap, fmt); |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
139 vfprintf(stderr, fmt, ap); |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
140 va_end(ap); |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
141 } |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
142 } |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
143 |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
144 |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
145 static void cdaudio_init() |
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
146 { |
2037 | 147 ConfigDb *db; |
148 gchar *menu_item_text; | |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
149 |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
150 debug("cdaudio_init()\n"); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
151 |
2384
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
152 cdng_cfg.use_dae = TRUE; |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
153 cdng_cfg.use_cdtext = TRUE; |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
154 cdng_cfg.use_cddb = TRUE; |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
155 cdng_cfg.debug = FALSE; |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
156 cdng_cfg.device = g_strdup(""); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
157 cdng_cfg.cddb_server = g_strdup(CDDA_DEFAULT_CDDB_SERVER); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
158 cdng_cfg.cddb_port = CDDA_DEFAULT_CDDB_PORT; |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
159 cdng_cfg.cddb_http = FALSE; |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
160 cdng_cfg.limitspeed = CDDA_DEFAULT_LIMIT_SPEED; |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
161 cdng_cfg.use_proxy = FALSE; |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
162 cdng_cfg.proxy_host = g_strdup(""); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
163 cdng_cfg.proxy_port = CDDA_DEFAULT_PROXY_PORT; |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
164 cdng_cfg.proxy_username = g_strdup(""); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
165 cdng_cfg.proxy_password = g_strdup(""); |
1125 | 166 |
2044 | 167 if ((db = aud_cfg_db_open()) == NULL) { |
2037 | 168 cdaudio_error("Failed to read configuration.\n"); |
169 cleanup_on_error(); | |
170 return; | |
171 } | |
172 | |
1123 | 173 if (!cdio_init()) { |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
174 cdaudio_error("Failed to initialize cdio subsystem.\n"); |
1123 | 175 cleanup_on_error(); |
2384
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
176 aud_cfg_db_close(db); |
1123 | 177 return; |
178 } | |
1382
28766475ca0a
More and more translatable strings... ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1378
diff
changeset
|
179 |
1282 | 180 libcddb_init(); |
1382
28766475ca0a
More and more translatable strings... ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1378
diff
changeset
|
181 |
2384
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
182 aud_cfg_db_get_bool(db, "CDDA", "use_dae", &cdng_cfg.use_dae); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
183 aud_cfg_db_get_bool(db, "CDDA", "use_cdtext", &cdng_cfg.use_cdtext); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
184 aud_cfg_db_get_bool(db, "CDDA", "use_cddb", &cdng_cfg.use_cddb); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
185 aud_cfg_db_get_bool(db, "CDDA", "debug", &cdng_cfg.debug); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
186 aud_cfg_db_get_string(db, "CDDA", "device", &cdng_cfg.device); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
187 aud_cfg_db_get_string(db, "CDDA", "cddbserver", &cdng_cfg.cddb_server); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
188 aud_cfg_db_get_int(db, "CDDA", "cddbport", &cdng_cfg.cddb_port); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
189 aud_cfg_db_get_bool(db, "CDDA", "cddbhttp", &cdng_cfg.cddb_http); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
190 aud_cfg_db_get_int(db, "CDDA", "limitspeed", &cdng_cfg.limitspeed); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
191 aud_cfg_db_get_bool(db, "audacious", "use_proxy", &cdng_cfg.use_proxy); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
192 aud_cfg_db_get_string(db, "audacious", "proxy_host", &cdng_cfg.proxy_host); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
193 aud_cfg_db_get_int(db, "audacious", "proxy_port", &cdng_cfg.proxy_port); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
194 aud_cfg_db_get_string(db, "audacious", "proxy_user", &cdng_cfg.proxy_username); |
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
195 aud_cfg_db_get_string(db, "audacious", "proxy_pass", &cdng_cfg.proxy_password); |
1189
af5bd4592100
Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
1125
diff
changeset
|
196 |
2044 | 197 aud_cfg_db_close(db); |
1189
af5bd4592100
Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
1125
diff
changeset
|
198 |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
199 debug("use_dae = %d, limitspeed = %d, use_cdtext = %d, use_cddb = %d, cddbserver = \"%s\", cddbport = %d, cddbhttp = %d, device = \"%s\", debug = %d\n", |
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
200 cdng_cfg.use_dae, cdng_cfg.limitspeed, cdng_cfg.use_cdtext, cdng_cfg.use_cddb, |
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
201 cdng_cfg.cddb_server, cdng_cfg.cddb_port, cdng_cfg.cddb_http, cdng_cfg.device, cdng_cfg.debug); |
1189
af5bd4592100
Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
1125
diff
changeset
|
202 |
2467
13f021d53367
Added a plugin-services menu option to force re-scanning of CD, patch
Matti Hamalainen <ccr@tnsp.org>
parents:
2458
diff
changeset
|
203 menu_item_text = _("Rescan CD"); |
13f021d53367
Added a plugin-services menu option to force re-scanning of CD, patch
Matti Hamalainen <ccr@tnsp.org>
parents:
2458
diff
changeset
|
204 main_menu_item = gtk_image_menu_item_new_with_label(menu_item_text); |
13f021d53367
Added a plugin-services menu option to force re-scanning of CD, patch
Matti Hamalainen <ccr@tnsp.org>
parents:
2458
diff
changeset
|
205 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(main_menu_item), gtk_image_new_from_stock(GTK_STOCK_REFRESH, GTK_ICON_SIZE_MENU)); |
13f021d53367
Added a plugin-services menu option to force re-scanning of CD, patch
Matti Hamalainen <ccr@tnsp.org>
parents:
2458
diff
changeset
|
206 gtk_widget_show(main_menu_item); |
13f021d53367
Added a plugin-services menu option to force re-scanning of CD, patch
Matti Hamalainen <ccr@tnsp.org>
parents:
2458
diff
changeset
|
207 audacious_menu_plugin_item_add(AUDACIOUS_MENU_MAIN, main_menu_item); |
13f021d53367
Added a plugin-services menu option to force re-scanning of CD, patch
Matti Hamalainen <ccr@tnsp.org>
parents:
2458
diff
changeset
|
208 g_signal_connect(G_OBJECT(main_menu_item), "activate", G_CALLBACK(rescan_menu_click), NULL); |
13f021d53367
Added a plugin-services menu option to force re-scanning of CD, patch
Matti Hamalainen <ccr@tnsp.org>
parents:
2458
diff
changeset
|
209 |
2470
2848669e63a4
Added a menuitem for 'Rescan CD' into that other menu too, since 'Add CD' is in both.
Matti Hamalainen <ccr@tnsp.org>
parents:
2467
diff
changeset
|
210 playlist_menu_item = gtk_image_menu_item_new_with_label(menu_item_text); |
2848669e63a4
Added a menuitem for 'Rescan CD' into that other menu too, since 'Add CD' is in both.
Matti Hamalainen <ccr@tnsp.org>
parents:
2467
diff
changeset
|
211 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(playlist_menu_item), gtk_image_new_from_stock(GTK_STOCK_CDROM, GTK_ICON_SIZE_MENU)); |
2848669e63a4
Added a menuitem for 'Rescan CD' into that other menu too, since 'Add CD' is in both.
Matti Hamalainen <ccr@tnsp.org>
parents:
2467
diff
changeset
|
212 gtk_widget_show(playlist_menu_item); |
2848669e63a4
Added a menuitem for 'Rescan CD' into that other menu too, since 'Add CD' is in both.
Matti Hamalainen <ccr@tnsp.org>
parents:
2467
diff
changeset
|
213 audacious_menu_plugin_item_add(AUDACIOUS_MENU_PLAYLIST_RCLICK, playlist_menu_item); |
2848669e63a4
Added a menuitem for 'Rescan CD' into that other menu too, since 'Add CD' is in both.
Matti Hamalainen <ccr@tnsp.org>
parents:
2467
diff
changeset
|
214 g_signal_connect(G_OBJECT(playlist_menu_item), "activate", G_CALLBACK(menu_click), NULL); |
2848669e63a4
Added a menuitem for 'Rescan CD' into that other menu too, since 'Add CD' is in both.
Matti Hamalainen <ccr@tnsp.org>
parents:
2467
diff
changeset
|
215 |
2037 | 216 menu_item_text = _("Add CD"); |
1529 | 217 main_menu_item = gtk_image_menu_item_new_with_label(menu_item_text); |
1490
032053ca08ab
Add CD menu entry is now created with the ui_plugin_menu functions
Calin Crisan ccrisan@gmail.com
parents:
1482
diff
changeset
|
218 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(main_menu_item), gtk_image_new_from_stock(GTK_STOCK_CDROM, GTK_ICON_SIZE_MENU)); |
032053ca08ab
Add CD menu entry is now created with the ui_plugin_menu functions
Calin Crisan ccrisan@gmail.com
parents:
1482
diff
changeset
|
219 gtk_widget_show(main_menu_item); |
032053ca08ab
Add CD menu entry is now created with the ui_plugin_menu functions
Calin Crisan ccrisan@gmail.com
parents:
1482
diff
changeset
|
220 audacious_menu_plugin_item_add(AUDACIOUS_MENU_MAIN, main_menu_item); |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
221 g_signal_connect(G_OBJECT(main_menu_item), "activate", G_CALLBACK(menu_click), NULL); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
222 |
1529 | 223 playlist_menu_item = gtk_image_menu_item_new_with_label(menu_item_text); |
1490
032053ca08ab
Add CD menu entry is now created with the ui_plugin_menu functions
Calin Crisan ccrisan@gmail.com
parents:
1482
diff
changeset
|
224 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(playlist_menu_item), gtk_image_new_from_stock(GTK_STOCK_CDROM, GTK_ICON_SIZE_MENU)); |
032053ca08ab
Add CD menu entry is now created with the ui_plugin_menu functions
Calin Crisan ccrisan@gmail.com
parents:
1482
diff
changeset
|
225 gtk_widget_show(playlist_menu_item); |
2419
944a510f5200
- now cdaudio-ng calculates discid correctly. closes #165
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2384
diff
changeset
|
226 audacious_menu_plugin_item_add(AUDACIOUS_MENU_PLAYLIST_RCLICK, playlist_menu_item); |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
227 g_signal_connect(G_OBJECT(playlist_menu_item), "activate", G_CALLBACK(menu_click), NULL); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
228 |
1997 | 229 aud_uri_set_plugin("cdda://", &inputplugin); |
1048 | 230 } |
231 | |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
232 static void cdaudio_about() |
1048 | 233 { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
234 debug("cdaudio_about()\n"); |
1382
28766475ca0a
More and more translatable strings... ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1378
diff
changeset
|
235 |
1377
4eb2bacab83a
Added an information box to cdaudio-ng
Calin Crisan ccrisan@gmail.com
parents:
1349
diff
changeset
|
236 static GtkWidget* about_window = NULL; |
1382
28766475ca0a
More and more translatable strings... ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1378
diff
changeset
|
237 |
2047 | 238 if (about_window) { |
2192
e5401b6c4665
the same thing in many plugins
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2150
diff
changeset
|
239 gtk_window_present(GTK_WINDOW(about_window)); |
e5401b6c4665
the same thing in many plugins
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2150
diff
changeset
|
240 } else { |
e5401b6c4665
the same thing in many plugins
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2150
diff
changeset
|
241 about_window = audacious_info_dialog(_("About CD Audio Plugin NG"), |
e5401b6c4665
the same thing in many plugins
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2150
diff
changeset
|
242 _("Copyright (c) 2007, by Calin Crisan <ccrisan@gmail.com> and The Audacious Team.\n\n" |
e5401b6c4665
the same thing in many plugins
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2150
diff
changeset
|
243 "Many thanks to libcdio developers <http://www.gnu.org/software/libcdio/>\n" |
e5401b6c4665
the same thing in many plugins
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2150
diff
changeset
|
244 "\tand to libcddb developers <http://libcddb.sourceforge.net/>.\n\n" |
e5401b6c4665
the same thing in many plugins
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2150
diff
changeset
|
245 "Also thank you Tony Vroon for mentoring & guiding me.\n\n" |
e5401b6c4665
the same thing in many plugins
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2150
diff
changeset
|
246 "This was a Google Summer of Code 2007 project."), _("OK"), FALSE, NULL, NULL); |
1382
28766475ca0a
More and more translatable strings... ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1378
diff
changeset
|
247 |
2192
e5401b6c4665
the same thing in many plugins
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2150
diff
changeset
|
248 g_signal_connect(G_OBJECT(about_window), "destroy", G_CALLBACK(gtk_widget_destroyed), &about_window); |
e5401b6c4665
the same thing in many plugins
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2150
diff
changeset
|
249 } |
1048 | 250 } |
251 | |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
252 static void cdaudio_configure() |
1048 | 253 { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
254 debug("cdaudio_configure()\n"); |
1189
af5bd4592100
Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
1125
diff
changeset
|
255 |
af5bd4592100
Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
1125
diff
changeset
|
256 configure_show_gui(); |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
257 |
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
258 debug("use_dae = %d, limitspeed = %d, use_cdtext = %d, use_cddb = %d, cddbserver = \"%s\", cddbport = %d, cddbhttp = %d, device = \"%s\", debug = %d\n", |
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
259 cdng_cfg.use_dae, cdng_cfg.limitspeed, cdng_cfg.use_cdtext, cdng_cfg.use_cddb, |
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
260 cdng_cfg.cddb_server, cdng_cfg.cddb_port, cdng_cfg.cddb_http, cdng_cfg.device, cdng_cfg.debug); |
1048 | 261 } |
262 | |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
263 static gint cdaudio_is_our_file(gchar *filename) |
1048 | 264 { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
265 debug("cdaudio_is_our_file(\"%s\")\n", filename); |
1125 | 266 |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
267 if (filename != NULL && !strcmp(filename, CDDA_DUMMYPATH)) { |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
268 debug("\"%s\" will add the whole audio cd\n", filename); |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
269 menu_click(); |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
270 return FALSE; |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
271 } |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
272 |
1048 | 273 if ((filename != NULL) && strlen(filename) > 4 && (!strcasecmp(filename + strlen(filename) - 4, ".cda"))) { |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
274 gint trackno = find_trackno_from_filename(filename); |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
275 |
2047 | 276 /* no CD information yet */ |
1123 | 277 if (pcdio == NULL) { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
278 debug("no CD information, scanning\n"); |
2443
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
279 if (first_trackno_to_add_after_scan == -1) |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
280 scan_cd_threaded(0, 0); |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
281 else |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
282 scan_cd_threaded(trackno, trackno); |
1048 | 283 } |
1123 | 284 |
2047 | 285 /* reload the cd information if the media has changed */ |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
286 if (pcdio != NULL && cdio_get_media_changed(pcdio)) { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
287 debug("CD changed, rescanning\n"); |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
288 scan_cd_threaded(0, 0); |
1313
28df54b3eaea
Ejecting the cd while playing no longer crashes the player.
Calin Crisan ccrisan@gmail.com
parents:
1303
diff
changeset
|
289 } |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
290 |
2047 | 291 /* check if the requested track actually exists on the current audio cd */ |
1125 | 292 if (trackno < firsttrackno || trackno > lasttrackno) { |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
293 debug("\"%s\" is not our file (track number is out of the valid range)\n", filename); |
1123 | 294 return FALSE; |
1125 | 295 } |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
296 |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
297 debug("\"%s\" is our file\n", filename); |
1123 | 298 return TRUE; |
1048 | 299 } |
1125 | 300 else { |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
301 debug("\"%s\" is not our file (unrecognized file name)\n", filename); |
1123 | 302 return FALSE; |
1125 | 303 } |
1048 | 304 } |
305 | |
2043
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
306 |
2046 | 307 static void cdaudio_set_strinfo(trackinfo_t *t, |
2043
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
308 const gchar *performer, const gchar *name, const gchar *genre) |
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
309 { |
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
310 g_strlcpy(t->performer, performer, DEF_STRING_LEN); |
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
311 g_strlcpy(t->name, name, DEF_STRING_LEN); |
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
312 g_strlcpy(t->genre, genre, DEF_STRING_LEN); |
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
313 } |
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
314 |
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
315 |
2046 | 316 static void cdaudio_set_fullinfo(trackinfo_t *t, |
2043
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
317 const lsn_t startlsn, const lsn_t endlsn, |
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
318 const gchar *performer, const gchar *name, const gchar *genre) |
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
319 { |
2046 | 320 t->startlsn = startlsn; |
321 t->endlsn = endlsn; | |
2043
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
322 cdaudio_set_strinfo(t, performer, name, genre); |
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
323 } |
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
324 |
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
325 |
2047 | 326 static void cdaudio_play_file(InputPlayback *pinputplayback) |
1125 | 327 { |
1466 | 328 Tuple *tuple; |
1958
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
329 gchar *title; |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
330 |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
331 debug("cdaudio_play_file(\"%s\")\n", pinputplayback->filename); |
1382
28766475ca0a
More and more translatable strings... ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1378
diff
changeset
|
332 |
1313
28df54b3eaea
Ejecting the cd while playing no longer crashes the player.
Calin Crisan ccrisan@gmail.com
parents:
1303
diff
changeset
|
333 pglobalinputplayback = pinputplayback; |
1125 | 334 |
1048 | 335 if (trackinfo == NULL) { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
336 debug("no CD information, scanning\n"); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
337 if (scan_cd_thread != NULL) |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
338 g_thread_join(scan_cd_thread); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
339 else |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
340 scan_cd(pinputplayback); |
1048 | 341 } |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
342 else |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
343 if (cdio_get_media_changed(pcdio)) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
344 debug("CD changed, rescanning\n"); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
345 if (scan_cd_thread != NULL) |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
346 g_thread_join(scan_cd_thread); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
347 else |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
348 scan_cd(pinputplayback); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
349 } |
1123 | 350 |
1389
e2754a023ae0
Fixed surprise eject segfault
Calin Crisan ccrisan@gmail.com
parents:
1388
diff
changeset
|
351 if (trackinfo == NULL) { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
352 debug("no CD information can be retrieved, aborting\n"); |
1389
e2754a023ae0
Fixed surprise eject segfault
Calin Crisan ccrisan@gmail.com
parents:
1388
diff
changeset
|
353 pinputplayback->playing = FALSE; |
e2754a023ae0
Fixed surprise eject segfault
Calin Crisan ccrisan@gmail.com
parents:
1388
diff
changeset
|
354 return; |
e2754a023ae0
Fixed surprise eject segfault
Calin Crisan ccrisan@gmail.com
parents:
1388
diff
changeset
|
355 } |
e2754a023ae0
Fixed surprise eject segfault
Calin Crisan ccrisan@gmail.com
parents:
1388
diff
changeset
|
356 |
2043
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
357 gint trackno = find_trackno_from_filename(pinputplayback->filename); |
1123 | 358 if (trackno < firsttrackno || trackno > lasttrackno) { |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
359 cdaudio_error("Track #%d is out of range [%d..%d]\n", trackno, firsttrackno, lasttrackno); |
1123 | 360 cleanup_on_error(); |
1048 | 361 return; |
1123 | 362 } |
1048 | 363 |
364 pinputplayback->playing = TRUE; | |
365 playing_track = trackno; | |
1123 | 366 is_paused = FALSE; |
367 | |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
368 tuple = create_tuple_from_trackinfo_and_filename(pinputplayback->filename); |
2055 | 369 title = aud_tuple_formatter_make_title_string(tuple, aud_get_gentitle_format()); |
1387
20c6caad7e03
Fixed the play/stop indication; added a temporary workaround for including the last 3 seconds in playback
Calin Crisan ccrisan@gmail.com
parents:
1382
diff
changeset
|
370 |
1984
489e32a8e106
change some places to use set_params() instead of set_info() directly
William Pitcock <nenolod@atheme.org>
parents:
1976
diff
changeset
|
371 pinputplayback->set_params(pinputplayback, title, calculate_track_length(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn), 1411200, 44100, 2); |
1958
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
372 g_free(title); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1967
diff
changeset
|
373 aud_tuple_free(tuple); |
1387
20c6caad7e03
Fixed the play/stop indication; added a temporary workaround for including the last 3 seconds in playback
Calin Crisan ccrisan@gmail.com
parents:
1382
diff
changeset
|
374 |
2046 | 375 if (cdng_cfg.use_dae) { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
376 debug("using digital audio extraction\n"); |
1125 | 377 |
1123 | 378 if (pdae_params != NULL) { |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
379 cdaudio_error("DAE playback seems to be already started.\n"); |
1123 | 380 return; |
381 } | |
382 | |
383 if (pinputplayback->output->open_audio(FMT_S16_LE, 44100, 2) == 0) { | |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
384 cdaudio_error("Failed to open audio output.\n"); |
1123 | 385 cleanup_on_error(); |
386 return; | |
387 } | |
388 | |
1349
ab387ad5b88e
Converted to new threading model
Calin Crisan ccrisan@gmail.com
parents:
1341
diff
changeset
|
389 /* |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
390 debug("starting dae thread...\n"); |
1349
ab387ad5b88e
Converted to new threading model
Calin Crisan ccrisan@gmail.com
parents:
1341
diff
changeset
|
391 */ |
1958
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
392 pdae_params = (dae_params_t *) g_new(dae_params_t, 1); |
1123 | 393 pdae_params->startlsn = trackinfo[trackno].startlsn; |
394 pdae_params->endlsn = trackinfo[trackno].endlsn; | |
395 pdae_params->pplayback = pinputplayback; | |
396 pdae_params->seektime = -1; | |
397 pdae_params->currlsn = trackinfo[trackno].startlsn; | |
1349
ab387ad5b88e
Converted to new threading model
Calin Crisan ccrisan@gmail.com
parents:
1341
diff
changeset
|
398 pdae_params->thread = g_thread_self(); |
1447
195b5657303e
updated input plugins to use set_pb_ready to signal to the core that they're ready for playback
Giacomo Lozito <james@develia.org>
parents:
1395
diff
changeset
|
399 pinputplayback->set_pb_ready(pinputplayback); |
1349
ab387ad5b88e
Converted to new threading model
Calin Crisan ccrisan@gmail.com
parents:
1341
diff
changeset
|
400 dae_play_loop(pdae_params); |
1123 | 401 } |
402 else { | |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
403 debug("not using digital audio extraction\n"); |
1125 | 404 |
1123 | 405 msf_t startmsf, endmsf; |
406 cdio_lsn_to_msf(trackinfo[trackno].startlsn, &startmsf); | |
407 cdio_lsn_to_msf(trackinfo[trackno].endlsn, &endmsf); | |
408 if (cdio_audio_play_msf(pcdio, &startmsf, &endmsf) != DRIVER_OP_SUCCESS) { | |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
409 cdaudio_error("Failed to play analog audio CD.\n"); |
1123 | 410 cleanup_on_error(); |
411 return; | |
412 } | |
413 } | |
1048 | 414 } |
415 | |
2047 | 416 static void cdaudio_stop(InputPlayback *pinputplayback) |
1125 | 417 { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
418 debug("cdaudio_stop(\"%s\")\n", pinputplayback != NULL ? pinputplayback->filename : "N/A"); |
1382
28766475ca0a
More and more translatable strings... ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1378
diff
changeset
|
419 |
1313
28df54b3eaea
Ejecting the cd while playing no longer crashes the player.
Calin Crisan ccrisan@gmail.com
parents:
1303
diff
changeset
|
420 pglobalinputplayback = NULL; |
1382
28766475ca0a
More and more translatable strings... ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1378
diff
changeset
|
421 |
1313
28df54b3eaea
Ejecting the cd while playing no longer crashes the player.
Calin Crisan ccrisan@gmail.com
parents:
1303
diff
changeset
|
422 if (playing_track == -1) |
28df54b3eaea
Ejecting the cd while playing no longer crashes the player.
Calin Crisan ccrisan@gmail.com
parents:
1303
diff
changeset
|
423 return; |
1125 | 424 |
1303 | 425 if (pinputplayback != NULL) |
426 pinputplayback->playing = FALSE; | |
1048 | 427 playing_track = -1; |
1123 | 428 is_paused = FALSE; |
429 | |
2046 | 430 if (cdng_cfg.use_dae) { |
1123 | 431 if (pdae_params != NULL) { |
432 g_thread_join(pdae_params->thread); | |
1958
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
433 g_free(pdae_params); |
1123 | 434 pdae_params = NULL; |
435 } | |
436 } | |
437 else { | |
438 if (cdio_audio_stop(pcdio) != DRIVER_OP_SUCCESS) { | |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
439 cdaudio_error("Failed to stop analog CD.\n"); |
1123 | 440 return; |
441 } | |
442 } | |
1048 | 443 } |
444 | |
2047 | 445 static void cdaudio_pause(InputPlayback *pinputplayback, gshort paused) |
1048 | 446 { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
447 debug("cdaudio_pause(\"%s\", %d)\n", pinputplayback->filename, paused); |
1125 | 448 |
1048 | 449 if (!is_paused) { |
450 is_paused = TRUE; | |
2046 | 451 if (!cdng_cfg.use_dae) |
1123 | 452 if (cdio_audio_pause(pcdio) != DRIVER_OP_SUCCESS) { |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
453 cdaudio_error("Failed to pause analog CD!\n"); |
1123 | 454 cleanup_on_error(); |
455 return; | |
456 } | |
1048 | 457 } |
458 else { | |
459 is_paused = FALSE; | |
2046 | 460 if (!cdng_cfg.use_dae) |
1123 | 461 if (cdio_audio_resume(pcdio) != DRIVER_OP_SUCCESS) { |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
462 cdaudio_error("Failed to resume analog CD!\n"); |
1123 | 463 cleanup_on_error(); |
464 return; | |
465 } | |
1048 | 466 } |
467 } | |
468 | |
2047 | 469 static void cdaudio_seek(InputPlayback *pinputplayback, gint time) |
1048 | 470 { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
471 debug("cdaudio_seek(\"%s\", %d)\n", pinputplayback->filename, time); |
1125 | 472 |
1048 | 473 if (playing_track == -1) |
474 return; | |
475 | |
2046 | 476 if (cdng_cfg.use_dae) { |
1123 | 477 if (pdae_params != NULL) { |
478 pdae_params->seektime = time * 1000; | |
479 } | |
480 } | |
481 else { | |
1958
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
482 gint newstartlsn = trackinfo[playing_track].startlsn + time * 75; |
1123 | 483 msf_t startmsf, endmsf; |
484 cdio_lsn_to_msf(newstartlsn, &startmsf); | |
485 cdio_lsn_to_msf(trackinfo[playing_track].endlsn, &endmsf); | |
1382
28766475ca0a
More and more translatable strings... ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1378
diff
changeset
|
486 |
1123 | 487 if (cdio_audio_play_msf(pcdio, &startmsf, &endmsf) != DRIVER_OP_SUCCESS) { |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
488 cdaudio_error("Failed to play analog CD\n"); |
1123 | 489 cleanup_on_error(); |
490 return; | |
491 } | |
492 } | |
1048 | 493 } |
494 | |
2047 | 495 static gint cdaudio_get_time(InputPlayback *pinputplayback) |
1048 | 496 { |
497 if (playing_track == -1) | |
498 return -1; | |
499 | |
2046 | 500 if (!cdng_cfg.use_dae) { |
1123 | 501 cdio_subchannel_t subchannel; |
502 if (cdio_audio_read_subchannel(pcdio, &subchannel) != DRIVER_OP_SUCCESS) { | |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
503 cdaudio_error("Failed to read analog CD subchannel.\n"); |
1123 | 504 cleanup_on_error(); |
1313
28df54b3eaea
Ejecting the cd while playing no longer crashes the player.
Calin Crisan ccrisan@gmail.com
parents:
1303
diff
changeset
|
505 return 0; |
1123 | 506 } |
1958
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
507 gint currlsn = cdio_msf_to_lsn(&subchannel.abs_addr); |
1048 | 508 |
2047 | 509 /* check to see if we have reached the end of the song */ |
1314
b93270e2b7e4
Continuous playing in DAE mode works again
Calin Crisan ccrisan@gmail.com
parents:
1313
diff
changeset
|
510 if (currlsn == trackinfo[playing_track].endlsn) |
1123 | 511 return -1; |
512 | |
513 return calculate_track_length(trackinfo[playing_track].startlsn, currlsn); | |
1048 | 514 } |
1123 | 515 else { |
516 if (pdae_params != NULL) | |
1314
b93270e2b7e4
Continuous playing in DAE mode works again
Calin Crisan ccrisan@gmail.com
parents:
1313
diff
changeset
|
517 if (pdae_params->pplayback->playing) |
b93270e2b7e4
Continuous playing in DAE mode works again
Calin Crisan ccrisan@gmail.com
parents:
1313
diff
changeset
|
518 return pinputplayback->output->output_time(); |
b93270e2b7e4
Continuous playing in DAE mode works again
Calin Crisan ccrisan@gmail.com
parents:
1313
diff
changeset
|
519 else |
b93270e2b7e4
Continuous playing in DAE mode works again
Calin Crisan ccrisan@gmail.com
parents:
1313
diff
changeset
|
520 return -1; |
1123 | 521 else |
522 return -1; | |
523 } | |
1048 | 524 } |
525 | |
2047 | 526 static gint cdaudio_get_volume(gint *l, gint *r) |
1048 | 527 { |
2046 | 528 if (cdng_cfg.use_dae) { |
1123 | 529 *l = *r = 0; |
530 return FALSE; | |
531 } | |
532 else { | |
533 cdio_audio_volume_t volume; | |
534 if (cdio_audio_get_volume(pcdio, &volume) != DRIVER_OP_SUCCESS) { | |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
535 cdaudio_error("Failed to retrieve analog CD volume.\n"); |
1123 | 536 cleanup_on_error(); |
537 *l = *r = 0; | |
538 return FALSE; | |
539 } | |
540 *l = volume.level[0]; | |
541 *r = volume.level[1]; | |
1382
28766475ca0a
More and more translatable strings... ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1378
diff
changeset
|
542 |
1123 | 543 return TRUE; |
544 } | |
1048 | 545 } |
546 | |
2047 | 547 static gint cdaudio_set_volume(gint l, gint r) |
1048 | 548 { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
549 debug("cdaudio_set_volume(%d, %d)\n", l, r); |
1125 | 550 |
2046 | 551 if (cdng_cfg.use_dae) { |
1123 | 552 return FALSE; |
553 } | |
554 else { | |
555 cdio_audio_volume_t volume = {{l, r, 0, 0}}; | |
556 if (cdio_audio_set_volume(pcdio, &volume) != DRIVER_OP_SUCCESS) { | |
2150
04421592e6a3
Fixed an unexpected cddb error messaje when no cddb info is available
Calin Crisan ccrisan@gmail.com
parents:
2057
diff
changeset
|
557 cdaudio_error("cdaudio-ng: failed to set analog cd volume\n"); |
1123 | 558 cleanup_on_error(); |
559 return FALSE; | |
560 } | |
1382
28766475ca0a
More and more translatable strings... ;-)
Stany HENRY <StrassBoy@gmail.com>
parents:
1378
diff
changeset
|
561 |
1123 | 562 return TRUE; |
563 } | |
1048 | 564 } |
565 | |
2047 | 566 static void cdaudio_cleanup(void) |
1048 | 567 { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
568 debug("cdaudio_cleanup()\n"); |
1125 | 569 |
1282 | 570 libcddb_shutdown(); |
571 | |
2046 | 572 if (pcdio != NULL) { |
573 if (playing_track != -1 && !cdng_cfg.use_dae) | |
1123 | 574 cdio_audio_stop(pcdio); |
575 cdio_destroy(pcdio); | |
576 pcdio = NULL; | |
577 } | |
578 if (trackinfo != NULL) { | |
1958
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
579 g_free(trackinfo); |
1123 | 580 trackinfo = NULL; |
581 } | |
582 playing_track = -1; | |
1282 | 583 |
1189
af5bd4592100
Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
1125
diff
changeset
|
584 // todo: destroy the gui |
af5bd4592100
Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
1125
diff
changeset
|
585 |
2044 | 586 ConfigDb *db = aud_cfg_db_open(); |
2384
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
587 aud_cfg_db_set_bool(db, "CDDA", "use_dae", cdng_cfg.use_dae); |
2046 | 588 aud_cfg_db_set_int(db, "CDDA", "limitspeed", cdng_cfg.limitspeed); |
589 aud_cfg_db_set_bool(db, "CDDA", "use_cdtext", cdng_cfg.use_cdtext); | |
590 aud_cfg_db_set_bool(db, "CDDA", "use_cddb", cdng_cfg.use_cddb); | |
591 aud_cfg_db_set_string(db, "CDDA", "cddbserver", cdng_cfg.cddb_server); | |
592 aud_cfg_db_set_int(db, "CDDA", "cddbport", cdng_cfg.cddb_port); | |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
593 aud_cfg_db_set_bool(db, "CDDA", "cddbhttp", cdng_cfg.cddb_http); |
2046 | 594 aud_cfg_db_set_string(db, "CDDA", "device", cdng_cfg.device); |
595 aud_cfg_db_set_bool(db, "CDDA", "debug", cdng_cfg.debug); | |
2044 | 596 aud_cfg_db_close(db); |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
597 |
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
598 audacious_menu_plugin_item_remove(AUDACIOUS_MENU_MAIN, main_menu_item); |
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
599 audacious_menu_plugin_item_remove(AUDACIOUS_MENU_PLAYLIST, playlist_menu_item); |
1048 | 600 } |
601 | |
2047 | 602 static void cdaudio_get_song_info(gchar *filename, gchar **title, gint *length) |
1048 | 603 { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
604 debug("cdaudio_get_song_info(\"%s\")\n", filename); |
1125 | 605 |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
606 Tuple *tuple = create_tuple_from_trackinfo_and_filename(filename); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
607 int trackno = find_trackno_from_filename(filename); |
1125 | 608 |
2046 | 609 if (tuple) { |
2055 | 610 *title = aud_tuple_formatter_process_string(tuple, aud_get_gentitle_format()); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1967
diff
changeset
|
611 aud_tuple_free(tuple); |
1466 | 612 tuple = NULL; |
613 } | |
1125 | 614 *length = calculate_track_length(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn); |
1048 | 615 } |
616 | |
2047 | 617 static Tuple *cdaudio_get_song_tuple(gchar *filename) |
1048 | 618 { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
619 debug("cdaudio_get_song_tuple(\"%s\")\n", filename); |
1125 | 620 |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
621 return create_tuple_from_trackinfo_and_filename(filename); |
1341
4ca99d2be90e
Titles are now built using tuples, with the preferred format
Calin Crisan ccrisan@gmail.com
parents:
1340
diff
changeset
|
622 } |
4ca99d2be90e
Titles are now built using tuples, with the preferred format
Calin Crisan ccrisan@gmail.com
parents:
1340
diff
changeset
|
623 |
4ca99d2be90e
Titles are now built using tuples, with the preferred format
Calin Crisan ccrisan@gmail.com
parents:
1340
diff
changeset
|
624 |
2047 | 625 /* |
626 * auxiliar functions | |
627 */ | |
2467
13f021d53367
Added a plugin-services menu option to force re-scanning of CD, patch
Matti Hamalainen <ccr@tnsp.org>
parents:
2458
diff
changeset
|
628 static void menu_click(void) |
1490
032053ca08ab
Add CD menu entry is now created with the ui_plugin_menu functions
Calin Crisan ccrisan@gmail.com
parents:
1482
diff
changeset
|
629 { |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
630 debug("plugin services menu option selected\n"); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
631 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
632 /* reload the cd information if the media has changed, or no track information is available */ |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
633 if (pcdio == NULL || cdio_get_media_changed(pcdio)) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
634 if (scan_cd_thread != NULL) |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
635 return; |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
636 else { |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
637 scan_cd_threaded(-1, -1); |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
638 debug("CD changed, rescanning\n"); |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
639 } |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
640 } |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
641 else { |
2453
e3225b9b3e59
Use glib types consistently.
Matti Hamalainen <ccr@tnsp.org>
parents:
2443
diff
changeset
|
642 gint trackno; |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
643 for (trackno = firsttrackno; trackno <= lasttrackno; trackno++) |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
644 append_track_to_playlist(trackno); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
645 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
646 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
647 |
2467
13f021d53367
Added a plugin-services menu option to force re-scanning of CD, patch
Matti Hamalainen <ccr@tnsp.org>
parents:
2458
diff
changeset
|
648 static void rescan_menu_click(void) |
13f021d53367
Added a plugin-services menu option to force re-scanning of CD, patch
Matti Hamalainen <ccr@tnsp.org>
parents:
2458
diff
changeset
|
649 { |
13f021d53367
Added a plugin-services menu option to force re-scanning of CD, patch
Matti Hamalainen <ccr@tnsp.org>
parents:
2458
diff
changeset
|
650 debug("plugin services rescan option selected\n"); |
13f021d53367
Added a plugin-services menu option to force re-scanning of CD, patch
Matti Hamalainen <ccr@tnsp.org>
parents:
2458
diff
changeset
|
651 |
13f021d53367
Added a plugin-services menu option to force re-scanning of CD, patch
Matti Hamalainen <ccr@tnsp.org>
parents:
2458
diff
changeset
|
652 scan_cd_threaded(0, 0); |
13f021d53367
Added a plugin-services menu option to force re-scanning of CD, patch
Matti Hamalainen <ccr@tnsp.org>
parents:
2458
diff
changeset
|
653 } |
13f021d53367
Added a plugin-services menu option to force re-scanning of CD, patch
Matti Hamalainen <ccr@tnsp.org>
parents:
2458
diff
changeset
|
654 |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
655 static Tuple *create_tuple_from_trackinfo_and_filename(gchar *filename) |
1341
4ca99d2be90e
Titles are now built using tuples, with the preferred format
Calin Crisan ccrisan@gmail.com
parents:
1340
diff
changeset
|
656 { |
2043
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
657 Tuple *tuple = aud_tuple_new_from_filename(filename); |
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
658 |
1389
e2754a023ae0
Fixed surprise eject segfault
Calin Crisan ccrisan@gmail.com
parents:
1388
diff
changeset
|
659 if (trackinfo == NULL) |
2043
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
660 return tuple; |
1389
e2754a023ae0
Fixed surprise eject segfault
Calin Crisan ccrisan@gmail.com
parents:
1388
diff
changeset
|
661 |
1958
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
662 gint trackno = find_trackno_from_filename(filename); |
1341
4ca99d2be90e
Titles are now built using tuples, with the preferred format
Calin Crisan ccrisan@gmail.com
parents:
1340
diff
changeset
|
663 |
1048 | 664 if (trackno < firsttrackno || trackno > lasttrackno) |
2043
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
665 return tuple; |
1048 | 666 |
1466 | 667 if(strlen(trackinfo[trackno].performer)) { |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1967
diff
changeset
|
668 aud_tuple_associate_string(tuple, FIELD_ARTIST, NULL, trackinfo[trackno].performer); |
1466 | 669 } |
670 if(strlen(trackinfo[0].name)) { | |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1967
diff
changeset
|
671 aud_tuple_associate_string(tuple, FIELD_ALBUM, NULL, trackinfo[0].name); |
1466 | 672 } |
673 if(strlen(trackinfo[trackno].name)) { | |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1967
diff
changeset
|
674 aud_tuple_associate_string(tuple, FIELD_TITLE, NULL, trackinfo[trackno].name); |
1466 | 675 } |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
676 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1967
diff
changeset
|
677 aud_tuple_associate_int(tuple, FIELD_TRACK_NUMBER, NULL, trackno); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1967
diff
changeset
|
678 aud_tuple_associate_string(tuple, -1, "ext", "cda"); //XXX should do? --yaz |
1466 | 679 |
2043
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
680 aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, |
624effc5a687
Clean up the str(n)cpy mess somewhat.
Matti Hamalainen <ccr@tnsp.org>
parents:
2042
diff
changeset
|
681 calculate_track_length(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn)); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
682 |
1466 | 683 if(strlen(trackinfo[trackno].genre)) { |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1967
diff
changeset
|
684 aud_tuple_associate_string(tuple, FIELD_GENRE, NULL, trackinfo[trackno].genre); |
1466 | 685 } |
1048 | 686 //tuple->year = 0; todo: set the year |
687 | |
688 return tuple; | |
689 } | |
690 | |
2047 | 691 static void dae_play_loop(dae_params_t *pdae_params) |
1123 | 692 { |
1958
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
693 guchar *buffer = g_new(guchar, CDDA_DAE_FRAMES * CDIO_CD_FRAMESIZE_RAW); |
1123 | 694 |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
695 debug("dae started\n"); |
1123 | 696 cdio_lseek(pcdio, pdae_params->startlsn * CDIO_CD_FRAMESIZE_RAW, SEEK_SET); |
697 | |
698 gboolean output_paused = FALSE; | |
1958
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
699 gint read_error_counter = 0; |
1125 | 700 |
1387
20c6caad7e03
Fixed the play/stop indication; added a temporary workaround for including the last 3 seconds in playback
Calin Crisan ccrisan@gmail.com
parents:
1382
diff
changeset
|
701 //pdae_params->endlsn += 75 * 3; |
20c6caad7e03
Fixed the play/stop indication; added a temporary workaround for including the last 3 seconds in playback
Calin Crisan ccrisan@gmail.com
parents:
1382
diff
changeset
|
702 |
1123 | 703 while (pdae_params->pplayback->playing) { |
2047 | 704 /* handle pause status */ |
1123 | 705 if (is_paused) { |
706 if (!output_paused) { | |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
707 debug("playback was not paused, pausing\n"); |
1123 | 708 pdae_params->pplayback->output->pause(TRUE); |
709 output_paused = TRUE; | |
710 } | |
1958
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
711 g_usleep(1000); |
1123 | 712 continue; |
713 } | |
1125 | 714 else { |
1123 | 715 if (output_paused) { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
716 debug("playback was paused, resuming\n"); |
1123 | 717 pdae_params->pplayback->output->pause(FALSE); |
718 output_paused = FALSE; | |
719 } | |
1125 | 720 } |
1123 | 721 |
2047 | 722 /* check if we have to seek */ |
1123 | 723 if (pdae_params->seektime != -1) { |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
724 debug("requested seek to %d ms\n", pdae_params->seektime); |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
725 gint newlsn = pdae_params->startlsn + ((pdae_params->seektime * 75) / 1000); |
1123 | 726 cdio_lseek(pcdio, newlsn * CDIO_CD_FRAMESIZE_RAW, SEEK_SET); |
727 pdae_params->pplayback->output->flush(pdae_params->seektime); | |
728 pdae_params->currlsn = newlsn; | |
729 pdae_params->seektime = -1; | |
730 } | |
731 | |
2047 | 732 /* compute the actual number of sectors to read */ |
1958
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
733 gint lsncount = CDDA_DAE_FRAMES <= (pdae_params->endlsn - pdae_params->currlsn + 1) ? CDDA_DAE_FRAMES : (pdae_params->endlsn - pdae_params->currlsn + 1); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
734 |
2047 | 735 /* check too see if we have reached the end of the song */ |
1387
20c6caad7e03
Fixed the play/stop indication; added a temporary workaround for including the last 3 seconds in playback
Calin Crisan ccrisan@gmail.com
parents:
1382
diff
changeset
|
736 if (lsncount <= 0) { |
20c6caad7e03
Fixed the play/stop indication; added a temporary workaround for including the last 3 seconds in playback
Calin Crisan ccrisan@gmail.com
parents:
1382
diff
changeset
|
737 sleep(3); |
1123 | 738 break; |
1387
20c6caad7e03
Fixed the play/stop indication; added a temporary workaround for including the last 3 seconds in playback
Calin Crisan ccrisan@gmail.com
parents:
1382
diff
changeset
|
739 } |
1123 | 740 |
741 if (cdio_read_audio_sectors(pcdio, buffer, pdae_params->currlsn, lsncount) != DRIVER_OP_SUCCESS) { | |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
742 debug("failed to read audio sector\n"); |
1313
28df54b3eaea
Ejecting the cd while playing no longer crashes the player.
Calin Crisan ccrisan@gmail.com
parents:
1303
diff
changeset
|
743 read_error_counter++; |
28df54b3eaea
Ejecting the cd while playing no longer crashes the player.
Calin Crisan ccrisan@gmail.com
parents:
1303
diff
changeset
|
744 if (read_error_counter >= 2) { |
1387
20c6caad7e03
Fixed the play/stop indication; added a temporary workaround for including the last 3 seconds in playback
Calin Crisan ccrisan@gmail.com
parents:
1382
diff
changeset
|
745 read_error_counter = 0; |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
746 cdaudio_error("This CD can no longer be played, stopping.\n"); |
1313
28df54b3eaea
Ejecting the cd while playing no longer crashes the player.
Calin Crisan ccrisan@gmail.com
parents:
1303
diff
changeset
|
747 break; |
28df54b3eaea
Ejecting the cd while playing no longer crashes the player.
Calin Crisan ccrisan@gmail.com
parents:
1303
diff
changeset
|
748 } |
1123 | 749 } |
1313
28df54b3eaea
Ejecting the cd while playing no longer crashes the player.
Calin Crisan ccrisan@gmail.com
parents:
1303
diff
changeset
|
750 else |
28df54b3eaea
Ejecting the cd while playing no longer crashes the player.
Calin Crisan ccrisan@gmail.com
parents:
1303
diff
changeset
|
751 read_error_counter = 0; |
1123 | 752 |
1958
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
753 gint remainingbytes = lsncount * CDIO_CD_FRAMESIZE_RAW; |
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
754 guchar *bytebuff = buffer; |
1123 | 755 while (pdae_params->pplayback->playing && remainingbytes > 0 && pdae_params->seektime == -1) { |
2047 | 756 /* compute the actual number of bytes to play */ |
1958
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
757 gint bytecount = CDIO_CD_FRAMESIZE_RAW <= remainingbytes ? CDIO_CD_FRAMESIZE_RAW : remainingbytes; |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
758 |
2047 | 759 /* wait until the output buffer has enough room */ |
1123 | 760 while (pdae_params->pplayback->playing && pdae_params->pplayback->output->buffer_free() < bytecount && pdae_params->seektime == -1) |
2041 | 761 g_usleep(1000); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
762 |
2047 | 763 /* play the sound :) */ |
1123 | 764 if (pdae_params->pplayback->playing && pdae_params->seektime == -1) |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
765 pdae_params->pplayback->pass_audio(pdae_params->pplayback, FMT_S16_LE, 2, |
1998
8f3188746b64
chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents:
1997
diff
changeset
|
766 bytecount, bytebuff, &pdae_params->pplayback->playing); |
1123 | 767 remainingbytes -= bytecount; |
768 bytebuff += bytecount; | |
769 } | |
770 pdae_params->currlsn += lsncount; | |
771 } | |
2256
dc92a550179e
cddb may use http instead of cddbp now; the global proxy settings are used if enabled
Calin Crisan ccrisan@gmail.com
parents:
2192
diff
changeset
|
772 debug("dae ended\n"); |
1123 | 773 |
774 pdae_params->pplayback->playing = FALSE; | |
1314
b93270e2b7e4
Continuous playing in DAE mode works again
Calin Crisan ccrisan@gmail.com
parents:
1313
diff
changeset
|
775 pdae_params->pplayback->output->close_audio(); |
1123 | 776 is_paused = FALSE; |
777 | |
778 pdae_params->pplayback->output->close_audio(); | |
1958
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
779 g_free(buffer); |
1123 | 780 } |
781 | |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
782 static void scan_cd_threaded(int firsttrackno, int lasttrackno) |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
783 { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
784 if (scan_cd_thread != NULL) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
785 debug("A scan_cd thread is already running.\n"); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
786 return; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
787 } |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
788 |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
789 first_trackno_to_add_after_scan = firsttrackno; |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
790 last_trackno_to_add_after_scan = lasttrackno; |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
791 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
792 scan_cd_thread = g_thread_create((GThreadFunc)scan_cd, NULL, TRUE, NULL); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
793 if (scan_cd_thread == NULL) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
794 cdaudio_error("Failed to create the thread for retrieving song information.\n"); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
795 return; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
796 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
797 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
798 |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
799 static void append_track_to_playlist(int trackno) |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
800 { |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
801 gchar pathname[DEF_STRING_LEN]; |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
802 |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
803 g_snprintf(pathname, DEF_STRING_LEN, "%strack%02u.cda", CDDA_DUMMYPATH, trackno); |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
804 aud_playlist_add(aud_playlist_get_active(), pathname); |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
805 |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
806 debug("added track \"%s\" to the playlist\n", pathname); |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
807 } |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
808 |
2443
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
809 static gboolean show_noaudiocd_info() |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
810 { |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
811 GDK_THREADS_ENTER(); |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
812 const gchar *markup = |
2443
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
813 N_("<b><big>No playable CD found.</big></b>\n\n" |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
814 "No CD inserted, or inserted CD is not an audio CD.\n"); |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
815 |
2443
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
816 GtkWidget *dialog = |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
817 gtk_message_dialog_new_with_markup(NULL, |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
818 GTK_DIALOG_DESTROY_WITH_PARENT, |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
819 GTK_MESSAGE_ERROR, |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
820 GTK_BUTTONS_OK, |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
821 _(markup)); |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
822 gtk_dialog_run(GTK_DIALOG(dialog)); |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
823 gtk_widget_destroy(dialog); |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
824 |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
825 GDK_THREADS_LEAVE(); |
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
826 return TRUE; |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
827 } |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
828 |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
829 static void *scan_cd(void *nothing) |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
830 { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
831 debug("scan_cd started\n"); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
832 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
833 gint trackno; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
834 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
835 /* find an available, audio capable, cd drive */ |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
836 if (cdng_cfg.device != NULL && strlen(cdng_cfg.device) > 0) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
837 pcdio = cdio_open(cdng_cfg.device, DRIVER_UNKNOWN); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
838 if (pcdio == NULL) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
839 cdaudio_error("Failed to open CD device \"%s\".\n", cdng_cfg.device); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
840 scan_cd_thread = NULL; |
2443
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
841 show_noaudiocd_info(); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
842 return NULL; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
843 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
844 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
845 else { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
846 gchar **ppcd_drives = cdio_get_devices_with_cap(NULL, CDIO_FS_AUDIO, false); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
847 pcdio = NULL; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
848 if (ppcd_drives != NULL && *ppcd_drives != NULL) { /* we have at least one audio capable cd drive */ |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
849 pcdio = cdio_open(*ppcd_drives, DRIVER_UNKNOWN); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
850 if (pcdio == NULL) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
851 cdaudio_error("Failed to open CD.\n"); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
852 cleanup_on_error(); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
853 scan_cd_thread = NULL; |
2443
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
854 show_noaudiocd_info(); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
855 return NULL; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
856 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
857 debug("found cd drive \"%s\" with audio capable media\n", *ppcd_drives); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
858 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
859 else { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
860 cdaudio_error("Unable to find or access a CDDA capable drive.\n"); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
861 cleanup_on_error(); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
862 scan_cd_thread = NULL; |
2443
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
863 show_noaudiocd_info(); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
864 return NULL; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
865 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
866 if (ppcd_drives != NULL && *ppcd_drives != NULL) |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
867 cdio_free_device_list(ppcd_drives); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
868 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
869 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
870 /* limit read speed */ |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
871 if (cdng_cfg.limitspeed > 0 && cdng_cfg.use_dae) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
872 debug("setting drive speed limit to %dx\n", cdng_cfg.limitspeed); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
873 if (cdio_set_speed(pcdio, cdng_cfg.limitspeed) != DRIVER_OP_SUCCESS) |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
874 cdaudio_error("Failed to set drive speed to %dx.\n", cdng_cfg.limitspeed); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
875 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
876 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
877 /* general track initialization */ |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
878 cdrom_drive_t *pcdrom_drive = cdio_cddap_identify_cdio(pcdio, 1, NULL); // todo : check return / NULL |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
879 firsttrackno = cdio_get_first_track_num(pcdrom_drive->p_cdio); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
880 lasttrackno = cdio_get_last_track_num(pcdrom_drive->p_cdio); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
881 if (firsttrackno == CDIO_INVALID_TRACK || lasttrackno == CDIO_INVALID_TRACK) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
882 cdaudio_error("Failed to retrieve first/last track number.\n"); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
883 cleanup_on_error(); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
884 scan_cd_thread = NULL; |
2443
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
885 show_noaudiocd_info(); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
886 return NULL; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
887 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
888 debug("first track is %d and last track is %d\n", firsttrackno, lasttrackno); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
889 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
890 g_free(trackinfo); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
891 trackinfo = (trackinfo_t *) g_new(trackinfo_t, (lasttrackno + 1)); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
892 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
893 cdaudio_set_fullinfo(&trackinfo[0], |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
894 cdio_get_track_lsn(pcdrom_drive->p_cdio, 0), |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
895 cdio_get_track_last_lsn(pcdrom_drive->p_cdio, CDIO_CDROM_LEADOUT_TRACK), |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
896 "", "", ""); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
897 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
898 for (trackno = firsttrackno; trackno <= lasttrackno; trackno++) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
899 cdaudio_set_fullinfo(&trackinfo[trackno], |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
900 cdio_get_track_lsn(pcdrom_drive->p_cdio, trackno), |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
901 cdio_get_track_last_lsn(pcdrom_drive->p_cdio, trackno), |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
902 "", "", ""); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
903 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
904 if (trackinfo[trackno].startlsn == CDIO_INVALID_LSN || trackinfo[trackno].endlsn == CDIO_INVALID_LSN) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
905 cdaudio_error("Failed to retrieve stard/end lsn for track %d.\n", trackno); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
906 cleanup_on_error(); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
907 scan_cd_thread = NULL; |
2443
32d4d5f7020b
Fixed the nocd-dialog; however it may still crash when starting audacious with cdda:// argument
Calin Crisan ccrisan@gmail.com
parents:
2433
diff
changeset
|
908 show_noaudiocd_info(); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
909 return NULL; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
910 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
911 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
912 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
913 /* get trackinfo[0] cdtext information (the disc) */ |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
914 if (cdng_cfg.use_cdtext) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
915 debug("getting cd-text information for disc\n"); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
916 cdtext_t *pcdtext = cdio_get_cdtext(pcdrom_drive->p_cdio, 0); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
917 if (pcdtext == NULL || pcdtext->field[CDTEXT_TITLE] == NULL) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
918 debug("no cd-text available for disc\n"); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
919 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
920 else { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
921 cdaudio_set_strinfo(&trackinfo[0], |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
922 pcdtext->field[CDTEXT_PERFORMER] ? pcdtext->field[CDTEXT_PERFORMER] : "", |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
923 pcdtext->field[CDTEXT_TITLE] ? pcdtext->field[CDTEXT_TITLE] : "", |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
924 pcdtext->field[CDTEXT_GENRE] ? pcdtext->field[CDTEXT_GENRE] : ""); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
925 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
926 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
927 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
928 /* get track information from cdtext */ |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
929 gboolean cdtext_was_available = FALSE; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
930 for (trackno = firsttrackno; trackno <= lasttrackno; trackno++) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
931 cdtext_t *pcdtext = NULL; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
932 if (cdng_cfg.use_cdtext) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
933 debug("getting cd-text information for track %d\n", trackno); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
934 pcdtext = cdio_get_cdtext(pcdrom_drive->p_cdio, trackno); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
935 if (pcdtext == NULL || pcdtext->field[CDTEXT_PERFORMER] == NULL) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
936 debug("no cd-text available for track %d\n", trackno); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
937 pcdtext = NULL; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
938 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
939 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
940 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
941 if (pcdtext != NULL) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
942 cdaudio_set_strinfo(&trackinfo[trackno], |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
943 pcdtext->field[CDTEXT_PERFORMER] ? pcdtext->field[CDTEXT_PERFORMER] : "", |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
944 pcdtext->field[CDTEXT_TITLE] ? pcdtext->field[CDTEXT_TITLE] : "", |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
945 pcdtext->field[CDTEXT_GENRE] ? pcdtext->field[CDTEXT_GENRE] : ""); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
946 cdtext_was_available = TRUE; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
947 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
948 else { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
949 cdaudio_set_strinfo(&trackinfo[trackno], "", "", ""); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
950 g_snprintf(trackinfo[trackno].name, DEF_STRING_LEN, "CD Audio Track %02u", trackno); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
951 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
952 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
953 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
954 if (!cdtext_was_available) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
955 /* initialize de cddb subsystem */ |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
956 cddb_conn_t *pcddb_conn = NULL; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
957 cddb_disc_t *pcddb_disc = NULL; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
958 cddb_track_t *pcddb_track = NULL; |
2419
944a510f5200
- now cdaudio-ng calculates discid correctly. closes #165
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2384
diff
changeset
|
959 lba_t lba; /* Logical Block Address */ |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
960 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
961 if (cdng_cfg.use_cddb) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
962 pcddb_conn = cddb_new(); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
963 if (pcddb_conn == NULL) |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
964 cdaudio_error("Failed to create the cddb connection.\n"); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
965 else { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
966 debug("getting CDDB info\n"); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
967 |
2384
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
968 cddb_cache_enable(pcddb_conn); |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
969 // cddb_cache_set_dir(pcddb_conn, "~/.cddbslave"); |
2384
0824c92b6132
- fixed a bug which writes TRUE as the default port number.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2326
diff
changeset
|
970 |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
971 if (cdng_cfg.use_proxy) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
972 cddb_http_proxy_enable(pcddb_conn); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
973 cddb_set_http_proxy_server_name(pcddb_conn, cdng_cfg.proxy_host); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
974 cddb_set_http_proxy_server_port(pcddb_conn, cdng_cfg.proxy_port); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
975 cddb_set_http_proxy_username(pcddb_conn, cdng_cfg.proxy_username); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
976 cddb_set_http_proxy_password(pcddb_conn, cdng_cfg.proxy_password); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
977 cddb_set_server_name(pcddb_conn, cdng_cfg.cddb_server); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
978 cddb_set_server_port(pcddb_conn, cdng_cfg.cddb_port); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
979 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
980 else |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
981 if (cdng_cfg.cddb_http) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
982 cddb_http_enable(pcddb_conn); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
983 cddb_set_server_name(pcddb_conn, cdng_cfg.cddb_server); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
984 cddb_set_server_port(pcddb_conn, cdng_cfg.cddb_port); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
985 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
986 else { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
987 cddb_set_server_name(pcddb_conn, cdng_cfg.cddb_server); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
988 cddb_set_server_port(pcddb_conn, cdng_cfg.cddb_port); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
989 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
990 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
991 pcddb_disc = cddb_disc_new(); |
2419
944a510f5200
- now cdaudio-ng calculates discid correctly. closes #165
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2384
diff
changeset
|
992 |
944a510f5200
- now cdaudio-ng calculates discid correctly. closes #165
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2384
diff
changeset
|
993 lba = cdio_get_track_lba(pcdio, CDIO_CDROM_LEADOUT_TRACK); |
944a510f5200
- now cdaudio-ng calculates discid correctly. closes #165
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2384
diff
changeset
|
994 cddb_disc_set_length(pcddb_disc, FRAMES_TO_SECONDS(lba)); |
944a510f5200
- now cdaudio-ng calculates discid correctly. closes #165
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2384
diff
changeset
|
995 |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
996 for (trackno = firsttrackno; trackno <= lasttrackno; trackno++) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
997 pcddb_track = cddb_track_new(); |
2419
944a510f5200
- now cdaudio-ng calculates discid correctly. closes #165
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2384
diff
changeset
|
998 cddb_track_set_frame_offset(pcddb_track, cdio_get_track_lba(pcdio, trackno)); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
999 cddb_disc_add_track(pcddb_disc, pcddb_track); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1000 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1001 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1002 cddb_disc_calc_discid(pcddb_disc); |
2453
e3225b9b3e59
Use glib types consistently.
Matti Hamalainen <ccr@tnsp.org>
parents:
2443
diff
changeset
|
1003 guint discid = cddb_disc_get_discid(pcddb_disc); |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1004 debug("CDDB disc id = %x\n", discid); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1005 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1006 gint matches; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1007 if ((matches = cddb_query(pcddb_conn, pcddb_disc)) == -1) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1008 if (cddb_errno(pcddb_conn) == CDDB_ERR_OK) |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1009 cdaudio_error("Failed to query the CDDB server\n"); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1010 else |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1011 cdaudio_error("Failed to query the CDDB server: %s\n", cddb_error_str(cddb_errno(pcddb_conn))); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1012 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1013 cddb_disc_destroy(pcddb_disc); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1014 pcddb_disc = NULL; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1015 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1016 else { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1017 if (matches == 0) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1018 debug("no cddb info available for this disc\n"); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1019 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1020 cddb_disc_destroy(pcddb_disc); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1021 pcddb_disc = NULL; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1022 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1023 else { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1024 debug("CDDB disc category = \"%s\"\n", cddb_disc_get_category_str(pcddb_disc)); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1025 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1026 cddb_read(pcddb_conn, pcddb_disc); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1027 if (cddb_errno(pcddb_conn) != CDDB_ERR_OK) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1028 cdaudio_error("failed to read the cddb info: %s\n", cddb_error_str(cddb_errno(pcddb_conn))); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1029 cddb_disc_destroy(pcddb_disc); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1030 pcddb_disc = NULL; |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1031 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1032 else { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1033 debug("we have got the cddb info\n"); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1034 cdaudio_set_strinfo(&trackinfo[0], |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1035 cddb_disc_get_artist(pcddb_disc), |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1036 cddb_disc_get_title(pcddb_disc), |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1037 cddb_disc_get_genre(pcddb_disc)); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1038 |
2453
e3225b9b3e59
Use glib types consistently.
Matti Hamalainen <ccr@tnsp.org>
parents:
2443
diff
changeset
|
1039 gint trackno; |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1040 for (trackno = firsttrackno; trackno <= lasttrackno; trackno++) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1041 cddb_track_t *pcddb_track = cddb_disc_get_track(pcddb_disc, trackno - 1); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1042 cdaudio_set_strinfo(&trackinfo[trackno], |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1043 cddb_track_get_artist(pcddb_track), |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1044 cddb_track_get_title(pcddb_track), |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1045 cddb_disc_get_genre(pcddb_disc)); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1046 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1047 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1048 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1049 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1050 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1051 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1052 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1053 if (pcddb_disc != NULL) |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1054 cddb_disc_destroy(pcddb_disc); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1055 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1056 if (pcddb_conn != NULL) |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1057 cddb_destroy(pcddb_conn); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1058 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1059 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1060 if (cdng_cfg.debug) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1061 debug("disc has : performer = \"%s\", name = \"%s\", genre = \"%s\"\n", |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1062 trackinfo[0].performer, trackinfo[0].name, trackinfo[0].genre); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1063 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1064 for (trackno = firsttrackno; trackno <= lasttrackno; trackno++) { |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1065 debug("track %d has : performer = \"%s\", name = \"%s\", genre = \"%s\", startlsn = %d, endlsn = %d\n", |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1066 trackno, trackinfo[trackno].performer, trackinfo[trackno].name, trackinfo[trackno].genre, trackinfo[trackno].startlsn, trackinfo[trackno].endlsn); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1067 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1068 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1069 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1070 debug("scan_cd ended\n"); |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1071 |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1072 scan_cd_thread = NULL; |
2433
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
1073 |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
1074 |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
1075 /* add the requested entries to the current playlist */ |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
1076 |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
1077 if (first_trackno_to_add_after_scan == 0 || last_trackno_to_add_after_scan == 0) |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
1078 return NULL; |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
1079 |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
1080 if (first_trackno_to_add_after_scan == -1) |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
1081 first_trackno_to_add_after_scan = firsttrackno; |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
1082 if (last_trackno_to_add_after_scan == -1) |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
1083 last_trackno_to_add_after_scan = lasttrackno; |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
1084 |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
1085 for (trackno = first_trackno_to_add_after_scan; trackno <= last_trackno_to_add_after_scan; trackno++) |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
1086 append_track_to_playlist(trackno); |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
1087 |
60936e29c803
reworked cdaudio-ng to avoid gui blockings as much as possible; the plugin now handles cdda:// URL by adding the whole cd to the playlist - to be used with -e argument from command line; the 'no cd' dialog may be broken
Calin Crisan ccrisan@gmail.com
parents:
2419
diff
changeset
|
1088 return NULL; |
2326
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1089 } |
854b5fae995e
1) cdaudio-ng tries to fetch cd information in a background thread, and 2) cdaudio-ng no longer queries the cddb if cdtext is available
Calin Crisan ccrisan@gmail.com
parents:
2256
diff
changeset
|
1090 |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
1091 static gint calculate_track_length(gint startlsn, gint endlsn) |
1048 | 1092 { |
1093 return ((endlsn - startlsn + 1) * 1000) / 75; | |
1094 } | |
1095 | |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
1096 static gint find_trackno_from_filename(gchar *filename) |
1048 | 1097 { |
2040
997c71881e5b
No need for that long buffer.
Matti Hamalainen <ccr@tnsp.org>
parents:
2038
diff
changeset
|
1098 gchar tracknostr[3]; |
1048 | 1099 if ((filename == NULL) || strlen(filename) <= 6) |
1100 return -1; | |
1101 | |
1102 strncpy(tracknostr, filename + strlen(filename) - 6, 2); | |
1103 tracknostr[2] = '\0'; | |
1104 return strtol(tracknostr, NULL, 10); | |
1105 } | |
1123 | 1106 |
1959
3fef1171cd6c
Basic start of cleanup of cdaudio-ng.
Matti Hamalainen <ccr@tnsp.org>
parents:
1958
diff
changeset
|
1107 static void cleanup_on_error() |
1123 | 1108 { |
1313
28df54b3eaea
Ejecting the cd while playing no longer crashes the player.
Calin Crisan ccrisan@gmail.com
parents:
1303
diff
changeset
|
1109 if (playing_track != -1) { |
28df54b3eaea
Ejecting the cd while playing no longer crashes the player.
Calin Crisan ccrisan@gmail.com
parents:
1303
diff
changeset
|
1110 playing_track = -1; |
1123 | 1111 } |
1313
28df54b3eaea
Ejecting the cd while playing no longer crashes the player.
Calin Crisan ccrisan@gmail.com
parents:
1303
diff
changeset
|
1112 |
1123 | 1113 if (trackinfo != NULL) { |
1958
2db72dd92ee3
Use glib types and functions in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
1708
diff
changeset
|
1114 g_free(trackinfo); |
1123 | 1115 trackinfo = NULL; |
1116 } | |
1117 } | |
1193 | 1118 |