[FFmpeg-devel] [PATCH] rtpdec: experimental VP9 depacketizer (draft 0)

Michael Niedermayer michaelni at gmx.at
Sun Feb 15 11:51:47 CET 2015


On Sat, Feb 14, 2015 at 04:29:40PM +0100, Thomas Volkert wrote:
> From: Thomas Volkert <thomas at homer-conferencing.com>
> 
> ---
>  Changelog                    |   1 +
>  MAINTAINERS                  |   1 +
>  libavcodec/version.h         |   4 +-
>  libavformat/Makefile         |   1 +
>  libavformat/rtpdec.c         |   1 +
>  libavformat/rtpdec_formats.h |   1 +
>  libavformat/rtpdec_vp9.c     | 316 +++++++++++++++++++++++++++++++++++++++++++
>  7 files changed, 323 insertions(+), 2 deletions(-)
>  create mode 100644 libavformat/rtpdec_vp9.c
> 
> diff --git a/Changelog b/Changelog
> index c663d5e..170382e 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -23,6 +23,7 @@ version <next>:
>  - Changed default DNxHD colour range in QuickTime .mov derivatives to mpeg range
>  - ported softpulldown filter from libmpcodecs as repeatfields filter
>  - dcshift filter
> +- VP9 RTP payload format (draft 0) experimental depacketizer
>  
>  
>  version 2.5:
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 13b211e..d71c7af 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -468,6 +468,7 @@ Muxers/Demuxers:
>    rtpdec_h261.*, rtpenc_h261.*          Thomas Volkert
>    rtpdec_hevc.*, rtpenc_hevc.*          Thomas Volkert
>    rtpdec_asf.*                          Ronald S. Bultje
> +  rtpdec_vp9.c                          Thomas Volkert
>    rtpenc_mpv.*, rtpenc_aac.*            Martin Storsjo
>    rtsp.c                                Luca Barbato
>    sbgdec.c                              Nicolas George
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 7e2750e..b25f48a 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,8 +29,8 @@
>  #include "libavutil/version.h"
>  
>  #define LIBAVCODEC_VERSION_MAJOR 56
> -#define LIBAVCODEC_VERSION_MINOR  21
> -#define LIBAVCODEC_VERSION_MICRO 102
> +#define LIBAVCODEC_VERSION_MINOR  22
> +#define LIBAVCODEC_VERSION_MICRO 100
>  
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
>                                                 LIBAVCODEC_VERSION_MINOR, \
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index ec312ba..c0f487c 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -48,6 +48,7 @@ OBJS-$(CONFIG_RTPDEC)                    += rdt.o                       \
>                                              rtpdec_qt.o                 \
>                                              rtpdec_svq3.o               \
>                                              rtpdec_vp8.o                \
> +                                            rtpdec_vp9.o                \
>                                              rtpdec_xiph.o               \
>                                              srtp.o
>  OBJS-$(CONFIG_RTPENC_CHAIN)              += rtpenc_chain.o rtp.o
> diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
> index 4ff209c..27f1e3b 100644
> --- a/libavformat/rtpdec.c
> +++ b/libavformat/rtpdec.c
> @@ -105,6 +105,7 @@ void ff_register_rtp_dynamic_payload_handlers(void)
>      ff_register_dynamic_payload_handler(&ff_theora_dynamic_handler);
>      ff_register_dynamic_payload_handler(&ff_vorbis_dynamic_handler);
>      ff_register_dynamic_payload_handler(&ff_vp8_dynamic_handler);
> +    ff_register_dynamic_payload_handler(&ff_vp9_dynamic_handler);
>      ff_register_dynamic_payload_handler(&gsm_dynamic_handler);
>      ff_register_dynamic_payload_handler(&opus_dynamic_handler);
>      ff_register_dynamic_payload_handler(&realmedia_mp3_dynamic_handler);
> diff --git a/libavformat/rtpdec_formats.h b/libavformat/rtpdec_formats.h
> index 87e316f..69e3418 100644
> --- a/libavformat/rtpdec_formats.h
> +++ b/libavformat/rtpdec_formats.h
> @@ -67,5 +67,6 @@ extern RTPDynamicProtocolHandler ff_svq3_dynamic_handler;
>  extern RTPDynamicProtocolHandler ff_theora_dynamic_handler;
>  extern RTPDynamicProtocolHandler ff_vorbis_dynamic_handler;
>  extern RTPDynamicProtocolHandler ff_vp8_dynamic_handler;
> +extern RTPDynamicProtocolHandler ff_vp9_dynamic_handler;
>  
>  #endif /* AVFORMAT_RTPDEC_FORMATS_H */
> diff --git a/libavformat/rtpdec_vp9.c b/libavformat/rtpdec_vp9.c
> new file mode 100644
> index 0000000..fb7fe18
> --- /dev/null
> +++ b/libavformat/rtpdec_vp9.c
> @@ -0,0 +1,316 @@
> +/*
> + * RTP parser for VP9 payload format (draft version 0) - experimental
> + * Copyright (c) 2015 Thomas Volkert <thomas at homer-conferencing.com>
> + *
> + * 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 "libavcodec/bytestream.h"
> +
> +#include "rtpdec_formats.h"
> +
> +#define RTP_VP9_DESC_REQUIRED_SIZE 1
> +
> +struct PayloadContext {
> +    AVIOContext *buf;
> +    uint32_t     timestamp;
> +};
> +
> +static av_cold PayloadContext *vp9_new_context(void)
> +{
> +    return av_mallocz(sizeof(PayloadContext));
> +}
> +
> +static void vp9_free_dyn_buffer(AVIOContext **dyn_buf)
> +{
> +    uint8_t *ptr_dyn_buffer;
> +    avio_close_dyn_buf(*dyn_buf, &ptr_dyn_buffer);
> +    av_free(ptr_dyn_buffer);
> +    *dyn_buf = NULL;
> +}
> +
> +static av_cold void vp9_free_context(PayloadContext *data)
> +{
> +    av_free(data);
> +}
> +
> +static av_cold int vp9_init(AVFormatContext *ctx, int st_index,
> +                             PayloadContext *data)
> +{
> +    av_dlog(ctx, "vp9_init() for stream %d\n", st_index);
> +    av_log(ctx, AV_LOG_WARNING,
> +           "RTP/VP9 support is still experimental\n");
> +
> +    if (st_index < 0)
> +        return 0;
> +
> +    ctx->streams[st_index]->need_parsing = AVSTREAM_PARSE_FULL;
> +
> +    return 0;
> +}
> +

> +static int vp9_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_vp9_ctx,
> +                             AVStream *st, AVPacket *pkt, uint32_t *timestamp,
> +                             const uint8_t *buf, int len, uint16_t seq,
> +                             int flags)
> +{
> +    int has_pic_id, has_ext_pic_id, has_layer_idc, has_ref_idc, has_ss_data, has_su_data;
> +    int pic_id = 0, non_key_frame = 0;
> +    int layer_temporal = -1, layer_spatial = -1, layer_quality = -1;
> +    int ref_fields = 0, has_ref_field_ext_pic_id = 0;
> +    int first_fragment, last_fragment;
> +    int res = 0;

these produces these warnings:

libavformat/rtpdec_vp9.c:74:50: warning: variable ‘layer_quality’ set but not used [-Wunused-but-set-variable]
libavformat/rtpdec_vp9.c:74:30: warning: variable ‘layer_spatial’ set but not used [-Wunused-but-set-variable]
libavformat/rtpdec_vp9.c:74:9: warning: variable ‘layer_temporal’ set but not used [-Wunused-but-set-variable]
libavformat/rtpdec_vp9.c:73:21: warning: variable ‘non_key_frame’ set but not used [-Wunused-but-set-variable]
libavformat/rtpdec_vp9.c:73:9: warning: variable ‘pic_id’ set but not used [-Wunused-but-set-variable]
libavformat/rtpdec_vp9.c:72:21: warning: unused variable ‘has_ext_pic_id’ [-Wunused-variable]

you can probebly supporess these with av_unused if you want to
keep the variables

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150215/070afb1b/attachment.asc>


More information about the ffmpeg-devel mailing list