Bug#803843: motion: FTBFS with FFmpeg 2.9

2016-01-19 Thread Ximin Luo
On 08/01/16 00:26, Andreas Cadhalpun wrote:
> So please upload a fixed version of motion now.
> 

Hi Andreas, I'm testing this now against 2.8, will upload as soon as I confirm 
that everything still works.

Do you also have a APT repo somewhere I can use to test against provisional 
ffmpeg 2.9 / 3.0 packages?

X

-- 
GPG: 4096R/1318EFAC5FBBDBCE
git://github.com/infinity0/pubkeys.git



Bug#803843: motion: FTBFS with FFmpeg 2.9

2016-01-19 Thread Andreas Cadhalpun
Hi Ximin,

On 19.01.2016 20:43, Ximin Luo wrote:
> I'm testing this now against 2.8, will upload as soon as I confirm that 
> everything still works.

Thanks!

> Do you also have a APT repo somewhere I can use to test against provisional 
> ffmpeg 2.9 / 3.0 packages?

I'm building ffmpeg from upstream git master.
I've just tested motion from commit bc90f28 of your packaging repository
with ffmpeg from git master and it compiled fine.

The runtime behavior should be the same as with ffmpeg 2.8.

Best regards,
Andreas



Bug#803843: motion: FTBFS with FFmpeg 2.9

2016-01-07 Thread Andreas Cadhalpun
Hi Ximin,

the next version of FFmpeg is planned to be released this month
(and it might be called 3.0 instead of 2.9).

So please upload a fixed version of motion now.

If this bug isn't fixed soon, it will become release critical and
thus the package will either get NMUed or removed from testing.

Best regards,
Andreas



Bug#803843: [Motion-devel] Bug#803843: motion: FTBFS with FFmpeg 2.9

2015-11-12 Thread Andreas Cadhalpun
Hi Dave,

On 12.11.2015 02:04, Mr Dave wrote:
> 2.  The 3.4.1rc01 (release candidate 01) is currently on the wiki as a 
> proposed patch.
> It is still being considered for putting into the SVN but this is not 
> something that
> I can do since I do not have access to the SVN.  It is also in github under 
> the MrDave fork.
> I will say that the github has a lot of "noise" in the commits because when I 
> started, I did
> not anticipate it would be proposed for a release.  Below are the links to 
> the wiki and github.
> 
> Wiki: http://www.lavrsen.dk/foswiki/bin/view/Motion/PatchworkForNewRelease
> github:  https://github.com/Mr-Dave/motion/tree/motion-3.4

Thanks for these links.

> 3.  The code in 3.4.1 takes a different approach in ffmpeg.c. Rather than 
> using so many preprocessor
> directives, it creates "MY" functions based upon the build version of ffmpeg. 
>  In this way I was able
> to get the code to function and compile correctly with what I think are all 
> the versions of Libav and
> ffmpeg from 2012 onwards.  As a result, you will still see those functions in 
> the code but they are
> now isolated and surrounded by simple directives. The following is the code 
> snippet for the frame
> allocate for illustration.
> 
> AVFrame *my_frame_alloc(void){
> AVFrame *pic;
> #if (LIBAVFORMAT_VERSION_MAJOR >= 55)
> pic = av_frame_alloc();
> #else
> pic = avcodec_alloc_frame();
> #endif
> return pic;
> }
> 
> I believe this allows the code to be backwards compatible to at least 2012 
> and also across libav and
> ffmpeg while at the same time make it much easier to maintain as those two 
> projects evolve in the future.

Yes this should work fine.
I see that you removed the deinterlace functionality. If you want to 
keep/reintroduce that, you can
use the yadif filter from libavfilter as I did in my patch.

> An additional enhancement that is outstanding is determining a precise method 
> of identifying whether
> the libraries are Libav or ffmpeg.

You can use e.g. LIBAVCODEC_VERSION_MICRO for that purpose: '>= 100' is FFmpeg 
'< 100' is Libav.

Best regards,
Andreas



Bug#803843: [Motion-devel] Bug#803843: motion: FTBFS with FFmpeg 2.9

2015-11-11 Thread Mr Dave
1.  I used the daily build from 2015/11/10 (immediately before typing 
the response to this email)


2.  The 3.4.1rc01 (release candidate 01) is currently on the wiki as a 
proposed patch.  It is still being considered for putting into the SVN 
but this is not something that I can do since I do not have access to 
the SVN.  It is also in github under the MrDave fork.  I will say that 
the github has a lot of "noise" in the commits because when I started, I 
did not anticipate it would be proposed for a release.  Below are the 
links to the wiki and github.


Wiki: http://www.lavrsen.dk/foswiki/bin/view/Motion/PatchworkForNewRelease
github:  https://github.com/Mr-Dave/motion/tree/motion-3.4

