diff mbox series

[FFmpeg-devel] lavc/pnm_parser: Add a pfm parser

Message ID CAB0OVGpsnrz=CNbA17NFya5uzzwC+Xpz-Kmr6s12t_bw_NF6gg@mail.gmail.com
State New
Headers show
Series [FFmpeg-devel] lavc/pnm_parser: Add a pfm parser
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Carl Eugen Hoyos Feb. 15, 2021, 10:24 p.m. UTC
Hi!

Attached patch is necessary for a new pfm demuxer.

Please comment, Carl Eugen
Subject: [PATCH] lavc/pnm_parser: Add a pfm parser.

A parser cannot support more than five codec_ids.
---
 libavcodec/parsers.c    | 1 +
 libavcodec/pnm_parser.c | 7 +++++++
 libavcodec/version.h    | 2 +-
 3 files changed, 9 insertions(+), 1 deletion(-)

Comments

Andreas Rheinhardt Feb. 15, 2021, 11:56 p.m. UTC | #1
Carl Eugen Hoyos:
> Hi!
> 
> Attached patch is necessary for a new pfm demuxer.
> 
> Please comment, Carl Eugen
> 
Can't we just wait and increment the number of codec_ids a parser can
support at the next bump?

- Andreas
Carl Eugen Hoyos Feb. 16, 2021, 6:01 p.m. UTC | #2
Am Di., 16. Feb. 2021 um 00:56 Uhr schrieb Andreas Rheinhardt
<andreas.rheinhardt@gmail.com>:
>
> Carl Eugen Hoyos:
> > Hi!
> >
> > Attached patch is necessary for a new pfm demuxer.
> >
> > Please comment, Carl Eugen
> >
> Can't we just wait and increment the number of codec_ids
> a parser can support at the next bump?

I wanted to suggest to reduce the number because for
90% of the parsers, one is enough and in one case,
six may not be enough in the future...

Carl Eugen
Andreas Rheinhardt Feb. 16, 2021, 6:28 p.m. UTC | #3
Carl Eugen Hoyos:
> Am Di., 16. Feb. 2021 um 00:56 Uhr schrieb Andreas Rheinhardt
> <andreas.rheinhardt@gmail.com>:
>>
>> Carl Eugen Hoyos:
>>> Hi!
>>>
>>> Attached patch is necessary for a new pfm demuxer.
>>>
>>> Please comment, Carl Eugen
>>>
>> Can't we just wait and increment the number of codec_ids
>> a parser can support at the next bump?
> 
> I wanted to suggest to reduce the number because for
> 90% of the parsers, one is enough and in one case,
> six may not be enough in the future...
> 
Parsers with multiple codec-ids:
ac3: AC3, EAC3
g729: G729, ACELP_KELVIN
gsm: GSM, GSM_MS
mjpeg: MJPEG, JPEGLS
mlp: MLP, TRUEHD
mpegaudio: MP1, MP2, MP3, MP3ADU
mpegvideo: MPEG1VIDEO, MPEG2VIDEO
pnm: PGM, PGMYUV, PPM, PBM, PAM
vp3: THEORA, VP3, VP6, VP6F, VP6A

We have 52 AVCodecParsers in total (for 69 codec ids) of which 9 use
multiple codec ids; the parsers with multiple codec ids have 26 codec
ids together. Either way that is way more than 10% and is not niche.
And I actually thought about incrementing it to seven.

- Andreas
Carl Eugen Hoyos Feb. 16, 2021, 6:43 p.m. UTC | #4
Am Di., 16. Feb. 2021 um 19:28 Uhr schrieb Andreas Rheinhardt
<andreas.rheinhardt@gmail.com>:
>
> Carl Eugen Hoyos:
> > Am Di., 16. Feb. 2021 um 00:56 Uhr schrieb Andreas Rheinhardt
> > <andreas.rheinhardt@gmail.com>:
> >>
> >> Carl Eugen Hoyos:
> >>> Hi!
> >>>
> >>> Attached patch is necessary for a new pfm demuxer.
> >>>
> >>> Please comment, Carl Eugen
> >>>
> >> Can't we just wait and increment the number of codec_ids
> >> a parser can support at the next bump?
> >
> > I wanted to suggest to reduce the number because for
> > 90% of the parsers, one is enough and in one case,
> > six may not be enough in the future...
> >
> Parsers with multiple codec-ids:
> ac3: AC3, EAC3
> g729: G729, ACELP_KELVIN
> gsm: GSM, GSM_MS
> mjpeg: MJPEG, JPEGLS
> mlp: MLP, TRUEHD
> mpegaudio: MP1, MP2, MP3, MP3ADU
> mpegvideo: MPEG1VIDEO, MPEG2VIDEO
> pnm: PGM, PGMYUV, PPM, PBM, PAM
> vp3: THEORA, VP3, VP6, VP6F, VP6A
>
> We have 52 AVCodecParsers in total (for 69 codec ids) of which 9 use
> multiple codec ids; the parsers with multiple codec ids have 26 codec
> ids together. Either way that is way more than 10% and is not niche.
> And I actually thought about incrementing it to seven.

(I thought two would be enough but obviously not.)

No strong opinion here, Carl Eugen
diff mbox series

Patch

diff --git a/libavcodec/parsers.c b/libavcodec/parsers.c
index f8cfa1cde9..0c48cb67e1 100644
--- a/libavcodec/parsers.c
+++ b/libavcodec/parsers.c
@@ -62,6 +62,7 @@  extern AVCodecParser ff_mpegvideo_parser;
 extern AVCodecParser ff_opus_parser;
 extern AVCodecParser ff_png_parser;
 extern AVCodecParser ff_pnm_parser;
+extern AVCodecParser ff_pfm_parser;
 extern AVCodecParser ff_rv30_parser;
 extern AVCodecParser ff_rv40_parser;
 extern AVCodecParser ff_sbc_parser;
diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
index f3be6d640c..45d77e69be 100644
--- a/libavcodec/pnm_parser.c
+++ b/libavcodec/pnm_parser.c
@@ -138,3 +138,10 @@  AVCodecParser ff_pnm_parser = {
     .parser_parse   = pnm_parse,
     .parser_close   = ff_parse_close,
 };
+
+AVCodecParser ff_pfm_parser = {
+    .codec_ids      = { AV_CODEC_ID_PFM },
+    .priv_data_size = sizeof(PNMParseContext),
+    .parser_parse   = pnm_parse,
+    .parser_close   = ff_parse_close,
+};
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 83dbd1ad63..d4fe2da937 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@ 
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  58
-#define LIBAVCODEC_VERSION_MINOR 123
+#define LIBAVCODEC_VERSION_MINOR 124
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \