Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#2101 Le 20/05/2011, à 23:13

The Uploader

Re : /* Topic des codeurs couche-tard [4] */

Bon, premier jet avec uade version git (git clone git://zakalwe.fi/uade) dont le dernier commit date de juillet 2010.. (je pense reéssayer avec le plugin pas à jour non plus s'appuyant sur la libdumb, elle me semble tout aussi complète qu'une solution se basant sur EaglePlayer et DeliTracker).

Je n'ai eu qu'à modifier /src/frontends/audacious/plugin.c. Ce ne marche pas pour autant, mais ça compile avec peu de warnings et le plugin est bien détecté, c'est toujours ça de pris..



la diff:

%git diff HEAD ./src/frontends/audacious/plugin.c
diff --git a/src/frontends/audacious/plugin.c b/src/frontends/audacious/plugin.c
index ad81340..725db31 100644
--- a/src/frontends/audacious/plugin.c
+++ b/src/frontends/audacious/plugin.c
@@ -23,6 +23,9 @@
 
 #define PLUGIN_DEBUG 0
 
+#define __AUDACIOUS_INPUT_PLUGIN_API__ 1
+#define __AUDACIOUS_PLUGIN_API__ 6
+
 #if PLUGIN_DEBUG
 #define plugindebug(fmt, args...) do { fprintf(stderr, "%s:%d: %s: " fmt, __FILE__, __LINE__, __func__, ## args); } while(0)
 #else
@@ -66,17 +69,19 @@ static void uade_stop(void);
 static InputPlugin uade_ip = {
   .description = "UADE " UADE_VERSION,
   .init = uade_init,
-  .is_our_file = uadeaudacious_is_our_file,
-  .play_file = uade_play_file,
+  .is_our_file_from_vfs = uadeaudacious_is_our_file,
+  .play = uade_play_file,
   .stop = uade_stop,
   .pause = uade_pause,
-  .seek = uade_seek,
+  .mseek = uade_seek,
   .get_time = uade_get_time,
   .cleanup = uade_cleanup,
-  .get_song_info = uade_get_song_info,
-  .file_info_box = uade_file_info,
+  /*.update_song_tuple = uade_get_song_info,*/
+  .file_info_box = uade_file_info
 };
 
+char *glfilename;
+
 #ifndef __AUDACIOUS_INPUT_PLUGIN_API__
 static InputPlugin *playhandle = &uade_ip;
 #endif
@@ -85,8 +90,8 @@ static InputPlugin *playhandle = &uade_ip;
 static InputPlugin *uade_iplist[] = {&uade_ip, NULL};
 DECLARE_PLUGIN(uade, NULL, NULL, uade_iplist, NULL, NULL, NULL, NULL);
 #endif
-
-static const AFormat sample_format = FMT_S16_NE;
+/*#define AFormat FMT_S16_NE;
+static const AFormat FMT_S16_NE;*/
 
 /* Definition of trigger type:
    abort_playing variable does not need locking, because it is initialized to
@@ -133,11 +138,11 @@ static pthread_mutex_t vlock = PTHREAD_MUTEX_INITIALIZER;
 
 static void uade_usleep(void)
 {
-#if __AUDACIOUS_PLUGIN_API__ >= 6
+//#if __AUDACIOUS_PLUGIN_API__ >= 6
   g_usleep(10000);
-#else
-  xmms_usleep(10000);
-#endif
+//#else
+  //xmms_usleep(10000);
+//#endif
 }
 
 
@@ -214,7 +219,7 @@ static void uade_cleanup(void)
 static void uade_file_info(char *filename)
 {
   int adder = 0;
-
+  
   if (strncmp(filename, "uade://", 7) == 0)
     adder = 7;
   uade_gui_file_info(filename + adder, gui_player_filename, gui_modulename, gui_playername, gui_formatname);
@@ -362,6 +367,7 @@ static int uadeaudacious_is_our_file(char *filename)
 /* Analyze file format, and handshake with uadecore. */
 static int initialize_song(char *filename)
 {
+    glfilename=filename;
   int ret;
   char modulename[PATH_MAX];
   char playername[PATH_MAX];
@@ -424,7 +430,7 @@ static int initialize_song(char *filename)
   return FALSE;
 }
 
-static void *play_loop(void *arg)
+static void *play_loop(InputPlayback *arg) /*was void argument type*/
 {
 #ifdef __AUDACIOUS_INPUT_PLUGIN_API__
   InputPlayback *playhandle = arg;
@@ -586,7 +592,9 @@ static void *play_loop(void *arg)
 
     uade_effect_run(&state.effects, (int16_t *) um->data, play_bytes / framesize);
 #if __AUDACIOUS_PLUGIN_API__ >= 6
-    playhandle->pass_audio(playhandle, sample_format, UADE_CHANNELS, play_bytes, um->data, &uade_thread_running);
+        playhandle->output->write_audio(um->data,um->size);
+    /*was 
+         * playhandle->pass_audio(playhandle, sample_format, UADE_CHANNELS, play_bytes, um->data, &uade_thread_running);*/
 #else
     produce_audio(playhandle->output->written_time(), sample_format, UADE_CHANNELS, play_bytes, um->data, &uade_thread_running);
 #endif
@@ -730,7 +738,7 @@ static void uade_play_file(char *filename)
 {
 
 #ifdef __AUDACIOUS_INPUT_PLUGIN_API__
-  char *filename = playhandle->filename;
+  char *filename = glfilename /*playhandle->filename*/;
 #endif
 
   char *decoded = NULL;
@@ -787,7 +795,7 @@ static void uade_play_file(char *filename)
     uade_spawn(&state, UADE_CONFIG_UADE_CORE, configname);
   }
 
-  if (!playhandle->output->open_audio(sample_format, state.permconfig.frequency, UADE_CHANNELS)) {
+  if (!playhandle->output->open_audio(FMT_S16_NE /*sampleformat*/, state.permconfig.frequency, UADE_CHANNELS)) {
     abort_playing = 1;
     return;
   }
@@ -955,7 +963,7 @@ static int uade_get_time(void)
     file_info_update(gui_module_filename, gui_player_filename, gui_modulename, gui_playername, gui_formatname);
   }
 
-  return playhandle->output->output_time();
+  return playhandle->output->written_time(); //was output_time
 }
 
 
@@ -997,7 +1005,7 @@ static void uade_info_string(void)
     strlcpy(info, gui_filename, sizeof info);
 
 #if __AUDACIOUS_PLUGIN_API__ >= 6
-  playhandle->set_params(playhandle, info, playtime,
+  playhandle->set_params(playhandle/*, info, playtime,*/,
              UADE_BYTES_PER_FRAME * state.config.frequency,
              state.config.frequency, UADE_CHANNELS);
 #else


le configure :

% ./configure --only-audacious
which: no gmake in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/vendor_perl:/usr/bin/core_perl)
Using strlcpy/cat() replacements

UADE and frontends is installed to      : /usr/local/bin
Data directory                          : /usr/local/share/uade2
Uadecore directory                      : /usr/local/lib/uade2
Man (documentation) directory           : /usr/local/share/man/man1
Installer                               : /bin/install
Make                                    : /usr/bin/make
Target CC                               : gcc
libuade                                 : no
uadecore                                : no
uade123                                 : no
XMMS plugin                             : no
Audacious plugin                        : yes
Audacious plugin directory              : /usr/lib/audacious/Input
uadefs                                  : no
Text scope support                      : no

le build log (en partie):

make[1]: Entering directory `/home/max/Dev/MOD/uade/src/frontends/audacious'
gcc -Wall -O2 -fPIC -shared -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/libmowgli -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng14    -g -I../common -I../include -c plugin.c
plugin.c:71:3: warning: initialization from incompatible pointer type [enabled by default]
plugin.c:71:3: warning: (near initialization for ‘uade_ip.init’) [enabled by default]
plugin.c:72:3: warning: initialization from incompatible pointer type [enabled by default]
plugin.c:72:3: warning: (near initialization for ‘uade_ip.is_our_file_from_vfs’) [enabled by default]
plugin.c:73:3: warning: initialization from incompatible pointer type [enabled by default]
plugin.c:73:3: warning: (near initialization for ‘uade_ip.play’) [enabled by default]
plugin.c:75:3: warning: initialization from incompatible pointer type [enabled by default]
plugin.c:75:3: warning: (near initialization for ‘uade_ip.pause’) [enabled by default]
plugin.c:81:1: warning: initialization from incompatible pointer type [enabled by default]
plugin.c:81:1: warning: (near initialization for ‘uade_ip.file_info_box’) [enabled by default]
plugin.c: In function ‘play_loop’:
plugin.c:653:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
plugin.c: At top level:
plugin.c:970:13: warning: ‘uade_get_song_info’ defined but not used [-Wunused-function]

Tout ce que j'ai eu comme résultat, c'est qu'aucun MOD lisible uniquement par uade ne fonctionne (Audacious refuse tout simplement de les lire : pas de décodeur trouvé, problème de registering du plugin, genre le plugin ne dit pas ce qu'il est censé décoder comme formats ?!). Ceci dit UN SEUL a eu un "résultat" (un son strident!), mais je ne saurai dire si c'est uade ou modplug qui bug (le plugin modplug d'Audacious n'est censé reconnaître que le format .MOD d'origine et aucun de ses dizaines de dérivés)

Mystère, un déboguage (DEBUG à 1 et lancement via la ligne de commande) en dira plus... (je crois aussi que je vais carrément prendre les sources d'audacious, et faire des points d'arrêt è_é )

Bonne nuit. wink

Dernière modification par The Uploader (Le 20/05/2011, à 23:20)


- Oldies PC : Intel Pentium 3 @ 800 Mhz sur CM ASUS P2B-F, GeForce 4 Ti4800 SE, Disque Dur Hitachi 160 Go, 512 Mo de RAM, 3DFX Voodoo 2, Sound Blaster 16 ISA PnP, Windows 98 SE / XP)
- Desktop : Intel Core i7 6700K @ 4 GHz sur CM ASUS Z170-P, GeForce GTX 1070, SSD Samsung 850 EVO 1 To, 16 Go de RAM, Disque Dur Seagate Barracuda 3 To, Windows 10

Hors ligne

#2102 Le 20/05/2011, à 23:13

The Uploader

Re : /* Topic des codeurs couche-tard [4] */

Les détails de la part de l'API Audacious 2.5.x concernée (je ne vais pas tout poster sinon j'ai pas fini) :
/usr/include/audacious/plugin.h (pas confondre avec ./src/frontends/audacious/plugin.h !)

/*
 * plugin.h
 * Copyright 2005-2010 Audacious Development Team
 *
 * This file is part of Audacious.
 *
 * Audacious is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, version 2 or version 3 of the License.
 *
 * Audacious is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * Audacious. If not, see <http://www.gnu.org/licenses/>.
 *
 * The Audacious team does not consider modular code linking to Audacious or
 * using our public API to be a derived work.
 */

#ifndef AUDACIOUS_PLUGIN_H
#define AUDACIOUS_PLUGIN_H

#include <glib.h>
#include <gmodule.h>

#include <audacious/api.h>
#include <audacious/types.h>
#include <libaudcore/audio.h>
#include <libaudcore/tuple.h>
#include <libaudcore/vfs.h>

/* "Magic" bytes identifying an Audacious plugin header. */
#define _AUD_PLUGIN_MAGIC 0x8EAC8DE2

/* API version.  Plugins are marked with this number at compile time.
 *
 * _AUD_PLUGIN_VERSION is the current version; _AUD_PLUGIN_VERSION_MIN is
 * the oldest one we are backward compatible with.  Plugins marked older than
 * _AUD_PLUGIN_VERSION_MIN or newer than _AUD_PLUGIN_VERSION are not loaded.
 *
 * Before releases that add new pointers to the end of the API tables, increment
 * _AUD_PLUGIN_VERSION but leave _AUD_PLUGIN_VERSION_MIN the same.
 *
 * Before releases that break backward compatibility (e.g. remove pointers from
 * the API tables), increment _AUD_PLUGIN_VERSION *and* set
 * _AUD_PLUGIN_VERSION_MIN to the same value. */

#define _AUD_PLUGIN_VERSION_MIN 18 /* 2.5-alpha1 */
#define _AUD_PLUGIN_VERSION     20 /* 2.5-beta2 */

/**
 * The plugin module header. Each module can contain several plugins,
 * of any supported type.
 */
typedef const struct {
    gint magic; /* checked against _AUD_PLUGIN_MAGIC */
    gint version; /* checked against _AUD_PLUGIN_VERSION */
    const gchar * name;
    void (* init) (void);
    void (* fini) (void);

    /* These are arrays of pointers, ending with NULL: */
    InputPlugin * const * ip_list;
    OutputPlugin * const * op_list;
    EffectPlugin * const * ep_list;
    GeneralPlugin * const * gp_list;
    VisPlugin * const * vp_list;
    TransportPlugin * const * tp_list;
    PlaylistPlugin * const * pp_list;

    Iface * iface;
} PluginHeader;

#define DECLARE_PLUGIN(name, ...) \
 AudAPITable * _aud_api_table = NULL; \
 G_MODULE_EXPORT PluginHeader * get_plugin_info (AudAPITable * table) { \
    static PluginHeader h = {_AUD_PLUGIN_MAGIC, _AUD_PLUGIN_VERSION, #name, \
     __VA_ARGS__}; \
    _aud_api_table = table; \
    return & h; \
 }

#define SIMPLE_TRANSPORT_PLUGIN(name, t) DECLARE_PLUGIN(name, .tp_list = t)
#define SIMPLE_PLAYLIST_PLUGIN(name, p) DECLARE_PLUGIN(name, .pp_list = p)
#define SIMPLE_INPUT_PLUGIN(name, i) DECLARE_PLUGIN (name, .ip_list = i)
#define SIMPLE_EFFECT_PLUGIN(name, e) DECLARE_PLUGIN (name, .ep_list = e)
#define SIMPLE_OUTPUT_PLUGIN(name, o) DECLARE_PLUGIN (name, .op_list = o)
#define SIMPLE_VIS_PLUGIN(name, v) DECLARE_PLUGIN(name, .vp_list = v)
#define SIMPLE_GENERAL_PLUGIN(name, g) DECLARE_PLUGIN (name, .gp_list = g)
#define SIMPLE_IFACE_PLUGIN(name, i) DECLARE_PLUGIN(name, .iface = i)

#define SIMPLE_VISUAL_PLUGIN SIMPLE_VIS_PLUGIN /* deprecated */

#define PLUGIN_COMMON_FIELDS        \
    gchar *description;            \
    gboolean (* init) (void); \
    void (*cleanup) (void);        \
    void (*about) (void);        \
    void (*configure) (void);        \
    PluginPreferences *settings;

struct _Plugin {
    PLUGIN_COMMON_FIELDS
};

struct _TransportPlugin {
    PLUGIN_COMMON_FIELDS
    const gchar * const * schemes; /* array ending with NULL */
    const VFSConstructor * vtable;
};

struct _PlaylistPlugin {
    PLUGIN_COMMON_FIELDS
    const gchar * const * extensions; /* array ending with NULL */
    gboolean (* load) (const gchar * filename, gint list, gint at);
    gboolean (* save) (const gchar * filename, gint list);
};

struct _OutputPlugin {
    PLUGIN_COMMON_FIELDS

    /* During probing, plugins with higher priority (10 to 0) are tried first. */
    gint probe_priority;

    /* Returns current volume for left and right channels (0 to 100). */
    void (* get_volume) (gint * l, gint * r);

    /* Changes volume for left and right channels (0 to 100). */
    void (* set_volume) (gint l, gint r);

    /* Begins playback of a PCM stream.  <format> is one of the FMT_*
     * enumeration values defined in libaudcore/audio.h.  Returns nonzero on
     * success. */
    gboolean (* open_audio) (gint format, gint rate, gint chans);

    /* Ends playback.  Any buffered audio data is discarded. */
    void (* close_audio) (void);

    /* Returns how many bytes of data may be passed to a following write_audio()
     * call.  NULL if the plugin supports only blocking writes (not recommended). */
    gint (* buffer_free) (void);

    /* Waits until buffer_free() will return a size greater than zero.
     * output_time(), pause(), and flush() may be called meanwhile; if flush()
     * is called, period_wait() should return immediately.  NULL if the plugin
     * supports only blocking writes (not recommended). */
    void (* period_wait) (void);

    /* Buffers <size> bytes of data, in the format given to open_audio(). */
    void (* write_audio) (void * data, gint size);

    /* Waits until all buffered data has been heard by the user. */
    void (* drain) (void);

    /* Returns time count (in milliseconds) of how much data has been written. */
    gint (* written_time) (void);

    /* Returns time count (in milliseconds) of how much data has been heard by
     * the user. */
    gint (* output_time) (void);

    /* Pauses the stream if <p> is nonzero; otherwise unpauses it.
     * write_audio() will not be called while the stream is paused. */
    void (* pause) (gboolean p);

    /* Discards any buffered audio data and sets the time counter (in
     * milliseconds) of data written. */
    void (* flush) (gint time);

    /* Sets the time counter (in milliseconds) of data written without
     * discarding any buffered audio data.  If <time> is less than the amount of
     * buffered data, following calls to output_time() will return negative
     * values. */
    void (* set_written_time) (gint time);
};

struct _EffectPlugin {
    PLUGIN_COMMON_FIELDS

    /* All processing is done in floating point.  If the effect plugin wants to
     * change the channel count or sample rate, it can change the parameters
     * passed to start().  They cannot be changed in the middle of a song. */
    void (* start) (gint * channels, gint * rate);

    /* process() has two options: modify the samples in place and leave the data
     * pointer unchanged or copy them into a buffer of its own.  If it sets the
     * pointer to dynamically allocated memory, it is the plugin's job to free
     * that memory.  process() may return different lengths of audio than it is
     * passed, even a zero length. */
    void (* process) (gfloat * * data, gint * samples);

    /* A seek is taking place; any buffers should be discarded. */
    void (* flush) (void);

    /* Exactly like process() except that any buffers should be drained (i.e.
     * the data processed and returned).  finish() will be called a second time
     * at the end of the last song in the playlist. */
    void (* finish) (gfloat * * data, gint * samples);

    /* For effects that change the length of the song, these functions allow the
     * correct time to be displayed. */
    gint (* decoder_to_output_time) (gint time);
    gint (* output_to_decoder_time) (gint time);

    /* Effects with lowest order (0 to 9) are applied first. */
    gint order;

    /* If the effect does not change the number of channels or the sampling
     * rate, it can be enabled and disabled more smoothly. */
    gboolean preserves_format;
};

struct OutputAPI
{
    /* In a multi-thread plugin, only one of these functions may be called at
     * once (but see pause and abort_write for exceptions to this rule). */

    /* Prepare the output system for playback in the specified format.  Returns
     * nonzero on success.  If the call fails, no other output functions may be
     * called. */
    gint (* open_audio) (gint format, gint rate, gint channels);

    /* Informs the output system of replay gain values for the current song so
     * that volume levels can be adjusted accordingly, if the user so desires.
     * This may be called at any time during playback should the values change. */
    void (* set_replaygain_info) (ReplayGainInfo * info);

    /* Pass audio data to the output system for playback.  The data must be in
     * the format passed to open_audio, and the length (in bytes) must be an
     * integral number of frames.  This function blocks until all the data has
     * been written (though it may not yet be heard by the user); if the output
     * system is paused; this may be indefinitely.  See abort_write for a way to
     * interrupt a blocked call. */
    void (* write_audio) (void * data, gint length);

    /* End playback.  Any audio data currently buffered by the output system
     * will be discarded.  After the call, no other output functions, except
     * open_audio, may be called. */
    void (* close_audio) (void);

    /* Pause or unpause playback.  This function may be called during a call to
     * write_audio, in which write_audio will block until playback is unpaused
     * (but see abort_write to prevent the call from blocking). */
    void (* pause) (gboolean pause);

    /* Discard any audio data currently buffered by the output system, and set
     * the time counter to a new value.  This function is intended to be used
     * for seeking. */
    void (* flush) (gint time);

    /* Returns the time counter.  Note that this represents the amount of audio
     * data passed to the output system, not the amount actually heard by the
     * user.  This function is useful for handling a changed audio format:
     * First, save the time counter using this function.  Second, call
     * close_audio and then open_audio with the new format (note that the call
     * may fail).  Finally, restore the time counter using flush. */
    gint (* written_time) (void);

    /* Returns TRUE if there is data remaining in the output buffer; FALSE if
     * all data written to the output system has been heard by the user.  This
     * function should be polled (1/50 second is a reasonable delay between
     * calls) at the end of a song before calling close_audio.  Once it returns
     * FALSE, close_audio can be called without cutting off any of the end of
     * the song. */
    gboolean (* buffer_playing) (void);

    /* Interrupt a call to write_audio so that it returns immediately.  This
     * works even when the call is blocked by pause.  Buffered audio data is
     * discarded as in flush.  Until flush is called or the output system is
     * reset, further calls to write_audio will have no effect and return
     * immediately.  This function is intended to be used in seeking or
     * stopping in a multi-thread plugin.  To seek, the handler function (called
     * in the main thread) should first set a flag for the decoding thread and
     * then call abort_write.  When the decoding thread notices the flag, it
     * should do the actual seek, call flush, and finally clear the flag.  Once
     * the flag is cleared, the handler function may return. */
    void (* abort_write) (void);
};

typedef const struct _InputPlayback InputPlayback;

struct _InputPlayback {
    /* Pointer to the output API functions. */
    const struct OutputAPI * output;

    /* Allows the plugin to associate data with a playback instance. */
    void (* set_data) (InputPlayback * p, void * data);

    /* Returns the pointer passed to set_data. */
    void * (* get_data) (InputPlayback * p);

    /* Signifies that the plugin has started playback is ready to accept mseek,
     * pause, and stop calls. */
    void (* set_pb_ready) (InputPlayback * p);

    /* Updates attributes of the stream.  "bitrate" is in bits per second.
     * "samplerate" is in hertz. */
    void (* set_params) (InputPlayback * p, gint bitrate, gint samplerate,
     gint channels);

    /**
     * Sets / updates playback entry #Tuple.
     * @attention Caller gives up ownership of one reference to the tuple.
     * @since Added in Audacious 2.2.
     */
    void (*set_tuple) (InputPlayback * playback, Tuple * tuple);

    /* If replay gain settings are stored in the tuple associated with the
     * current song, this function can be called (after opening audio) to apply
     * those settings.  If the settings are changed in a call to set_tuple, this
     * function must be called again to apply the updated settings. */
    void (* set_gain_from_playlist) (InputPlayback * playback);
};

struct _InputPlugin {
    PLUGIN_COMMON_FIELDS

    /* Nonzero if the files handled by the plugin may contain more than one
     * song.  When reading the tuple for such a file, the plugin should set the
     * FIELD_SUBSONG_NUM field to the number of songs in the file.  For all
     * other files, the field should be left unset.
     *
     * Example:
     * 1. User adds a file named "somefile.xxx" to the playlist.  Having
     * determined that this plugin can handle the file, Audacious opens the file
     * and calls probe_for_tuple().  probe_for_tuple() sees that there are 3
     * songs in the file and sets FIELD_SUBSONG_NUM to 3.
     * 2. For each song in the file, Audacious opens the file and calls
     * probe_for_tuple() -- this time, however, a question mark and song number
     * are appended to the file name passed: "somefile.sid?2" refers to the
     * second song in the file "somefile.sid".
     * 3. When one of the songs is played, Audacious opens the file and calls
     * play() with a file name modified in this way.
     */
    gboolean have_subtune;

    /* Pointer to an array (terminated with NULL) of file extensions associated
     * with file types the plugin can handle. */
    const gchar * const * vfs_extensions;

    /* How quickly the plugin should be tried in searching for a plugin to
     * handle a file which could not be identified from its extension.  Plugins
     * with priority 0 are tried first, 10 last. */
    gint priority;

    /* Must return nonzero if the plugin can handle this file.  If the file
     * could not be opened, "file" will be NULL.  (This is normal in the case of
     * special URI schemes like cdda:// that do not represent actual files.) */
    gboolean (* is_our_file_from_vfs) (const gchar * filename, VFSFile * file);

    /* Must return a tuple containing metadata for this file, or NULL if no
     * metadata could be read.  If the file could not be opened, "file" will be
     * NULL.  Audacious takes over one reference to the tuple returned. */
    Tuple * (* probe_for_tuple) (const gchar * filename, VFSFile * file);

    /* Optional.  Must write metadata from a tuple to this file.  Must return
     * nonzero on success or zero on failure.  "file" will never be NULL. */
    /* Bug: This function does not support special URI schemes like cdda://,
     * since no file name is passed. */
    gboolean (* update_song_tuple) (const Tuple * tuple, VFSFile * file);

    /* Optional, and not recommended.  Must show a window with information about
     * this file.  If this function is provided, update_song_tuple should not be. */
    /* Bug: Implementing this function duplicates user interface code and code
     * to open the file in each and every plugin. */
    void (* file_info_box) (const gchar * filename);

    /* Optional.  Must try to read an "album art" image embedded in this file.
     * Must return nonzero on success or zero on failure.  If the file could not
     * be opened, "file" will be NULL.  On success, must fill "data" with a
     * pointer to a block of data allocated with g_malloc and "size" with the
     * size in bytes of that block.  The data may be in any format supported by
     * GTK.  Audacious will free the data when it is no longer needed. */
    gboolean (* get_song_image) (const gchar * filename, VFSFile * file,
     void * * data, gint * size);

    /* Must try to play this file.  "playback" is a structure containing output-
     * related functions which the plugin may make use of.  It also contains a
     * "data" pointer which the plugin may use to refer private data associated
     * with the playback state.  This pointer can then be used from pause,
     * mseek, and stop. If the file could not be opened, "file" will be NULL.
     * "start_time" is the position in milliseconds at which to start from, or
     * -1 to start from the beginning of the file.  "stop_time" is the position
     * in milliseconds at which to end playback, or -1 to play to the end of the
     * file.  "paused" specifies whether playback should immediately be paused.
     * Must return nonzero if some of the file was successfully played or zero
     * on failure. */
    gboolean (* play) (InputPlayback * playback, const gchar * filename,
     VFSFile * file, gint start_time, gint stop_time, gboolean pause);

    /* Must pause or unpause a file currently being played.  This function will
     * be called from a different thread than play, but it will not be called
     * before the plugin calls set_pb_ready or after stop is called. */
    void (* pause) (InputPlayback * playback, gboolean paused);

    /* Optional.  Must seek to the given position in milliseconds within a file
     * currently being played.  This function will be called from a different
     * thread than play, but it will not be called before the plugin calls
     * set_pb_ready or after stop is called. */
    void (* mseek) (InputPlayback * playback, gint time);

    /* Must signal a currently playing song to stop and cause play to return.
     * This function will be called from a different thread than play.  It will
     * only be called once. It should not join the thread from which play is
     * called. */
    void (* stop) (InputPlayback * playback);

    /* Advanced, for plugins that do not use Audacious's output system.  Use at
     * your own risk. */
    gint (* get_time) (InputPlayback * playback);
    gint (* get_volume) (gint * l, gint * r);
    gint (* set_volume) (gint l, gint r);
};

struct _GeneralPlugin {
    PLUGIN_COMMON_FIELDS

    /* GtkWidget * (* get_widget) (void); */
    void * (* get_widget) (void);
};

struct _VisPlugin {
    PLUGIN_COMMON_FIELDS

    gint num_pcm_chs_wanted;
    gint num_freq_chs_wanted;

    void (*playback_start) (void);
    void (*playback_stop) (void);
    void (*render_pcm) (gint16 pcm_data[2][512]);

    /* The range of intensities is 0 - 32767 (though theoretically it is
     * possible for the FFT to result in bigger values, making the final
     * intensity negative due to overflowing the 16bit signed integer.)
     *
     * If output is mono, only freq_data[0] is filled.
     */
    void (*render_freq) (gint16 freq_data[2][256]);

    /* GtkWidget * (* get_widget) (void); */
    void * (* get_widget) (void);
};

#undef PLUGIN_COMMON_FIELDS

#endif /* AUDACIOUS_PLUGIN_H */ 

- Oldies PC : Intel Pentium 3 @ 800 Mhz sur CM ASUS P2B-F, GeForce 4 Ti4800 SE, Disque Dur Hitachi 160 Go, 512 Mo de RAM, 3DFX Voodoo 2, Sound Blaster 16 ISA PnP, Windows 98 SE / XP)
- Desktop : Intel Core i7 6700K @ 4 GHz sur CM ASUS Z170-P, GeForce GTX 1070, SSD Samsung 850 EVO 1 To, 16 Go de RAM, Disque Dur Seagate Barracuda 3 To, Windows 10

Hors ligne

#2103 Le 20/05/2011, à 23:16

The Uploader

Re : /* Topic des codeurs couche-tard [4] */

ici, du code devait apparaître - Bon je ne peux pas poster ./src/frontends/audacious/plugin.c, ça fait planter le truc du forum pour poster... hmm
/*
Na, puisque ça plantait en un seul post! tongue
(heureusement ensuite je ne ferais que des git diff tongue ) */


- Oldies PC : Intel Pentium 3 @ 800 Mhz sur CM ASUS P2B-F, GeForce 4 Ti4800 SE, Disque Dur Hitachi 160 Go, 512 Mo de RAM, 3DFX Voodoo 2, Sound Blaster 16 ISA PnP, Windows 98 SE / XP)
- Desktop : Intel Core i7 6700K @ 4 GHz sur CM ASUS Z170-P, GeForce GTX 1070, SSD Samsung 850 EVO 1 To, 16 Go de RAM, Disque Dur Seagate Barracuda 3 To, Windows 10

Hors ligne

#2105 Le 21/05/2011, à 00:16

Rolinh

Re : /* Topic des codeurs couche-tard [4] */

Argh mais pourquoi il m'invente des \n ???

Hors ligne

#2106 Le 21/05/2011, à 00:37

nesthib

Re : /* Topic des codeurs couche-tard [4] */

plop


GUL Bordeaux : GirollServices libres : TdCT.org
Hide in your shell, scripts & astuces :  applications dans un tunnelsmart wgettrouver des pdfinstall. auto de paquetssauvegarde auto♥ awk
  ⃛ɹǝsn xnuᴉꞁ uʍop-ǝpᴉsdn

Hors ligne

#2107 Le 21/05/2011, à 01:02

Pylades

Re : /* Topic des codeurs couche-tard [4] */

Rolinh a écrit :

Ouais je sais, j'ai eu la même réaction...
En fait, c'est qu'il y a des différences au niveau des regex apparemment. D'ailleurs, c'est pour ça que le deuxième find à été changé pour un iname plutôt que pour la regex: il ne trouvait rien sur OS X (sous FreeBSD aussi d'ailleurs...) alors que sur mon Arch ça marchait très bien.

T’as regardé s’il y a une histoire de regex basiques/étendues ?

Sinon, ça ne m’étonnerait pas que ce soit le [[:digit:]] qu’il ne digère pas ; essaie de regarder…


“Any if-statement is a goto. As are all structured loops.
“And sometimes structure is good. When it’s good, you should use it.
“And sometimes structure is _bad_, and gets into the way, and using a goto is just much clearer.”
                Linus Torvalds – 12 janvier 2003

Hors ligne

#2108 Le 21/05/2011, à 01:27

Кຼزດ

Re : /* Topic des codeurs couche-tard [4] */

Hop

Dernière modification par Кຼزດ (Le 21/05/2011, à 02:08)


dou

Hors ligne

#2109 Le 21/05/2011, à 02:06

Sir Na Kraïou

Re : /* Topic des codeurs couche-tard [4] */

Poh !


Descendant de Charlemagne et de LUCA.
Bleu, en l'hommage d'un truc bleu. :'(
C'est pas du bleu.
C'est pas le lac de Genève, c'est le Lac Léman.

Hors ligne

#2110 Le 21/05/2011, à 03:20

nesthib

Re : /* Topic des codeurs couche-tard [4] */

plop


GUL Bordeaux : GirollServices libres : TdCT.org
Hide in your shell, scripts & astuces :  applications dans un tunnelsmart wgettrouver des pdfinstall. auto de paquetssauvegarde auto♥ awk
  ⃛ɹǝsn xnuᴉꞁ uʍop-ǝpᴉsdn

Hors ligne

#2111 Le 21/05/2011, à 04:08

Pylades

Re : /* Topic des codeurs couche-tard [4] */

Bon… je ne suis pas d’une efficacité redoutable, au Code Jam… ^^


“Any if-statement is a goto. As are all structured loops.
“And sometimes structure is good. When it’s good, you should use it.
“And sometimes structure is _bad_, and gets into the way, and using a goto is just much clearer.”
                Linus Torvalds – 12 janvier 2003

Hors ligne

#2112 Le 21/05/2011, à 05:17

Pylades

Re : /* Topic des codeurs couche-tard [4] */

I’m almost capot hmm


“Any if-statement is a goto. As are all structured loops.
“And sometimes structure is good. When it’s good, you should use it.
“And sometimes structure is _bad_, and gets into the way, and using a goto is just much clearer.”
                Linus Torvalds – 12 janvier 2003

Hors ligne

#2113 Le 21/05/2011, à 05:32

Pylades

Re : /* Topic des codeurs couche-tard [4] */

Ma non-connaissance de Python m’a tuer.


“Any if-statement is a goto. As are all structured loops.
“And sometimes structure is good. When it’s good, you should use it.
“And sometimes structure is _bad_, and gets into the way, and using a goto is just much clearer.”
                Linus Torvalds – 12 janvier 2003

Hors ligne

#2114 Le 21/05/2011, à 05:46

Pylades

Re : /* Topic des codeurs couche-tard [4] */

Oh putain !


Je viens de trouver mon bug. Il manquait une ligne dans mon code. Un a = b. Si j’avais résolu ce problème, je me serais qualifié. À treize minutes près, c’est mort.


1305742540.jpg


“Any if-statement is a goto. As are all structured loops.
“And sometimes structure is good. When it’s good, you should use it.
“And sometimes structure is _bad_, and gets into the way, and using a goto is just much clearer.”
                Linus Torvalds – 12 janvier 2003

Hors ligne

#2115 Le 21/05/2011, à 05:56

Pylades

Re : /* Topic des codeurs couche-tard [4] */

On a les satisfactions qu’on peut : mon algo était trop lent ; il n’aurait ramassé que le tiers des points…


“Any if-statement is a goto. As are all structured loops.
“And sometimes structure is good. When it’s good, you should use it.
“And sometimes structure is _bad_, and gets into the way, and using a goto is just much clearer.”
                Linus Torvalds – 12 janvier 2003

Hors ligne

#2116 Le 21/05/2011, à 07:42

Compteur du TdCCT

Re : /* Topic des codeurs couche-tard [4] */

Scores totaux, depuis le début :

1) 3306    nesthib
2) 3006    samuncle
3) 2733    Pylade
4) 2093    Кຼزດ
5) 1690+5  grim7reaper /* ./viewtopic.php?pid=3486252#p3486252 */
6) 1600    cm-t
7) 1240    na kraïou
8) 866    helly
9) 858    \\Ouranos//
10) 659    gnuuat
11) 569    tshirtman
12) 565    Lagierl
13) 388    Rolinh
14) 327    The Uploader
15) 298    nathéo
16) 253    Kanor
17) 196    Askelon
18) 160    :!pakman
19) 121    ǤƦƯƝƬ
20) 93    petifrancais
21) 91    kamui57
22) 78    edge_one
22) 78    pierguiard
24) 70    gulp
25) 42    sakul
26) 39    Le Rouge
27) 37    ilagas
28) 33    xapantu
29) 30    keny
30) 26    gustare
30) 26    d10g3n
32) 25    GentooUser
32) 25    Morgiver
34) 24    ไ୦บเઢ'
34) 24    Steap
36) 20    CROWD
37) 18    Ph3nix_
38) 16    kouskous
39) 15    timsy
40) 12    stratoboy
40) 12    sailing
42) 11    alexises
42) 11    Crocoii
44) 10    Toineo
44) 10    NutMotion
44) 10    pseudovingtcinqcaracteres
44) 10    pfriedZ
44) 10    CasseTaTele
44) 10    Zeibux
44) 10    THS`
51) 8    Mornagest
52) 7    Vista
53) 6    ubuntlin
53) 6    asma.geek
55) 5    tendances-tdct
55) 5    kinouchou
57) 4    danychou56
57) 4    Neros
57) 4    Biaise
57) 4    totoflute
57) 4    pinballyoda ㋛
57) 4    NLS le pingouin
57) 4    ceric
57) 4    Dice-Man
65) 3    Revan26914
65) 3    raspouillas
65) 3    sweetly
68) 2    SoJaS
69) 1    geenux
69) 1    ArzhurBZH

