Re: [FFmpeg-devel] [PATCH 1/3] avcodec/mpeg4audio: add a logging context parameter to avpriv_mpeg4audio_get_config()

2019-09-23 Thread myp...@gmail.com
On Sat, Sep 21, 2019 at 11:53 PM James Almer  wrote:
>
> This is an ABI change, so it's scheduled for the next bump.
>
> Signed-off-by: James Almer 
> ---
>  libavcodec/aacdec_template.c   |  2 +-
>  libavcodec/alsdec.c|  4 
>  libavcodec/mpeg4audio.c| 11 +--
>  libavcodec/mpeg4audio.h|  8 +++-
>  libavcodec/mpegaudiodec_template.c |  4 
>  libavformat/adtsenc.c  |  4 
>  libavformat/isom.c |  4 
>  libavformat/latmenc.c  |  4 
>  libavformat/matroskaenc.c  |  4 
>  9 files changed, 41 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
> index 6e086e00df..8726c8b828 100644
> --- a/libavcodec/aacdec_template.c
> +++ b/libavcodec/aacdec_template.c
> @@ -975,7 +975,7 @@ static int decode_audio_specific_config_gb(AACContext *ac,
>  int i, ret;
>  GetBitContext gbc = *gb;
>
> -if ((i = ff_mpeg4audio_get_config_gb(m4ac, , sync_extension)) < 0)
> +if ((i = ff_mpeg4audio_get_config_gb(m4ac, , sync_extension, avctx)) 
> < 0)
>  return AVERROR_INVALIDDATA;
I think return i better than the error AVERROR_INVALIDDATA in this context
>  if (m4ac->sampling_index > 12) {
> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
> index a53c170d18..767d1be7d3 100644
> --- a/libavcodec/alsdec.c
> +++ b/libavcodec/alsdec.c
> @@ -303,7 +303,11 @@ static av_cold int read_specific_config(ALSDecContext 
> *ctx)
>  return ret;
>
>  config_offset = avpriv_mpeg4audio_get_config(, avctx->extradata,
> +#if LIBAVCODEC_VERSION_MAJOR < 59
>   avctx->extradata_size * 8, 
> 1);
> +#else
> + avctx->extradata_size * 8, 
> 1, avctx);
> +#endif
>
>  if (config_offset < 0)
>  return AVERROR_INVALIDDATA;
> diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
> index 219714752f..43c19c4188 100644
> --- a/libavcodec/mpeg4audio.c
> +++ b/libavcodec/mpeg4audio.c
> @@ -84,7 +84,7 @@ static inline int get_sample_rate(GetBitContext *gb, int 
> *index)
>  }
>
>  int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb,
> -int sync_extension)
> +int sync_extension, void *logctx)
>  {
>  int specific_config_bitindex, ret;
>  int start_bit_index = get_bits_count(gb);
> @@ -152,9 +152,16 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, 
> GetBitContext *gb,
>  return specific_config_bitindex - start_bit_index;
>  }
>
> +#if LIBAVCODEC_VERSION_MAJOR < 59
>  int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf,
>   int bit_size, int sync_extension)
>  {
> +void *logctx = NULL;
> +#else
> +int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf,
> + int bit_size, int sync_extension, void 
> *logctx)
> +{
> +#endif
>  GetBitContext gb;
>  int ret;
>
> @@ -165,5 +172,5 @@ int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, 
> const uint8_t *buf,
>  if (ret < 0)
>  return ret;
>
> -return ff_mpeg4audio_get_config_gb(c, , sync_extension);
> +return ff_mpeg4audio_get_config_gb(c, , sync_extension, logctx);
>  }
> diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h
> index b9cea8af17..ee6c8da233 100644
> --- a/libavcodec/mpeg4audio.h
> +++ b/libavcodec/mpeg4audio.h
> @@ -53,10 +53,11 @@ extern const uint8_t ff_mpeg4audio_channels[8];
>   * @param[in] cMPEG4AudioConfig structure to fill.
>   * @param[in] gb   Extradata from container.
>   * @param[in] sync_extension look for a sync extension after config if true.
> + * @param[in] logctx opaque struct starting with an AVClass element, used 
> for logging.
>   * @return On error -1 is returned, on success AudioSpecificConfig bit index 
> in extradata.
>   */
>  int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb,
> -int sync_extension);
> +int sync_extension, void *logctx);
Missed the parase_config_ALS for logging context support.
>
>  /**
>   * Parse MPEG-4 systems extradata from a raw buffer to retrieve audio 
> configuration.
> @@ -64,10 +65,15 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, 
> GetBitContext *gb,
>   * @param[in] buf  Extradata from container.
>   * @param[in] bit_size Extradata size in bits.
>   * @param[in] sync_extension look for a sync extension after config if true.
> + * @param[in] logctx opaque struct starting with an AVClass element, used 
> for logging.
>   * @return On error -1 is returned, on success AudioSpecificConfig bit index 
> in extradata.
>   */
>  int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf,
> +#if LIBAVCODEC_VERSION_MAJOR < 59
>   int 

Re: [FFmpeg-devel] [PATCH 1/3] avcodec/mpeg4audio: add a logging context parameter to avpriv_mpeg4audio_get_config()

2019-09-21 Thread James Almer
On 9/21/2019 7:42 PM, Carl Eugen Hoyos wrote:
> Am So., 22. Sept. 2019 um 00:40 Uhr schrieb James Almer :
>>
>> On 9/21/2019 7:38 PM, Carl Eugen Hoyos wrote:
>>> Am So., 22. Sept. 2019 um 00:36 Uhr schrieb James Almer :

 On 9/21/2019 7:31 PM, Carl Eugen Hoyos wrote:
> Am Sa., 21. Sept. 2019 um 17:53 Uhr schrieb James Almer 
> :
>
>> This is an ABI change, so it's scheduled for the next bump.
>
> Why don't you add avpriv_mpeg4audio_get_config2() now?

 I don't like the idea of adding a function that will be gone as soon as
 we bump (and still require line changes in lavf once it's removed).
>>>
>>> Don't remove it.
>>
>> Why would i leave a redundant internal function?
> 
> Drop avpriv_mpeg4audio_get_config(), keep avpriv_mpeg4audio_get_config2().

Yes, of course, but i'm talking about the name. I'll be dropping the old
function as soon as we bump, but also ensuring the new one starts using
the old name.

> 
 But if that's preferred to get the logging context in lavf working right
 now, then i can do it.
>>>
>>> It's just less ugly and it avoids code changes for third parties.
>>
>> What third parties? This is not public API.
> 
> True, it's still less ugly.

Alright, will do that instead.

> 
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/3] avcodec/mpeg4audio: add a logging context parameter to avpriv_mpeg4audio_get_config()

2019-09-21 Thread Carl Eugen Hoyos
Am So., 22. Sept. 2019 um 00:40 Uhr schrieb James Almer :
>
> On 9/21/2019 7:38 PM, Carl Eugen Hoyos wrote:
> > Am So., 22. Sept. 2019 um 00:36 Uhr schrieb James Almer :
> >>
> >> On 9/21/2019 7:31 PM, Carl Eugen Hoyos wrote:
> >>> Am Sa., 21. Sept. 2019 um 17:53 Uhr schrieb James Almer 
> >>> :
> >>>
>  This is an ABI change, so it's scheduled for the next bump.
> >>>
> >>> Why don't you add avpriv_mpeg4audio_get_config2() now?
> >>
> >> I don't like the idea of adding a function that will be gone as soon as
> >> we bump (and still require line changes in lavf once it's removed).
> >
> > Don't remove it.
>
> Why would i leave a redundant internal function?

Drop avpriv_mpeg4audio_get_config(), keep avpriv_mpeg4audio_get_config2().

> >> But if that's preferred to get the logging context in lavf working right
> >> now, then i can do it.
> >
> > It's just less ugly and it avoids code changes for third parties.
>
> What third parties? This is not public API.

True, it's still less ugly.

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/3] avcodec/mpeg4audio: add a logging context parameter to avpriv_mpeg4audio_get_config()

