GValue * value, GParamSpec * pspec);
static GstFlowReturn gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buffer);
+static GstCaps *gst_jpeg_dec_getcaps (GstPad * pad);
static gboolean gst_jpeg_dec_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_jpeg_dec_src_event (GstPad * pad, GstEvent * event);
static GstStateChangeReturn gst_jpeg_dec_change_state (GstElement * element,
gst_pad_new_from_static_template (&gst_jpeg_dec_sink_pad_template,
"sink");
gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
+ gst_pad_set_getcaps_function (dec->sinkpad,
+ GST_DEBUG_FUNCPTR (gst_jpeg_dec_getcaps));
gst_pad_set_chain_function (dec->sinkpad,
GST_DEBUG_FUNCPTR (gst_jpeg_dec_chain));
gst_pad_set_event_function (dec->sinkpad,
return TRUE;
}
+static GstCaps *
+gst_jpeg_dec_getcaps (GstPad * pad, GstCaps * filter)
+{
+ GstJpegDec *dec;
+ GstCaps *caps;
+ GstPad *peer;
+
+ dec = GST_JPEG_DEC (GST_OBJECT_PARENT (pad));
+
+ if (GST_PAD_CAPS (pad))
+ return gst_caps_ref (GST_PAD_CAPS (pad));
+
+ peer = gst_pad_get_peer (dec->srcpad);
+
+ if (peer) {
+ GstCaps *peer_caps;
+ const GstCaps *templ_caps;
+ GstStructure *s;
+ guint i, n;
+
+ peer_caps = gst_pad_get_caps (peer, filter);
+
+ /* Translate peercaps to image/jpeg */
+ peer_caps = gst_caps_make_writable (peer_caps);
+ n = gst_caps_get_size (peer_caps);
+ for (i = 0; i < n; i++) {
+ s = gst_caps_get_structure (peer_caps, i);
+
+ gst_structure_set_name (s, "image/jpeg");
+ }
+
+ templ_caps = gst_pad_get_pad_template_caps (pad);
+ caps = gst_caps_intersect_full (peer_caps, templ_caps,
+ GST_CAPS_INTERSECT_FIRST);
+
+ gst_object_unref (peer);
+ } else {
+ caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+ }
+
+ return caps;
+}
+
+
/* yuk */
static void
hresamplecpy1 (guint8 * dest, const guint8 * src, guint len)
entry->pos + demux->common.ebml_segment_start);
}
- flush = !!(flags & GST_SEEK_FLAG_FLUSH);
- keyunit = !!(flags & GST_SEEK_FLAG_KEY_UNIT);
+ flush = ! !(flags & GST_SEEK_FLAG_FLUSH);
+ keyunit = ! !(flags & GST_SEEK_FLAG_KEY_UNIT);
if (flush) {
GST_DEBUG_OBJECT (demux, "Starting flush");
"framed", G_TYPE_BOOLEAN, TRUE, NULL);
gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, priv, NULL);
*codec_name = g_strdup_printf ("MPEG-%d AAC audio", mpegversion);
+ gst_buffer_unref (priv);
}
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_TTA)) {
caps = gst_caps_new_simple ("audio/x-tta",
event = NULL;
break;
}
- case GST_EVENT_NEWSEGMENT:
- /* We don't support NEWSEGMENT events */
- ret = FALSE;
- gst_event_unref (event);
- event = NULL;
+ case GST_EVENT_NEWSEGMENT:{
+ GstFormat format;
+
+ gst_event_parse_new_segment (event, NULL, NULL, &format, NULL, NULL,
+ NULL);
+ if (format != GST_FORMAT_TIME) {
+ ret = FALSE;
+ gst_event_unref (event);
+ event = NULL;
+ }
break;
+ }
case GST_EVENT_CUSTOM_DOWNSTREAM:{
const GstStructure *structure;
collect_pad->buffer = NULL;
return NULL;
} else {
+ GST_LOG_OBJECT (mux, "buffer ts %" GST_TIME_FORMAT " -> %"
+ GST_TIME_FORMAT " running time",
+ GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (collect_pad->buffer)),
+ GST_TIME_ARGS (time));
collect_pad->buffer =
gst_buffer_make_metadata_writable (collect_pad->buffer);
GST_BUFFER_TIMESTAMP (collect_pad->buffer) = time;
rtpg722pay->rate = rate;
rtpg722pay->channels = channels;
- /* octet-per-sample is 1 * channels for G722 */
+ /* bits-per-sample is 4 * channels for G722, but as the RTP clock runs at
+ * half speed (8 instead of 16 khz), pretend it's 8 bits per sample
+ * channels. */
gst_base_rtp_audio_payload_set_samplebits_options (basertpaudiopayload,
- 4 * rtpg722pay->channels);
+ 8 * rtpg722pay->channels);
return res;