#include <gst/base/gstbitreader.h>
#include <gst/rtp/gstrtppayloads.h>
#include <gst/rtp/gstrtpbuffer.h>
+#include <gst/video/video.h>
#include "dboolhuff.h"
#include "gstrtpvp8pay.h"
+#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (gst_rtp_vp8_pay_debug);
#define GST_CAT_DEFAULT gst_rtp_vp8_pay_debug
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("application/x-rtp, "
"payload = (int) " GST_RTP_PAYLOAD_DYNAMIC_STRING ","
- "clock-rate = (int) 90000, encoding-name = (string) \"VP8-DRAFT-IETF-01\""));
+ "clock-rate = (int) 90000, encoding-name = (string) { \"VP8\", \"VP8-DRAFT-IETF-01\" }"));
static GstStaticPadTemplate gst_rtp_vp8_pay_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_TYPE_RTP_VP8_PAY_PICTURE_ID_MODE, DEFAULT_PICTURE_ID_MODE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_rtp_vp8_pay_sink_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_rtp_vp8_pay_src_template));
+ gst_element_class_add_static_pad_template (element_class,
+ &gst_rtp_vp8_pay_sink_template);
+ gst_element_class_add_static_pad_template (element_class,
+ &gst_rtp_vp8_pay_src_template);
gst_element_class_set_static_metadata (element_class, "RTP VP8 payloader",
"Codec/Payloader/Network/RTP",
- "Puts VP8 video in RTP packets)", "Sjoerd Simons <sjoerd@luon.net>");
+ "Puts VP8 video in RTP packets", "Sjoerd Simons <sjoerd@luon.net>");
pay_class->handle_buffer = gst_rtp_vp8_pay_handle_buffer;
pay_class->sink_event = gst_rtp_vp8_pay_sink_event;
GST_DEBUG_CATEGORY_INIT (gst_rtp_vp8_pay_debug, "rtpvp8pay", 0,
"VP8 Video RTP Payloader");
+
+#ifndef TIZEN_FEATURE_GST_UPSTREAM_AVOID_BUILD_BREAK
+ gst_type_mark_as_plugin_api (GST_TYPE_RTP_VP8_PAY_PICTURE_ID_MODE, 0);
+#endif
}
static void
{
int i;
- for (i = 0; i < self->n_partitions; i++) {
- if (offset >= self->partition_offset[i] &&
- offset < self->partition_offset[i + 1])
- return i;
+ for (i = 1; i < self->n_partitions; i++) {
+ if (offset < self->partition_offset[i])
+ return i - 1;
}
- return i;
+ return i - 1;
}
static gsize
return out;
}
-
static guint
gst_rtp_vp8_payload_next (GstRtpVP8Pay * self, GstBufferList * list,
guint offset, GstBuffer * buffer, gsize buffer_size, gsize max_payload_len)
offset == self->partition_offset[partition], mark, buffer);
sub = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, offset, available);
+ gst_rtp_copy_video_meta (self, header, buffer);
+
out = gst_buffer_append (header, sub);
gst_buffer_list_insert (list, -1, out);
static gboolean
gst_rtp_vp8_pay_set_caps (GstRTPBasePayload * payload, GstCaps * caps)
{
+ GstCaps *src_caps;
+ const char *encoding_name = "VP8";
+
+ src_caps = gst_pad_get_allowed_caps (GST_RTP_BASE_PAYLOAD_SRCPAD (payload));
+ if (src_caps) {
+ GstStructure *s;
+ const GValue *value;
+
+ s = gst_caps_get_structure (src_caps, 0);
+
+ if (gst_structure_has_field (s, "encoding-name")) {
+ GValue default_value = G_VALUE_INIT;
+
+ g_value_init (&default_value, G_TYPE_STRING);
+ g_value_set_static_string (&default_value, encoding_name);
+
+ value = gst_structure_get_value (s, "encoding-name");
+ if (!gst_value_can_intersect (&default_value, value))
+ encoding_name = "VP8-DRAFT-IETF-01";
+ }
+ gst_caps_unref (src_caps);
+ }
+
gst_rtp_base_payload_set_options (payload, "video", TRUE,
- "VP8-DRAFT-IETF-01", 90000);
+ encoding_name, 90000);
+
return gst_rtp_base_payload_set_outcaps (payload, NULL);
}