G_BEGIN_DECLS
-#define GST_KATE_MEDIA_TYPE "subtitle/x-kate"
+/* nothing here any more */
G_END_DECLS
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_KATE_MEDIA_TYPE)
+ GST_STATIC_CAPS ("subtitle/x-kate")
);
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_KATE_MEDIA_TYPE)
+ GST_STATIC_CAPS ("subtitle/x-kate; application/x-kate")
);
static void gst_kate_enc_set_property (GObject * object, guint prop_id,
}
if (rflow == GST_FLOW_OK) {
- caps =
- gst_kate_util_set_header_on_caps (&ke->element,
- gst_pad_get_caps (ke->srcpad), headers);
+ if (ke->category != NULL && strstr (ke->category, "subtitle")) {
+ caps = gst_kate_util_set_header_on_caps (&ke->element,
+ gst_caps_from_string ("subtitle/x-kate"), headers);
+ } else {
+ caps = gst_kate_util_set_header_on_caps (&ke->element,
+ gst_caps_from_string ("application/x-kate"), headers);
+ }
if (caps) {
GST_DEBUG_OBJECT (ke, "here are the caps: %" GST_PTR_FORMAT, caps);
gst_pad_set_caps (ke->srcpad, caps);
"Vincent Penquerc'h <ogg.k.ogg.k at googlemail dot com>");
static GstStaticPadTemplate gst_kate_parse_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_KATE_MEDIA_TYPE)
+ GST_STATIC_CAPS ("subtitle/x-kate; application/x-kate")
);
static GstStaticPadTemplate gst_kate_parse_src_factory =
-GST_STATIC_PAD_TEMPLATE ("src",
+ GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_KATE_MEDIA_TYPE)
+ GST_STATIC_CAPS ("subtitle/x-kate; application/x-kate")
);
GST_BOILERPLATE (GstKateParse, gst_kate_parse, GstElement, GST_TYPE_ELEMENT);
/* get the headers into the caps, passing them to kate as we go */
caps =
gst_kate_util_set_header_on_caps (&parse->element,
- gst_pad_get_caps (parse->srcpad), parse->streamheader);
+ gst_pad_get_negotiated_caps (parse->sinkpad), parse->streamheader);
+
if (G_UNLIKELY (!caps)) {
GST_ERROR_OBJECT (parse, "Failed to set headers on caps");
return GST_FLOW_ERROR;
g_assert (klass->parse_packet != NULL);
+ if (G_UNLIKELY (GST_PAD_CAPS (pad) == NULL))
+ return GST_FLOW_NOT_NEGOTIATED;
+
return klass->parse_packet (parse, buffer);
}
ARG_DEFAULT_BACKGROUND_RED,
ARG_DEFAULT_BACKGROUND_GREEN,
ARG_DEFAULT_BACKGROUND_BLUE,
- ARG_DEFAULT_BACKGROUND_ALPHA,
+ ARG_DEFAULT_BACKGROUND_ALPHA
};
static GstStaticPadTemplate kate_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("kate_sink",
+ GST_STATIC_PAD_TEMPLATE ("kate_sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_KATE_MEDIA_TYPE)
+ GST_STATIC_CAPS ("subtitle/x-kate; application/x-kate")
);
static GstStaticPadTemplate video_sink_factory =
GST_DEBUG_FUNCPTR (gst_kate_tiger_kate_chain));
gst_pad_set_query_function (tiger->katesinkpad,
GST_DEBUG_FUNCPTR (gst_kate_tiger_kate_sink_query));
- gst_pad_use_fixed_caps (tiger->katesinkpad);
- gst_pad_set_caps (tiger->katesinkpad,
- gst_static_pad_template_get_caps (&kate_sink_factory));
- gst_pad_set_event_function (tiger->katesinkpad, gst_kate_tiger_kate_event);
+ gst_pad_set_event_function (tiger->katesinkpad,
+ GST_DEBUG_FUNCPTR (gst_kate_tiger_kate_event));
gst_element_add_pad (GST_ELEMENT (tiger), tiger->katesinkpad);
tiger->videosinkpad =
GstStructure *structure;
GValue array = { 0 };
+ GST_LOG_OBJECT (element, "caps: %" GST_PTR_FORMAT, caps);
+
if (G_UNLIKELY (!caps))
return NULL;
if (G_UNLIKELY (!headers))
0x72, 0x29, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x54, 0x49, 0x54, 0x4c, 0x45, 0x3d, /* r)........TITLE= */
0x54, 0x69, 0x67, 0x65, 0x72, /* Tiger */
};
+
static const guint8 kate_header_0x8x[10] = {
0x80, 0x6b, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00
};
+
static const guint8 kate_header_0x88[11] = {
0x88, 0x6b, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00
};
+
static const guint8 kate_header_0x00[45] = {
0x00, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, /* ................ */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x70, 0x6c, 0x61, /* .............pla */
0x69, 0x6e, 0x20, 0x6f, 0x6c, 0x64, 0x20, 0x74, 0x65, 0x78, 0x74, 0x08, 0x00 /* in old text.. */
};
+
static const guint8 kate_header_0x01[1] = {
0x01
};
+
static const guint8 kate_header_0x7f[1] = {
0x7f
};
test_kate_send_headers (GstPad * pad)
{
GstBuffer *inbuffer;
+ GstCaps *caps;
int i;
+ caps = gst_caps_new_simple ("subtitle/x-kate", NULL);
+
/* push headers */
inbuffer = gst_buffer_new ();
+ gst_buffer_set_caps (inbuffer, caps);
GST_BUFFER_DATA (inbuffer) = (guint8 *) kate_header_0x80;
GST_BUFFER_SIZE (inbuffer) = sizeof (kate_header_0x80);
GST_BUFFER_OFFSET (inbuffer) = GST_BUFFER_OFFSET_END (inbuffer) = 0;
fail_unless_equals_int (gst_pad_push (pad, inbuffer), GST_FLOW_OK);
inbuffer = gst_buffer_new ();
+ gst_buffer_set_caps (inbuffer, caps);
GST_BUFFER_DATA (inbuffer) = (guint8 *) kate_header_0x81;
GST_BUFFER_SIZE (inbuffer) = sizeof (kate_header_0x81);
GST_BUFFER_OFFSET (inbuffer) = GST_BUFFER_OFFSET_END (inbuffer) = 0;
for (i = 2; i < 8; ++i) {
inbuffer = gst_buffer_new_and_alloc (sizeof (kate_header_0x8x));
+ gst_buffer_set_caps (inbuffer, caps);
memcpy (GST_BUFFER_DATA (inbuffer), (guint8 *) kate_header_0x8x,
sizeof (kate_header_0x8x));
GST_BUFFER_DATA (inbuffer)[0] = 0x80 | i;
}
inbuffer = gst_buffer_new ();
+ gst_buffer_set_caps (inbuffer, caps);
GST_BUFFER_DATA (inbuffer) = (guint8 *) kate_header_0x88;
GST_BUFFER_SIZE (inbuffer) = sizeof (kate_header_0x88);
GST_BUFFER_OFFSET (inbuffer) = GST_BUFFER_OFFSET_END (inbuffer) = 0;
fail_unless_equals_int (gst_pad_push (pad, inbuffer), GST_FLOW_OK);
+
+ gst_caps_unref (caps);
}
GST_START_TEST (test_kate_parse)