Discussion:
[PATCH] Fix mp4 compile error with SVN versions
Johannes Weißl
2011-09-02 21:33:09 UTC
Permalink
The reason is that the MP4 API changed, but it only affects C, not C++,
since only default parameters were changed.

SVN entry that changed MP4Close(): r479
SVN entry that changed MP4Read(): r453

They only reliable check seems to be introduced/dropped #defines :-(

mp4.c: In function 'mp4_open':
mp4.c:159:2: error: too many arguments to function 'MP4Read'
/usr/include/mp4v2/file.h:331:15: note: declared here
mp4.c:208:3: error: too few arguments to function 'MP4Close'
/usr/include/mp4v2/file.h:56:6: note: declared here
mp4.c: In function 'mp4_close':
mp4.c:222:3: error: too few arguments to function 'MP4Close'
/usr/include/mp4v2/file.h:56:6: note: declared here

Reported-by: Anonymous user
---
mp4.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/mp4.c b/mp4.c
index 0f91822..e8535aa 100644
--- a/mp4.c
+++ b/mp4.c
@@ -126,6 +126,15 @@ static void mp4_get_channel_map(struct input_plugin_data *ip_data)
ip_data->channel_map[i] = channel_position_aac(frame_info.channel_position[i]);
}

+static void mp4_close_handle(MP4FileHandle handle)
+{
+#ifdef MP4_CLOSE_DO_NOT_COMPUTE_BITRATE
+ MP4Close(handle, 0);
+#else
+ MP4Close(handle);
+#endif
+}
+
static int mp4_open(struct input_plugin_data *ip_data)
{
struct mp4_private *priv;
@@ -156,7 +165,11 @@ static int mp4_open(struct input_plugin_data *ip_data)
NeAACDecSetConfiguration(priv->decoder, neaac_cfg);

/* open mpeg-4 file */
+#ifdef MP4_DETAILS_ALL
priv->mp4.handle = MP4Read(ip_data->filename, 0);
+#else
+ priv->mp4.handle = MP4Read(ip_data->filename);
+#endif
if (!priv->mp4.handle) {
d_print("MP4Read failed\n");
goto out;
@@ -205,7 +218,7 @@ static int mp4_open(struct input_plugin_data *ip_data)

out:
if (priv->mp4.handle)
- MP4Close(priv->mp4.handle);
+ mp4_close_handle(priv->mp4.handle);
if (priv->decoder)
NeAACDecClose(priv->decoder);
free(priv);
@@ -219,7 +232,7 @@ static int mp4_close(struct input_plugin_data *ip_data)
priv = ip_data->private;

if (priv->mp4.handle)
- MP4Close(priv->mp4.handle);
+ mp4_close_handle(priv->mp4.handle);

if (priv->decoder)
NeAACDecClose(priv->decoder);
--
1.7.6
Gregory Petrosyan
2011-09-03 19:21:18 UTC
Permalink
Post by Johannes Weißl
The reason is that the MP4 API changed, but it only affects C, not C++,
since only default parameters were changed.
SVN entry that changed MP4Close(): r479
SVN entry that changed MP4Read(): r453
They only reliable check seems to be introduced/dropped #defines :-(
OK, hope it is reliable enough. Merged, thanks!

Gregory

Loading...