[FFmpeg-devel] [PATCH] MLP/TrueHD decoder
Michael Niedermayer
michaelni
Sun Nov 18 17:43:22 CET 2007
Hi
On Thu, Nov 15, 2007 at 12:37:47PM +0000, Ian Caulfield wrote:
> On Nov 14, 2007 9:05 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> >
> > id only read enough in as needed for the size in the first pass
>
> Here's a first pass at it.
>
> > also we could add a special case for the case where the input containes
> > a whole packet or more so no memcpy is done but thats seperate
> > and we shouldnt waste time with it until the parser is in svn
>
> I've left this for now.
[...]
> +static int mlp_parse(AVCodecParserContext *s,
> + AVCodecContext *avctx,
> + const uint8_t **poutbuf, int *poutbuf_size,
> + const uint8_t *buf, int buf_size)
> +{
> + MLPParseContext *mp = s->priv_data;
> + int sync_present;
> + uint8_t parity_bits;
> + int next;
> + int i, p;
> +
> + *poutbuf_size = 0;
> + if (buf_size == 0)
> + return 0;
> +
> + if (!mp->in_sync) {
> + // Not in sync - find a major sync header
> +
> + for (i = 0; i < buf_size; i++) {
> + mp->pc.state = (mp->pc.state << 8) | buf[i];
> + if ((mp->pc.state & 0xfffffffe) == 0xf8726fba) {
> + mp->in_sync = 1;
> + mp->bytes_left = 0;
> + break;
> + }
> + }
> +
> + if (!mp->in_sync) {
> + ff_combine_frame(&mp->pc, END_NOT_FOUND, &buf, &buf_size);
> + return buf_size;
> + }
> +
> + ff_combine_frame(&mp->pc, i - 7, &buf, &buf_size);
> +
> + return FFMAX(i - 7, 0);
i think this should be return i-7
[...]
> + if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) {
> + av_log(NULL, AV_LOG_INFO, "mlpparse: parity check failed\n");
please provide some non null context to av_log() otherwise its impossible
for an application with several decoders to make sense of the messages
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
It is not what we do, but why we do it that matters.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071118/2f83646b/attachment.pgp>
More information about the ffmpeg-devel
mailing list