diff mbox series

[FFmpeg-devel,v3,2/2] libavformat/img2dec: Added pgx demuxer

Message ID 20200628144329.7408-2-gautamramk@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,v3,1/2] libavcodec/pgxdec: Add PGX decoder
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Gautam Ramakrishnan June 28, 2020, 2:43 p.m. UTC
From: Gautam Ramakrishnan <gautamramk@gmail.com>

This patch adds support to demux pgx file
format.
---
 libavformat/allformats.c |  1 +
 libavformat/img2dec.c    | 10 ++++++++++
 libavformat/version.h    |  2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

Comments

Carl Eugen Hoyos June 28, 2020, 2:46 p.m. UTC | #1
Am So., 28. Juni 2020 um 16:43 Uhr schrieb <gautamramk@gmail.com>:
>
> From: Gautam Ramakrishnan <gautamramk@gmail.com>
>
> This patch adds support to demux pgx file
> format.

Has anything changed compared to earlier versions?

> ---
>  libavformat/allformats.c |  1 +
>  libavformat/img2dec.c    | 10 ++++++++++
>  libavformat/version.h    |  2 +-
>  3 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> index 97fd06debb..f8527b1fd4 100644
> --- a/libavformat/allformats.c
> +++ b/libavformat/allformats.c
> @@ -488,6 +488,7 @@ extern AVInputFormat  ff_image_pbm_pipe_demuxer;
>  extern AVInputFormat  ff_image_pcx_pipe_demuxer;
>  extern AVInputFormat  ff_image_pgmyuv_pipe_demuxer;
>  extern AVInputFormat  ff_image_pgm_pipe_demuxer;
> +extern AVInputFormat  ff_image_pgx_pipe_demuxer;
>  extern AVInputFormat  ff_image_pictor_pipe_demuxer;
>  extern AVInputFormat  ff_image_png_pipe_demuxer;
>  extern AVInputFormat  ff_image_ppm_pipe_demuxer;
> diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
> index ee7ceed08f..ec27e04a30 100644
> --- a/libavformat/img2dec.c
> +++ b/libavformat/img2dec.c
> @@ -1000,6 +1000,15 @@ static int pgmyuv_probe(const AVProbeData *p) // custom FFmpeg format recognized
>      return ret && av_match_ext(p->filename, "pgmyuv") ? ret : 0;
>  }
>
> +static int pgx_probe(const AVProbeData *p)
> +{
> +    const uint8_t *b = p->buf;
> +    int ret = (AV_RB64(b) & 0xFFFFFFFFFFFF0000) == 0x5047204D4C200000;
> +    if (ret)
> +        return AVPROBE_SCORE_EXTENSION + 1;
> +    return 0;

Why is the variable ret useful?

Carl Eugen
Gautam Ramakrishnan June 28, 2020, 3 p.m. UTC | #2
On Sun, Jun 28, 2020 at 8:16 PM Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>
> Am So., 28. Juni 2020 um 16:43 Uhr schrieb <gautamramk@gmail.com>:
> >
> > From: Gautam Ramakrishnan <gautamramk@gmail.com>
> >
> > This patch adds support to demux pgx file
> > format.
>
> Has anything changed compared to earlier versions?
No change. I didnt realize that it is exclusive from the first
patch of the series and does not have to be resubmitted.
>
> > ---
> >  libavformat/allformats.c |  1 +
> >  libavformat/img2dec.c    | 10 ++++++++++
> >  libavformat/version.h    |  2 +-
> >  3 files changed, 12 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> > index 97fd06debb..f8527b1fd4 100644
> > --- a/libavformat/allformats.c
> > +++ b/libavformat/allformats.c
> > @@ -488,6 +488,7 @@ extern AVInputFormat  ff_image_pbm_pipe_demuxer;
> >  extern AVInputFormat  ff_image_pcx_pipe_demuxer;
> >  extern AVInputFormat  ff_image_pgmyuv_pipe_demuxer;
> >  extern AVInputFormat  ff_image_pgm_pipe_demuxer;
> > +extern AVInputFormat  ff_image_pgx_pipe_demuxer;
> >  extern AVInputFormat  ff_image_pictor_pipe_demuxer;
> >  extern AVInputFormat  ff_image_png_pipe_demuxer;
> >  extern AVInputFormat  ff_image_ppm_pipe_demuxer;
> > diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
> > index ee7ceed08f..ec27e04a30 100644
> > --- a/libavformat/img2dec.c
> > +++ b/libavformat/img2dec.c
> > @@ -1000,6 +1000,15 @@ static int pgmyuv_probe(const AVProbeData *p) // custom FFmpeg format recognized
> >      return ret && av_match_ext(p->filename, "pgmyuv") ? ret : 0;
> >  }
> >
> > +static int pgx_probe(const AVProbeData *p)
> > +{
> > +    const uint8_t *b = p->buf;
> > +    int ret = (AV_RB64(b) & 0xFFFFFFFFFFFF0000) == 0x5047204D4C200000;
> > +    if (ret)
> > +        return AVPROBE_SCORE_EXTENSION + 1;
> > +    return 0;
>
> Why is the variable ret useful?
It is not useful, should I remove it and resubmit?
diff mbox series

Patch

diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 97fd06debb..f8527b1fd4 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -488,6 +488,7 @@  extern AVInputFormat  ff_image_pbm_pipe_demuxer;
 extern AVInputFormat  ff_image_pcx_pipe_demuxer;
 extern AVInputFormat  ff_image_pgmyuv_pipe_demuxer;
 extern AVInputFormat  ff_image_pgm_pipe_demuxer;
+extern AVInputFormat  ff_image_pgx_pipe_demuxer;
 extern AVInputFormat  ff_image_pictor_pipe_demuxer;
 extern AVInputFormat  ff_image_png_pipe_demuxer;
 extern AVInputFormat  ff_image_ppm_pipe_demuxer;
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index ee7ceed08f..ec27e04a30 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -1000,6 +1000,15 @@  static int pgmyuv_probe(const AVProbeData *p) // custom FFmpeg format recognized
     return ret && av_match_ext(p->filename, "pgmyuv") ? ret : 0;
 }
 