2019-09-21 Thread James Almer
On 9/21/2019 7:38 PM, Carl Eugen Hoyos wrote:
> Am So., 22. Sept. 2019 um 00:36 Uhr schrieb James Almer :
>>
>> On 9/21/2019 7:31 PM, Carl Eugen Hoyos wrote:
>>> Am Sa., 21. Sept. 2019 um 17:53 Uhr schrieb James Almer :
>>>
 This is an ABI change, so it's scheduled for the next bump.
>>>
>>> Why don't you add avpriv_mpeg4audio_get_config2() now?
>>
>> I don't like the idea of adding a function that will be gone as soon as
>> we bump (and still require line changes in lavf once it's removed).
> 
> Don't remove it.

Why would i leave a redundant internal function?

> 
>> But if that's preferred to get the logging context in lavf working right
>> now, then i can do it.
> 
> It's just less ugly and it avoids code changes for third parties.

What third parties? This is not public API.

> 
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/3] avcodec/mpeg4audio: add a logging context parameter to avpriv_mpeg4audio_get_config()

2019-09-21 Thread Carl Eugen Hoyos
Am So., 22. Sept. 2019 um 00:36 Uhr schrieb James Almer :
>
> On 9/21/2019 7:31 PM, Carl Eugen Hoyos wrote:
> > Am Sa., 21. Sept. 2019 um 17:53 Uhr schrieb James Almer :
> >
> >> This is an ABI change, so it's scheduled for the next bump.
> >
> > Why don't you add avpriv_mpeg4audio_get_config2() now?
>
> I don't like the idea of adding a function that will be gone as soon as
> we bump (and still require line changes in lavf once it's removed).

Don't remove it.

> But if that's preferred to get the logging context in lavf working right
> now, then i can do it.

It's just less ugly and it avoids code changes for third parties.

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/3] avcodec/mpeg4audio: add a logging context parameter to avpriv_mpeg4audio_get_config()

2019-09-21 Thread James Almer
On 9/21/2019 7:31 PM, Carl Eugen Hoyos wrote:
> Am Sa., 21. Sept. 2019 um 17:53 Uhr schrieb James Almer :
> 
>> This is an ABI change, so it's scheduled for the next bump.
> 
> Why don't you add avpriv_mpeg4audio_get_config2() now?

I don't like the idea of adding a function that will be gone as soon as
we bump (and still require line changes in lavf once it's removed). But
if that's preferred to get the logging context in lavf working right
now, then i can do it.

> 
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/3] avcodec/mpeg4audio: add a logging context parameter to avpriv_mpeg4audio_get_config()

2019-09-21 Thread Carl Eugen Hoyos
Am Sa., 21. Sept. 2019 um 17:53 Uhr schrieb James Almer :

> This is an ABI change, so it's scheduled for the next bump.

Why don't you add avpriv_mpeg4audio_get_config2() now?

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/3] avcodec/mpeg4audio: add a logging context parameter to avpriv_mpeg4audio_get_config()

2019-09-21 Thread James Almer
This is an ABI change, so it's scheduled for the next bump.

