rpms/audacious-plugin-fc/devel audacious-plugin-fc-0.5.1-plugin-api16.patch, 1.1, 1.2 audacious-plugin-fc.spec, 1.28, 1.29

Michael Schwendt mschwendt at fedoraproject.org
Fri Jul 23 08:46:31 UTC 2010


Author: mschwendt

Update of /cvs/pkgs/rpms/audacious-plugin-fc/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv13217

Modified Files:
	audacious-plugin-fc-0.5.1-plugin-api16.patch 
	audacious-plugin-fc.spec 
Log Message:
* Fri Jul 23 2010 Michael Schwendt <mschwendt at fedoraproject.org> - 0.5.1-4
- Larger patch, also to remove deprecated API usage.


audacious-plugin-fc-0.5.1-plugin-api16.patch:
 configure.c |    4 -
 main.c      |  163 +++++++++++++++++++++++++++++++++++++-----------------------
 plugin.c    |   12 ++--
 3 files changed, 111 insertions(+), 68 deletions(-)

Index: audacious-plugin-fc-0.5.1-plugin-api16.patch
===================================================================
RCS file: /cvs/pkgs/rpms/audacious-plugin-fc/devel/audacious-plugin-fc-0.5.1-plugin-api16.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- audacious-plugin-fc-0.5.1-plugin-api16.patch	21 Jul 2010 14:58:03 -0000	1.1
+++ audacious-plugin-fc-0.5.1-plugin-api16.patch	23 Jul 2010 08:46:27 -0000	1.2
@@ -21,8 +21,17 @@ diff -Nur audacious-plugin-fc-0.5.1-orig
  		fc_myConfig.precision = 16;
 diff -Nur audacious-plugin-fc-0.5.1-orig/src/main.c audacious-plugin-fc-0.5.1/src/main.c
 --- audacious-plugin-fc-0.5.1-orig/src/main.c	2010-07-10 12:46:00.000000000 +0200
-+++ audacious-plugin-fc-0.5.1/src/main.c	2010-07-21 16:41:08.000000000 +0200
-@@ -27,7 +27,7 @@
++++ audacious-plugin-fc-0.5.1/src/main.c	2010-07-23 10:03:42.000000000 +0200
+@@ -22,12 +22,16 @@
+ #include <glib.h>
+ #include <fc14audiodecoder.h>
+ 
++#if __AUDACIOUS_PLUGIN_API__ < 16
++#error "At least Audacious 2.4 beta1 is required."
++#endif
++
+ #include "config.h"
+ #include "configure.h"
  
  struct audioFormat
  {
@@ -31,7 +40,7 @@ diff -Nur audacious-plugin-fc-0.5.1-orig
      gint bits, freq, channels;
      gint zeroSample;
  };
-@@ -54,7 +54,7 @@
+@@ -54,7 +58,7 @@
      unsigned char magicBuf[5];
      int ret;
  
@@ -40,48 +49,87 @@ diff -Nur audacious-plugin-fc-0.5.1-orig
          return 1;
      }
      dec = fc14dec_new();
