summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-03-21 12:26:13 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-03-21 12:26:23 +0100
commitca03e2cda42c1da6272526a2fcc7436e5b7d72a6 (patch)
tree8b405f094f93a5432c8fdfeabca1398b261ab11d
parent13737dbe61b1e0598f6ef9e0444b47e2942aba99 (diff)
downloadgst-plugins-fsl-vpu-ca03e2cda42c1da6272526a2fcc7436e5b7d72a6.tar.gz
gst-plugins-fsl-vpu-ca03e2cda42c1da6272526a2fcc7436e5b7d72a6.tar.xz
vpu encoder: Add mjpeg support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--src/mfw_gst_vpu.c1
-rw-r--r--src/mfw_gst_vpu.h1
-rw-r--r--src/mfw_gst_vpu_encoder.c30
-rw-r--r--src/mfw_gst_vpu_encoder.h1
4 files changed, 29 insertions, 4 deletions
diff --git a/src/mfw_gst_vpu.c b/src/mfw_gst_vpu.c
index 4fbd601..4007de5 100644
--- a/src/mfw_gst_vpu.c
+++ b/src/mfw_gst_vpu.c
@@ -31,6 +31,7 @@ mfw_gst_vpu_codec_get_type(void)
{STD_MPEG4, "0", "std_mpeg4"},
{STD_H263, "1", "std_h263"},
{STD_AVC, "2", "std_avc"},
+ {STD_MJPG, "3", "std_mjpg"},
{0, NULL, NULL},
};
if (!vpu_codec_type) {
diff --git a/src/mfw_gst_vpu.h b/src/mfw_gst_vpu.h
index 61cbd74..b9097a0 100644
--- a/src/mfw_gst_vpu.h
+++ b/src/mfw_gst_vpu.h
@@ -21,6 +21,7 @@ enum {
MFW_GST_VPU_DBK_OFFSETB,
MFW_GST_VPU_ROTATION,
MFW_GST_VPU_MIRROR,
+ MFW_GST_VPUENC_MJPEG_QUALITY,
};
#endif /* __MFW_GST_VPU_H */
diff --git a/src/mfw_gst_vpu_encoder.c b/src/mfw_gst_vpu_encoder.c
index b0c2788..062be45 100644
--- a/src/mfw_gst_vpu_encoder.c
+++ b/src/mfw_gst_vpu_encoder.c
@@ -88,6 +88,8 @@ typedef struct _GstVPU_Enc
unsigned int buf_size[NUM_BUFFERS];
unsigned int queued;
char *device;
+
+ int mjpeg_quality;
}GstVPU_Enc;
/* Default frame rate */
@@ -107,8 +109,8 @@ typedef struct _GstVPU_Enc
"height = (int) [16, 720]; " \
\
"image/jpeg, " \
- "width = (int) [16, 1280], " \
- "height = (int) [16, 720]; "
+ "width = (int) [16, 1920], " \
+ "height = (int) [16, 1080]; "
/* get the element details */
static GstElementDetails mfw_gst_vpuenc_details =
@@ -130,8 +132,8 @@ GST_STATIC_PAD_TEMPLATE("sink",
GST_PAD_ALWAYS,
GST_STATIC_CAPS("video/x-raw-yuv, "
"format = (fourcc) {I420}, "
- "width = (int) [16, 1280], "
- "height = (int) [16, 720], "
+ "width = (int) [16, 1920], "
+ "height = (int) [16, 1080], "
"framerate = (fraction) [0/1, 60/1]")
);
@@ -172,6 +174,10 @@ static void mfw_gst_vpuenc_set_property(GObject * object, guint prop_id,
vpu_enc->gopsize = g_value_get_int(value);
break;
+ case MFW_GST_VPUENC_MJPEG_QUALITY:
+ vpu_enc->mjpeg_quality = g_value_get_int(value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -209,6 +215,10 @@ static void mfw_gst_vpuenc_get_property(GObject * object, guint prop_id,
g_value_set_int(value, vpu_enc->gopsize);
break;
+ case MFW_GST_VPUENC_MJPEG_QUALITY:
+ g_value_set_int(value, vpu_enc->mjpeg_quality);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -267,6 +277,12 @@ static int mfw_gst_vpuenc_init_encoder(GstPad *pad, enum v4l2_memory memory)
return GST_FLOW_ERROR;
}
+ retval = ioctl(vpu_enc->vpu_fd, VPU_IOC_MJPEG_QUALITY, vpu_enc->mjpeg_quality);
+ if (retval) {
+ perror("VPU_IOC_MJPEG_QUALITY");
+ return GST_FLOW_ERROR;
+ }
+
for (i = 0; i < NUM_BUFFERS; i++) {
struct v4l2_buffer *buf = &vpu_enc->buf_v4l2[i];
buf->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
@@ -645,6 +661,11 @@ mfw_gst_vpuenc_class_init(GstVPU_EncClass * klass)
0, 60, 0,
G_PARAM_READWRITE));
+ g_object_class_install_property(gobject_class, MFW_GST_VPUENC_MJPEG_QUALITY,
+ g_param_spec_int("mjpegquality", "mjpegquality",
+ "MJPEG Quality",
+ 0, 100, 50,
+ G_PARAM_READWRITE));
}
static void
@@ -678,6 +699,7 @@ mfw_gst_vpuenc_init(GstVPU_Enc * vpu_enc, GstVPU_EncClass * gclass)
vpu_enc->gopsize = 0;
vpu_enc->codecTypeProvided = FALSE;
vpu_enc->memory = V4L2_MEMORY_USERPTR;
+ vpu_enc->mjpeg_quality = 50;
}
GType mfw_gst_type_vpu_enc_get_type(void)
diff --git a/src/mfw_gst_vpu_encoder.h b/src/mfw_gst_vpu_encoder.h
index 803cd9a..ea9b0c8 100644
--- a/src/mfw_gst_vpu_encoder.h
+++ b/src/mfw_gst_vpu_encoder.h
@@ -98,6 +98,7 @@ GType mfw_gst_vpuenc_codec_get_type(void);
#define VPU_IOC_MAGIC 'V'
#define VPU_IOC_ROTATE_MIRROR _IO(VPU_IOC_MAGIC, 7)
#define VPU_IOC_CODEC _IO(VPU_IOC_MAGIC, 8)
+#define VPU_IOC_MJPEG_QUALITY _IO(VPU_IOC_MAGIC, 9)
G_END_DECLS
#endif /* __MFW_GST_VPU_ENCODER_H__ */