mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
omx: Add pads based on element type
This allows to later add sources and sink that only have a srcpad or sinkpad. https://bugzilla.gnome.org/show_bug.cgi?id=699754
This commit is contained in:
parent
2d1138f45c
commit
715b44ea66
5 changed files with 50 additions and 34 deletions
73
omx/gstomx.c
73
omx/gstomx.c
|
@ -2616,52 +2616,57 @@ _class_init (gpointer g_class, gpointer data)
|
||||||
|
|
||||||
/* Add pad templates */
|
/* Add pad templates */
|
||||||
err = NULL;
|
err = NULL;
|
||||||
if (!(template_caps =
|
if (class_data->type != GST_OMX_COMPONENT_TYPE_SOURCE) {
|
||||||
g_key_file_get_string (config, element_name, "sink-template-caps",
|
if (!(template_caps =
|
||||||
&err))) {
|
g_key_file_get_string (config, element_name, "sink-template-caps",
|
||||||
GST_DEBUG
|
&err))) {
|
||||||
("No sink template caps specified for element '%s', using default '%s'",
|
|
||||||
element_name, class_data->default_sink_template_caps);
|
|
||||||
caps = gst_caps_from_string (class_data->default_sink_template_caps);
|
|
||||||
g_assert (caps != NULL);
|
|
||||||
g_error_free (err);
|
|
||||||
} else {
|
|
||||||
caps = gst_caps_from_string (template_caps);
|
|
||||||
if (!caps) {
|
|
||||||
GST_DEBUG
|
GST_DEBUG
|
||||||
("Could not parse sink template caps '%s' for element '%s', using default '%s'",
|
("No sink template caps specified for element '%s', using default '%s'",
|
||||||
template_caps, element_name, class_data->default_sink_template_caps);
|
element_name, class_data->default_sink_template_caps);
|
||||||
caps = gst_caps_from_string (class_data->default_sink_template_caps);
|
caps = gst_caps_from_string (class_data->default_sink_template_caps);
|
||||||
g_assert (caps != NULL);
|
g_assert (caps != NULL);
|
||||||
|
g_error_free (err);
|
||||||
|
} else {
|
||||||
|
caps = gst_caps_from_string (template_caps);
|
||||||
|
if (!caps) {
|
||||||
|
GST_DEBUG
|
||||||
|
("Could not parse sink template caps '%s' for element '%s', using default '%s'",
|
||||||
|
template_caps, element_name,
|
||||||
|
class_data->default_sink_template_caps);
|
||||||
|
caps = gst_caps_from_string (class_data->default_sink_template_caps);
|
||||||
|
g_assert (caps != NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
templ = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
|
||||||
|
g_free (template_caps);
|
||||||
|
gst_element_class_add_pad_template (element_class, templ);
|
||||||
}
|
}
|
||||||
templ = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
|
|
||||||
g_free (template_caps);
|
|
||||||
gst_element_class_add_pad_template (element_class, templ);
|
|
||||||
|
|
||||||
err = NULL;
|
err = NULL;
|
||||||
if (!(template_caps =
|
if (class_data->type != GST_OMX_COMPONENT_TYPE_SINK) {
|
||||||
g_key_file_get_string (config, element_name, "src-template-caps",
|
if (!(template_caps =
|
||||||
&err))) {
|
g_key_file_get_string (config, element_name, "src-template-caps",
|
||||||
GST_DEBUG
|
&err))) {
|
||||||
("No src template caps specified for element '%s', using default '%s'",
|
|
||||||
element_name, class_data->default_src_template_caps);
|
|
||||||
caps = gst_caps_from_string (class_data->default_src_template_caps);
|
|
||||||
g_assert (caps != NULL);
|
|
||||||
g_error_free (err);
|
|
||||||
} else {
|
|
||||||
caps = gst_caps_from_string (template_caps);
|
|
||||||
if (!caps) {
|
|
||||||
GST_DEBUG
|
GST_DEBUG
|
||||||
("Could not parse src template caps '%s' for element '%s', using default '%s'",
|
("No src template caps specified for element '%s', using default '%s'",
|
||||||
template_caps, element_name, class_data->default_src_template_caps);
|
element_name, class_data->default_src_template_caps);
|
||||||
caps = gst_caps_from_string (class_data->default_src_template_caps);
|
caps = gst_caps_from_string (class_data->default_src_template_caps);
|
||||||
g_assert (caps != NULL);
|
g_assert (caps != NULL);
|
||||||
|
g_error_free (err);
|
||||||
|
} else {
|
||||||
|
caps = gst_caps_from_string (template_caps);
|
||||||
|
if (!caps) {
|
||||||
|
GST_DEBUG
|
||||||
|
("Could not parse src template caps '%s' for element '%s', using default '%s'",
|
||||||
|
template_caps, element_name, class_data->default_src_template_caps);
|
||||||
|
caps = gst_caps_from_string (class_data->default_src_template_caps);
|
||||||
|
g_assert (caps != NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
|
||||||
|
g_free (template_caps);
|
||||||
|
gst_element_class_add_pad_template (element_class, templ);
|
||||||
}
|
}
|
||||||
templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
|
|
||||||
g_free (template_caps);
|
|
||||||
gst_element_class_add_pad_template (element_class, templ);
|
|
||||||
|
|
||||||
if ((hacks =
|
if ((hacks =
|
||||||
g_key_file_get_string_list (config, element_name, "hacks", NULL,
|
g_key_file_get_string_list (config, element_name, "hacks", NULL,
|
||||||
|
|
|
@ -156,6 +156,12 @@ typedef enum {
|
||||||
GST_OMX_MESSAGE_BUFFER_DONE,
|
GST_OMX_MESSAGE_BUFFER_DONE,
|
||||||
} GstOMXMessageType;
|
} GstOMXMessageType;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
GST_OMX_COMPONENT_TYPE_SINK,
|
||||||
|
GST_OMX_COMPONENT_TYPE_SOURCE,
|
||||||
|
GST_OMX_COMPONENT_TYPE_FILTER
|
||||||
|
} GstOmxComponentType;
|
||||||
|
|
||||||
struct _GstOMXMessage {
|
struct _GstOMXMessage {
|
||||||
GstOMXMessageType type;
|
GstOMXMessageType type;
|
||||||
|
|
||||||
|
@ -272,6 +278,8 @@ struct _GstOMXClassData {
|
||||||
guint32 in_port_index, out_port_index;
|
guint32 in_port_index, out_port_index;
|
||||||
|
|
||||||
guint64 hacks;
|
guint64 hacks;
|
||||||
|
|
||||||
|
GstOmxComponentType type;
|
||||||
};
|
};
|
||||||
|
|
||||||
GKeyFile * gst_omx_get_configuration (void);
|
GKeyFile * gst_omx_get_configuration (void);
|
||||||
|
|
|
@ -85,6 +85,7 @@ gst_omx_audio_enc_class_init (GstOMXAudioEncClass * klass)
|
||||||
audio_encoder_class->sink_event =
|
audio_encoder_class->sink_event =
|
||||||
GST_DEBUG_FUNCPTR (gst_omx_audio_enc_sink_event);
|
GST_DEBUG_FUNCPTR (gst_omx_audio_enc_sink_event);
|
||||||
|
|
||||||
|
klass->cdata.type = GST_OMX_COMPONENT_TYPE_FILTER;
|
||||||
klass->cdata.default_sink_template_caps = "audio/x-raw, "
|
klass->cdata.default_sink_template_caps = "audio/x-raw, "
|
||||||
"rate = (int) [ 1, MAX ], "
|
"rate = (int) [ 1, MAX ], "
|
||||||
"channels = (int) [ 1, " G_STRINGIFY (OMX_AUDIO_MAXCHANNELS) " ], "
|
"channels = (int) [ 1, " G_STRINGIFY (OMX_AUDIO_MAXCHANNELS) " ], "
|
||||||
|
|
|
@ -727,6 +727,7 @@ gst_omx_video_dec_class_init (GstOMXVideoDecClass * klass)
|
||||||
video_decoder_class->decide_allocation =
|
video_decoder_class->decide_allocation =
|
||||||
GST_DEBUG_FUNCPTR (gst_omx_video_dec_decide_allocation);
|
GST_DEBUG_FUNCPTR (gst_omx_video_dec_decide_allocation);
|
||||||
|
|
||||||
|
klass->cdata.type = GST_OMX_COMPONENT_TYPE_FILTER;
|
||||||
klass->cdata.default_src_template_caps = "video/x-raw, "
|
klass->cdata.default_src_template_caps = "video/x-raw, "
|
||||||
"width = " GST_VIDEO_SIZE_RANGE ", "
|
"width = " GST_VIDEO_SIZE_RANGE ", "
|
||||||
"height = " GST_VIDEO_SIZE_RANGE ", " "framerate = " GST_VIDEO_FPS_RANGE;
|
"height = " GST_VIDEO_SIZE_RANGE ", " "framerate = " GST_VIDEO_FPS_RANGE;
|
||||||
|
|
|
@ -192,6 +192,7 @@ gst_omx_video_enc_class_init (GstOMXVideoEncClass * klass)
|
||||||
GST_DEBUG_FUNCPTR (gst_omx_video_enc_propose_allocation);
|
GST_DEBUG_FUNCPTR (gst_omx_video_enc_propose_allocation);
|
||||||
video_encoder_class->getcaps = GST_DEBUG_FUNCPTR (gst_omx_video_enc_getcaps);
|
video_encoder_class->getcaps = GST_DEBUG_FUNCPTR (gst_omx_video_enc_getcaps);
|
||||||
|
|
||||||
|
klass->cdata.type = GST_OMX_COMPONENT_TYPE_FILTER;
|
||||||
klass->cdata.default_sink_template_caps = "video/x-raw, "
|
klass->cdata.default_sink_template_caps = "video/x-raw, "
|
||||||
"width = " GST_VIDEO_SIZE_RANGE ", "
|
"width = " GST_VIDEO_SIZE_RANGE ", "
|
||||||
"height = " GST_VIDEO_SIZE_RANGE ", " "framerate = " GST_VIDEO_FPS_RANGE;
|
"height = " GST_VIDEO_SIZE_RANGE ", " "framerate = " GST_VIDEO_FPS_RANGE;
|
||||||
|
|
Loading…
Reference in a new issue