2 * Copyright (C) 2018 Collabora Inc.
4 * Ezequiel Garcia <ezequiel@collabora.com>
5 * Nicolas Dufresne <nicolas.dufresne@collabora.com>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
34 #include "gstv4l2object.h"
35 #include "gstv4l2jpegenc.h"
38 #include <gst/gst-i18n-plugin.h>
40 GST_DEBUG_CATEGORY_STATIC (gst_v4l2_jpeg_enc_debug);
41 #define GST_CAT_DEFAULT gst_v4l2_jpeg_enc_debug
43 static GstStaticCaps src_template_caps = GST_STATIC_CAPS ("image/jpeg");
48 V4L2_STD_OBJECT_PROPS,
52 #define gst_v4l2_jpeg_enc_parent_class parent_class
53 G_DEFINE_TYPE (GstV4l2JPEGEnc, gst_v4l2_jpeg_enc, GST_TYPE_V4L2_VIDEO_ENC);
56 gst_v4l2_jpeg_enc_set_property (GObject * object,
57 guint prop_id, const GValue * value, GParamSpec * pspec)
63 gst_v4l2_jpeg_enc_get_property (GObject * object,
64 guint prop_id, GValue * value, GParamSpec * pspec)
70 gst_v4l2_jpeg_enc_init (GstV4l2JPEGEnc * self)
75 gst_v4l2_jpeg_enc_class_init (GstV4l2JPEGEncClass * klass)
77 GstElementClass *element_class;
78 GObjectClass *gobject_class;
79 GstV4l2VideoEncClass *baseclass;
81 parent_class = g_type_class_peek_parent (klass);
83 element_class = (GstElementClass *) klass;
84 gobject_class = (GObjectClass *) klass;
85 baseclass = (GstV4l2VideoEncClass *) (klass);
87 GST_DEBUG_CATEGORY_INIT (gst_v4l2_jpeg_enc_debug, "v4l2jpegenc", 0,
90 gst_element_class_set_static_metadata (element_class,
92 "Codec/Encoder/Video/Hardware",
93 "Encode JPEG video streams via V4L2 API",
94 "Ezequiel Garcia <ezequiel@collabora.com");
96 gobject_class->set_property =
97 GST_DEBUG_FUNCPTR (gst_v4l2_jpeg_enc_set_property);
98 gobject_class->get_property =
99 GST_DEBUG_FUNCPTR (gst_v4l2_jpeg_enc_get_property);
101 baseclass->codec_name = "JPEG";
104 /* Probing functions */
106 gst_v4l2_is_jpeg_enc (GstCaps * sink_caps, GstCaps * src_caps)
108 return gst_v4l2_is_video_enc (sink_caps, src_caps,
109 gst_static_caps_get (&src_template_caps));
113 gst_v4l2_jpeg_enc_register (GstPlugin * plugin, const gchar * basename,
114 const gchar * device_path, GstCaps * sink_caps, GstCaps * src_caps)
116 gst_v4l2_video_enc_register (plugin, GST_TYPE_V4L2_JPEG_ENC,
117 "jpeg", basename, device_path, sink_caps,
118 gst_static_caps_get (&src_template_caps), src_caps);