mirror of
https://github.com/gryf/gryf-overlay.git
synced 2026-01-05 13:24:17 +01:00
144 lines
3.1 KiB
Diff
144 lines
3.1 KiB
Diff
--- libspeex.c.old 2004-10-11 00:57:18.000000000 +0800
|
|
+++ libspeex.c 2004-10-12 05:11:33.000000000 +0800
|
|
@@ -190,7 +190,7 @@
|
|
|
|
static void play (char *filename) {
|
|
|
|
- speex_comment_t comments;
|
|
+ speex_comment_t comments = {0};
|
|
|
|
if (speex_fs == NULL)
|
|
speex_fs = malloc(sizeof(Speex_File_State));
|
|
@@ -215,9 +215,12 @@
|
|
}
|
|
else
|
|
{
|
|
- speex_file_info(filename, NULL, &comments, &speex_fs->length);
|
|
- speex_fs->length *= 1000;
|
|
- speex_fs->title = generate_title(filename, &comments);
|
|
+ if (!speex_file_info(filename, NULL, &comments, &speex_fs->length))
|
|
+ {
|
|
+ speex_fs->length *= 1000;
|
|
+ speex_fs->title = generate_title(filename, &comments);
|
|
+ }
|
|
+ speex_comment_free(&comments);
|
|
}
|
|
|
|
|
|
@@ -235,6 +238,7 @@
|
|
fprintf(stderr, PACKAGE ": error opening file\n");
|
|
#endif
|
|
|
|
+ speex_fs->playing = FALSE;
|
|
return;
|
|
}
|
|
}
|
|
@@ -265,7 +269,7 @@
|
|
SpeexBits sbits;
|
|
SpeexStereoState stereo = SPEEX_STEREO_STATE_INIT;
|
|
|
|
- speex_comment_t comments;
|
|
+ speex_comment_t comments = {0};
|
|
int valid_comment;
|
|
|
|
#ifdef DEBUG
|
|
@@ -404,8 +408,8 @@
|
|
if (valid_comment)
|
|
{
|
|
speex_fs->title = generate_title(NULL, &comments);
|
|
- speex_comment_free(&comments);
|
|
}
|
|
+ speex_comment_free(&comments);
|
|
}
|
|
|
|
}
|
|
@@ -672,11 +676,13 @@
|
|
}
|
|
|
|
static void stop (void) {
|
|
- speex_fs->playing = FALSE;
|
|
+ if (speex_fs->playing == TRUE)
|
|
+ {
|
|
+ speex_fs->playing = FALSE;
|
|
|
|
- // Wait for the thread to close
|
|
- pthread_join(spx_decode_thread, NULL);
|
|
-
|
|
+ // Wait for the thread to close
|
|
+ pthread_join(spx_decode_thread, NULL);
|
|
+ }
|
|
#ifdef DEBUG
|
|
fprintf(stderr, PACKAGE ": stop\n");
|
|
#endif
|
|
@@ -707,7 +713,7 @@
|
|
|
|
static void get_song_info (char *filename, char **title, int *length) {
|
|
|
|
- speex_comment_t comments;
|
|
+ speex_comment_t comments = {0};
|
|
|
|
#ifdef DEBUG
|
|
fprintf(stderr, "get_song_info\n");
|
|
@@ -720,10 +726,11 @@
|
|
}
|
|
else
|
|
{
|
|
- speex_file_info(filename, NULL, &comments, length);
|
|
- *length *= 1000;
|
|
- (*title) = g_strdup(generate_title(filename, &comments));
|
|
-
|
|
+ if(!speex_file_info(filename, NULL, &comments, length))
|
|
+ {
|
|
+ *length *= 1000;
|
|
+ (*title) = generate_title(filename, &comments);
|
|
+ }
|
|
speex_comment_free(&comments);
|
|
}
|
|
|
|
--- speexutil.c.old 2004-10-11 00:33:43.000000000 +0800
|
|
+++ speexutil.c 2004-10-11 01:20:55.000000000 +0800
|
|
@@ -161,15 +161,13 @@
|
|
}
|
|
else if (op.packetno == 1)
|
|
{
|
|
- if (comment != NULL)
|
|
+ if (comment != NULL && comment->vendor == NULL)
|
|
{
|
|
if (!speex_comment_init(op.packet, op.bytes, comment))
|
|
{
|
|
#ifdef DEBUG
|
|
fprintf(stderr,"Warning: invalid comment struct\n");
|
|
#endif
|
|
-
|
|
- memset(comment, 0, sizeof(speex_comment_t));
|
|
}
|
|
}
|
|
|
|
@@ -310,17 +308,18 @@
|
|
int i;
|
|
|
|
// Free vendor-string
|
|
- free(comment->vendor);
|
|
+ if(comment->vendor != NULL) free(comment->vendor);
|
|
|
|
- // Free comments
|
|
- for(i=0; i < comment->comment_num; i++)
|
|
+ if(comment->comments != NULL)
|
|
{
|
|
- free( *(comment->comments+i));
|
|
+ // Free comments
|
|
+ for(i=0; i < comment->comment_num; i++)
|
|
+ {
|
|
+ free( *(comment->comments+i));
|
|
+ }
|
|
+ // Free comment index
|
|
+ free(comment->comments);
|
|
}
|
|
-
|
|
- // Free comment index
|
|
- free(comment->comments);
|
|
-
|
|
return;
|
|
}
|
|
|