[FFmpeg-devel] [PATCH 2/2] avformat: add demuxer for Rayman 2's APM format

Zane van Iperen zane at zanevaniperen.com
Tue Feb 18 01:20:54 EET 2020


On 18/2/20 8:54 am, Moritz Barsnick wrote:
> 
> On Mon, Feb 17, 2020 at 18:34:34 +0100, Carl Eugen Hoyos wrote:
>> Am 17.02.2020 um 10:49 schrieb Zane van Iperen <zane at zanevaniperen.com>:
>>> There's no real "magic" fields to look for, hence why I set the `extensions`
>>> field. What would a probe function do in this case?
>>
>> I cannot look at the files right now:
>> Is there nothing that allows to distinguish them from random data?
> 
> I wonder too why there should be no magic data. The header function
> already checks
> 
> +    if (vs12.magic != MKTAG('v', 's', '1', '2')) {
> 
> and
> 
> +    if (avio_rl32(s->pb) != MKTAG('D', 'A', 'T', 'A'))
> 
> Is this not magic? Is it not unique? Or at least a good hit justifying
> some score?
> 

So, something like this?

#define APM_TAG_VS12  MKTAG('v', 's', '1', '2')
#define APM_TAG_DATA  MKTAG('D', 'A', 'T', 'A')

static int apm_probe(const AVProbeData *p)
{
     if (p->buf_size < 100)
         return 0;

     if (AV_RL32(p->buf + 20) != APM_TAG_VS12)
         return 0;

     if (AV_RL32(p->buf + 96) != APM_TAG_DATA)
         return 0;

     return AVPROBE_SCORE_EXTENSION + 1;
}

> Moritz
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> 

Zane



More information about the ffmpeg-devel mailing list