summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjitendra <jvarshney20@gmail.com>2013-05-06 19:03:59 +0530
committerJosep Torra <n770galaxy@gmail.com>2013-05-10 10:30:51 +0200
commit7ba0aff3a3941485bec808339bdbc381d1f22691 (patch)
treeefa5124a56e49ce726cb23e40b69b8c01409cafe
parent59175ca4ca0308be6a971fc01df22389e485c1b7 (diff)
downloadgst-omx-7ba0aff3a3941485bec808339bdbc381d1f22691.tar.gz
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 Conflicts: omx/gstomxaudioenc.c omx/gstomxvideodec.c omx/gstomxvideoenc.c
-rw-r--r--omx/gstomx.c73
-rw-r--r--omx/gstomx.h8
-rw-r--r--omx/gstomxaudioenc.c1
-rw-r--r--omx/gstomxvideodec.c1
-rw-r--r--omx/gstomxvideoenc.c1
5 files changed, 50 insertions, 34 deletions
diff --git a/omx/gstomx.c b/omx/gstomx.c
index e7a1660..2541799 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -2623,52 +2623,57 @@ _class_init (gpointer g_class, gpointer data)
/* Add pad templates */
err = NULL;
- if (!(template_caps =
- g_key_file_get_string (config, element_name, "sink-template-caps",
- &err))) {
- GST_DEBUG
- ("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) {
+ if (class_data->type != GST_OMX_COMPONENT_TYPE_SOURCE) {
+ if (!(template_caps =
+ g_key_file_get_string (config, element_name, "sink-template-caps",
+ &err))) {
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);
+ ("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
+ ("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;
- if (!(template_caps =
- g_key_file_get_string (config, element_name, "src-template-caps",
- &err))) {
- GST_DEBUG
- ("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) {
+ if (class_data->type != GST_OMX_COMPONENT_TYPE_SINK) {
+ if (!(template_caps =
+ g_key_file_get_string (config, element_name, "src-template-caps",
+ &err))) {
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);
+ ("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
+ ("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 =
g_key_file_get_string_list (config, element_name, "hacks", NULL,
diff --git a/omx/gstomx.h b/omx/gstomx.h
index b89dfd7..6911725 100644
--- a/omx/gstomx.h
+++ b/omx/gstomx.h
@@ -168,6 +168,12 @@ typedef enum {
GST_OMX_MESSAGE_BUFFER_DONE,
} GstOMXMessageType;
+typedef enum {
+ GST_OMX_COMPONENT_TYPE_SINK,
+ GST_OMX_COMPONENT_TYPE_SOURCE,
+ GST_OMX_COMPONENT_TYPE_FILTER
+} GstOmxComponentType;
+
struct _GstOMXMessage {
GstOMXMessageType type;
@@ -284,6 +290,8 @@ struct _GstOMXClassData {
guint32 in_port_index, out_port_index;
guint64 hacks;
+
+ GstOmxComponentType type;
};
GKeyFile * gst_omx_get_configuration (void);
diff --git a/omx/gstomxaudioenc.c b/omx/gstomxaudioenc.c
index 584cd2a..c4bdcbc 100644
--- a/omx/gstomxaudioenc.c
+++ b/omx/gstomxaudioenc.c
@@ -89,6 +89,7 @@ gst_omx_audio_enc_class_init (GstOMXAudioEncClass * klass)
GST_DEBUG_FUNCPTR (gst_omx_audio_enc_handle_frame);
audio_encoder_class->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-int, "
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, " G_STRINGIFY (OMX_AUDIO_MAXCHANNELS) " ], "
diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
index a7da459..cdecf84 100644
--- a/omx/gstomxvideodec.c
+++ b/omx/gstomxvideodec.c
@@ -133,6 +133,7 @@ gst_omx_video_dec_class_init (GstOMXVideoDecClass * klass)
GST_DEBUG_FUNCPTR (gst_omx_video_dec_handle_frame);
video_decoder_class->finish = GST_DEBUG_FUNCPTR (gst_omx_video_dec_finish);
+ klass->cdata.type = GST_OMX_COMPONENT_TYPE_FILTER;
klass->cdata.default_src_template_caps = "video/x-raw-yuv, "
"width = " GST_VIDEO_SIZE_RANGE ", "
"height = " GST_VIDEO_SIZE_RANGE ", " "framerate = " GST_VIDEO_FPS_RANGE
diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c
index 40a381c..9d528fb 100644
--- a/omx/gstomxvideoenc.c
+++ b/omx/gstomxvideoenc.c
@@ -191,6 +191,7 @@ gst_omx_video_enc_class_init (GstOMXVideoEncClass * klass)
video_encoder_class->finish = GST_DEBUG_FUNCPTR (gst_omx_video_enc_finish);
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-yuv, "
"width = " GST_VIDEO_SIZE_RANGE ", "
"height = " GST_VIDEO_SIZE_RANGE ", " "framerate = " GST_VIDEO_FPS_RANGE;