Discussion:
Fixed support for mp4v2.
Evan Niessen-Derry
2010-05-23 22:59:04 UTC
Permalink
---
configure | 4 ++--
mp4.c | 31 +++++++++++++++++++++++++++++--
2 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 332677a..2fac032 100755
--- a/configure
+++ b/configure
@@ -263,7 +263,7 @@ check_waveout()
check_mp4()
{
check_header mp4v2/mp4v2.h
- MP4_USE_OLD_HEADER=$?
+ USE_MPEG4IP=$?
check_header neaacdec.h &&
check_library MP4 "" "-lmp4v2 -lfaad -lm"
return $?
@@ -387,7 +387,7 @@ config_header config/libdir.h LIBDIR
config_header config/debug.h DEBUG
config_header config/tremor.h CONFIG_TREMOR
config_header config/mpc.h MPC_SV7
-config_header config/mp4.h MP4_USE_OLD_HEADER
+config_header config/mp4.h USE_MPEG4IP
config_header config/curses.h HAVE_RESIZETERM HAVE_USE_DEFAULT_COLORS

makefile_vars bindir datadir libdir mandir exampledir
diff --git a/mp4.c b/mp4.c
index a8054c3..3daee6a 100644
--- a/mp4.c
+++ b/mp4.c
@@ -23,7 +23,7 @@
#include "file.h"
#include "config/mp4.h"

-#if MP4_USE_OLD_HEADER
+#if USE_MPEG4IP
#include <mp4.h>
#else
#include <mp4v2/mp4v2.h>
@@ -317,15 +317,20 @@ static int mp4_read_comments(struct input_plugin_data *ip_data,
struct keyval **comments)
{
struct mp4_private *priv;
+#if USE_MPEG4IP
uint16_t meta_num, meta_total;
uint8_t val;
+ char *str;
+#else
+ const MP4Tags *tags;
+#endif
/*uint8_t *ustr;
uint32_t size;*/
- char *str;
GROWING_KEYVALS(c);

priv = ip_data->private;

+#if USE_MPEG4IP
/* MP4GetMetadata* provides malloced pointers, and the data
* is in UTF-8 (or at least it should be). */
if (MP4GetMetadataArtist(priv->mp4.handle, &str))
@@ -373,6 +378,28 @@ static int mp4_read_comments(struct input_plugin_data *ip_data,
snprintf(buf, 6, "%u", meta_num);
comments_add_const(&c, "discnumber", buf);
}
+#else
+
+ /* Allocate a struct for the tag info*/
+ tags = MP4TagsAlloc();
+
+ /* Fetch the tag info from the file and populate the tags struct*/
+ MP4TagsFetch( tags, priv->mp4.handle );
+
+ if(tags->artist)
+ comments_add(&c, "artist", xstrdup((char *)tags->artist));
+ if(tags->album)
+ comments_add(&c, "album", xstrdup((char *)tags->album));
+ if(tags->name)
+ comments_add(&c, "title", xstrdup((char *)tags->name));
+ if(tags->releaseDate)
+ comments_add(&c, "date", xstrdup((char *)tags->releaseDate));
+ if(tags->compilation)
+ comments_add_const(&c, "compilation", *tags->compilation ? "yes" : "no");
+
+ MP4TagsFree( tags );
+
+#endif

keyvals_terminate(&c);
*comments = c.keyvals;
--
1.7.1


--EeQfGwPcQSOJBaQU
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0001-Fixed-support-for-mp4v2.patch"
Evan Niessen-Derry
2010-05-23 22:59:04 UTC
Permalink
---
configure | 4 ++--
mp4.c | 31 +++++++++++++++++++++++++++++--
2 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 332677a..2fac032 100755
--- a/configure
+++ b/configure
@@ -263,7 +263,7 @@ check_waveout()
check_mp4()
{
check_header mp4v2/mp4v2.h
- MP4_USE_OLD_HEADER=$?
+ USE_MPEG4IP=$?
check_header neaacdec.h &&
check_library MP4 "" "-lmp4v2 -lfaad -lm"
return $?
@@ -387,7 +387,7 @@ config_header config/libdir.h LIBDIR
config_header config/debug.h DEBUG
config_header config/tremor.h CONFIG_TREMOR
config_header config/mpc.h MPC_SV7
-config_header config/mp4.h MP4_USE_OLD_HEADER
+config_header config/mp4.h USE_MPEG4IP
config_header config/curses.h HAVE_RESIZETERM HAVE_USE_DEFAULT_COLORS

makefile_vars bindir datadir libdir mandir exampledir
diff --git a/mp4.c b/mp4.c
index a8054c3..3daee6a 100644
--- a/mp4.c
+++ b/mp4.c
@@ -23,7 +23,7 @@
#include "file.h"
#include "config/mp4.h"

-#if MP4_USE_OLD_HEADER
+#if USE_MPEG4IP
#include <mp4.h>
#else
#include <mp4v2/mp4v2.h>
@@ -317,15 +317,20 @@ static int mp4_read_comments(struct input_plugin_data *ip_data,
struct keyval **comments)
{
struct mp4_private *priv;
+#if USE_MPEG4IP
uint16_t meta_num, meta_total;
uint8_t val;
+ char *str;
+#else
+ const MP4Tags *tags;
+#endif
/*uint8_t *ustr;
uint32_t size;*/
- char *str;
GROWING_KEYVALS(c);

priv = ip_data->private;

+#if USE_MPEG4IP
/* MP4GetMetadata* provides malloced pointers, and the data
* is in UTF-8 (or at least it should be). */
if (MP4GetMetadataArtist(priv->mp4.handle, &str))
@@ -373,6 +378,28 @@ static int mp4_read_comments(struct input_plugin_data *ip_data,
snprintf(buf, 6, "%u", meta_num);
comments_add_const(&c, "discnumber", buf);
}
+#else
+
+ /* Allocate a struct for the tag info*/
+ tags = MP4TagsAlloc();
+
+ /* Fetch the tag info from the file and populate the tags struct*/
+ MP4TagsFetch( tags, priv->mp4.handle );
+
+ if(tags->artist)
+ comments_add(&c, "artist", xstrdup((char *)tags->artist));
+ if(tags->album)
+ comments_add(&c, "album", xstrdup((char *)tags->album));
+ if(tags->name)
+ comments_add(&c, "title", xstrdup((char *)tags->name));
+ if(tags->releaseDate)
+ comments_add(&c, "date", xstrdup((char *)tags->releaseDate));
+ if(tags->compilation)
+ comments_add_const(&c, "compilation", *tags->compilation ? "yes" : "no");
+
+ MP4TagsFree( tags );
+
+#endif

keyvals_terminate(&c);
*comments = c.keyvals;
--
1.7.1


--EeQfGwPcQSOJBaQU--
Loading...