~ubuntu-branches/ubuntu/wily/xmms2/wily

« back to all changes in this revision

Viewing changes to src/plugins/cue/cue.c

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2008-07-04 16:23:34 UTC
  • mfrom: (1.1.5 upstream) (6.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080704162334-b3esbkcapt8wbrk4
Tags: 0.5DrLecter-2ubuntu1
* Merge from debian unstable (LP: #241098), remaining changes:
  + debian/control:
    + Update Maintainer field
    + add lpia to xmms2-plugin-alsa supported architectures
    + Added liba52-0.7.4-dev to build depends
  + debian/rules: Added patch, patch-stamp and unpatch
  + changed 01_gcc4.3.patch:
    + src/include/xmmsclient/xmmsclient++/helpers.h: Added #include <climits>
* New upstream relase fixes LP: #212566, #222341

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*  XMMS2 - X Music Multiplexer System
2
 
 *  Copyright (C) 2003-2007 XMMS2 Team
 
2
 *  Copyright (C) 2003-2008 XMMS2 Team
3
3
 *
4
4
 *  PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!!
5
5
 *
128
128
static void
129
129
add_index (cue_track *tr, gchar *idx)
130
130
{
131
 
        guint ms;
 
131
        guint ms = 0;
132
132
        guint tmp;
133
133
 
134
134
        gchar **a = g_strsplit (idx, ":", 0);
135
135
 
136
 
        tmp = strtol (a[0], NULL, 10);
137
 
        ms = tmp * 60000;
138
 
 
139
 
        tmp = strtol (a[1], NULL, 10);
140
 
        ms += tmp * 1000;
141
 
 
142
 
        tmp = strtol (a[2], NULL, 10);
143
 
        ms += (guint)((gfloat)tmp * 1.0/75.0) * 1000.0;
 
136
        if (a[0] != NULL) {
 
137
                tmp = strtol (a[0], NULL, 10);
 
138
                ms = tmp * 60000;
 
139
 
 
140
                if (a[1] != NULL) {
 
141
                        tmp = strtol (a[1], NULL, 10);
 
142
                        ms += tmp * 1000;
 
143
 
 
144
                        if (a[2] != NULL) {
 
145
                                tmp = strtol (a[2], NULL, 10);
 
146
                                ms += (guint)((gfloat)tmp * 1.0/75.0) * 1000.0;
 
147
                        }
 
148
                }
 
149
        }
144
150
 
145
151
        if (!tr->index) {
146
152
                tr->index = ms;
148
154
                tr->index2 = ms;
149
155
        }
150
156
 
 
157
        g_strfreev (a);
151
158
}
152
159
 
153
160
static void
162
169
        file = xmms_build_playlist_url (xmms_xform_get_url (xform), tr->file);
163
170
 
164
171
        while (n) {
165
 
                gchar *arg[2];
 
172
                gchar arg0[32], arg1[32];
 
173
                gchar *arg[2] = { arg0, arg1 };
166
174
                gint numargs = 1;
167
175
                cue_track *t = n->data;
168
176
                if (!t) {
169
177
                        continue;
170
178
                }
171
179
 
172
 
                arg[0] = g_strdup_printf ("startms=%d", t->index2 ? t->index2 : t->index);
 
180
                g_snprintf (arg0, sizeof (arg0), "startms=%d",
 
181
                            t->index2 ? t->index2 : t->index);
173
182
 
174
183
                if (n->next && n->next->data) {
175
184
                        cue_track *t2 = n->next->data;
176
 
                        arg[1] = g_strdup_printf ("stopms=%d", t2->index);
 
185
                        g_snprintf (arg1, sizeof (arg1), "stopms=%d", t2->index);
177
186
                        numargs = 2;
178
187
                }
179
188
 
183
192
                xmms_xform_browse_add_entry_property_str (xform, "artist", t->artist);
184
193
                xmms_xform_browse_add_entry_property_str (xform, "album", tr->album);
185
194
 
186
 
                g_free (arg[0]);
187
 
                if (numargs == 2) {
188
 
                        g_free (arg[1]);
189
 
                }
190
 
 
191
195
                g_free (t);
192
196
                n = g_list_delete_link (n, n);
193
197
        }