[FFmpeg-devel] [PATCH] Add FITS Decoder

Nicolas George george at nsup.org
Sun Aug 6 15:02:36 EEST 2017


Le duodi 12 thermidor, an CCXXV, Paras Chadha a écrit :
> > > +            if (strncmp(keyword, "BITPIX", 6)) {
> > > +                av_log(avcl, AV_LOG_ERROR, "expected BITPIX keyword,
> > found %s = %s\n", keyword, value);
> > > +                return AVERROR_INVALIDDATA;
> > > +            }
> > > +
> >
> > > +            if (sscanf(value, "%d", &header->bitpix) != 1) {
> > > +                av_log(avcl, AV_LOG_ERROR, "invalid value of BITPIX
> > keyword, %s = %s\n", keyword, value);
> > > +                return AVERROR_INVALIDDATA;
> > > +            }

> Do you mean i should add checking of keyword and value in single if using
> && ?

No, I meant that you could have a function or a macro that parses the
value as an integer, prints the error and returns, all in one step.
Possibly the keyword in the same step, depending on how many you have.

> Yes, i know about this. This version is the correct one to use. Actually,
> for the image, ascii table extensions these keywords should be present
> after NAXISN only and in that order only. But in binary table and groups
> structure there may be other keywords after NAXISN and before PCOUNT,
> GCOUNT. Here it will enter PCOUNT state only when image extension is there.
> Otherwise these keywords will be parsed in the REST state.

You do not need to validate the order of the fields in the demuxer: you
can just parse everything in REST. If it comes in the correct order, it
works, if it comes in the incorrect order, it works too and that is not
a problem.

> Since a common function is made, i have to include them here too for ascii,
> binary table extensions etc. That is why they are checked only when image
> extension is not there.

There is no need to parse them twice: just store the value in an
integer, and once it is finished check that integer only if needed.

> ok, so should i use SIZE_MAX = INT_MAX - 2879 ?

See my other mail: it depends on the type in the computation.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170806/27dc0ecf/attachment.sig>


More information about the ffmpeg-devel mailing list