From 81d8a4ec1c0e6610d7c95db8f4125f6c2779f7df Mon Sep 17 00:00:00 2001 From: Tomas Chvatal Date: Mon, 17 Jun 2013 18:41:51 +0000 Subject: Update ffmpeg patches to match upstream commits, add one more change to build with libav9. Wrt bug#443194. (Portage version: 2.2.0_alpha180/cvs/Linux x86_64, signed Manifest commit with key 8EEE3BE8) --- media-video/motion/ChangeLog | 9 +- media-video/motion/files/ffmpeg-1.patch | 95 +++++++++++++++++++ media-video/motion/files/ffmpeg-2.patch | 141 +++++++++++++++++++++++++++++ media-video/motion/files/ffmpeg-3.patch | 35 +++++++ media-video/motion/files/ffmpeg-4.patch | 68 ++++++++++++++ media-video/motion/files/ffmpeg-5.patch | 122 +++++++++++++++++++++++++ media-video/motion/files/ffmpeg08.patch | 53 ----------- media-video/motion/files/ffmpeg1.patch | 122 ------------------------- media-video/motion/files/libav-9.patch | 21 +++++ media-video/motion/motion-3.2.12-r2.ebuild | 9 +- 10 files changed, 496 insertions(+), 179 deletions(-) create mode 100644 media-video/motion/files/ffmpeg-1.patch create mode 100644 media-video/motion/files/ffmpeg-2.patch create mode 100644 media-video/motion/files/ffmpeg-3.patch create mode 100644 media-video/motion/files/ffmpeg-4.patch create mode 100644 media-video/motion/files/ffmpeg-5.patch delete mode 100644 media-video/motion/files/ffmpeg08.patch delete mode 100644 media-video/motion/files/ffmpeg1.patch create mode 100644 media-video/motion/files/libav-9.patch (limited to 'media-video/motion') diff --git a/media-video/motion/ChangeLog b/media-video/motion/ChangeLog index aa215deacfe8..8c09f64b68b8 100644 --- a/media-video/motion/ChangeLog +++ b/media-video/motion/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for media-video/motion # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/media-video/motion/ChangeLog,v 1.42 2013/02/15 19:17:27 aballier Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-video/motion/ChangeLog,v 1.43 2013/06/17 18:41:51 scarabeus Exp $ + + 17 Jun 2013; Tomáš Chvátal +files/ffmpeg-1.patch, + +files/ffmpeg-2.patch, +files/ffmpeg-3.patch, +files/ffmpeg-4.patch, + +files/ffmpeg-5.patch, +files/libav-9.patch, -files/ffmpeg08.patch, + -files/ffmpeg1.patch, motion-3.2.12-r2.ebuild: + Update ffmpeg patches to match upstream commits, add one more change to build + with libav9. Wrt bug#443194. 15 Feb 2013; Alexis Ballier +files/ffmpeg1.patch, motion-3.2.12-r2.ebuild: diff --git a/media-video/motion/files/ffmpeg-1.patch b/media-video/motion/files/ffmpeg-1.patch new file mode 100644 index 000000000000..56c83c474f09 --- /dev/null +++ b/media-video/motion/files/ffmpeg-1.patch @@ -0,0 +1,95 @@ +Description: Fix FFmpeg guess_format() deprecation warning +Author: Angel Carpintero +Origin: Upstream, https://github.com/sackmotion/motion/commit/527377#svn517 +Last-Update: 2012-02-12 + +--- a/ffmpeg.c ++++ b/ffmpeg.c +@@ -36,6 +36,11 @@ + # endif /* __GNUC__ */ + #endif /* LIBAVCODEC_BUILD > 4680 */ + ++#if defined LIBAVFORMAT_VERSION_MAJOR && defined LIBAVFORMAT_VERSION_MINOR ++#if LIBAVFORMAT_VERSION_MAJOR < 53 && LIBAVFORMAT_VERSION_MINOR < 45 ++ #define GUESS_NO_DEPRECATED ++#endif ++#endif + + #if LIBAVFORMAT_BUILD >= 4616 + /* The API for av_write_frame changed with FFmpeg version 0.4.9pre1. +@@ -258,7 +263,11 @@ + /* We use "mpeg1video" for raw mpeg1 format. Using "mpeg" would + * result in a muxed output file, which isn't appropriate here. + */ +- of = guess_format("mpeg1video", NULL, NULL); ++#ifdef GUESS_NO_DEPRECATED ++ of = guess_format("mpeg1video", NULL, NULL); ++#else ++ of = av_guess_format("mpeg1video", NULL, NULL); ++#endif + if (of) { + /* But we want the trailer to be correctly written. */ + of->write_trailer = mpeg1_write_trailer; +@@ -270,24 +279,44 @@ + #endif + } else if (strcmp(codec, "mpeg4") == 0) { + ext = ".avi"; +- of = guess_format("avi", NULL, NULL); ++#ifdef GUESS_NO_DEPRECATED ++ of = guess_format("mpeg1video", NULL, NULL); ++#else ++ of = av_guess_format("avi", NULL, NULL); ++#endif + } else if (strcmp(codec, "msmpeg4") == 0) { + ext = ".avi"; +- of = guess_format("avi", NULL, NULL); ++#ifdef GUESS_NO_DEPRECATED ++ of = guess_format("mpeg1video", NULL, NULL); ++#else ++ of = av_guess_format("avi", NULL, NULL); ++#endif + if (of) { + /* Manually override the codec id. */ + of->video_codec = CODEC_ID_MSMPEG4V2; + } + } else if (strcmp(codec, "swf") == 0) { + ext = ".swf"; +- of = guess_format("swf", NULL, NULL); ++#ifdef GUESS_NO_DEPRECATED ++ of = guess_format("mpeg1video", NULL, NULL); ++#else ++ of = av_guess_format("swf", NULL, NULL); ++#endif + } else if (strcmp(codec, "flv") == 0) { + ext = ".flv"; +- of = guess_format("flv", NULL, NULL); ++#ifdef GUESS_NO_DEPRECATED ++ of = guess_format("mpeg1video", NULL, NULL); ++#else ++ of = av_guess_format("flv", NULL, NULL); ++#endif + of->video_codec = CODEC_ID_FLV1; + } else if (strcmp(codec, "ffv1") == 0) { + ext = ".avi"; +- of = guess_format("avi", NULL, NULL); ++#ifdef GUESS_NO_DEPRECATED ++ of = guess_format("mpeg1video", NULL, NULL); ++#else ++ of = av_guess_format("avi", NULL, NULL); ++#endif + if (of) { + /* Use the FFMPEG Lossless Video codec (experimental!). + Requires strict_std_compliance to be <= -2 */ +@@ -295,7 +324,11 @@ + } + } else if (strcmp(codec, "mov") == 0) { + ext = ".mov"; +- of = guess_format("mov", NULL, NULL); ++#ifdef GUESS_NO_DEPRECATED ++ of = guess_format("mpeg1video", NULL, NULL); ++#else ++ of = av_guess_format("mov", NULL, NULL); ++#endif + } else { + motion_log(LOG_ERR, 0, "ffmpeg_video_codec option value %s is not supported", codec); + return NULL; diff --git a/media-video/motion/files/ffmpeg-2.patch b/media-video/motion/files/ffmpeg-2.patch new file mode 100644 index 000000000000..480819d9987d --- /dev/null +++ b/media-video/motion/files/ffmpeg-2.patch @@ -0,0 +1,141 @@ +Description: Improve detection of av_register_protocol() for ffmpeg. +Author: Angel Carpintero +Origin: Upstream, https://github.com/sackmotion/motion/commit/7aec4b#svn538 +Last-Update: 2012-02-12 + +--- a/configure.in ++++ b/configure.in +@@ -316,7 +316,7 @@ + # + else if test "${FFMPEG_DIR}" = "yes"; then + # AUTODETECT STATIC/SHARED LIB +- AC_MSG_CHECKING(for ffmpeg autodetecting) ++ AC_MSG_CHECKING(for ffmpeg autodetecting libraries) + + if test -f /usr/lib64/libavcodec.a -o -f /usr/lib64/libavcodec.so && test -f /usr/lib64/libavformat.a -o -f /usr/lib64/libavformat.so ; then + AC_MSG_RESULT(found in /usr/lib64) +@@ -347,7 +347,7 @@ + echo "" + fi + else +- AC_MSG_CHECKING(for ffmpeg in -> [${FFMPEG_DIR}] <-) ++ AC_MSG_CHECKING(for ffmpeg libraries in -> [${FFMPEG_DIR}] <-) + if test -f ${FFMPEG_DIR}/lib/libavcodec.a -o -f ${FFMPEG_DIR}/lib/libavcodec.so && test -f ${FFMPEG_DIR}/lib/libavformat.a -o -f ${FFMPEG_DIR}/lib/libavformat.so ; then + AC_MSG_RESULT(found) + FFMPEG_OK="found" +@@ -392,9 +392,11 @@ + elif test -f ${FFMPEG_DIR}/include/libavformat/avformat.h; then + AC_MSG_RESULT(found ${FFMPEG_DIR}/include/libavformat/avformat.h) + FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include -DFFMPEG_NEW_INCLUDES" ++ AVFORMAT="-I${FFMPEG_DIR}/include/libavformat" + elif test -f ${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h; then + AC_MSG_RESULT(found ${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h) + FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include/ffmpeg -DFFMPEG_NEW_INCLUDES" ++ AVFORMAT="-I${FFMPEG_DIR}/include/ffmpeg/libavformat" + else + AC_MSG_RESULT(not found) + FFMPEG_OK="no_found" +@@ -423,9 +425,11 @@ + AC_MSG_CHECKING([file_protocol is defined in ffmpeg ?]) + saved_CFLAGS=$CFLAGS + saved_LIBS=$LIBS +- CFLAGS="${FFMPEG_CFLAGS}" ++ ++ ++ CFLAGS="${FFMPEG_CFLAGS} ${AVFORMAT}" + LIBS="$TEMP_LIBS" +- ++ + AC_COMPILE_IFELSE( + [ + #include +@@ -442,7 +446,35 @@ + ] + ) + CFLAGS=$saved_CFLAGS +- LIBS=$saved_LIBS ++ LIBS=$saved_LIBS ++ ++ AC_MSG_CHECKING([av_register_protocol is defined in ffmpeg ?]) ++ saved_CFLAGS=$CFLAGS ++ saved_LIBS=$LIBS ++ CFLAGS="${FFMPEG_CFLAGS} ${AVFORMAT}" ++ LIBS="$TEMP_LIBS" ++ ++ AC_COMPILE_IFELSE( ++ [ ++ #include ++ URLProtocol test_file_protocol; ++ int main(void){ ++ av_register_protocol(&test_file_protocol); ++ return 0; ++ } ++ ], ++ [ ++ AC_MSG_RESULT(yes) ++ TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_FFMPEG_AV_REGISTER_PROTOCOL" ++ ], ++ [ ++ AC_MSG_RESULT(no) ++ ] ++ ) ++ ++ CFLAGS=$saved_CFLAGS ++ LIBS=$saved_LIBS ++ + fi + fi + fi +--- a/ffmpeg.c ++++ b/ffmpeg.c +@@ -232,11 +232,11 @@ + mpeg1_file_protocol.url_seek = file_protocol.url_seek; + mpeg1_file_protocol.url_close = file_protocol.url_close; + +- /* Register the append file protocol. */ +-#if LIBAVFORMAT_BUILD >= (52<<16 | 31<<8) ++/* Register the append file protocol. */ ++#ifdef HAVE_FFMPEG_AV_REGISTER_PROTOCOL + av_register_protocol(&mpeg1_file_protocol); + #else +- register_protocol(&mpeg1_file_protocol); ++ av_register_protocol2(&mpeg1_file_protocol, sizeof(mpeg1_file_protocol)); + #endif + } + +@@ -410,7 +410,11 @@ + + ffmpeg->c = c = AVSTREAM_CODEC_PTR(ffmpeg->video_st); + c->codec_id = ffmpeg->oc->oformat->video_codec; ++#if LIBAVCODEC_VERSION_MAJOR < 53 + c->codec_type = CODEC_TYPE_VIDEO; ++#else ++ c->codec_type = AVMEDIA_TYPE_VIDEO; ++#endif + is_mpeg1 = c->codec_id == CODEC_ID_MPEG1VIDEO; + + if (strcmp(ffmpeg_video_codec, "ffv1") == 0) +@@ -679,7 +683,11 @@ + if (ffmpeg->oc->oformat->flags & AVFMT_RAWPICTURE) { + /* raw video case. The API will change slightly in the near future for that */ + #ifdef FFMPEG_AVWRITEFRAME_NEWAPI ++#if LIBAVCODEC_VERSION_MAJOR < 53 + pkt.flags |= PKT_FLAG_KEY; ++#else ++ pkt.flags |= AV_PKT_FLAG_KEY; ++#endif + pkt.data = (uint8_t *)pic; + pkt.size = sizeof(AVPicture); + ret = av_write_frame(ffmpeg->oc, &pkt); +@@ -700,7 +708,11 @@ + #ifdef FFMPEG_AVWRITEFRAME_NEWAPI + pkt.pts = AVSTREAM_CODEC_PTR(ffmpeg->video_st)->coded_frame->pts; + if (AVSTREAM_CODEC_PTR(ffmpeg->video_st)->coded_frame->key_frame) { ++#if LIBAVCODEC_VERSION_MAJOR < 53 + pkt.flags |= PKT_FLAG_KEY; ++#else ++ pkt.flags |= AV_PKT_FLAG_KEY; ++#endif + } + pkt.data = ffmpeg->video_outbuf; + pkt.size = out_size; diff --git a/media-video/motion/files/ffmpeg-3.patch b/media-video/motion/files/ffmpeg-3.patch new file mode 100644 index 000000000000..1d6be1959229 --- /dev/null +++ b/media-video/motion/files/ffmpeg-3.patch @@ -0,0 +1,35 @@ +Description: Fix avoid crash producing MPEG4 with newer FFmpeg. +Author: Angel Carpintero +Origin: Upstream, https://github.com/sackmotion/motion/commit/734155#svn539 +Bug: http://www.lavrsen.dk/foswiki/bin/view/Motion/BugReport2011x10x05x071936 +Last-Update: 2012-02-12 + +--- a/configure.in ++++ b/configure.in +@@ -1099,6 +1099,10 @@ + LIBS="${TEMP_LIBS}" + LDFLAGS="${TEMP_LDFLAGS}" + ++ ++AC_CHECK_FUNC(avformat_alloc_context, AC_DEFINE([have_avformat_alloc_context],1,[Define to 1 if you have avformat_alloc_context support])) ++AC_CHECK_FUNC(av_avformat_alloc_context, AC_DEFINE([have_av_avformat_alloc_context],1,[Define to 1 if you have av_avformat_alloc_context support])) ++ + # + # Add the right exec path for rc scripts + # +--- a/ffmpeg.c ++++ b/ffmpeg.c +@@ -373,7 +373,13 @@ + snprintf(ffmpeg->codec, sizeof(ffmpeg->codec), "%s", ffmpeg_video_codec); + + /* allocation the output media context */ ++#ifdef have_avformat_alloc_context ++ ffmpeg->oc = avformat_alloc_context(); ++#elif defined have_av_avformat_alloc_context ++ ffmpeg->oc = av_alloc_format_context(); ++#else + ffmpeg->oc = av_mallocz(sizeof(AVFormatContext)); ++#endif + + if (!ffmpeg->oc) { + motion_log(LOG_ERR, 1, "Memory error while allocating output media context"); diff --git a/media-video/motion/files/ffmpeg-4.patch b/media-video/motion/files/ffmpeg-4.patch new file mode 100644 index 000000000000..05abd9e28410 --- /dev/null +++ b/media-video/motion/files/ffmpeg-4.patch @@ -0,0 +1,68 @@ +Description: Improve av_register_protocol2()/av_register_protocol() detection +Author: Angel Carpintero +Origin: Upstream, https://github.com/sackmotion/motion/commit/5dd9ed#svn540#svn540 +Last-Update: 2012-02-12 + +--- a/configure.in ++++ b/configure.in +@@ -448,33 +448,6 @@ + CFLAGS=$saved_CFLAGS + LIBS=$saved_LIBS + +- AC_MSG_CHECKING([av_register_protocol is defined in ffmpeg ?]) +- saved_CFLAGS=$CFLAGS +- saved_LIBS=$LIBS +- CFLAGS="${FFMPEG_CFLAGS} ${AVFORMAT}" +- LIBS="$TEMP_LIBS" +- +- AC_COMPILE_IFELSE( +- [ +- #include +- URLProtocol test_file_protocol; +- int main(void){ +- av_register_protocol(&test_file_protocol); +- return 0; +- } +- ], +- [ +- AC_MSG_RESULT(yes) +- TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_FFMPEG_AV_REGISTER_PROTOCOL" +- ], +- [ +- AC_MSG_RESULT(no) +- ] +- ) +- +- CFLAGS=$saved_CFLAGS +- LIBS=$saved_LIBS +- + fi + fi + fi +@@ -1102,6 +1075,9 @@ + + AC_CHECK_FUNC(avformat_alloc_context, AC_DEFINE([have_avformat_alloc_context],1,[Define to 1 if you have avformat_alloc_context support])) + AC_CHECK_FUNC(av_avformat_alloc_context, AC_DEFINE([have_av_avformat_alloc_context],1,[Define to 1 if you have av_avformat_alloc_context support])) ++AC_CHECK_FUNC(av_register_protocol2, AC_DEFINE([have_av_register_protocol2],1,[Define to 1 if you have av_register_protocol2 support])) ++AC_CHECK_FUNC(av_register_protocol, AC_DEFINE([have_av_register_protocol],1,[Define to 1 if you have av_register_protocol support])) ++ + + # + # Add the right exec path for rc scripts +--- a/ffmpeg.c ++++ b/ffmpeg.c +@@ -233,10 +233,12 @@ + mpeg1_file_protocol.url_close = file_protocol.url_close; + + /* Register the append file protocol. */ +-#ifdef HAVE_FFMPEG_AV_REGISTER_PROTOCOL ++#ifdef have_av_register_protocol2 ++ av_register_protocol2(&mpeg1_file_protocol, sizeof(mpeg1_file_protocol)); ++#elif defined have_av_register_protocol + av_register_protocol(&mpeg1_file_protocol); + #else +- av_register_protocol2(&mpeg1_file_protocol, sizeof(mpeg1_file_protocol)); ++# warning av_register_protocolXXX missing + #endif + } + diff --git a/media-video/motion/files/ffmpeg-5.patch b/media-video/motion/files/ffmpeg-5.patch new file mode 100644 index 000000000000..c7d114b1470a --- /dev/null +++ b/media-video/motion/files/ffmpeg-5.patch @@ -0,0 +1,122 @@ +Convert to avio API. +Disable mpeg1 append code based or the ffurl API as mpeg1 is blacklisted with +new ffmpeg versions in this code anyway. +Fix build with ffmpeg-1 + +Index: motion-3.2.12/ffmpeg.c +=================================================================== +--- motion-3.2.12.orig/ffmpeg.c ++++ motion-3.2.12/ffmpeg.c +@@ -73,6 +73,7 @@ AVFrame *ffmpeg_prepare_frame(struct ffm + /* This is the trailer used to end mpeg1 videos. */ + static unsigned char mpeg1_trailer[] = {0x00, 0x00, 0x01, 0xb7}; + ++#ifndef FFMPEG_NO_NONSTD_MPEG1 + /* Append version of the file open function used in libavformat when opening + * an ordinary file. The original file open function truncates an existing + * file, but this version appends to it instead. +@@ -118,6 +119,7 @@ URLProtocol mpeg1_file_protocol = { + .url_open = file_open_append + }; + ++#endif + + #ifdef HAVE_FFMPEG_NEW + +@@ -132,6 +134,7 @@ URLProtocol mpeg1_file_protocol = { + #include "avstring.h" + #endif + ++#ifndef FFMPEG_NO_NONSTD_MPEG1 + static int file_open(URLContext *h, const char *filename, int flags) + { + int access_flags, fd; +@@ -195,6 +198,7 @@ URLProtocol file_protocol = { + }; + + #endif ++#endif + + + /* We set AVOutputFormat->write_trailer to this function for mpeg1. That way, +@@ -203,8 +207,8 @@ URLProtocol file_protocol = { + static int mpeg1_write_trailer(AVFormatContext *s) + { + #if LIBAVFORMAT_BUILD >= (52<<16) +- put_buffer(s->pb, mpeg1_trailer, 4); +- put_flush_packet(s->pb); ++ avio_write(s->pb, mpeg1_trailer, 4); ++ avio_flush(s->pb); + #else + put_buffer(&s->pb, mpeg1_trailer, 4); + put_flush_packet(&s->pb); +@@ -226,6 +230,7 @@ void ffmpeg_init() + /* Copy the functions to use for the append file protocol from the standard + * file protocol. + */ ++#ifndef FFMPEG_NO_NONSTD_MPEG1 + mpeg1_file_protocol.url_read = file_protocol.url_read; + mpeg1_file_protocol.url_write = file_protocol.url_write; + mpeg1_file_protocol.url_seek = file_protocol.url_seek; +@@ -239,6 +244,7 @@ void ffmpeg_init() + #else + register_protocol(&mpeg1_file_protocol); + #endif ++#endif + } + + /* Obtains the output format used for the specified codec. For mpeg4 codecs, +@@ -422,13 +428,6 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_ + c->flags |= CODEC_FLAG_GLOBAL_HEADER; + } + +- /* set the output parameters (must be done even if no parameters). */ +- if (av_set_parameters(ffmpeg->oc, NULL) < 0) { +- motion_log(LOG_ERR, 0, "ffmpeg av_set_parameters error: Invalid output format parameters"); +- ffmpeg_cleanups(ffmpeg); +- return NULL; +- } +- + /* Dump the format settings. This shows how the various streams relate to each other */ + //dump_format(ffmpeg->oc, 0, filename, 1); + +@@ -504,7 +503,7 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_ + snprintf(file_proto, sizeof(file_proto), "%s", filename); + + +- if (url_fopen(&ffmpeg->oc->pb, file_proto, URL_WRONLY) < 0) { ++ if (avio_open(&ffmpeg->oc->pb, file_proto, AVIO_FLAG_WRITE) < 0) { + /* path did not exist? */ + if (errno == ENOENT) { + /* create path for file (don't use file_proto)... */ +@@ -514,7 +513,7 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_ + } + + /* and retry opening the file (use file_proto) */ +- if (url_fopen(&ffmpeg->oc->pb, file_proto, URL_WRONLY) < 0) { ++ if (avio_open(&ffmpeg->oc->pb, file_proto, AVIO_FLAG_WRITE) < 0) { + motion_log(LOG_ERR, 1, "url_fopen - error opening file %s",filename); + ffmpeg_cleanups(ffmpeg); + return NULL; +@@ -535,7 +534,11 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_ + } + + /* write the stream header, if any */ +- av_write_header(ffmpeg->oc); ++ if(avformat_write_header(ffmpeg->oc, NULL) < 0) { ++ motion_log(LOG_ERR, 1, "Error while writing header for %s", filename); ++ ffmpeg_cleanups(ffmpeg); ++ return NULL; ++ } + + return ffmpeg; + } +@@ -602,7 +605,7 @@ void ffmpeg_close(struct ffmpeg *ffmpeg) + if (!(ffmpeg->oc->oformat->flags & AVFMT_NOFILE)) { + /* close the output file */ + #if LIBAVFORMAT_BUILD >= (52<<16) +- url_fclose(ffmpeg->oc->pb); ++ avio_close(ffmpeg->oc->pb); + #else + url_fclose(&ffmpeg->oc->pb); + #endif /* LIBAVFORMAT_BUILD >= (52<<16) */ diff --git a/media-video/motion/files/ffmpeg08.patch b/media-video/motion/files/ffmpeg08.patch deleted file mode 100644 index f6743e36fad4..000000000000 --- a/media-video/motion/files/ffmpeg08.patch +++ /dev/null @@ -1,53 +0,0 @@ -Index: motion-3.2.12/ffmpeg.c -=================================================================== ---- motion-3.2.12.orig/ffmpeg.c -+++ motion-3.2.12/ffmpeg.c -@@ -60,6 +60,10 @@ - */ - #define APPEND_PROTO "appfile" - -+#ifndef guess_format -+#define guess_format av_guess_format -+#endif -+ - /* Some forward-declarations. */ - void ffmpeg_put_frame(struct ffmpeg *, AVFrame *); - void ffmpeg_cleanups(struct ffmpeg *); -@@ -228,7 +232,9 @@ void ffmpeg_init() - mpeg1_file_protocol.url_close = file_protocol.url_close; - - /* Register the append file protocol. */ --#if LIBAVFORMAT_BUILD >= (52<<16 | 31<<8) -+#if LIBAVFORMAT_BUILD >= (53<<16 ) -+ av_register_protocol2(&mpeg1_file_protocol, sizeof(mpeg1_file_protocol)); -+#elif LIBAVFORMAT_BUILD >= (52<<16 | 31<<8) - av_register_protocol(&mpeg1_file_protocol); - #else - register_protocol(&mpeg1_file_protocol); -@@ -377,7 +383,7 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_ - - ffmpeg->c = c = AVSTREAM_CODEC_PTR(ffmpeg->video_st); - c->codec_id = ffmpeg->oc->oformat->video_codec; -- c->codec_type = CODEC_TYPE_VIDEO; -+ c->codec_type = AVMEDIA_TYPE_VIDEO; - is_mpeg1 = c->codec_id == CODEC_ID_MPEG1VIDEO; - - if (strcmp(ffmpeg_video_codec, "ffv1") == 0) -@@ -646,7 +652,7 @@ void ffmpeg_put_frame(struct ffmpeg *ffm - if (ffmpeg->oc->oformat->flags & AVFMT_RAWPICTURE) { - /* raw video case. The API will change slightly in the near future for that */ - #ifdef FFMPEG_AVWRITEFRAME_NEWAPI -- pkt.flags |= PKT_FLAG_KEY; -+ pkt.flags |= AV_PKT_FLAG_KEY; - pkt.data = (uint8_t *)pic; - pkt.size = sizeof(AVPicture); - ret = av_write_frame(ffmpeg->oc, &pkt); -@@ -667,7 +673,7 @@ void ffmpeg_put_frame(struct ffmpeg *ffm - #ifdef FFMPEG_AVWRITEFRAME_NEWAPI - pkt.pts = AVSTREAM_CODEC_PTR(ffmpeg->video_st)->coded_frame->pts; - if (AVSTREAM_CODEC_PTR(ffmpeg->video_st)->coded_frame->key_frame) { -- pkt.flags |= PKT_FLAG_KEY; -+ pkt.flags |= AV_PKT_FLAG_KEY; - } - pkt.data = ffmpeg->video_outbuf; - pkt.size = out_size; diff --git a/media-video/motion/files/ffmpeg1.patch b/media-video/motion/files/ffmpeg1.patch deleted file mode 100644 index c7d114b1470a..000000000000 --- a/media-video/motion/files/ffmpeg1.patch +++ /dev/null @@ -1,122 +0,0 @@ -Convert to avio API. -Disable mpeg1 append code based or the ffurl API as mpeg1 is blacklisted with -new ffmpeg versions in this code anyway. -Fix build with ffmpeg-1 - -Index: motion-3.2.12/ffmpeg.c -=================================================================== ---- motion-3.2.12.orig/ffmpeg.c -+++ motion-3.2.12/ffmpeg.c -@@ -73,6 +73,7 @@ AVFrame *ffmpeg_prepare_frame(struct ffm - /* This is the trailer used to end mpeg1 videos. */ - static unsigned char mpeg1_trailer[] = {0x00, 0x00, 0x01, 0xb7}; - -+#ifndef FFMPEG_NO_NONSTD_MPEG1 - /* Append version of the file open function used in libavformat when opening - * an ordinary file. The original file open function truncates an existing - * file, but this version appends to it instead. -@@ -118,6 +119,7 @@ URLProtocol mpeg1_file_protocol = { - .url_open = file_open_append - }; - -+#endif - - #ifdef HAVE_FFMPEG_NEW - -@@ -132,6 +134,7 @@ URLProtocol mpeg1_file_protocol = { - #include "avstring.h" - #endif - -+#ifndef FFMPEG_NO_NONSTD_MPEG1 - static int file_open(URLContext *h, const char *filename, int flags) - { - int access_flags, fd; -@@ -195,6 +198,7 @@ URLProtocol file_protocol = { - }; - - #endif -+#endif - - - /* We set AVOutputFormat->write_trailer to this function for mpeg1. That way, -@@ -203,8 +207,8 @@ URLProtocol file_protocol = { - static int mpeg1_write_trailer(AVFormatContext *s) - { - #if LIBAVFORMAT_BUILD >= (52<<16) -- put_buffer(s->pb, mpeg1_trailer, 4); -- put_flush_packet(s->pb); -+ avio_write(s->pb, mpeg1_trailer, 4); -+ avio_flush(s->pb); - #else - put_buffer(&s->pb, mpeg1_trailer, 4); - put_flush_packet(&s->pb); -@@ -226,6 +230,7 @@ void ffmpeg_init() - /* Copy the functions to use for the append file protocol from the standard - * file protocol. - */ -+#ifndef FFMPEG_NO_NONSTD_MPEG1 - mpeg1_file_protocol.url_read = file_protocol.url_read; - mpeg1_file_protocol.url_write = file_protocol.url_write; - mpeg1_file_protocol.url_seek = file_protocol.url_seek; -@@ -239,6 +244,7 @@ void ffmpeg_init() - #else - register_protocol(&mpeg1_file_protocol); - #endif -+#endif - } - - /* Obtains the output format used for the specified codec. For mpeg4 codecs, -@@ -422,13 +428,6 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_ - c->flags |= CODEC_FLAG_GLOBAL_HEADER; - } - -- /* set the output parameters (must be done even if no parameters). */ -- if (av_set_parameters(ffmpeg->oc, NULL) < 0) { -- motion_log(LOG_ERR, 0, "ffmpeg av_set_parameters error: Invalid output format parameters"); -- ffmpeg_cleanups(ffmpeg); -- return NULL; -- } -- - /* Dump the format settings. This shows how the various streams relate to each other */ - //dump_format(ffmpeg->oc, 0, filename, 1); - -@@ -504,7 +503,7 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_ - snprintf(file_proto, sizeof(file_proto), "%s", filename); - - -- if (url_fopen(&ffmpeg->oc->pb, file_proto, URL_WRONLY) < 0) { -+ if (avio_open(&ffmpeg->oc->pb, file_proto, AVIO_FLAG_WRITE) < 0) { - /* path did not exist? */ - if (errno == ENOENT) { - /* create path for file (don't use file_proto)... */ -@@ -514,7 +513,7 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_ - } - - /* and retry opening the file (use file_proto) */ -- if (url_fopen(&ffmpeg->oc->pb, file_proto, URL_WRONLY) < 0) { -+ if (avio_open(&ffmpeg->oc->pb, file_proto, AVIO_FLAG_WRITE) < 0) { - motion_log(LOG_ERR, 1, "url_fopen - error opening file %s",filename); - ffmpeg_cleanups(ffmpeg); - return NULL; -@@ -535,7 +534,11 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_ - } - - /* write the stream header, if any */ -- av_write_header(ffmpeg->oc); -+ if(avformat_write_header(ffmpeg->oc, NULL) < 0) { -+ motion_log(LOG_ERR, 1, "Error while writing header for %s", filename); -+ ffmpeg_cleanups(ffmpeg); -+ return NULL; -+ } - - return ffmpeg; - } -@@ -602,7 +605,7 @@ void ffmpeg_close(struct ffmpeg *ffmpeg) - if (!(ffmpeg->oc->oformat->flags & AVFMT_NOFILE)) { - /* close the output file */ - #if LIBAVFORMAT_BUILD >= (52<<16) -- url_fclose(ffmpeg->oc->pb); -+ avio_close(ffmpeg->oc->pb); - #else - url_fclose(&ffmpeg->oc->pb); - #endif /* LIBAVFORMAT_BUILD >= (52<<16) */ diff --git a/media-video/motion/files/libav-9.patch b/media-video/motion/files/libav-9.patch new file mode 100644 index 000000000000..39b4059df0bd --- /dev/null +++ b/media-video/motion/files/libav-9.patch @@ -0,0 +1,21 @@ +diff -urN motion-3.2.12.old/ffmpeg.c motion-3.2.12/ffmpeg.c +--- motion-3.2.12.old/ffmpeg.c 2013-06-17 20:36:45.355529743 +0200 ++++ motion-3.2.12/ffmpeg.c 2013-06-17 20:35:41.868532001 +0200 +@@ -409,7 +409,7 @@ + ffmpeg->video_st = NULL; + + if (ffmpeg->oc->oformat->video_codec != CODEC_ID_NONE) { +- ffmpeg->video_st = av_new_stream(ffmpeg->oc, 0); ++ ffmpeg->video_st = avformat_new_stream(ffmpeg->oc, 0); + if (!ffmpeg->video_st) { + motion_log(LOG_ERR, 1, "av_new_stream - could not alloc stream"); + ffmpeg_cleanups(ffmpeg); +@@ -487,7 +487,7 @@ + pthread_mutex_lock(&global_lock); + + /* open the codec */ +- if (avcodec_open(c, codec) < 0) { ++ if (avcodec_open2(c, codec, NULL) < 0) { + /* Release the lock. */ + pthread_mutex_unlock(&global_lock); + motion_log(LOG_ERR, 1, "avcodec_open - could not open codec"); diff --git a/media-video/motion/motion-3.2.12-r2.ebuild b/media-video/motion/motion-3.2.12-r2.ebuild index 3ae75b05b750..ac5398c73b53 100644 --- a/media-video/motion/motion-3.2.12-r2.ebuild +++ b/media-video/motion/motion-3.2.12-r2.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/media-video/motion/motion-3.2.12-r2.ebuild,v 1.4 2013/02/15 19:17:27 aballier Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-video/motion/motion-3.2.12-r2.ebuild,v 1.5 2013/06/17 18:41:51 scarabeus Exp $ EAPI=4 inherit eutils user @@ -30,8 +30,11 @@ pkg_setup() { src_prepare() { epatch \ - "${FILESDIR}"/ffmpeg08.patch \ - "${FILESDIR}"/ffmpeg1.patch \ + "${FILESDIR}"/ffmpeg-1.patch \ + "${FILESDIR}"/ffmpeg-2.patch \ + "${FILESDIR}"/ffmpeg-3.patch \ + "${FILESDIR}"/ffmpeg-4.patch \ + "${FILESDIR}"/ffmpeg-5.patch \ "${FILESDIR}"/${P}-workaround-v4l1_deprecation.patch } -- cgit v1.2.3-65-gdbad