-@@ -79,30 +79,30 @@
-     jumpToTime = -1;
-     decoder = fc14dec_new();
+@@ -63,11 +67,11 @@
+     return ret;
+ }
+ 
+-void ip_play_file(InputPlayback *playback) {
++gboolean ip_play(InputPlayback *playback, const gchar *filename, VFSFile *fd,
++                 gint start_time, gint stop_time, gboolean pause) {
+     void *decoder = NULL;
+     gpointer sampleBuf = NULL;
+     size_t sampleBufSize;
+-    VFSFile *fd;
+     gpointer fileBuf = NULL;
+     size_t fileLen;
+     gboolean haveModule = FALSE;
+@@ -75,38 +79,34 @@
+     gboolean haveSampleBuf = FALSE;
+     struct audioFormat myFormat;
+ 
++    if (fd == NULL) {
++        return FALSE;
++    }
++
+     playback->playing = FALSE;
+-    jumpToTime = -1;
+-    decoder = fc14dec_new();
++    jumpToTime = (start_time > 0) ? start_time : -1;
  
 -    fd = aud_vfs_fopen(playback->filename,"rb");
-+    fd = vfs_fopen(playback->filename,"rb");
-     if (!fd) {
-         goto PLAY_FAILURE_1;
-     }
+-    if (!fd) {
+-        goto PLAY_FAILURE_1;
+-    }
 -    if ( aud_vfs_fseek(fd,0,SEEK_END)!=0 ) {
 -        aud_vfs_fclose(fd);
-+    if ( vfs_fseek(fd,0,SEEK_END)!=0 ) {
-+        vfs_fclose(fd);
-         goto PLAY_FAILURE_1;
-     }
+-        goto PLAY_FAILURE_1;
+-    }
 -    fileLen = aud_vfs_ftell(fd);
 -    if ( aud_vfs_fseek(fd,0,SEEK_SET)!=0 ) {
 -        aud_vfs_fclose(fd);
+-        goto PLAY_FAILURE_1;
++    if ( vfs_fseek(fd,0,SEEK_END)!=0 ) {
++        return FALSE;
++    }
 +    fileLen = vfs_ftell(fd);
 +    if ( vfs_fseek(fd,0,SEEK_SET)!=0 ) {
-+        vfs_fclose(fd);
-         goto PLAY_FAILURE_1;
++        return FALSE;
      }
      fileBuf = g_malloc(fileLen);
      if ( !fileBuf ) {
 -        aud_vfs_fclose(fd);
-+        vfs_fclose(fd);
-         goto PLAY_FAILURE_1;
+-        goto PLAY_FAILURE_1;
++        return FALSE;
      }
 -    if ( fileLen != aud_vfs_fread((char*)fileBuf,1,fileLen,fd) ) {
 -        aud_vfs_fclose(fd);
 +    if ( fileLen != vfs_fread((char*)fileBuf,1,fileLen,fd) ) {
-+        vfs_fclose(fd);
          g_free(fileBuf);
-         goto PLAY_FAILURE_1;
+-        goto PLAY_FAILURE_1;
++        return FALSE;
      }
 -    aud_vfs_fclose(fd);
-+    vfs_fclose(fd);
++    decoder = fc14dec_new();
      haveModule = fc14dec_init(decoder,fileBuf,fileLen);
      g_free(fileBuf);
      if ( !haveModule ) {
-@@ -168,9 +168,9 @@
+-        goto PLAY_FAILURE_1;
++        fc14dec_delete(decoder);
++        return FALSE;
+     }
+ 
+     myFormat.freq = fc_myConfig.frequency;
+@@ -159,6 +159,9 @@
+         while (formatList[++i].bits != 0);
+     }
+     if ( audioDriverOK ) {
++        if (pause) {
++            playback->output->pause(TRUE);
++        }
+         sampleBufSize = 512*(myFormat.bits/8)*myFormat.channels;
+         sampleBuf = g_malloc(sampleBufSize);
+         haveSampleBuf = (sampleBuf != NULL);
+@@ -168,9 +171,9 @@
      if ( haveSampleBuf && haveModule ) {
          int msecSongLen = fc14dec_duration(decoder);
  
@@ -94,18 +142,177 @@ diff -Nur audacious-plugin-fc-0.5.1-orig
          playback->set_tuple( playback, t );
  
          /* bitrate => 4*1000 will be displayed as "4 CHANNELS" */
-@@ -233,11 +233,11 @@
+@@ -180,19 +183,9 @@
+         playback->set_pb_ready(playback);
+ 
+         while ( playback->playing ) {
+-            fc14dec_buffer_fill(decoder,sampleBuf,sampleBufSize);
+-            if ( playback->playing && jumpToTime<0 ) {
+-#if __AUDACIOUS_PLUGIN_API__ >= 13
+-                playback->output->write_audio(sampleBuf,sampleBufSize);
+-#else
+-                playback->pass_audio(playback,myFormat.xmmsAFormat,myFormat.channels,sampleBufSize,sampleBuf,NULL);
+-#endif
+-            }
+-            if ( fc14dec_song_end(decoder) && jumpToTime<0 ) {
+-                playback->eof = TRUE;
+-                playback->playing = FALSE;
++            if (stop_time >= 0 && playback->output->written_time () >= stop_time) {
++                goto DRAIN;
+             }
+-
+             g_mutex_lock(seek_mutex);
+             if ( jumpToTime != -1 ) {
+                 fc14dec_seek(decoder,jumpToTime);
+@@ -201,44 +194,94 @@
+                 g_cond_signal(seek_cond);
+             }
+             g_mutex_unlock(seek_mutex);
++
++            fc14dec_buffer_fill(decoder,sampleBuf,sampleBufSize);
++            if ( playback->playing && jumpToTime<0 ) {
++                playback->output->write_audio(sampleBuf,sampleBufSize);
++            }
++            if ( fc14dec_song_end(decoder) && jumpToTime<0 ) {
++                playback->eof = TRUE;
++                playback->playing = FALSE;
++ DRAIN:
++                while (playback->output->buffer_playing() && playback->playing) {
++                    g_usleep(20000);
++                }
++                break;
++            }
+         }
+-        playback->playing = FALSE;
+-        playback->output->close_audio();
+     }
++ CLEANUP:
++    g_mutex_lock(seek_mutex);
++    playback->playing = FALSE;
++    g_cond_signal(seek_cond);  /* wake up any waiting request */
++    g_mutex_unlock(seek_mutex);
+ 
+- PLAY_FAILURE_2:
++    playback->output->close_audio();
+     g_free(sampleBuf);
+- PLAY_FAILURE_1:
+     fc14dec_delete(decoder);
++    return FALSE;
+ }
+     
+ void ip_stop(InputPlayback *playback) {
+-    playback->playing = FALSE;
++    g_mutex_lock(seek_mutex);
++    if (playback->playing) {
++        playback->playing = FALSE;
++        playback->output->abort_write();
++        g_cond_signal(seek_cond);
++    }
++    g_mutex_unlock(seek_mutex);
  }
  
- Tuple* ip_get_song_tuple(const gchar *filename) {
--    Tuple *t = aud_tuple_new_from_filename(filename);
-+    Tuple *t = tuple_new_from_filename(filename);
+ void ip_pause(InputPlayback *playback, gshort p) {
+-    playback->output->pause(p);
++    g_mutex_lock(seek_mutex);
++    if (playback->playing) {
++        playback->output->pause(p);
++    }
++    g_mutex_unlock(seek_mutex);
+ }
+ 
+ void ip_mseek(InputPlayback *playback, gulong msec) {
+     g_mutex_lock(seek_mutex);
+-    jumpToTime = msec;
+-    g_cond_wait(seek_cond, seek_mutex);
++    if (playback->playing) {
++        jumpToTime = msec;
++        playback->output->abort_write();
++        g_cond_signal(seek_cond);
++        g_cond_wait(seek_cond, seek_mutex);
++    }
+     g_mutex_unlock(seek_mutex);
+ }
  
-     /* delay length detection to start of playback */
+-void ip_seek(InputPlayback *playback, gint secs) {
+-    gulong msec = secs * 1000;
+-    ip_mseek(playback, msec);
+-}
+-
+-Tuple* ip_get_song_tuple(const gchar *filename) {
+-    Tuple *t = aud_tuple_new_from_filename(filename);
+-
+-    /* delay length detection to start of playback */
 -    aud_tuple_associate_int(t, FIELD_LENGTH, NULL, -1);
 -    aud_tuple_associate_string(t, FIELD_QUALITY, NULL, "sequenced");
-+    tuple_associate_int(t, FIELD_LENGTH, NULL, -1);
-+    tuple_associate_string(t, FIELD_QUALITY, NULL, "sequenced");
-     /* aud_tuple_associate_string(ti, FIELD_TITLE, NULL, tmp); */
+-    /* aud_tuple_associate_string(ti, FIELD_TITLE, NULL, tmp); */
++Tuple *ip_probe_for_tuple(const gchar *filename, VFSFile *fd) {
++    void *decoder = NULL;
++    gpointer fileBuf = NULL;
++    size_t fileLen;
++    Tuple *t;
  
++    if ( fd==NULL || vfs_fseek(fd,0,SEEK_END)!=0 ) {
++        return NULL;
++    }
++    fileLen = vfs_ftell(fd);
++    if ( vfs_fseek(fd,0,SEEK_SET)!=0 ) {
++        return NULL;
++    }
++    fileBuf = g_malloc(fileLen);
++    if ( !fileBuf ) {
++        return NULL;
++    }
++    if ( fileLen != vfs_fread((char*)fileBuf,1,fileLen,fd) ) {
++        g_free(fileBuf);
++        return NULL;
++    }
++    decoder = fc14dec_new();
++    if (fc14dec_init(decoder,fileBuf,fileLen)) {
++        t = tuple_new_from_filename(filename);
++        tuple_associate_int(t, FIELD_LENGTH, NULL, fc14dec_duration(decoder));
++        tuple_associate_string(t, FIELD_QUALITY, NULL, "sequenced");
++    }
++    else {
++        t = NULL;
++    }
++    g_free(fileBuf);
++    fc14dec_delete(decoder);
      return t;
+ }
+diff -Nur audacious-plugin-fc-0.5.1-orig/src/plugin.c audacious-plugin-fc-0.5.1/src/plugin.c
+--- audacious-plugin-fc-0.5.1-orig/src/plugin.c	2010-06-20 19:00:14.000000000 +0200
++++ audacious-plugin-fc-0.5.1/src/plugin.c	2010-07-23 10:03:42.000000000 +0200
+@@ -6,13 +6,14 @@
+ void ip_cleanup(void);
+ void fc_ip_about(void);
+ void fc_ip_configure(void);
+-gint ip_is_valid_file_vfs(const gchar *fileName, VFSFile *fd);
+-void ip_play_file(InputPlayback *playback);
++gint ip_is_valid_file_vfs(const gchar *filename, VFSFile *fd);
++gboolean ip_play(InputPlayback *playback, const gchar *filename, VFSFile *fd,
++                 gint start_time, gint stop_time, gboolean pause);
+ void ip_stop(InputPlayback *playback);
+ void ip_pause(InputPlayback *playback, gshort p);
+ void ip_seek(InputPlayback *playback, gint secs);
+ void ip_mseek(InputPlayback *playback, gulong msec);
+-Tuple* ip_get_song_tuple(const gchar *filename);
++Tuple *ip_probe_for_tuple(const gchar *filename, VFSFile *fd);
+ 
+ InputPlugin iplugin =
+ {
+@@ -22,13 +23,12 @@
+     .configure = fc_ip_configure,
+     .have_subtune = FALSE,
+     .vfs_extensions = fc_fmts,
+-    .play_file = ip_play_file,
++    .play = ip_play,
+     .stop = ip_stop,
+     .pause = ip_pause,
+-    .seek = ip_seek,
+     .mseek = ip_mseek,
+     .cleanup = ip_cleanup,
+-    .get_song_tuple = ip_get_song_tuple,
++    .probe_for_tuple = ip_probe_for_tuple,
+     .is_our_file_from_vfs = ip_is_valid_file_vfs
+ };
+ 


Index: audacious-plugin-fc.spec
===================================================================
RCS file: /cvs/pkgs/rpms/audacious-plugin-fc/devel/audacious-plugin-fc.spec,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -p -r1.28 -r1.29
--- audacious-plugin-fc.spec	21 Jul 2010 14:58:03 -0000	1.28
+++ audacious-plugin-fc.spec	23 Jul 2010 08:46:29 -0000	1.29
@@ -7,7 +7,7 @@
 Summary: Future Composer input plugin for Audacious
 Name: audacious-plugin-fc
 Version: 0.5.1
-Release: 3%{?dist}
+Release: 4%{?dist}
 URL: http://xmms-fc.sourceforge.net/
 License: GPLv2+
 Source:	http://downloads.sourceforge.net/xmms-fc/audacious-plugin-fc-%{version}.tar.bz2
@@ -54,6 +54,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Fri Jul 23 2010 Michael Schwendt <mschwendt at fedoraproject.org> - 0.5.1-4
+- Larger patch, also to remove deprecated API usage.
+
 * Wed Jul 21 2010 Michael Schwendt <mschwendt at fedoraproject.org> - 0.5.1-3
 - Patch and rebuild for Audacious 2.4 beta1 generic plugin API/ABI bump.
 



More information about the scm-commits mailing list