rpms/audacious-plugin-fc/devel audacious-plugin-fc-0.2-api14.patch, NONE, 1.1
Michael Schwendt (mschwendt)
fedora-extras-commits at redhat.com
Wed Nov 21 16:39:55 UTC 2007
Author: mschwendt
Update of /cvs/pkgs/rpms/audacious-plugin-fc/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6728
Added Files:
audacious-plugin-fc-0.2-api14.patch
Log Message:
patch for new API
audacious-plugin-fc-0.2-api14.patch:
--- NEW FILE audacious-plugin-fc-0.2-api14.patch ---
diff -Nur audacious-plugin-fc-0.2-orig/src/configure.c audacious-plugin-fc-0.2/src/configure.c
--- audacious-plugin-fc-0.2-orig/src/configure.c 2007-01-15 12:44:09.000000000 +0100
+++ audacious-plugin-fc-0.2/src/configure.c 2007-11-21 16:22:50.000000000 +0100
@@ -36,13 +36,13 @@
fc_myConfig.precision = 8;
fc_myConfig.channels = 1;
- if ((cfg = bmp_cfg_db_open()))
+ if ((cfg = aud_cfg_db_open()))
{
- bmp_cfg_db_get_int(cfg, configSection, "frequency", &fc_myConfig.frequency);
- bmp_cfg_db_get_int(cfg, configSection, "precision", &fc_myConfig.precision);
- bmp_cfg_db_get_int(cfg, configSection, "channels", &fc_myConfig.channels);
+ aud_cfg_db_get_int(cfg, configSection, "frequency", &fc_myConfig.frequency);
+ aud_cfg_db_get_int(cfg, configSection, "precision", &fc_myConfig.precision);
+ aud_cfg_db_get_int(cfg, configSection, "channels", &fc_myConfig.channels);
- bmp_cfg_db_close(cfg);
+ aud_cfg_db_close(cfg);
}
}
@@ -249,12 +249,12 @@
if (GTK_TOGGLE_BUTTON(Sample_11)->active)
fc_myConfig.frequency = FREQ_SAMPLE_11;
- if ((cfg = bmp_cfg_db_open()))
+ if ((cfg = aud_cfg_db_open()))
{
- bmp_cfg_db_set_int(cfg, configSection, "frequency", fc_myConfig.frequency);
- bmp_cfg_db_set_int(cfg, configSection, "precision", fc_myConfig.precision);
- bmp_cfg_db_set_int(cfg, configSection, "channels", fc_myConfig.channels);
- bmp_cfg_db_close(cfg);
+ aud_cfg_db_set_int(cfg, configSection, "frequency", fc_myConfig.frequency);
+ aud_cfg_db_set_int(cfg, configSection, "precision", fc_myConfig.precision);
+ aud_cfg_db_set_int(cfg, configSection, "channels", fc_myConfig.channels);
+ aud_cfg_db_close(cfg);
}
gtk_widget_destroy(fc_config_window);
}
diff -Nur audacious-plugin-fc-0.2-orig/src/Main.cpp audacious-plugin-fc-0.2/src/Main.cpp
--- audacious-plugin-fc-0.2-orig/src/Main.cpp 2007-03-05 13:19:20.000000000 +0100
+++ audacious-plugin-fc-0.2/src/Main.cpp 2007-11-21 17:38:57.000000000 +0100
@@ -33,8 +33,6 @@
using namespace std;
#endif
-#include <pthread.h>
-
#include "Config.h"
#ifdef FC_HAVE_NOTHROW
#include <new>
@@ -72,33 +70,45 @@
static gint ip_get_time(InputPlayback *playback);
static void ip_get_song_info(gchar *fileName, gchar **title, gint *length);
-static pthread_t decode_thread;
+static GThread *decode_thread;
+
+static gchar *fc_fmts[] = { "fc", "fc13", "fc14", NULL };
InputPlugin iplugin =
{
NULL,
NULL,
+
"Future Composer Player",
ip_init,
+ NULL,
fc_ip_about,
fc_ip_configure,
+ TRUE,
+
NULL,
NULL,
+
ip_play_file,
ip_stop,
ip_pause,
ip_seek,
+
NULL,
+
ip_get_time,
+
NULL,
NULL,
+
NULL,
NULL,
- NULL,
+
NULL,
NULL,
ip_get_song_info,
NULL,
+
NULL,
NULL,
@@ -107,25 +117,29 @@
// 1.3.0
ip_is_valid_file_vfs,
- NULL
+ fc_fmts,
+
+ // 1.4.0
+ NULL,
+ NULL,
+
+ // 1.4.1
+ FALSE
};
-InputPlugin *get_iplugin_info(void)
-{
- return &iplugin;
-}
+static InputPlugin *fc_iplist[] = { &iplugin, NULL };
+
+SIMPLE_INPUT_PLUGIN(libfc, fc_iplist);
static const udword extraFileBufLen = 8+1; // see FC.cpp
static ubyte* fileBuf = 0;
-static glong fileLen = 0;
+static gulong fileLen = 0;
static int sampleBufSize = 0;
static ubyte* sampleBuf = 0;
-static bool playing = false;
-static bool paused = true;
-static int jumpToTime = -1;
+static gint jumpToTime = -1;
static void deleteFileBuf()
{
@@ -151,13 +165,13 @@
{
deleteFileBuf();
- VFSFile *fd = vfs_fopen(fileName,"rb");
+ VFSFile *fd = aud_vfs_fopen(fileName,"rb");
if (!fd) {
return false;
}
- if ( vfs_fseek(fd,0,SEEK_END)!=0 ) return false;
- fileLen = vfs_ftell(fd);
- if ( vfs_fseek(fd,0,SEEK_SET)!=0 ) return false;
+ if ( aud_vfs_fseek(fd,0,SEEK_END)!=0 ) return false;
+ fileLen = aud_vfs_ftell(fd);
+ if ( aud_vfs_fseek(fd,0,SEEK_SET)!=0 ) return false;
#ifdef FC_HAVE_NOTHROW
if ((fileBuf = new(std::nothrow) ubyte[fileLen+extraFileBufLen]) == 0)
@@ -168,12 +182,12 @@
fileLen = 0;
return false;
}
- if ( fileLen != vfs_fread((char*)fileBuf,1,fileLen,fd) )
+ if ( fileLen != aud_vfs_fread((char*)fileBuf,1,fileLen,fd) )
{
deleteFileBuf();
return false;
}
- vfs_fclose(fd);
+ aud_vfs_fclose(fd);
return true;
}
@@ -183,57 +197,42 @@
static void *play_loop(void *arg)
{
- bool stop = false;
- while ( playing )
+ InputPlayback *playback = (InputPlayback*)arg;
+ while ( playback->playing )
{
- if ( paused && stop )
+ mixerFillBuffer(sampleBuf,sampleBufSize);
+ while ( playback->output->buffer_free() < sampleBufSize && playback->playing )
+ g_usleep( sleepVal );
+ if ( playback->playing && jumpToTime<0 )
+ playback->pass_audio(playback,myFormat.xmmsAFormat,myFormat.channels,sampleBufSize,sampleBuf,&playback->playing);
+ if ( FC_songEnd && jumpToTime<0 )
{
- memset(sampleBuf,0,sampleBufSize);
+ playback->output->buffer_free();
+ playback->output->buffer_free();
+ while ( playback->output->buffer_playing() )
+ {
+ g_usleep(10000);
+ }
+ playback->playing = false;
}
if ( jumpToTime != -1 )
{
- iplugin.output->flush(jumpToTime);
FC_init(fileBuf,fileLen,0,0);
- while (jumpToTime > 0)
+ gint j = jumpToTime;
+ while (j > 0)
{
FC_play();
- jumpToTime -= 20;
+ j -= 20;
};
+ playback->output->flush(jumpToTime);
jumpToTime = -1;
- stop = false;
- }
- if ( !stop )
- {
- mixerFillBuffer(sampleBuf,sampleBufSize);
- iplugin.add_vis_pcm(iplugin.output->written_time(),
- myFormat.xmmsAFormat, myFormat.channels,
- sampleBufSize, sampleBuf);
- while ( iplugin.output->buffer_free() < sampleBufSize && playing )
- xmms_usleep( sleepVal );
- if ( playing && jumpToTime<0 )
- iplugin.output->write_audio(sampleBuf,sampleBufSize);
- if ( FC_songEnd && jumpToTime<0 )
- {
- iplugin.output->buffer_free();
- iplugin.output->buffer_free();
- while ( iplugin.output->buffer_playing() && playing && jumpToTime<0 )
- {
- xmms_usleep(10000);
- }
- stop = true;
- }
- }
- else
- {
- xmms_usleep( 10000 );
}
}
- pthread_exit(NULL);
+ return NULL;
}
static void ip_init(void)
{
- playing = false;
fileBuf = 0;
fileLen = 0;
sampleBuf = 0;
@@ -245,7 +244,7 @@
static gint ip_is_valid_file_vfs(gchar *fileName, VFSFile *fd)
{
ubyte magicBuf[5];
- if ( 5 != vfs_fread(magicBuf,1,5,fd) ) {
+ if ( 5 != aud_vfs_fread(magicBuf,1,5,fd) ) {
return false;
}
@@ -265,8 +264,7 @@
static void ip_play_file(InputPlayback *playback)
{
- playing = false;
- paused = true;
+ playback->playing = false;
jumpToTime = -1;
bool haveModule = false;
@@ -302,9 +300,9 @@
if (myFormat.freq>0 && myFormat.channels>0)
{
- audioDriverOK = (iplugin.output->open_audio(myFormat.xmmsAFormat,
- myFormat.freq,
- myFormat.channels) != 0);
+ audioDriverOK = (playback->output->open_audio(myFormat.xmmsAFormat,
+ myFormat.freq,
+ myFormat.channels) != 0);
}
if ( !audioDriverOK )
@@ -329,9 +327,9 @@
{
myFormat = formatList[i];
- if (iplugin.output->open_audio(myFormat.xmmsAFormat,
- myFormat.freq,
- myFormat.channels) != 0)
+ if (playback->output->open_audio(myFormat.xmmsAFormat,
+ myFormat.freq,
+ myFormat.channels) != 0)
{
audioDriverOK = true;
break;
@@ -370,15 +368,15 @@
title = pathSepPos+1;
else
title = playback->filename;
- iplugin.set_info( title, msecSongLen, bitsPerSec, myFormat.freq, myFormat.channels );
-
+ playback->set_params( playback, title, msecSongLen, bitsPerSec, myFormat.freq, myFormat.channels );
int usecPerBuf = (sampleBufSize * 1000000) / (myFormat.freq * myFormat.channels * (myFormat.bits/8));
sleepVal = usecPerBuf;
- paused = false;
- playing = true;
+ playback->playing = true;
- pthread_create(&decode_thread, NULL, play_loop, NULL);
+ decode_thread = g_thread_self();
+ playback->set_pb_ready(playback);
+ play_loop(playback);
}
else
{
@@ -389,12 +387,11 @@
static void ip_stop(InputPlayback *playback)
{
- if ( fileBuf!=0 && playing )
+ if ( fileBuf!=0 && playback->playing )
{
- playing = false;
- paused = true;
- pthread_join(decode_thread, NULL);
- iplugin.output->close_audio();
+ playback->playing = false;
+ g_thread_join(decode_thread);
+ playback->output->close_audio();
deleteSampleBuf();
deleteFileBuf();
@@ -403,7 +400,7 @@
static void ip_pause(InputPlayback *playback, gshort p)
{
- iplugin.output->pause(p);
+ playback->output->pause(p);
}
static void ip_seek(InputPlayback *playback, gint secs)
@@ -411,22 +408,17 @@
jumpToTime = secs * 1000;
while (jumpToTime != -1)
- xmms_usleep(10000);
+ g_usleep(10000);
}
static gint ip_get_time(InputPlayback *playback)
{
- if (iplugin.output)
- {
- if ( playing && FC_songEnd && !iplugin.output->buffer_playing() )
- return -1; // stop and next file
- else if ( playing )
- return iplugin.output->output_time();
- else
- return -1;
- }
- else
- return -1;
+ if ( playback->playing && FC_songEnd && !playback->output->buffer_playing() )
+ return -1; // stop and next file
+ else if ( playback->playing )
+ return playback->output->output_time();
+ else
+ return -1;
}
static void ip_get_song_info(gchar *fileName, gchar **title, gint *length)
More information about the fedora-extras-commits
mailing list