-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2012-06-11 14:47, IOhannes m zmoelnig wrote: > On 2012-06-08 23:13, Burkhard Plaum wrote: >
and i found a small issue when trying to compile gmerlin-encoders with the ffmpeg/libav implementation found in debian. #1 is that plugins/ffmpeg/ffmpeg_common.c tries to access the struct member "samples_written" in an ENCODE_AUDIO2 protected zone, whereas the struct member is only defined in an ENCODE_VIDEO2 protected zone. changing the ifdef in plugins/ffmpeg/ffmpeg_common.h to ENCODE_AUDIO2 makes it compile. (see attached encode_audio.patch) #2 before finding out that the actual build fix is so simple, i noticed that a lot of code is protected with liberal use of version checks like "#if LIBAVCODEC_VERSION_MAJOR >= 54". it seems that these checks are mostly too strict, as Debian does not come yet with such versions but still provides the protected symbols. the attached libav.patch tries to use more fine-grained version numbers. the numbers i used come from what i found on the web, and i only tested, whether the thing compiles :-) in any case, i ended up using only the encode_audio.patch for the debian pacakge. fgasmdr IOhannes -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk/WEwoACgkQkX2Xpv6ydvTqtQCgmOEb2Arkx64xuuCnmWr6Hrjb 7dsAn19gCDyT8JHLgsTNMytnxRXqYIuO =NysR -----END PGP SIGNATURE-----
Author: IOhannes m zmölnig Description: 'samples_written' is needed when encoding AUDIO2 rather than VIDEO2 --- gmerlin-encoders.orig/plugins/ffmpeg/ffmpeg_common.h +++ gmerlin-encoders/plugins/ffmpeg/ffmpeg_common.h @@ -123,7 +123,7 @@ AVDictionary * options; #endif -#if ENCODE_VIDEO2 +#if ENCODE_AUDIO2 int64_t samples_written; #endif
Author: IOhannes m zmölnig
Description: more fine-grained version-checks for ffmpeg-features.
--- gmerlin-encoders.orig/plugins/ffmpeg/codecs.c
+++ gmerlin-encoders/plugins/ffmpeg/codecs.c
@@ -870,7 +870,8 @@
found = 1; \
}
-#if LIBAVCODEC_VERSION_MAJOR >= 54
+#ifdef USE_AV_DICTIONARY
+
#define PARAM_DICT_STRING(n, ffmpeg_key) \
if(!strcmp(n, name)) \
{ \
@@ -901,7 +902,7 @@
void
bg_ffmpeg_set_codec_parameter(AVCodecContext * ctx,
-#if LIBAVCODEC_VERSION_MAJOR >= 54
+#ifdef USE_AV_DICTIONARY
AVDictionary ** options,
#endif
@@ -1009,7 +1010,7 @@
PARAM_FLAG2("ff_flag2_fast",CODEC_FLAG2_FAST);
PARAM_FLAG2("ff_flag2_strict_gop",CODEC_FLAG2_STRICT_GOP);
-#if LIBAVCODEC_VERSION_MAJOR >= 54
+#ifdef USE_AV_DICTIONARY
PARAM_DICT_STRING("libx264_preset", "preset");
PARAM_DICT_STRING("libx264_tune", "tune");
PARAM_DICT_FLOAT("libx264_crf", "crf");
--- gmerlin-encoders.orig/plugins/ffmpeg/ffmpeg_common.c
+++ gmerlin-encoders/plugins/ffmpeg/ffmpeg_common.c
@@ -537,7 +537,7 @@
}
else
bg_ffmpeg_set_codec_parameter(st->stream->codec,
-#if LIBAVCODEC_VERSION_MAJOR >= 54
+#ifdef USE_AV_DICTIONARY
&st->options,
#endif
name, v);
@@ -585,7 +585,7 @@
}
else
bg_ffmpeg_set_codec_parameter(st->stream->codec,
-#if LIBAVCODEC_VERSION_MAJOR >= 54
+#ifdef USE_AV_DICTIONARY
&st->options,
#endif
name, v);
@@ -635,7 +635,7 @@
if(priv->ctx->oformat->flags & AVFMT_GLOBALHEADER)
st->stream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
-#if LIBAVCODEC_VERSION_MAJOR < 54
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53,7,1)
if(avcodec_open(st->stream->codec, codec) < 0)
{
bg_log(BG_LOG_ERROR, LOG_DOMAIN, "avcodec_open failed for audio");
@@ -760,7 +760,7 @@
if(priv->ctx->oformat->flags & AVFMT_GLOBALHEADER)
st->stream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
-#if LIBAVCODEC_VERSION_MAJOR < 54
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53,7,1)
if(avcodec_open(st->stream->codec, codec) < 0)
{
bg_log(BG_LOG_ERROR, LOG_DOMAIN, "avcodec_open failed for video");
@@ -789,7 +789,7 @@
int i;
priv = data;
-#if LIBAVFORMAT_VERSION_MAJOR < 54
+#if LIBAVFORMAT_VERSION_MAJOR < 52
/* set the output parameters (must be done even if no
parameters). */
if(av_set_parameters(priv->ctx, NULL) < 0)
@@ -820,7 +820,7 @@
return 0;
#endif
-#if LIBAVFORMAT_VERSION_MAJOR < 54
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53,2,0)
if(av_write_header(priv->ctx))
{
bg_log(BG_LOG_ERROR, LOG_DOMAIN, "av_write_header failed");
@@ -1042,7 +1042,7 @@
st->buffer, st->buffer_alloc,
frame);
if(bytes_encoded < 0)
- return;
+ return -1;
else if(bytes_encoded > 0)
got_packet = 1;
#endif
@@ -1134,7 +1134,7 @@
av_init_packet(&pkt);
- fprintf(stderr, "Write subtitle 1 %ld -> %ld\n", start, start + duration);
+ fprintf(stderr, "Write subtitle 1 %ld -> %ld\n", (long int)start, (long int)(start + duration));
fprintf(stderr, "%s\n", text);
pkt.data = (uint8_t*)bg_strdup(NULL, text);
@@ -1147,8 +1147,8 @@
st->stream->codec->time_base,
st->stream->time_base) + st->pts_offset;
- fprintf(stderr, "Write subtitle 2 %ld -> %ld\n", pkt.pts,
- pkt.pts + pkt.duration);
+ fprintf(stderr, "Write subtitle 2 %ld -> %ld\n", (long int)pkt.pts,
+ (long int)(pkt.pts + pkt.duration));
pkt.convergence_duration = pkt.duration;
pkt.dts = pkt.pts;
--- gmerlin-encoders.orig/plugins/ffmpeg/ffmpeg_common.h
+++ gmerlin-encoders/plugins/ffmpeg/ffmpeg_common.h
@@ -52,6 +52,12 @@
#define ENCODE_AUDIO 1
#endif
+#if LIBAVFORMAT_VERSION_INT >= ((52<<16)+(43<<8)+0)
+#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(8<<8)+0)
+# define USE_AV_DICTIONARY
+#endif
+#endif
+
typedef struct
{
@@ -95,7 +101,7 @@
void
bg_ffmpeg_set_codec_parameter(AVCodecContext * ctx,
-#if LIBAVCODEC_VERSION_MAJOR >= 54
+#ifdef USE_AV_DICTIONARY
AVDictionary ** options,
#endif
const char * name,
@@ -119,11 +125,11 @@
int initialized;
-#if LIBAVCODEC_VERSION_MAJOR >= 54
+#ifdef USE_AV_DICTIONARY
AVDictionary * options;
#endif
-#if ENCODE_VIDEO2
+#if ENCODE_AUDIO2
int64_t samples_written;
#endif
@@ -151,7 +157,7 @@
int64_t frames_written;
-#if LIBAVCODEC_VERSION_MAJOR >= 54
+#ifdef USE_AV_DICTIONARY
AVDictionary * options;
#endif
const gavl_compression_info_t * ci;
smime.p7s
Description: S/MIME Cryptographic Signature
------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________ Gmerlin-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gmerlin-general
