Discussion:
[PATCH 1/2] ffmpeg: fix compiler warning
Johannes Weißl
2011-01-20 09:49:22 UTC
Permalink
ffmpeg.c:275: warning: ISO C90 forbids mixed declarations and code
---
ffmpeg.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 3f2077d..69e3e0f 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -272,12 +272,14 @@ static int ffmpeg_fill_buffer(AVFormatContext *ic, AVCodecContext *cc, struct ff
len = avcodec_decode_audio2(cc, (int16_t *) output->buffer, &frame_size,
input->curr_pkt_buf, input->curr_pkt_size);
#else
- AVPacket avpkt;
- av_init_packet(&avpkt);
- avpkt.data = input->curr_pkt_buf;
- avpkt.size = input->curr_pkt_size;
- len = avcodec_decode_audio3(cc, (int16_t *) output->buffer, &frame_size, &avpkt);
- av_free_packet(&avpkt);
+ {
+ AVPacket avpkt;
+ av_init_packet(&avpkt);
+ avpkt.data = input->curr_pkt_buf;
+ avpkt.size = input->curr_pkt_size;
+ len = avcodec_decode_audio3(cc, (int16_t *) output->buffer, &frame_size, &avpkt);
+ av_free_packet(&avpkt);
+ }
#endif
if (len < 0) {
/* this is often reached when seeking, not sure why */
--
1.7.2.3
Johannes Weißl
2011-01-20 09:49:23 UTC
Permalink
old one was deprecated (2009-03-01 - r17682 - lavf 52.31.0)
---
comment.c | 3 +++
ffmpeg.c | 22 ++++++++++++++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/comment.c b/comment.c
index a0e1674..8d9e3a8 100644
--- a/comment.c
+++ b/comment.c
@@ -156,6 +156,9 @@ static struct {
{ "album artist", "albumartist" },
{ "disc", "discnumber" },
{ "track", "tracknumber" },
+ { "WM/Year", "date" },
+ { "WM/ArtistSortOrder", "artistsort" },
+ { "WM/AlbumArtistSortOrder", "albumartistsort" },
{ NULL, NULL }
};

diff --git a/ffmpeg.c b/ffmpeg.c
index 69e3e0f..a55aa44 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -35,7 +35,9 @@
#include "utils.h"
#include "config/ffmpeg.h"

-#define NUM_FFMPEG_KEYS 8
+#if (LIBAVFORMAT_VERSION_INT < ((52<<16)+(31<<8)+0))
+# define NUM_FFMPEG_KEYS 8
+#endif

struct ffmpeg_input {
AVPacket pkt;
@@ -347,6 +349,7 @@ static int ffmpeg_seek(struct input_plugin_data *ip_data, double offset)
}
}

+#if (LIBAVFORMAT_VERSION_INT < ((52<<16)+(31<<8)+0))
/* Return new i. */
static int set_comment(struct keyval *comment, int i, const char *key, const char *val)
{
@@ -357,12 +360,15 @@ static int set_comment(struct keyval *comment, int i, const char *key, const cha
comment[i].val = xstrdup(val);
return i + 1;
}
+#endif

static int ffmpeg_read_comments(struct input_plugin_data *ip_data, struct keyval **comments)
{
- char buff[16];
struct ffmpeg_private *priv = ip_data->private;
AVFormatContext *ic = priv->input_context;
+
+#if (LIBAVFORMAT_VERSION_INT < ((52<<16)+(31<<8)+0))
+ char buff[16];
int i = 0;

*comments = xnew0(struct keyval, NUM_FFMPEG_KEYS + 1);
@@ -381,6 +387,18 @@ static int ffmpeg_read_comments(struct input_plugin_data *ip_data, struct keyval
snprintf(buff, sizeof(buff), "%d", ic->track);
i = set_comment(*comments, i, "tracknumber", buff);
}
+#else
+ GROWING_KEYVALS(c);
+ AVMetadataTag *tag = NULL;
+
+ while ((tag = av_metadata_get(ic->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
+ if (tag && tag->value[0])
+ comments_add_const(&c, tag->key, tag->value);
+ }
+
+ keyvals_terminate(&c);
+ *comments = c.keyvals;
+#endif

return 0;
}
--
1.7.2.3
Gregory Petrosyan
2011-01-20 19:54:34 UTC
Permalink
Post by Johannes Weißl
old one was deprecated (2009-03-01 - r17682 - lavf 52.31.0)
Thanks, I've pushed both of these patches to master.

                Gregory

Loading...