diff mbox series

[FFmpeg-devel,03/11] avcodec/tests/avcodec: Test AVCodec and AVCodecDescriptor consistency

Message ID PR3PR03MB6665FE2FCFD09D36F6DBC9C18FA49@PR3PR03MB6665.eurprd03.prod.outlook.com
State Accepted
Commit d77798309fa9527cce3e5811e9cdd85214335846
Headers show
Series [FFmpeg-devel,01/11] avcodec/tests/utils: Rename to avcodec | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 24, 2021, 4:37 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/tests/avcodec.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Sept. 24, 2021, 10:37 p.m. UTC | #1
On Fri, Sep 24, 2021 at 06:37:11PM +0200, Andreas Rheinhardt wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/tests/avcodec.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)

This and also the other patches adding checks LGTM

thx

[...]
Andreas Rheinhardt Sept. 25, 2021, 9:47 p.m. UTC | #2
Michael Niedermayer:
> On Fri, Sep 24, 2021 at 06:37:11PM +0200, Andreas Rheinhardt wrote:
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>> ---
>>  libavcodec/tests/avcodec.c | 11 ++++++++++-
>>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> This and also the other patches adding checks LGTM
> 

Then I'll apply this patchset tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/tests/avcodec.c b/libavcodec/tests/avcodec.c
index 22f308fafa..64940cfdb1 100644
--- a/libavcodec/tests/avcodec.c
+++ b/libavcodec/tests/avcodec.c
@@ -16,7 +16,8 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavcodec/avcodec.h"
+#include "libavcodec/codec.h"
+#include "libavcodec/codec_desc.h"
 
 static const char *get_type_string(enum AVMediaType type)
 {
@@ -39,6 +40,8 @@  int main(void){
     int ret = 0;
 
     while (codec = av_codec_iterate(&iter)) {
+        const AVCodecDescriptor *desc;
+
         if (!codec->name) {
             AV_LOG("Codec for format %s has no name\n",
                    avcodec_get_name(codec->id));
@@ -68,6 +71,12 @@  int main(void){
                 }
             }
         }
+        if (!(desc = avcodec_descriptor_get(codec->id))) {
+            ERR("Codec %s lacks a corresponding descriptor\n");
+        } else if (desc->type != codec->type)
+            ERR_EXT("The type of AVCodec %s and its AVCodecDescriptor differ: "
+                    "%s vs %s\n",
+                    get_type_string(codec->type), get_type_string(desc->type));
     }
     return ret;
 }