RépartitionPosts/heure


Codez-vous trop tard le soir ?
Demandez au Compteur du TdCCT pour le savoir !

J’ai été généreusement codé par tshirtman ; d’ailleurs, voici mon code source. TdCCT CEP : ./viewtopic.php?pid=3493579#p3493579 (p3492608).

Hors ligne

#2117 Le 21/05/2011, à 07:42

Compteur du TdCCT

Re : /* Topic des codeurs couche-tard [4] */

Scores de la période en cours :

1) 200    Pylade
2) 136    nesthib
3) 110    na kraïou
4) 80    Кຼزດ
5) 77    samuncle
6) 58    cm-t
7) 50    nathéo
8) 34    Rolinh
9) 32    tshirtman
10) 27    The Uploader
11) 22    Kanor
12) 15    :!pakman
12) 15    grim7reaper
14) 10    sakul
14) 10    THS`
16) 8    helly
17) 6    Lagierl
18) 4    \\Ouranos//
19) 1    ArzhurBZH

Codez-vous trop tard le soir ?
Demandez au Compteur du TdCCT pour le savoir !

J’ai été généreusement codé par tshirtman ; d’ailleurs, voici mon code source. TdCCT CEP : ./viewtopic.php?pid=3493579#p3493579 (p3492608).

Hors ligne

#2118 Le 21/05/2011, à 11:17

tshirtman

Re : /* Topic des codeurs couche-tard [4] */

ouais pour certains trucs python peut être un peu limite en puissance de calcul avec codejam, à moins de trouver un algo bien optimal… quelqu'un qui code en C pourra se permettre un algo plus naif, souvent…

utiliser un os 32 bits pour avoir psycho peut faire la différence…

Hors ligne

#2119 Le 21/05/2011, à 11:25

grim7reaper

Re : /* Topic des codeurs couche-tard [4] */

Ouais, on voit aussi ça dans Project Euler : pas mal d'asm, de C et de C++ (pour certains c'est juste leur langage de prédilection, pour d'autres ça permet de compenser leur manque de réflexion).

Dernière modification par grim7reaper (Le 21/05/2011, à 11:25)

Hors ligne

#2120 Le 21/05/2011, à 13:51

Pylades

Re : /* Topic des codeurs couche-tard [4] */

L’asm comme langage de prédilection ? O_o"


En plus, je pense que ça doit pas être simple de faire quelque chose qui tienne la route niveau perfs en asm. C’est tellement spécial…


“Any if-statement is a goto. As are all structured loops.
“And sometimes structure is good. When it’s good, you should use it.
“And sometimes structure is _bad_, and gets into the way, and using a goto is just much clearer.”
                Linus Torvalds – 12 janvier 2003

Hors ligne

#2121 Le 21/05/2011, à 13:56

grim7reaper

Re : /* Topic des codeurs couche-tard [4] */

Pylade a écrit :

L’asm comme langage de prédilection ? O_o"

Je connais au moins une personne pour qui c'est le cas ^^

Pylade a écrit :

En plus, je pense que ça doit pas être simple de faire quelque chose qui tienne la route niveau perfs en asm. C’est tellement spécial…

Faire un truc qui tiennent la route c'est faisable. Faire un truc plus optimisé que ce que fait un bon compilateur, là faut vraiment très bien connaître sa machine (enfin son processeur surtout).

Hors ligne

#2122 Le 21/05/2011, à 14:02

Rolinh

Re : /* Topic des codeurs couche-tard [4] */

Aaaaaaaaaah, voilà la version qui fonctionne au poil sur Mac smile (j'ai finis par demander sur developpez.com pour le sed...)

#!/bin/bash
# This script creates folders in which to move files according to their
# ID given in their filename as in, for example, 12345_bob_marley_london.mov
# 12345 would be the ID

echo 'Yay, gonna clean ya mess dude...'
echo 'Moving files:'
while read file; do
    BASE=$(basename "$file")
    ID=$(sed -n 's/\([^[:digit:]]*\)\([[:digit:]]*\).*/\2/p' <<< ${BASE%.*})
    if [ -n "$ID" ] ; then
        mkdir -p "$ID"
        mv -v "$file" "$ID"
    fi
done < <(find . -maxdepth 2 -iname '*.jpg' -or -iname '*.jpeg' -or -iname '*.mov' -or -iname '*.xml')
find . -type d -empty -delete
echo 'Hurray, everythins been sorted out!'

Hors ligne

#2123 Le 21/05/2011, à 14:11

Pylades

Re : /* Topic des codeurs couche-tard [4] */

Ouais, c’est pour ça que je trouve bizarre de faire de l’asm pour pouvoir utiliser un algo plus naïf… ^^


Sinon, un truc qui m’a bien gêné pour cette nuit :

>>> tab = [1, 2, 3]
>>> for i in tab:
...  if i == 2:
...   del i
... 
>>> tab
[1, 2, 3]

En plus, je ne savais plus comment faire pour récupéré à la fois l’item et son index, dans un for

Du coup voilà ce que j’ai fait :

>>> tab = [1, 2, 3]
>>> torem = list()
>>> for i in tab:
...  if i == 2:
...   torem.append(i)
... 
>>> for remo in torem:
...  del tab[tab.index(remo)]
... 
>>> tab
[1, 3]

Mais c’est chiant, quoi…


Du coup, avec ces conneries, j’ai tout juste pas eu le temps de finir ! \o/


Je n’aurais pas dû choisir un langage que je ne maîtrise pas (même si c’est pratique pour le parsing des données)

Dernière modification par Pylade (Le 21/05/2011, à 14:12)


“Any if-statement is a goto. As are all structured loops.
“And sometimes structure is good. When it’s good, you should use it.
“And sometimes structure is _bad_, and gets into the way, and using a goto is just much clearer.”
                Linus Torvalds – 12 janvier 2003

Hors ligne

#2124 Le 21/05/2011, à 14:20

tshirtman

Re : /* Topic des codeurs couche-tard [4] */

Pylade a écrit :

Ouais, c’est pour ça que je trouve bizarre de faire de l’asm pour pouvoir utiliser un algo plus naïf… ^^


Sinon, un truc qui m’a bien gêné pour cette nuit :

>>> tab = [1, 2, 3]
>>> for i in tab:
...  if i == 2:
...   del i
... 
>>> tab
[1, 2, 3]

En plus, je ne savais plus comment faire pour récupéré à la fois l’item et son index, dans un for

for index,value in enumerate(tab):
   if value == 2:
       del tab[i]

Du coup voilà ce que j’ai fait :

>>> tab = [1, 2, 3]
>>> torem = list()
>>> for i in tab:
...  if i == 2:
...   torem.append(i)
... 
>>> for remo in torem:
...  del tab[tab.index(remo)]
... 
>>> tab
[1, 3]

Mais c’est chiant, quoi…


Du coup, avec ces conneries, j’ai tout juste pas eu le temps de finir ! \o/


Je n’aurais pas dû choisir un langage que je ne maîtrise pas (même si c’est pratique pour le parsing des données)

oui, c'est sur, après c'est bien de connaitre plusieurs langages, pour choisir le bon, il y a parfois des langages encore plus pratique que python pour résoudre les problème de GCJ… (même si souvent c'est trivial en python, le parsing de leurs données).

Hors ligne

#2125 Le 21/05/2011, à 14:23

Pylades

Re : /* Topic des codeurs couche-tard [4] */

tshirtman a écrit :
for i, value in enumerate(tab):
   if value == 2:
       del tab[i]

Ah, ouais, c’était ça ; merci tout plein.

Enfin, c’est trop tard, là, mais bon… ^^

Dernière modification par Pylade (Le 21/05/2011, à 14:25)


“Any if-statement is a goto. As are all structured loops.
“And sometimes structure is good. When it’s good, you should use it.
“And sometimes structure is _bad_, and gets into the way, and using a goto is just much clearer.”
                Linus Torvalds – 12 janvier 2003

Hors ligne