summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrijesh.singh <brijesh.singh@24075187-2e39-4e88-bbb8-bc8aa768f540>2011-03-12 17:00:24 +0000
committerbrijesh.singh <brijesh.singh@24075187-2e39-4e88-bbb8-bc8aa768f540>2011-03-12 17:00:24 +0000
commit4863b1b0a492c356cab9ad5a0015faf99b577176 (patch)
treeda21ea1d302bd869508aa21eec138b2650b36344
parent9a4dae797bb9fcdfa8473a50968e6d30889857e1 (diff)
viddec2: if height and width is passed during cap negotiation then configure codec maxHeight and maxWidth with this information.r919
Note: typically demuxer provides height/width and one can use stream parsers (like h264parse, mpeg4videoparse, mpegvideoparse) to retrive this information from elementory streams. git-svn-id: https://gstreamer.ti.com/svn/gstreamer_ti/trunk@919 24075187-2e39-4e88-bbb8-bc8aa768f540
-rw-r--r--gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.c23
-rw-r--r--gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.h1
2 files changed, 23 insertions, 1 deletions
diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.c
index ea43f7b..880c82e 100644
--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.c
+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.c
@@ -476,6 +476,9 @@ static void gst_tividdec2_init(GstTIViddec2 *viddec2, GstTIViddec2Class *gclass)
viddec2->rtCodecThread = TRUE;
+ viddec2->width = 0;
+ viddec2->height = 0;
+
/* Initialize GValue members */
memset(&viddec2->framerate, 0, sizeof(GValue));
g_value_init(&viddec2->framerate, GST_TYPE_FRACTION);
@@ -635,6 +638,16 @@ static gboolean gst_tividdec2_set_sink_caps(GstPad *pad, GstCaps *caps)
framerateDen);
}
}
+
+ if (viddec2->width == 0 &&
+ !gst_structure_get_int(capStruct, "width", &viddec2->width)) {
+ viddec2->width = 0;
+ }
+
+ if (viddec2->height == 0 &&
+ !gst_structure_get_int(capStruct, "height", &viddec2->height)) {
+ viddec2->height = 0;
+ }
}
/* MPEG Decode */
@@ -708,10 +721,11 @@ static gboolean gst_tividdec2_set_sink_caps(GstPad *pad, GstCaps *caps)
if (!viddec2->engineName) {
viddec2->engineName = codec->CE_EngineName;
}
+
if (!viddec2->codecName) {
viddec2->codecName = codec->CE_CodecName;
}
-
+
gst_object_unref(viddec2);
GST_LOG("sink caps negotiation successful\n");
@@ -955,6 +969,7 @@ static GstFlowReturn gst_tividdec2_chain(GstPad * pad, GstBuffer * buf)
GstFlowReturn flow = GST_FLOW_OK;
gboolean checkResult;
+
/* If the decode thread aborted, signal it to let it know it's ok to
* shut down, and communicate the failure to the pipeline.
*/
@@ -1370,6 +1385,12 @@ static gboolean gst_tividdec2_codec_start (GstTIViddec2 *viddec2,
break;
}
+ /* If height and width is passed then configure codec params with this information */
+ if (viddec2->width > 0 && viddec2->height > 0) {
+ params.maxWidth = viddec2->width;
+ params.maxHeight = viddec2->height;
+ }
+
GST_LOG("opening video decoder \"%s\"\n", viddec2->codecName);
viddec2->hVd = Vdec2_create(viddec2->hEngine, (Char*)viddec2->codecName,
&params, &dynParams);
diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.h b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.h
index 6b09d2a..6232f48 100644
--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.h
+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.h
@@ -78,6 +78,7 @@ struct _GstTIViddec2
pthread_mutex_t threadStatusMutex;
UInt32 threadStatus;
gboolean firstFrame;
+ gint width, height;
/* Decode thread */
pthread_t decodeThread;