Am Fr., 11. Sept. 2020 um 08:36 Uhr schrieb Josef Zlomek <jo...@pex.com>:
This is not the requested review, I am just curious about the behaviour: > +static int webp_probe(const AVProbeData *p) > +{ > + const uint8_t *b = p->buf; > + > + if (AV_RB32(b) == MKBETAG('R', 'I', 'F', 'F') && > + AV_RB32(b + 8) == MKBETAG('W', 'E', 'B', 'P')) > + return AVPROBE_SCORE_MAX; What happens if you pipe several (not animated) webp images through your new demuxer? Does it behave like the existing pipe demuxer? > +static int ensure_seekback(AVFormatContext *s, int64_t bytes) > +{ > + WebPDemuxContext *wdc = s->priv_data; > + AVIOContext *pb = s->pb; > + int ret; > + > + int64_t pos = avio_tell(pb); > + if (pos < 0) > + return pos; > + > + if (pos + bytes <= wdc->seekback_buffer_end) > + return 0; > + > + if ((ret = ffio_ensure_seekback(pb, bytes)) < 0) > + return ret; > + > + wdc->seekback_buffer_end = pos + bytes; > + return 0; > +} > + > +static int resync(AVFormatContext *s, int seek_to_start) > +{ > + WebPDemuxContext *wdc = s->priv_data; > + AVIOContext *pb = s->pb; > + int ret; > + int i; > + uint64_t state = 0; > + > + // ensure seek back for the file header and the first chunk header > + if ((ret = ensure_seekback(s, 12 + 8)) < 0) > + return ret; > + > + for (i = 0; i < 12; i++) { > + state = (state << 8) | avio_r8(pb); > + if (i == 11) { > + if ((uint32_t) state == MKBETAG('W', 'E', 'B', 'P')) The cast looks really ugly: Why is it necessary? Carl Eugen _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".