mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
ffmpeg: change getcaps to query
This commit is contained in:
parent
54fdd9faf7
commit
175a092331
2 changed files with 33 additions and 6 deletions
|
@ -475,7 +475,7 @@ gst_ffmpegdec_src_query (GstPad * pad, GstQuery * query)
|
||||||
ffmpegdec = (GstFFMpegDec *) gst_pad_get_parent (pad);
|
ffmpegdec = (GstFFMpegDec *) gst_pad_get_parent (pad);
|
||||||
|
|
||||||
/* just forward to peer */
|
/* just forward to peer */
|
||||||
res = gst_pad_peer_query (ffmpegdec->sinkpad, query);
|
res = gst_pad_query_default (pad, query);
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
GstFormat bfmt;
|
GstFormat bfmt;
|
||||||
|
|
|
@ -105,6 +105,7 @@ static GstFlowReturn gst_ffmpegenc_chain_audio (GstPad * pad,
|
||||||
GstBuffer * buffer);
|
GstBuffer * buffer);
|
||||||
static gboolean gst_ffmpegenc_event_sink (GstPad * pad, GstEvent * event);
|
static gboolean gst_ffmpegenc_event_sink (GstPad * pad, GstEvent * event);
|
||||||
static gboolean gst_ffmpegenc_event_src (GstPad * pad, GstEvent * event);
|
static gboolean gst_ffmpegenc_event_src (GstPad * pad, GstEvent * event);
|
||||||
|
static gboolean gst_ffmpegenc_query_sink (GstPad * pad, GstQuery * query);
|
||||||
|
|
||||||
static void gst_ffmpegenc_set_property (GObject * object,
|
static void gst_ffmpegenc_set_property (GObject * object,
|
||||||
guint prop_id, const GValue * value, GParamSpec * pspec);
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
||||||
|
@ -242,7 +243,7 @@ gst_ffmpegenc_init (GstFFMpegEnc * ffmpegenc)
|
||||||
|
|
||||||
/* setup pads */
|
/* setup pads */
|
||||||
ffmpegenc->sinkpad = gst_pad_new_from_template (oclass->sinktempl, "sink");
|
ffmpegenc->sinkpad = gst_pad_new_from_template (oclass->sinktempl, "sink");
|
||||||
gst_pad_set_getcaps_function (ffmpegenc->sinkpad, gst_ffmpegenc_getcaps);
|
gst_pad_set_query_function (ffmpegenc->sinkpad, gst_ffmpegenc_query_sink);
|
||||||
ffmpegenc->srcpad = gst_pad_new_from_template (oclass->srctempl, "src");
|
ffmpegenc->srcpad = gst_pad_new_from_template (oclass->srctempl, "src");
|
||||||
gst_pad_use_fixed_caps (ffmpegenc->srcpad);
|
gst_pad_use_fixed_caps (ffmpegenc->srcpad);
|
||||||
|
|
||||||
|
@ -1174,16 +1175,18 @@ gst_ffmpegenc_event_sink (GstPad * pad, GstEvent * event)
|
||||||
break;
|
break;
|
||||||
/* no flushing if flush received,
|
/* no flushing if flush received,
|
||||||
* buffers in encoder are considered (in the) past */
|
* buffers in encoder are considered (in the) past */
|
||||||
|
case GST_EVENT_CUSTOM_DOWNSTREAM:
|
||||||
case GST_EVENT_CUSTOM_DOWNSTREAM:{
|
{
|
||||||
const GstStructure *s;
|
const GstStructure *s;
|
||||||
|
|
||||||
s = gst_event_get_structure (event);
|
s = gst_event_get_structure (event);
|
||||||
if (gst_structure_has_name (s, "GstForceKeyUnit")) {
|
if (gst_structure_has_name (s, "GstForceKeyUnit")) {
|
||||||
ffmpegenc->picture->pict_type = FF_I_TYPE;
|
ffmpegenc->picture->pict_type = FF_I_TYPE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_EVENT_CAPS:{
|
case GST_EVENT_CAPS:
|
||||||
|
{
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
|
@ -1191,7 +1194,6 @@ gst_ffmpegenc_event_sink (GstPad * pad, GstEvent * event)
|
||||||
ret = gst_ffmpegenc_setcaps (ffmpegenc, caps);
|
ret = gst_ffmpegenc_setcaps (ffmpegenc, caps);
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
return ret;
|
return ret;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1230,6 +1232,31 @@ gst_ffmpegenc_event_src (GstPad * pad, GstEvent * event)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_ffmpegenc_query_sink (GstPad * pad, GstQuery * query)
|
||||||
|
{
|
||||||
|
gboolean res = FALSE;
|
||||||
|
|
||||||
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
|
case GST_QUERY_CAPS:
|
||||||
|
{
|
||||||
|
GstCaps *filter, *caps;
|
||||||
|
|
||||||
|
gst_query_parse_caps (query, &filter);
|
||||||
|
caps = gst_ffmpegenc_getcaps (pad, filter);
|
||||||
|
gst_query_set_caps_result (query, caps);
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
res = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
res = gst_pad_query_default (pad, query);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_ffmpegenc_set_property (GObject * object,
|
gst_ffmpegenc_set_property (GObject * object,
|
||||||
guint prop_id, const GValue * value, GParamSpec * pspec)
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
||||||
|
|
Loading…
Reference in a new issue