[FFmpeg-devel] tests/api-flac-test: Rename NUMBER_OF_FRAMES as NUMBER_OF_AUDIO_FRAMES

Submitted by Carl Eugen Hoyos on Dec. 3, 2018, 12:17 a.m.

Details

Message ID CAB0OVGp6SQiojhPX6cXeh0g+JxMN_uOuzBG512+JDpG22CoTfA@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos Dec. 3, 2018, 12:17 a.m.
Hi!

Both aix and sunos define NUMBER_OF_FRAMES in a system header (as
_NUMBER_OF_FRAMES), attached patch fixes a warning when running fate.

Please comment, Carl Eugen

Comments

Carl Eugen Hoyos Dec. 3, 2018, 12:25 a.m.
2018-12-03 1:17 GMT+01:00, Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> Hi!
>
> Both aix and sunos define NUMBER_OF_FRAMES in a system header (as
> _NUMBER_OF_FRAMES), attached patch fixes a warning when running fate.

Only aix...

Carl Eugen
Michael Niedermayer Dec. 4, 2018, 1:57 a.m.
On Mon, Dec 03, 2018 at 01:17:42AM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> Both aix and sunos define NUMBER_OF_FRAMES in a system header (as
> _NUMBER_OF_FRAMES), attached patch fixes a warning when running fate.
> 
> Please comment, Carl Eugen

>  api-flac-test.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 389d56ef407b6d7d7c8c023e6ebb41abbbd36a62  0001-tests-api-flac-test-Rename-NUMBER_OF_FRAMES-as-NUMBE.patch
> From 7360f2e9721b88bb58e55f05911b16222c249e59 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
> Date: Mon, 3 Dec 2018 01:14:24 +0100
> Subject: [PATCH] tests/api-flac-test: Rename NUMBER_OF_FRAMES as
>  NUMBER_OF_AUDIO_FRAMES.
> 
> Both sunos and aix define NUMBER_OF_FRAMES in a system header,
> causing redefinition warnings.
> ---
>  tests/api/api-flac-test.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

this is probably a bug in the system header ...

but renaming does no harm so this patch should be ok

thx

[...]
Carl Eugen Hoyos Dec. 11, 2018, 6:15 p.m.
2018-12-04 2:57 GMT+01:00, Michael Niedermayer <michael@niedermayer.cc>:
> On Mon, Dec 03, 2018 at 01:17:42AM +0100, Carl Eugen Hoyos wrote:
>> Hi!
>>
>> Both aix and sunos define NUMBER_OF_FRAMES in a system header (as
>> _NUMBER_OF_FRAMES), attached patch fixes a warning when running fate.
>>
>> Please comment, Carl Eugen
>
>>  api-flac-test.c |   10 +++++-----
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>> 389d56ef407b6d7d7c8c023e6ebb41abbbd36a62
>> 0001-tests-api-flac-test-Rename-NUMBER_OF_FRAMES-as-NUMBE.patch
>> From 7360f2e9721b88bb58e55f05911b16222c249e59 Mon Sep 17 00:00:00 2001
>> From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
>> Date: Mon, 3 Dec 2018 01:14:24 +0100
>> Subject: [PATCH] tests/api-flac-test: Rename NUMBER_OF_FRAMES as
>>  NUMBER_OF_AUDIO_FRAMES.
>>
>> Both sunos and aix define NUMBER_OF_FRAMES in a system header,
>> causing redefinition warnings.
>> ---
>>  tests/api/api-flac-test.c |   10 +++++-----
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> this is probably a bug in the system header ...
>
> but renaming does no harm so this patch should be ok

Patch applied.

Thank you, Carl Eugen

Patch hide | download patch | download mbox

From 7360f2e9721b88bb58e55f05911b16222c249e59 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Mon, 3 Dec 2018 01:14:24 +0100
Subject: [PATCH] tests/api-flac-test: Rename NUMBER_OF_FRAMES as
 NUMBER_OF_AUDIO_FRAMES.

Both sunos and aix define NUMBER_OF_FRAMES in a system header,
causing redefinition warnings.
---
 tests/api/api-flac-test.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/api/api-flac-test.c b/tests/api/api-flac-test.c
index 2e90812..e8e8cbf 100644
--- a/tests/api/api-flac-test.c
+++ b/tests/api/api-flac-test.c
@@ -31,7 +31,7 @@ 
 #include "libavutil/common.h"
 #include "libavutil/samplefmt.h"
 
-#define NUMBER_OF_FRAMES 200
+#define NUMBER_OF_AUDIO_FRAMES 200
 #define NAME_BUFF_SIZE 100
 
 /* generate i-th frame of test audio */
@@ -137,19 +137,19 @@  static int run_test(AVCodec *enc, AVCodec *dec, AVCodecContext *enc_ctx,
         return AVERROR(ENOMEM);
     }
 
-    raw_in = av_malloc(in_frame->linesize[0] * NUMBER_OF_FRAMES);
+    raw_in = av_malloc(in_frame->linesize[0] * NUMBER_OF_AUDIO_FRAMES);
     if (!raw_in) {
         av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for raw_in\n");
         return AVERROR(ENOMEM);
     }
 
-    raw_out = av_malloc(in_frame->linesize[0] * NUMBER_OF_FRAMES);
+    raw_out = av_malloc(in_frame->linesize[0] * NUMBER_OF_AUDIO_FRAMES);
     if (!raw_out) {
         av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for raw_out\n");
         return AVERROR(ENOMEM);
     }
 
-    for (i = 0; i < NUMBER_OF_FRAMES; i++) {
+    for (i = 0; i < NUMBER_OF_AUDIO_FRAMES; i++) {
         av_init_packet(&enc_pkt);
         enc_pkt.data = NULL;
         enc_pkt.size = 0;
@@ -209,7 +209,7 @@  static int run_test(AVCodec *enc, AVCodec *dec, AVCodecContext *enc_ctx,
         av_packet_unref(&enc_pkt);
     }
 
-    if (memcmp(raw_in, raw_out, out_frame_bytes * NUMBER_OF_FRAMES) != 0) {
+    if (memcmp(raw_in, raw_out, out_frame_bytes * NUMBER_OF_AUDIO_FRAMES) != 0) {
         av_log(NULL, AV_LOG_ERROR, "Output differs\n");
         return 1;
     }
-- 
1.7.10.4