Signed-off-by: James Almer 
---
 libavcodec/aacdec_template.c   |  2 +-
 libavcodec/alsdec.c|  4 
 libavcodec/mpeg4audio.c| 11 +--
 libavcodec/mpeg4audio.h|  8 +++-
 libavcodec/mpegaudiodec_template.c |  4 
 libavformat/adtsenc.c  |  4 
 libavformat/isom.c |  4 
 libavformat/latmenc.c  |  4 
 libavformat/matroskaenc.c  |  4 
 9 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index 6e086e00df..8726c8b828 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -975,7 +975,7 @@ static int decode_audio_specific_config_gb(AACContext *ac,
 int i, ret;
 GetBitContext gbc = *gb;
 
-if ((i = ff_mpeg4audio_get_config_gb(m4ac, , sync_extension)) < 0)
+if ((i = ff_mpeg4audio_get_config_gb(m4ac, , sync_extension, avctx)) < 
0)
 return AVERROR_INVALIDDATA;
 
 if (m4ac->sampling_index > 12) {
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index a53c170d18..767d1be7d3 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -303,7 +303,11 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
 return ret;
 
 config_offset = avpriv_mpeg4audio_get_config(, avctx->extradata,
+#if LIBAVCODEC_VERSION_MAJOR < 59
  avctx->extradata_size * 8, 1);
+#else
+ avctx->extradata_size * 8, 1, 
avctx);
+#endif
 
 if (config_offset < 0)
 return AVERROR_INVALIDDATA;
diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
index 219714752f..43c19c4188 100644
--- a/libavcodec/mpeg4audio.c
+++ b/libavcodec/mpeg4audio.c
@@ -84,7 +84,7 @@ static inline int get_sample_rate(GetBitContext *gb, int 
*index)
 }
 
 int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb,
-int sync_extension)
+int sync_extension, void *logctx)
 {
 int specific_config_bitindex, ret;
 int start_bit_index = get_bits_count(gb);
@@ -152,9 +152,16 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, 
GetBitContext *gb,
 return specific_config_bitindex - start_bit_index;
 }
 
+#if LIBAVCODEC_VERSION_MAJOR < 59
 int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf,
  int bit_size, int sync_extension)
 {
+void *logctx = NULL;
+#else
+int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf,
+ int bit_size, int sync_extension, void 
*logctx)
+{
+#endif
 GetBitContext gb;
 int ret;
 
@@ -165,5 +172,5 @@ int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const 
uint8_t *buf,
 if (ret < 0)
 return ret;
 
-return ff_mpeg4audio_get_config_gb(c, , sync_extension);
+return ff_mpeg4audio_get_config_gb(c, , sync_extension, logctx);
 }
diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h
index b9cea8af17..ee6c8da233 100644
--- a/libavcodec/mpeg4audio.h
+++ b/libavcodec/mpeg4audio.h
@@ -53,10 +53,11 @@ extern const uint8_t ff_mpeg4audio_channels[8];
  * @param[in] cMPEG4AudioConfig structure to fill.
  * @param[in] gb   Extradata from container.
  * @param[in] sync_extension look for a sync extension after config if true.
+ * @param[in] logctx opaque struct starting with an AVClass element, used for 
logging.
  * @return On error -1 is returned, on success AudioSpecificConfig bit index 
in extradata.
  */
 int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb,
-int sync_extension);
+int sync_extension, void *logctx);
 
 /**
  * Parse MPEG-4 systems extradata from a raw buffer to retrieve audio 
configuration.
@@ -64,10 +65,15 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, 
GetBitContext *gb,
  * @param[in] buf  Extradata from container.
  * @param[in] bit_size Extradata size in bits.
  * @param[in] sync_extension look for a sync extension after config if true.
+ * @param[in] logctx opaque struct starting with an AVClass element, used for 
logging.
  * @return On error -1 is returned, on success AudioSpecificConfig bit index 
in extradata.
  */
 int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf,
+#if LIBAVCODEC_VERSION_MAJOR < 59
  int bit_size, int sync_extension);
+#else
+ int bit_size, int sync_extension, void 
*logctx);
+#endif
 
 enum AudioObjectType {
 AOT_NULL,
diff --git a/libavcodec/mpegaudiodec_template.c 
b/libavcodec/mpegaudiodec_template.c
index 9cce88e263..a89d7e408f 100644
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c
@@ -1852,7 +1852,11 @@ static av_cold int