3.  The code in 3.4.1 takes a different approach in ffmpeg.c. Rather 
than using so many preprocessor directives, it creates "MY" functions 
based upon the build version of ffmpeg.  In this way I was able to get 
the code to function and compile correctly with what I think are all the 
versions of Libav and ffmpeg from 2012 onwards.  As a result, you will 
still see those functions in the code but they are now isolated and 
surrounded by simple directives. The following is the code snippet for 
the frame allocate for illustration.


AVFrame *my_frame_alloc(void){
AVFrame *pic;
#if (LIBAVFORMAT_VERSION_MAJOR >= 55)
pic = av_frame_alloc();
#else
pic = avcodec_alloc_frame();
#endif
return pic;
}

I believe this allows the code to be backwards compatible to at least 
2012 and also across libav and ffmpeg while at the same time make it 
much easier to maintain as those two projects evolve in the future.   An 
additional enhancement that is outstanding is determining a precise 
method of identifying whether the libraries are Libav or ffmpeg.  Once 
that is available, an exact version number from each could be used for 
the directives of when the new APIs appeared.  Right now, the directives 
are based upon the version found in the debian and ubuntu releases in 
which depreciation warnings were observed.


Dave
On 11/11/2015 2:24 PM, Andreas Cadhalpun wrote:

Hi Dave,

On 11.11.2015 03:40, Mr Dave wrote:

Regarding the ffmpeg.
I was unable to find any tarball labeled 2.9 on the ffmpeg.org/releases page.

That's right, it's not yet released.


I did however just complete a test of their daily build.

Which daily build?


It does appear that there are many changes to ffmpeg since Motion is now 
reporting
many warnings whereas with the 2.8 version, there were none.  The 3.4.1 code 
appears
to be functional and compiling with the daily snapshot.

If tried to locate the 3.4.1 code, but even the trunk [1] still uses the APIs 
that have
been removed from ffmpeg git, i.e. PIX_FMT_YUV420P, avcodec_alloc_frame and
avpicture_deinterlace.


Since the code appears to be functional and only providing new compiler 
warnings of
depreciated functions, I think it would be best to proceed with the 3.4.1rc01 
code and
address the warnings later.

If it still uses any of the above mentioned API, it will not compile with 
FFmpeg 2.9.

Best regards,
Andreas


1: http://www.lavrsen.dk/svn/motion/trunk/ffmpeg.c





Bug#803843: [Motion-devel] Bug#803843: motion: FTBFS with FFmpeg 2.9

2015-11-11 Thread Andreas Cadhalpun
Hi Dave,

On 11.11.2015 03:40, Mr Dave wrote:
> Regarding the ffmpeg.
> I was unable to find any tarball labeled 2.9 on the ffmpeg.org/releases page.

That's right, it's not yet released.

> I did however just complete a test of their daily build.

Which daily build?

> It does appear that there are many changes to ffmpeg since Motion is now 
> reporting
> many warnings whereas with the 2.8 version, there were none.  The 3.4.1 code 
> appears
> to be functional and compiling with the daily snapshot.

If tried to locate the 3.4.1 code, but even the trunk [1] still uses the APIs 
that have
been removed from ffmpeg git, i.e. PIX_FMT_YUV420P, avcodec_alloc_frame and
avpicture_deinterlace.

> Since the code appears to be functional and only providing new compiler 
> warnings of
> depreciated functions, I think it would be best to proceed with the 3.4.1rc01 
> code and
> address the warnings later.

If it still uses any of the above mentioned API, it will not compile with 
FFmpeg 2.9.

Best regards,
Andreas


1: http://www.lavrsen.dk/svn/motion/trunk/ffmpeg.c



Bug#803843: motion: FTBFS with FFmpeg 2.9

2015-11-10 Thread Ximin Luo
Hi Motion developers,

I see the 3.4 release is going well, let me know when/if you want testers for 
Debian unstable. (Note that things only go into Debian testing via Debian 
unstable, and never directly.)

Please see the following bug report about FFmpeg 2.9. I am not sure if it has 
been applied already to motion 3.4. If not, please don't let it delay the 
release too much - we can always release a new version with FFmpeg 2.9 support.

The bug report can be viewed at [1] and the patch at [2]. Please keep the 
nnn...@bugs.debian.org address CC'd so that we can keep track.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=803843
[2] 
https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;bug=803843;att=1;filename=motion_ffmpeg-2.9.patch

Thanks,

Ximin (maintainer of the motion Debian package)

