[FFmpeg-devel] configure: Fix libopus detection

Submitted by Carl Eugen Hoyos on March 29, 2017, 10:47 p.m.

Details

Message ID 201703300047.47659.cehoyos@ag.or.at
State New
Headers show

Commit Message

Carl Eugen Hoyos March 29, 2017, 10:47 p.m.
Hi!

Attached patch fixes a compilation error here.

Please test for success, Carl Eugen
From 600b568651c60f8de609f211c814b5cd0640e584 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos@ag.or.at>
Date: Thu, 30 Mar 2017 00:45:06 +0200
Subject: [PATCH] configure: Fix libopus detection.

Avoids a compilation error for old libopus.
Regression since 37941878
---
 configure |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lou Logan March 29, 2017, 11:41 p.m.
On Thu, 30 Mar 2017 00:47:47 +0200
Carl Eugen Hoyos <cehoyos@ag.or.at> wrote:

> Hi!
> 
> Attached patch fixes a compilation error here.

What is the error? How can I duplicate the error?
James Almer March 29, 2017, 11:52 p.m.
On 3/29/2017 7:47 PM, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes a compilation error here.
> 
> Please test for success, Carl Eugen
> 
> 
> 0001-configure-Fix-libopus-detection.patch
> 
> 
> From 600b568651c60f8de609f211c814b5cd0640e584 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <cehoyos@ag.or.at>
> Date: Thu, 30 Mar 2017 00:45:06 +0200
> Subject: [PATCH] configure: Fix libopus detection.
> 
> Avoids a compilation error for old libopus.
> Regression since 37941878
> ---
>  configure |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index a84b126..76a287e 100755
> --- a/configure
> +++ b/configure
> @@ -5797,7 +5797,7 @@ enabled libopenjpeg       && { { check_lib openjpeg-2.1/openjpeg.h opj_version -
>                                 { check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
>                                 die "ERROR: libopenjpeg not found"; }
>  enabled libopenmpt        && require_pkg_config "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create
> -enabled libopus           && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
> +enabled libopus           && require_pkg_config opus opus_multistream.h opus_multistream_surround_encoder_create

Should be ok, but strictly speaking, this function is needed by the
encoder and not the decoder. Something like

enabled libopus           && {
    enabled libopus_decoder && {
        require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
    }
    enabled libopus_encoder && {
        use_pkg_config "opus >= 1.1" opus_multistream.h opus_multistream_surround_encoder_create ||
            disable libopus_encoder;
    }
}

Would keep the decoder working as it used to with versions < 1.1 while
silently disabling the encoder.
A warn() call could be also added to let the user know they are getting
the decoder only with such old versions of libopus if deemed necessary.

>  enabled libpulse          && require_pkg_config libpulse pulse/pulseaudio.h pa_context_new
>  enabled librtmp           && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
>  enabled librubberband     && require_pkg_config "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new
> -- 1.7.10.4
James Almer March 29, 2017, 11:58 p.m.
On 3/29/2017 8:41 PM, Lou Logan wrote:
> On Thu, 30 Mar 2017 00:47:47 +0200
> Carl Eugen Hoyos <cehoyos@ag.or.at> wrote:
> 
>> Hi!
>>
>> Attached patch fixes a compilation error here.
> 
> What is the error? How can I duplicate the error?

Install libopus 1.0.2 or older and configure will succeed but
fail during compilation of the encoder because
opus_multistream_surround_encoder_create() is undefined.

It was introduced in 1.1 then backported to the 1.0 branch
for 1.0.3
Carl Eugen Hoyos April 12, 2017, 11:08 p.m.
2017-03-30 1:52 GMT+02:00 James Almer <jamrial@gmail.com>:
> On 3/29/2017 7:47 PM, Carl Eugen Hoyos wrote:
>> Hi!
>>
>> Attached patch fixes a compilation error here.
>>
>> Please test for success, Carl Eugen
>>
>>
>> 0001-configure-Fix-libopus-detection.patch
>>
>>
>> From 600b568651c60f8de609f211c814b5cd0640e584 Mon Sep 17 00:00:00 2001
>> From: Carl Eugen Hoyos <cehoyos@ag.or.at>
>> Date: Thu, 30 Mar 2017 00:45:06 +0200
>> Subject: [PATCH] configure: Fix libopus detection.
>>
>> Avoids a compilation error for old libopus.
>> Regression since 37941878
>> ---
>>  configure |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index a84b126..76a287e 100755
>> --- a/configure
>> +++ b/configure
>> @@ -5797,7 +5797,7 @@ enabled libopenjpeg       && { { check_lib openjpeg-2.1/openjpeg.h opj_version -
>>                                 { check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
>>                                 die "ERROR: libopenjpeg not found"; }
>>  enabled libopenmpt        && require_pkg_config "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create
>> -enabled libopus           && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
>> +enabled libopus           && require_pkg_config opus opus_multistream.h opus_multistream_surround_encoder_create
>
> Should be ok,

> but strictly speaking, this function is needed by the
> encoder and not the decoder. Something like
>
> enabled libopus           && {
>     enabled libopus_decoder && {
>         require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
>     }
>     enabled libopus_encoder && {
>         use_pkg_config "opus >= 1.1" opus_multistream.h opus_multistream_surround_encoder_create ||
>             disable libopus_encoder;
>     }
> }

Please commit this if you prefer it.
(I didn't test it.)

Thank you, Carl Eugen
Carl Eugen Hoyos April 25, 2017, 8:19 a.m.
2017-04-13 1:08 GMT+02:00 Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> 2017-03-30 1:52 GMT+02:00 James Almer <jamrial@gmail.com>:
>> On 3/29/2017 7:47 PM, Carl Eugen Hoyos wrote:
>>> Hi!
>>>
>>> Attached patch fixes a compilation error here.
>>>
>>> Please test for success, Carl Eugen
>>>
>>>
>>> 0001-configure-Fix-libopus-detection.patch
>>>
>>>
>>> From 600b568651c60f8de609f211c814b5cd0640e584 Mon Sep 17 00:00:00 2001
>>> From: Carl Eugen Hoyos <cehoyos@ag.or.at>
>>> Date: Thu, 30 Mar 2017 00:45:06 +0200
>>> Subject: [PATCH] configure: Fix libopus detection.
>>>
>>> Avoids a compilation error for old libopus.
>>> Regression since 37941878
>>> ---
>>>  configure |    2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/configure b/configure
>>> index a84b126..76a287e 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -5797,7 +5797,7 @@ enabled libopenjpeg       && { { check_lib openjpeg-2.1/openjpeg.h opj_version -
>>>                                 { check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
>>>                                 die "ERROR: libopenjpeg not found"; }
>>>  enabled libopenmpt        && require_pkg_config "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create
>>> -enabled libopus           && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
>>> +enabled libopus           && require_pkg_config opus opus_multistream.h opus_multistream_surround_encoder_create
>>
>> Should be ok,
>
>> but strictly speaking, this function is needed by the
>> encoder and not the decoder. Something like
>>
>> enabled libopus           && {
>>     enabled libopus_decoder && {
>>         require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
>>     }
>>     enabled libopus_encoder && {
>>         use_pkg_config "opus >= 1.1" opus_multistream.h opus_multistream_surround_encoder_create ||
>>             disable libopus_encoder;
>>     }
>> }
>
> Please commit this if you prefer it.

Ping.

Carl Eugen
Aaron Levinson May 2, 2017, 10:01 p.m.
On 4/25/2017 1:19 AM, Carl Eugen Hoyos wrote:
> 2017-04-13 1:08 GMT+02:00 Carl Eugen Hoyos <ceffmpeg@gmail.com>:
>> 2017-03-30 1:52 GMT+02:00 James Almer <jamrial@gmail.com>:
>>> On 3/29/2017 7:47 PM, Carl Eugen Hoyos wrote:
>>>> Hi!
>>>>
>>>> Attached patch fixes a compilation error here.
>>>>
>>>> Please test for success, Carl Eugen
>>>>
>>>>
>>>> 0001-configure-Fix-libopus-detection.patch
>>>>
>>>>
>>>> From 600b568651c60f8de609f211c814b5cd0640e584 Mon Sep 17 00:00:00 2001
>>>> From: Carl Eugen Hoyos <cehoyos@ag.or.at>
>>>> Date: Thu, 30 Mar 2017 00:45:06 +0200
>>>> Subject: [PATCH] configure: Fix libopus detection.
>>>>
>>>> Avoids a compilation error for old libopus.
>>>> Regression since 37941878
>>>> ---
>>>>  configure |    2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/configure b/configure
>>>> index a84b126..76a287e 100755
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -5797,7 +5797,7 @@ enabled libopenjpeg       && { { check_lib openjpeg-2.1/openjpeg.h opj_version -
>>>>                                 { check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
>>>>                                 die "ERROR: libopenjpeg not found"; }
>>>>  enabled libopenmpt        && require_pkg_config "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create
>>>> -enabled libopus           && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
>>>> +enabled libopus           && require_pkg_config opus opus_multistream.h opus_multistream_surround_encoder_create
>>>
>>> Should be ok,
>>
>>> but strictly speaking, this function is needed by the
>>> encoder and not the decoder. Something like
>>>
>>> enabled libopus           && {
>>>     enabled libopus_decoder && {
>>>         require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
>>>     }
>>>     enabled libopus_encoder && {
>>>         use_pkg_config "opus >= 1.1" opus_multistream.h opus_multistream_surround_encoder_create ||
>>>             disable libopus_encoder;
>>>     }
>>> }
>>
>> Please commit this if you prefer it.
>
> Ping.

Perhaps you could submit a new patch that modifies configure in the 
fashion suggested by James Almer.  Technically, it is possible to enable 
the libopus decoder independently of the libopus encoder, and if that is 
done, it won't build libopusenc.c.  But, with your original patch, it 
won't even permit configure to succeed even though such a build would be 
possible.  It is true that the approach currently taken in configure 
doesn't distinguish between encoding and decoding, but the patch as 
originally proposed just trades decoding API requirements for encoding 
API requirements.

Aaron Levinson
Carl Eugen Hoyos May 3, 2017, 7:24 a.m.
2017-03-30 0:47 GMT+02:00 Carl Eugen Hoyos <cehoyos@ag.or.at>:

> Attached patch fixes a compilation error here.

If nobody wants to work on this issue, I'll commit
this patch in a few days.

Carl Eugen
Clément Bœsch May 3, 2017, 7:39 a.m.
On Tue, May 02, 2017 at 03:01:46PM -0700, Aaron Levinson wrote:
> On 4/25/2017 1:19 AM, Carl Eugen Hoyos wrote:
> > 2017-04-13 1:08 GMT+02:00 Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> > > 2017-03-30 1:52 GMT+02:00 James Almer <jamrial@gmail.com>:
> > > > On 3/29/2017 7:47 PM, Carl Eugen Hoyos wrote:
> > > > > Hi!
> > > > > 
> > > > > Attached patch fixes a compilation error here.
> > > > > 
> > > > > Please test for success, Carl Eugen
> > > > > 
> > > > > 
> > > > > 0001-configure-Fix-libopus-detection.patch
> > > > > 
> > > > > 
> > > > > From 600b568651c60f8de609f211c814b5cd0640e584 Mon Sep 17 00:00:00 2001
> > > > > From: Carl Eugen Hoyos <cehoyos@ag.or.at>
> > > > > Date: Thu, 30 Mar 2017 00:45:06 +0200
> > > > > Subject: [PATCH] configure: Fix libopus detection.
> > > > > 
> > > > > Avoids a compilation error for old libopus.
> > > > > Regression since 37941878
> > > > > ---
> > > > >  configure |    2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/configure b/configure
> > > > > index a84b126..76a287e 100755
> > > > > --- a/configure
> > > > > +++ b/configure
> > > > > @@ -5797,7 +5797,7 @@ enabled libopenjpeg       && { { check_lib openjpeg-2.1/openjpeg.h opj_version -
> > > > >                                 { check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
> > > > >                                 die "ERROR: libopenjpeg not found"; }
> > > > >  enabled libopenmpt        && require_pkg_config "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create
> > > > > -enabled libopus           && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
> > > > > +enabled libopus           && require_pkg_config opus opus_multistream.h opus_multistream_surround_encoder_create
> > > > 
> > > > Should be ok,
> > > 
> > > > but strictly speaking, this function is needed by the
> > > > encoder and not the decoder. Something like
> > > > 
> > > > enabled libopus           && {
> > > >     enabled libopus_decoder && {
> > > >         require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
> > > >     }
> > > >     enabled libopus_encoder && {
> > > >         use_pkg_config "opus >= 1.1" opus_multistream.h opus_multistream_surround_encoder_create ||
> > > >             disable libopus_encoder;
> > > >     }
> > > > }
> > > 
> > > Please commit this if you prefer it.
> > 
> > Ping.
> 
> Perhaps you could submit a new patch that modifies configure in the fashion
> suggested by James Almer.  Technically, it is possible to enable the libopus
> decoder independently of the libopus encoder, and if that is done, it won't
> build libopusenc.c.  But, with your original patch, it won't even permit
> configure to succeed even though such a build would be possible.  It is true
> that the approach currently taken in configure doesn't distinguish between
> encoding and decoding, but the patch as originally proposed just trades
> decoding API requirements for encoding API requirements.
> 

Basically, something similar to what is done with libvpx.
James Almer May 4, 2017, 3:28 a.m.
On 5/3/2017 4:24 AM, Carl Eugen Hoyos wrote:
> 2017-03-30 0:47 GMT+02:00 Carl Eugen Hoyos <cehoyos@ag.or.at>:
> 
>> Attached patch fixes a compilation error here.
> 
> If nobody wants to work on this issue, I'll commit
> this patch in a few days.
> 
> Carl Eugen

I have pushed a variation of my previous suggestion.
Carl Eugen Hoyos May 4, 2017, 9:35 p.m.
2017-05-04 5:28 GMT+02:00 James Almer <jamrial@gmail.com>:
> On 5/3/2017 4:24 AM, Carl Eugen Hoyos wrote:
>> 2017-03-30 0:47 GMT+02:00 Carl Eugen Hoyos <cehoyos@ag.or.at>:
>>
>>> Attached patch fixes a compilation error here.
>>
>> If nobody wants to work on this issue, I'll commit
>> this patch in a few days.
>>
>> Carl Eugen
>
> I have pushed a variation of my previous suggestion.

I can confirm that this fixes my original issue (that libopus
detection succeeds but compilation fails) - thank you!

Carl Eugen

Patch hide | download patch | download mbox

diff --git a/configure b/configure
index a84b126..76a287e 100755
--- a/configure
+++ b/configure
@@ -5797,7 +5797,7 @@  enabled libopenjpeg       && { { check_lib openjpeg-2.1/openjpeg.h opj_version -
                                { check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
                                die "ERROR: libopenjpeg not found"; }
 enabled libopenmpt        && require_pkg_config "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create
-enabled libopus           && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
+enabled libopus           && require_pkg_config opus opus_multistream.h opus_multistream_surround_encoder_create
 enabled libpulse          && require_pkg_config libpulse pulse/pulseaudio.h pa_context_new
 enabled librtmp           && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
 enabled librubberband     && require_pkg_config "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new