aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dechesne <nicolas.dechesne@linaro.org>2014-09-26 16:05:17 +0000
committerprasanth kamuju <prasanth.kamuju@linaro.org>2014-10-07 16:30:09 +0530
commitfa2c5383bcfcf697708f142d2e5e3b2f5a58011f (patch)
treec90627959196e50cab0240b57138e2783ef84886
parentab28513b834a31ff3eebcd450efae9734876ccda (diff)
qcvideodec: parse caps to detect codec info and pass down to driver
We want to try to reuse the same element for all the supported codecs, so let's look at the CAPS and configure the downstream codec accordingly. Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
-rw-r--r--src/gstqcvideodec.c53
1 files changed, 50 insertions, 3 deletions
diff --git a/src/gstqcvideodec.c b/src/gstqcvideodec.c
index 34ded39..51d93e2 100644
--- a/src/gstqcvideodec.c
+++ b/src/gstqcvideodec.c
@@ -85,7 +85,25 @@ enum
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/mpeg")
+ GST_STATIC_CAPS (
+ "video/mpeg, "
+ "mpegversion=(int) 4, "
+ "systemstream=(boolean) false, "
+ "width=(int) [1,2048], "
+ "height=(int) [1,2048]"
+ ";"
+ "video/x-divx, "
+ "divxversion = (int)[3, 5], "
+ "width=(int) [1,2048], "
+ "height=(int) [1,2048]"
+ ";"
+ "video/x-h264, "
+ "parsed=(boolean)true, "
+ "alignment=(string) au, "
+ "stream-format=(string) byte-stream, "
+ "width=(int) [1,2048], "
+ "height=(int) [1,2048]"
+ )
);
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
@@ -301,6 +319,7 @@ static gboolean gst_qcvideodec_set_format (GstVideoDecoder * decoder,GstVideoCod
GstCaps *caps;
gchar *caps_data;
+ GstStructure *structure;
GstVideoFormat fmt = GST_VIDEO_FORMAT_NV12_64Z32;
@@ -322,8 +341,36 @@ static gboolean gst_qcvideodec_set_format (GstVideoDecoder * decoder,GstVideoCod
g_print("\n gst_qcvideodec_set_format Enter: data_size : %d \n",minfo.size);
g_print("\n gst_qcvideodec_set_format Enter: width : %d , Height : %d \n",Vinfo->width,Vinfo->height);
- // dec->decoder_format = VDEC_CODECTYPE_H264;
- dec->decoder_format = VDEC_CODECTYPE_MPEG4;
+ structure = gst_caps_get_structure (state->caps, 0);
+
+ if (gst_structure_has_name(structure, "video/mpeg")) {
+ dec->decoder_format = VDEC_CODECTYPE_MPEG4;
+ } else if (gst_structure_has_name(structure, "video/x-divx")) {
+ int version;
+ gst_structure_get_int (structure, "divxversion", &version);
+ switch (version) {
+ case 3:
+ dec->decoder_format = VDEC_CODECTYPE_DIVX_3;
+ break;
+ case 4:
+ dec->decoder_format = VDEC_CODECTYPE_DIVX_4;
+ break;
+ case 5:
+ dec->decoder_format = VDEC_CODECTYPE_DIVX_5;
+ break;
+ case 6:
+ dec->decoder_format = VDEC_CODECTYPE_DIVX_6;
+ break;
+ default:
+ g_print("OUCH\n");
+ }
+ } else if (gst_structure_has_name(structure, "video/x-h264")) {
+ dec->decoder_format = VDEC_CODECTYPE_H264;
+ } else {
+ g_print("OUCH\n");
+ }
+
+ g_print("set_format decoder_format is %d\n", dec->decoder_format);
/*Initialize Decoder with codec type and resolution*/
ioctl_msg.in = &dec->decoder_format;