On 02/11/15 22:07, Andreas Cadhalpun wrote:
> Package: motion
> Version: 3.2.12+git20140228-7
> Severity: important
> Tags: patch
> User: pkg-multimedia-maintain...@lists.alioth.debian.org
> Usertags: ffmpeg2.9
> 
> Dear Maintainer,
> 
> your package fails to build with the upcoming ffmpeg 2.9.
> This bug will become release-critical at some point when the
> ffmpeg2.9 transition gets closer.
> 
> Attached is a patch replacing the deprecated functionality.
> It also works with ffmpeg 2.8.
> Please apply this patch and forward it upstream, if necessary.
> 
> These changes are non-trivial and should be runtime-tested.
> 
> Best regards,
> Andreas
> 

-- 
GPG: 4096R/1318EFAC5FBBDBCE
git://github.com/infinity0/pubkeys.git



Bug#803843: [Motion-devel] Bug#803843: motion: FTBFS with FFmpeg 2.9

2015-11-10 Thread Mr Dave
I am at the end of the testing from a code standpoint.  The largest 
issue appears to be with the starting of Motion as a service.  I believe 
this is related to the platform change to systemd and therefore it could 
take me a significant amount of time to diagnose since this is not my 
area of expertise.


Regarding the ffmpeg.  I was unable to find any tarball labeled 2.9 on 
the ffmpeg.org/releases page.  I did however just complete a test of 
their daily build.  It does appear that there are many changes to ffmpeg 
since Motion is now reporting many warnings whereas with the 2.8 
version, there were none.  The 3.4.1 code appears to be functional and 
compiling with the daily snapshot.


Since the code appears to be functional and only providing new compiler 
warnings of depreciated functions, I think it would be best to proceed 
with the 3.4.1rc01 code and address the warnings later.


I would welcome any testing to determine whether there are other bugs or 
issues since the changes are material.  Especially any that are 
indicating that the code is not functional under the 2.9 version of 
ffmpeg or in the sid environment


Dave

On 11/10/2015 5:04 AM, Ximin Luo wrote:

Hi Motion developers,

I see the 3.4 release is going well, let me know when/if you want testers for 
Debian unstable. (Note that things only go into Debian testing via Debian 
unstable, and never directly.)

Please see the following bug report about FFmpeg 2.9. I am not sure if it has 
been applied already to motion 3.4. If not, please don't let it delay the 
release too much - we can always release a new version with FFmpeg 2.9 support.

The bug report can be viewed at [1] and the patch at [2]. Please keep the 
nnn...@bugs.debian.org address CC'd so that we can keep track.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=803843
[2] 
https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;bug=803843;att=1;filename=motion_ffmpeg-2.9.patch

Thanks,

Ximin (maintainer of the motion Debian package)

On 02/11/15 22:07, Andreas Cadhalpun wrote:

Package: motion
Version: 3.2.12+git20140228-7
Severity: important
Tags: patch
User: pkg-multimedia-maintain...@lists.alioth.debian.org
Usertags: ffmpeg2.9

Dear Maintainer,

your package fails to build with the upcoming ffmpeg 2.9.
This bug will become release-critical at some point when the
ffmpeg2.9 transition gets closer.

Attached is a patch replacing the deprecated functionality.
It also works with ffmpeg 2.8.
Please apply this patch and forward it upstream, if necessary.

These changes are non-trivial and should be runtime-tested.

Best regards,
Andreas





Bug#803843: motion: FTBFS with FFmpeg 2.9

2015-11-02 Thread Andreas Cadhalpun
Package: motion
Version: 3.2.12+git20140228-7
Severity: important
Tags: patch
User: pkg-multimedia-maintain...@lists.alioth.debian.org
Usertags: ffmpeg2.9

Dear Maintainer,

your package fails to build with the upcoming ffmpeg 2.9.
This bug will become release-critical at some point when the
ffmpeg2.9 transition gets closer.

Attached is a patch replacing the deprecated functionality.
It also works with ffmpeg 2.8.
Please apply this patch and forward it upstream, if necessary.

These changes are non-trivial and should be runtime-tested.

Best regards,
Andreas

diff --git a/debian/control b/debian/control
index c898a07..6329f18 100644
--- a/debian/control
+++ b/debian/control
@@ -5,6 +5,7 @@ Maintainer: Ximin Luo 
 Homepage: http://motion.sf.net
 Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.16), dh-autoreconf,
  libavcodec-dev,
+ libavfilter-dev,
  libavformat-dev,
  libjpeg-dev,
  libmysqlclient-dev (>= 5.5.17-4),
diff --git a/debian/patches/ffmpeg_2.9.patch b/debian/patches/ffmpeg_2.9.patch
new file mode 100644
index 000..50418b1
--- /dev/null
+++ b/debian/patches/ffmpeg_2.9.patch
@@ -0,0 +1,200 @@
+Description: Replace deprecated FFmpeg API
+Author: Andreas Cadhalpun 
+Last-Update: <2015-11-02>
+
+--- motion-3.2.12+git20140228.orig/configure.in
 motion-3.2.12+git20140228/configure.in