+static int pgx_probe(const AVProbeData *p)
+{
+    const uint8_t *b = p->buf;
+    int ret = (AV_RB64(b) & 0xFFFFFFFFFFFF0000) == 0x5047204D4C200000;
+    if (ret)
+        return AVPROBE_SCORE_EXTENSION + 1;
+    return 0;
+}
+
 static int ppm_probe(const AVProbeData *p)
 {
     return pnm_magic_check(p, 3) || pnm_magic_check(p, 6) ? pnm_probe(p) : 0;
@@ -1094,6 +1103,7 @@  IMAGEAUTO_DEMUXER(pbm,     AV_CODEC_ID_PBM)
 IMAGEAUTO_DEMUXER(pcx,     AV_CODEC_ID_PCX)
 IMAGEAUTO_DEMUXER(pgm,     AV_CODEC_ID_PGM)
 IMAGEAUTO_DEMUXER(pgmyuv,  AV_CODEC_ID_PGMYUV)
+IMAGEAUTO_DEMUXER(pgx,     AV_CODEC_ID_PGX)
 IMAGEAUTO_DEMUXER(pictor,  AV_CODEC_ID_PICTOR)
 IMAGEAUTO_DEMUXER(png,     AV_CODEC_ID_PNG)
 IMAGEAUTO_DEMUXER(ppm,     AV_CODEC_ID_PPM)
diff --git a/libavformat/version.h b/libavformat/version.h
index 3c1957b00c..75c03fde0a 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@ 
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  58
-#define LIBAVFORMAT_VERSION_MINOR  47
+#define LIBAVFORMAT_VERSION_MINOR  48
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \