diff options
author | Alexis Ballier <aballier@gentoo.org> | 2013-02-15 19:17:27 +0000 |
---|---|---|
committer | Alexis Ballier <aballier@gentoo.org> | 2013-02-15 19:17:27 +0000 |
commit | eb723991de15ceaba9bbe97724415f5f7ea133d7 (patch) | |
tree | cbe607b6fd63ad26a9a5f3394ffedd3e59004786 /media-video/motion/files | |
parent | Stable for x86, wrt bug #457438 (diff) | |
download | gentoo-2-eb723991de15ceaba9bbe97724415f5f7ea133d7.tar.gz gentoo-2-eb723991de15ceaba9bbe97724415f5f7ea133d7.tar.bz2 gentoo-2-eb723991de15ceaba9bbe97724415f5f7ea133d7.zip |
Fix build with ffmpeg-1. Disable mpeg1 append code based on the ffurl API as mpeg1 is blacklisted with
new ffmpeg versions in this code anyway.
(Portage version: 2.2.0_alpha163/cvs/Linux x86_64, signed Manifest commit with key 160F534A)
Diffstat (limited to 'media-video/motion/files')
-rw-r--r-- | media-video/motion/files/ffmpeg1.patch | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/media-video/motion/files/ffmpeg1.patch b/media-video/motion/files/ffmpeg1.patch new file mode 100644 index 000000000000..c7d114b1470a --- /dev/null +++ b/media-video/motion/files/ffmpeg1.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) */ |