+@@ -518,7 +518,7 @@ if test "${FFMPEG_OK}" = "found"; then
+ #
+ 
+ 	if  test "${FFMPEG_OK}" = "found"; then	
+-TEMP_LIBS="$TEMP_LIBS -L${FFMPEG_LIB} -lavformat -lavcodec -lavutil -lm -lz"
++TEMP_LIBS="$TEMP_LIBS -L${FFMPEG_LIB} -lavfilter -lavformat -lavcodec -lavutil -lm -lz"
+ TEMP_LDFLAGS="${TEMP_LDFLAGS} -L${FFMPEG_LIB}"
+ TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_FFMPEG ${FFMPEG_CFLAGS}"
+ 
+--- motion-3.2.12+git20140228.orig/ffmpeg.c
 motion-3.2.12+git20140228/ffmpeg.c
+@@ -655,7 +655,7 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_
+ }
+ 
+ /* Set the picture format - need in ffmpeg starting round April-May 2005 */
+-c->pix_fmt = PIX_FMT_YUV420P;
++c->pix_fmt = AV_PIX_FMT_YUV420P;
+ 
+ /* Get a mutex lock. */
+ pthread_mutex_lock(_lock);
+@@ -692,10 +692,10 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_
+ }
+ 
+ /* Allocate the encoded raw picture. */
+-ffmpeg->picture = avcodec_alloc_frame();
++ffmpeg->picture = av_frame_alloc();
+ 
+ if (!ffmpeg->picture) {
+-MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, "%s: avcodec_alloc_frame -"
++MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, "%s: av_frame_alloc -"
+" could not alloc frame");
+ ffmpeg_cleanups(ffmpeg);
+ return NULL;
+@@ -801,7 +801,7 @@ void ffmpeg_cleanups(struct ffmpeg *ffmp
+ #endif
+ avcodec_close(AVSTREAM_CODEC_PTR(ffmpeg->video_st));
+ pthread_mutex_unlock(_lock);
+-av_freep(>picture);
++av_frame_free(>picture);
+ free(ffmpeg->video_outbuf);
+ }
+ 
+@@ -833,7 +833,7 @@ void ffmpeg_close(struct ffmpeg *ffmpeg)
+ pthread_mutex_lock(_lock);
+ avcodec_close(AVSTREAM_CODEC_PTR(ffmpeg->video_st));
+ pthread_mutex_unlock(_lock);
+-av_freep(>picture);
++av_frame_free(>picture);
+ free(ffmpeg->video_outbuf);
+ }
+ 
+@@ -897,7 +897,7 @@ int ffmpeg_put_other_image(struct ffmpeg
+ if (picture) {
+ ret = ffmpeg_put_frame(ffmpeg, picture);
+ if (!ret)
+-av_free(picture);
++av_frame_free();
+ }
+ 
+ return ret;
+@@ -1009,7 +1009,7 @@ AVFrame *ffmpeg_prepare_frame(struct ffm
+ {
+ AVFrame *picture;
+ 
+-picture = avcodec_alloc_frame();
++picture = av_frame_alloc();
+ 
+ if (!picture) {
+ MOTION_LOG(ERR, TYPE_ENCODER, SHOW_ERRNO, "%s: Could not alloc frame");
+@@ -1031,6 +1031,81 @@ AVFrame *ffmpeg_prepare_frame(struct ffm
+ return picture;
+ }
+ 
++AVFilterContext *buffersink_ctx;
++AVFilterContext *buffersrc_ctx;
++AVFilterGraph *filter_graph;
++AVFrame *filter_frame;
++int last_width = -1;
++int last_height = -1;
++enum AVPixelFormat last_pixfmt = AV_PIX_FMT_NONE;
++
++static void delete_filter_graph() {
++if (filter_graph) {
++av_frame_free(_frame);
++avfilter_graph_free(_graph);
++}
++}
++
++static int init_filter_graph(enum AVPixelFormat pixfmt, int width, int height) {
++AVFilterInOut *inputs = NULL, *outputs = NULL;
++char args[512];
++int res;
++
++delete_filter_graph();
++filter_graph = avfilter_graph_alloc();
++snprintf(args, sizeof(args),
++ "buffer=video_size=%dx%d:pix_fmt=%d:time_base=1/1:pixel_aspect=0/1[in];"
++ "[in]yadif[out];"
++ "[out]buffersink",
++ width, height, pixfmt);
++res = avfilter_graph_parse2(filter_graph, args, , );
++if (res < 0)
++return res;
++if(inputs || outputs)
++return -1;
++res = avfilter_graph_config(filter_graph, NULL);
++if (res < 0)
++return