On Sun, Dec 31, 2017 at 05:46:04PM +0800, mi...@brew.sh wrote: > From: Maxim Poliakovski <maximumspat...@googlemail.com> > > Changes by Misty De Meo <mistyde...@gmail.com>: > > atrac3plus_parser: remove return statements for invalid data > > atrac3plus_parser: use libavcodec's oma > > atrac3plus_parser: pass along unexpected data unaltered > > Change by Michael "Bazz" Bazzinotti <mbazzino...@gmail.com>: > > atrac3plus_parser: don't always fail video for "2nd frame portion found" > > Signed-off-by: Misty De Meo <mistyde...@gmail.com> [...] > +static int ff_atrac3p_parse(AVCodecParserContext *s, > + AVCodecContext *avctx, > + const uint8_t **poutbuf, int *poutbuf_size, > + const uint8_t *buf, int buf_size) > +{ > + Atrac3PlusParseContext *ctx = s->priv_data; > + const uint8_t *hdr_buf = buf; > + size_t bytes_remain; > + int frame_size, hdr_bytes = 8; > + int next = 0; > + int second_portion_found = 0; > + > + if (s->flags & PARSER_FLAG_COMPLETE_FRAMES || !buf_size) { > + next = buf_size; > + } else { > + if (buf_size >= 2) { > + bytes_remain = AV_RB16(buf); > + > + if (bytes_remain != 0xFD0) { > + second_portion_found = bytes_remain && !ctx->pc.index && > !ctx->hdr_bytes_needed; > + /* Got something unexpected; either this means we got > + the second part of a frame and not the first part, > + or more likely these aren't ATRAC3+ packets in the > + format we're expecting. For example, it might mean > + the source data is from ATRAC3+ in RIFF WAVE, which > + doesn't use the same format as ATRAC3+ in MPEG. > + Just pass this along unaltered. */ > + if (second_portion_found && !ctx->got_bytes) { > + *poutbuf = buf; > + *poutbuf_size = buf_size; > + return buf_size; > + } > + > + next += 2; > + buf += 2; > + buf_size -= 2; > + hdr_buf = buf; > + > + if (second_portion_found) { > + ctx->got_bytes = 0; > + goto process; > + } > + > + if (ctx->hdr_bytes_needed) {bytes_remain > + if (buf_size >= ctx->hdr_bytes_needed) { > + memcpy(&ctx->hdr[8 - ctx->hdr_bytes_needed], > + buf, ctx->hdr_bytes_needed); > + hdr_bytes = ctx->hdr_bytes_needed; > + ctx->hdr_bytes_needed = 0; > + hdr_buf = ctx->hdr; > + } > + } else if (bytes_remain) { > + if (buf_size < bytes_remain) {
> + av_log(avctx, AV_LOG_ERROR, > + "Couldn't combine frame: bytes needed=%d, > bytes supplied=%d\n", > + bytes_remain, buf_size); Types mismatch [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Breaking DRM is a little like attempting to break through a door even though the window is wide open and the only thing in the house is a bunch of things you dont want and which you would get tomorrow for free anyway
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel