Mercurial > audlegacy-plugins
changeset 1429:b274ac478607
Automated merge with ssh://hg.atheme.org//hg/audacious-plugins
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Fri, 10 Aug 2007 07:45:36 -0500 |
parents | 4993976d7ed0 (current diff) 138ea47220e8 (diff) |
children | e6eab0c725cd d557d987e42d |
files | |
diffstat | 2 files changed, 84 insertions(+), 54 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aac/src/libmp4.c Fri Aug 10 07:45:29 2007 -0500 +++ b/src/aac/src/libmp4.c Fri Aug 10 07:45:36 2007 -0500 @@ -6,13 +6,15 @@ #include "mp4ff.h" #include "tagging.h" -#include <audacious/plugin.h> -#include <audacious/output.h> -#include <audacious/util.h> -#include <audacious/titlestring.h> -#include <audacious/vfs.h> -#include <audacious/i18n.h> -#include <audacious/strings.h> +#include "audacious/plugin.h" +#include "audacious/output.h" +#include "audacious/util.h" +#include "audacious/vfs.h" +#include "audacious/i18n.h" +#include "audacious/strings.h" +#include "audacious/main.h" +#include "audacious/tuple.h" +#include "audacious/tuple_formatter.h" #define MP4_VERSION VERSION @@ -41,7 +43,7 @@ static void mp4_seek(InputPlayback *, int); static void mp4_cleanup(void); static void mp4_get_song_title_len(char *filename, char **, int *); -static TitleInput* mp4_get_song_tuple(char *); +static Tuple* mp4_get_song_tuple(char *); static int mp4_is_our_fd(char *, VFSFile *); static gchar *fmts[] = { "m4a", "mp4", "aac", NULL }; @@ -326,13 +328,13 @@ { } -static TitleInput *mp4_get_song_tuple(char *fn) +static Tuple *mp4_get_song_tuple(char *fn) { mp4ff_callback_t *mp4cb = g_malloc0(sizeof(mp4ff_callback_t)); VFSFile *mp4fh; mp4ff_t *mp4file; - TitleInput *input = NULL; - gchar *filename = g_strdup(fn); + Tuple *ti = tuple_new(); + gchar *scratch; gboolean remote = str_has_prefix_nocase(filename, "http:") || str_has_prefix_nocase(filename, "https:"); @@ -343,19 +345,22 @@ { g_free(mp4cb); - input = bmp_title_input_new(); + tuple_associate_string(ti, "title", vfs_get_metadata(mp4fh, "track-name")); + tuple_associate_string(ti, "album", vfs_get_metadata(mp4fh, "stream-name")); - input->track_name = vfs_get_metadata(mp4fh, "track-name"); - input->album_name = vfs_get_metadata(mp4fh, "stream-name"); + scratch = g_path_get_basename(fn); + tuple_associate_string(ti, "file-name", scratch); + g_free(scratch); - input->file_name = g_path_get_basename(filename); - input->file_path = g_path_get_dirname(filename); - input->file_ext = extname(filename); + scratch = g_path_get_dirname(fn); + tuple_associate_string(ti, "file-path", scratch); + g_free(scratch); - input->mtime = 0; - input->length = -1; + tuple_associate_string(ti, "file-ext", extname(fn)); + tuple_associate_string(ti, "codec", "Advanced Audio Coding (AAC)"); + tuple_associate_string(ti, "quality", "lossy"); - return input; + return ti; } vfs_rewind(mp4fh); @@ -409,13 +414,23 @@ msDuration = ((float)numSamples * (float)(framesize - 1.0)/(float)samplerate) * 1000; - input = bmp_title_input_new(); + mp4ff_meta_get_title(mp4file, scratch); + tuple_associate_string(ti, "title", scratch); + g_free(scratch); + + mp4ff_meta_get_album(mp4file, scratch); + tuple_associate_string(ti, "title", scratch); + g_free(scratch); - mp4ff_meta_get_title(mp4file, &input->track_name); - mp4ff_meta_get_album(mp4file, &input->album_name); - mp4ff_meta_get_artist(mp4file, &input->performer); + mp4ff_meta_get_artist(mp4file, scratch); + tuple_associate_string(ti, "artist", scratch); + g_free(scratch); + + mp4ff_meta_get_genre(mp4file, scratch); + tuple_associate_string(ti, "genre", scratch); + g_free(scratch); + mp4ff_meta_get_date(mp4file, &tmpval); - mp4ff_meta_get_genre(mp4file, &input->genre); if (tmpval) { @@ -423,16 +438,23 @@ free(tmpval); } - input->file_name = g_path_get_basename(filename); - input->file_path = g_path_get_dirname(filename); - input->file_ext = extname(filename); - input->length = msDuration; + scratch = g_path_get_basename(fn); + tuple_associate_string(ti, "file-name", scratch); + g_free(scratch); + + scratch = g_path_get_dirname(fn); + tuple_associate_string(ti, "file-path", scratch); + g_free(scratch); + + tuple_associate_string(ti, "file-ext", extname(fn)); + tuple_associate_string(ti, "codec", "Advanced Audio Coding (AAC)"); + tuple_associate_string(ti, "quality", "lossy"); free (mp4cb); vfs_fclose(mp4fh); } - return input; + return ti; } static void mp4_get_song_title_len(char *filename, char **title, int *len)
--- a/src/wma/wma.c Fri Aug 10 07:45:29 2007 -0500 +++ b/src/wma/wma.c Fri Aug 10 07:45:36 2007 -0500 @@ -32,13 +32,15 @@ #include <strings.h> #include <glib.h> -#include <audacious/plugin.h> -#include <audacious/output.h> -#include <audacious/util.h> -#include <audacious/titlestring.h> -#include <audacious/vfs.h> -#include <audacious/strings.h> -#include <audacious/i18n.h> +#include "audacious/plugin.h" +#include "audacious/output.h" +#include "audacious/util.h" +#include "audacious/vfs.h" +#include "audacious/strings.h" +#include "audacious/i18n.h" +#include "audacious/main.h" +#include "audacious/tuple.h" +#include "audacious/tuple_formatter.h" #include "avcodec.h" #include "avformat.h" @@ -82,7 +84,7 @@ static void wma_seek(InputPlayback *data, int time); static void wma_do_pause(InputPlayback *data, short p); static void wma_get_song_info(char *filename, char **title, int *length); -static TitleInput *wma_get_song_tuple(char *filename); +static Tuple *wma_get_song_tuple(char *filename); static char *wsong_title; static int wsong_time; @@ -241,39 +243,45 @@ return ext; } -static TitleInput *wma_get_song_tuple(gchar * filename) +static Tuple *wma_get_song_tuple(gchar * filename) { - TitleInput *tuple = NULL; + Tuple *ti = tuple_new(); AVFormatContext *in = NULL; - gchar *filename_proxy = g_strdup(filename); + gchar *scratch; if (av_open_input_file(&in, str_twenty_to_space(filename), NULL, 0, NULL) < 0) return NULL; - tuple = bmp_title_input_new(); + scratch = g_path_get_basename(filename); + tuple_associate_string(ti, "file-name", scratch); + g_free(scratch); - tuple->file_name = g_path_get_basename(filename_proxy); - tuple->file_path = g_path_get_dirname(filename_proxy); - tuple->file_ext = extname(filename_proxy); - + scratch = g_path_get_dirname(filename); + tuple_associate_string(ti, "file-path", scratch); + g_free(scratch); + + tuple_associate_string(ti, "file-ext", extname(filename)); + tuple_associate_string(ti, "codec", "Windows Media Audio (WMA)"); + tuple_associate_string(ti, "quality", "lossy"); + av_find_stream_info(in); if(strlen(in->title)) - tuple->track_name = strdup(in->title); + tuple_associate_string(ti, "title", in->title); if(strlen(in->author)) - tuple->performer = strdup(in->author); + tuple_associate_string(ti, "artist", in->author); if(strlen(in->album)) - tuple->album_name = strdup(in->album); + tuple_associate_string(ti, "album", in->album); if(strlen(in->comment)) - tuple->comment = strdup(in->comment); + tuple_associate_string(ti, "comment", in->comment); if(strlen(in->genre)) - tuple->genre = strdup(in->genre); + tuple_associate_string(ti, "genre", in->genre); if(in->year > 0) - tuple->year = in->year; + tuple_associate_int(ti, "year", in->year); if(in->track > 0) - tuple->track_number = in->track; + tuple_associate_int(ti, "track", in->track); if (in->duration) - tuple->length = in->duration / 1000; + tuple_associate_int(ti, "length", in->duration / 1000); av_close_input_file(in);