summaryrefslogtreecommitdiff
blob: 1d6be19592292762c2d3da63f40c553217cf56ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Description: Fix avoid crash producing MPEG4 with newer FFmpeg.
Author: Angel Carpintero <motiondevelop@gmail.com>
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");