Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Volkert <thomas@netzeal.de>2016-05-30 17:31:52 +0300
committerThomas Volkert <thomas@netzeal.de>2016-06-13 19:09:34 +0300
commit668fb1cb6a4ebdbf367881ca0f1b4dfd1fdafce8 (patch)
treeb19c9b20651b31b0c301fbce99fffa1499acbcb9 /libavformat/rtpenc_vp9.c
parent60de31e98c1630c11d13a4789e1dfacddc31ef9d (diff)
rtpenc: packetizer for VP9 RTP payload format (draft v2)
Diffstat (limited to 'libavformat/rtpenc_vp9.c')
-rw-r--r--libavformat/rtpenc_vp9.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/libavformat/rtpenc_vp9.c b/libavformat/rtpenc_vp9.c
new file mode 100644
index 0000000000..172ab21f1e
--- /dev/null
+++ b/libavformat/rtpenc_vp9.c
@@ -0,0 +1,54 @@
+/*
+ * RTP packetizer for VP9 payload format (draft version 02) - experimental
+ * Copyright (c) 2016 Thomas Volkert <thomas@netzeal.de>
+ *
+ * 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 "rtpenc.h"
+
+#define RTP_VP9_DESC_REQUIRED_SIZE 1
+
+void ff_rtp_send_vp9(AVFormatContext *ctx, const uint8_t *buf, int size)
+{
+ RTPMuxContext *rtp_ctx = ctx->priv_data;
+ int len;
+
+ rtp_ctx->timestamp = rtp_ctx->cur_timestamp;
+ rtp_ctx->buf_ptr = rtp_ctx->buf;
+
+ /* mark the first fragment */
+ *rtp_ctx->buf_ptr++ = 0x08;
+
+ while (size > 0) {
+ len = FFMIN(size, rtp_ctx->max_payload_size - RTP_VP9_DESC_REQUIRED_SIZE);
+
+ if (len == size) {
+ /* mark the last fragment */
+ rtp_ctx->buf[0] |= 0x04;
+ }
+
+ memcpy(rtp_ctx->buf_ptr, buf, len);
+ ff_rtp_send_data(ctx, rtp_ctx->buf, len + RTP_VP9_DESC_REQUIRED_SIZE, size == len);
+
+ size -= len;
+ buf += len;
+
+ /* clear the end bit */
+ rtp_ctx->buf[0] &= ~0x08;
+ }
+}