summaryrefslogtreecommitdiff
path: root/plugins/aac
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-03-09 11:38:38 +0100
committerGravatar waker <wakeroid@gmail.com>2011-03-09 11:38:38 +0100
commit2d0b00f6bbd326790c053961ccec07106cb172c7 (patch)
treea4ffb39b2a5d1c9a80aa2ba79f885d0d20667df8 /plugins/aac
parentfb269bc2b4cbbe6b457b46588d39ace1c021e3f1 (diff)
moved most of track properties from playItem struct to metadata
implemented track properties with multiple selection
Diffstat (limited to 'plugins/aac')
-rw-r--r--plugins/aac/aac.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/plugins/aac/aac.c b/plugins/aac/aac.c
index ca76340a..332870e0 100644
--- a/plugins/aac/aac.c
+++ b/plugins/aac/aac.c
@@ -384,7 +384,7 @@ static int
aac_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
aac_info_t *info = (aac_info_t *)_info;
- info->file = deadbeef->fopen (it->fname);
+ info->file = deadbeef->fopen (deadbeef->pl_find_meta (it, ":URI"));
if (!info->file) {
return -1;
}
@@ -424,7 +424,7 @@ aac_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
if (!info->file->vfs->is_streaming ()) {
#ifdef USE_MP4FF
- trace ("aac_init: mp4ff_open_read %s\n", it->fname);
+ trace ("aac_init: mp4ff_open_read %s\n", deadbeef->pl_find_meta (it, ":URI"));
info->mp4file = mp4ff_open_read (&info->mp4reader);
if (info->mp4file) {
int ntracks = mp4ff_total_tracks (info->mp4file);
@@ -493,8 +493,8 @@ aac_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
}
}
#else
- trace ("aac_init: MP4ReadProvider %s\n", it->fname);
- info->mp4file = MP4ReadProvider (it->fname, 0, &info->mp4reader);
+ trace ("aac_init: MP4ReadProvider %s\n", deadbeef->pl_find_meta (it, ":URI"));
+ info->mp4file = MP4ReadProvider (deadbeef->pl_find_meta (it, ":URI"), 0, &info->mp4reader);
info->mp4track = MP4FindTrackId(info->mp4file, 0, "audio", 0);
trace ("aac_init: MP4FindTrackId returned %d\n", info->mp4track);
if (info->mp4track >= 0) {
@@ -991,24 +991,20 @@ aac_load_tags (DB_playItem_t *it, mp4ff_t *mp4) {
free (s);
}
}
- it->replaygain_track_gain = 0;
- it->replaygain_track_peak = 1;
- it->replaygain_album_gain = 0;
- it->replaygain_album_peak = 1;
if (mp4ff_meta_find_by_name(mp4, "replaygain_track_gain", &s)) {
- it->replaygain_track_gain = atof (s);
+ deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_TRACKGAIN, atof (s));
free (s);
}
if (mp4ff_meta_find_by_name(mp4, "replaygain_track_peak", &s)) {
- it->replaygain_track_peak = atof (s);
+ deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_TRACKPEAK, atof (s));
free (s);
}
if (mp4ff_meta_find_by_name(mp4, "replaygain_album_gain", &s)) {
- it->replaygain_album_gain = atof (s);
+ deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_ALBUMGAIN, atof (s));
free (s);
}
if (mp4ff_meta_find_by_name(mp4, "replaygain_album_peak", &s)) {
- it->replaygain_album_peak = atof (s);
+ deadbeef->pl_set_item_replaygain (it, DDB_REPLAYGAIN_ALBUMPEAK, atof (s));
free (s);
}
deadbeef->pl_add_meta (it, "title", NULL);
@@ -1019,7 +1015,7 @@ aac_load_tags (DB_playItem_t *it, mp4ff_t *mp4) {
int
aac_read_metadata (DB_playItem_t *it) {
#ifdef USE_MP4FF
- DB_FILE *fp = deadbeef->fopen (it->fname);
+ DB_FILE *fp = deadbeef->fopen (deadbeef->pl_find_meta (it, ":URI"));
if (!fp) {
return -1;
}
@@ -1112,9 +1108,7 @@ aac_insert (DB_playItem_t *after, const char *fname) {
}
}
- DB_playItem_t *it = deadbeef->pl_item_alloc ();
- it->decoder_id = deadbeef->plug_get_decoder_id (plugin.plugin.id);
- it->fname = strdup (fname);
+ DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id);
it->filetype = ftype;
deadbeef->pl_set_item_duration (it, duration);
trace ("duration: %f sec\n", duration);