[FFmpeg-devel] [PATCH] oggdec: add support for VP8 demuxing
Timothy Gu
timothygu99 at gmail.com
Sun Dec 8 00:44:37 CET 2013
On Dec 7, 2013 12:41 AM, "James Almer" <jamrial at gmail.com> wrote:
>
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> Changelog | 1 +
> libavformat/Makefile | 1 +
> libavformat/oggdec.c | 1 +
> libavformat/oggdec.h | 1 +
> libavformat/oggparsevp8.c | 114
++++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 118 insertions(+)
> create mode 100644 libavformat/oggparsevp8.c
[...]
> diff --git a/libavformat/oggparsevp8.c b/libavformat/oggparsevp8.c
> new file mode 100644
> index 0000000..a2b776e
> --- /dev/null
> +++ b/libavformat/oggparsevp8.c
> @@ -0,0 +1,114 @@
> +/*
> + * On2 VP8 parser for Ogg
> + * Copyright (C) 2013 James Almer
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
> + */
> +
> +#include "libavutil/intreadwrite.h"
> +#include "avformat.h"
> +#include "internal.h"
> +#include "oggdec.h"
> +
> +#define VP8_HEADER_SIZE 26
> +
> +static int vp8_header(AVFormatContext *s, int idx)
> +{
> + struct ogg *ogg = s->priv_data;
> + struct ogg_stream *os = ogg->streams + idx;
> + uint8_t *p = os->buf + os->pstart;
> + AVStream *st = s->streams[idx];
> + AVRational framerate;
> +
> + if (os->psize < 7 || p[0] != 0x4f)
> + return 0;
> +
> + switch (p[5]){
> + case 0x01:
> + if (os->psize < VP8_HEADER_SIZE) {
> + av_log(s, AV_LOG_ERROR, "Invalid OggVP8 header packet");
> + return AVERROR_INVALIDDATA;
> + }
> +
> + if (p[6] != 1) {
> + av_log(s, AV_LOG_WARNING, "Unsupported OggVP8 version
%d.%d\n", p[6], p[7]);
Maybe print the supported version too?
> + return -1;
PATCH_WELCOME or INVALID_DATA
[...]
Timothy
More information about the ffmpeg-devel
mailing list