[xiph-commits] r9705 - icecast/trunk/ices0/src
brendan at svn.xiph.org
brendan at svn.xiph.org
Fri Aug 5 23:50:47 PDT 2005
Author: brendan
Date: 2005-08-05 23:50:46 -0700 (Fri, 05 Aug 2005)
New Revision: 9705
Modified:
icecast/trunk/ices0/src/in_mp4.c
Log:
"bedlam"'s mp4 metadata patch
Modified: icecast/trunk/ices0/src/in_mp4.c
===================================================================
--- icecast/trunk/ices0/src/in_mp4.c 2005-08-06 05:55:44 UTC (rev 9704)
+++ icecast/trunk/ices0/src/in_mp4.c 2005-08-06 06:50:46 UTC (rev 9705)
@@ -41,6 +41,7 @@
} mp4_in_t;
/* -- static prototypes -- */
+static void ices_mp4_read_metadata (MP4FileHandle mp4file);
static int ices_mp4_readpcm (input_stream_t* self, size_t len,
int16_t* left, int16_t* right);
static int ices_mp4_close (input_stream_t* self);
@@ -68,7 +69,9 @@
if (! self->filesize)
return 1;
- if ((mp4file = MP4Read(self->path, 0)) == MP4_INVALID_FILE_HANDLE)
+ if ((mp4file = MP4Read(self->path, 0)) != MP4_INVALID_FILE_HANDLE) {
+ ices_mp4_read_metadata(mp4file);
+ } else
return 1;
/* find audio stream */
@@ -140,6 +143,27 @@
return -1;
}
+static void
+ices_mp4_read_metadata (MP4FileHandle mp4file)
+{
+ char *artist = NULL, *title = NULL;
+
+ if (MP4GetMetadataName(mp4file, &title) && title != NULL)
+ ices_log_debug("Title: %s", title);
+
+ if (MP4GetMetadataArtist(mp4file, &artist) && artist != NULL)
+ ices_log_debug("Artist: %s", artist);
+
+ ices_metadata_set(artist, title);
+ if (artist)
+ ices_util_free(artist);
+ if (title)
+ ices_util_free(title);
+
+ return;
+}
+
+
static int
ices_mp4_readpcm (input_stream_t* self, size_t olen, int16_t* left,
int16_t* right)
More information about the commits
mailing list