Blame sys/v4l2/gstv4l2jpegenc.c

Packit 8ff292
/*
Packit 8ff292
 * Copyright (C) 2018 Collabora Inc.
Packit 8ff292
 *    Authors:
Packit 8ff292
 *    Ezequiel Garcia <ezequiel@collabora.com>
Packit 8ff292
 *    Nicolas Dufresne <nicolas.dufresne@collabora.com>
Packit 8ff292
 *
Packit 8ff292
 * This library is free software; you can redistribute it and/or
Packit 8ff292
 * modify it under the terms of the GNU Library General Public
Packit 8ff292
 * License as published by the Free Software Foundation; either
Packit 8ff292
 * version 2 of the License, or (at your option) any later version.
Packit 8ff292
 *
Packit 8ff292
 * This library is distributed in the hope that it will be useful,
Packit 8ff292
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 8ff292
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 8ff292
 * Library General Public License for more details.
Packit 8ff292
 *
Packit 8ff292
 * You should have received a copy of the GNU Library General Public
Packit 8ff292
 * License along with this library; if not, write to the
Packit 8ff292
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit 8ff292
 * Boston, MA 02110-1301, USA.
Packit 8ff292
 *
Packit 8ff292
 */
Packit 8ff292
Packit 8ff292
#ifdef HAVE_CONFIG_H
Packit 8ff292
#include "config.h"
Packit 8ff292
#endif
Packit 8ff292
Packit 8ff292
#include <sys/stat.h>
Packit 8ff292
#include <fcntl.h>
Packit 8ff292
#include <errno.h>
Packit 8ff292
#include <unistd.h>
Packit 8ff292
#include <string.h>
Packit 8ff292
Packit 8ff292
#include "gstv4l2object.h"
Packit 8ff292
#include "gstv4l2jpegenc.h"
Packit 8ff292
Packit 8ff292
#include <string.h>
Packit 8ff292
#include <gst/gst-i18n-plugin.h>
Packit 8ff292
Packit 8ff292
GST_DEBUG_CATEGORY_STATIC (gst_v4l2_jpeg_enc_debug);
Packit 8ff292
#define GST_CAT_DEFAULT gst_v4l2_jpeg_enc_debug
Packit 8ff292
Packit 8ff292
static GstStaticCaps src_template_caps = GST_STATIC_CAPS ("image/jpeg");
Packit 8ff292
Packit 8ff292
enum
Packit 8ff292
{
Packit 8ff292
  PROP_0,
Packit 8ff292
  V4L2_STD_OBJECT_PROPS,
Packit 8ff292
  /* TODO */
Packit 8ff292
};
Packit 8ff292
Packit 8ff292
#define gst_v4l2_jpeg_enc_parent_class parent_class
Packit 8ff292
G_DEFINE_TYPE (GstV4l2JPEGEnc, gst_v4l2_jpeg_enc, GST_TYPE_V4L2_VIDEO_ENC);
Packit 8ff292
Packit 8ff292
static void
Packit 8ff292
gst_v4l2_jpeg_enc_set_property (GObject * object,
Packit 8ff292
    guint prop_id, const GValue * value, GParamSpec * pspec)
Packit 8ff292
{
Packit 8ff292
  /* TODO */
Packit 8ff292
}
Packit 8ff292
Packit 8ff292
static void
Packit 8ff292
gst_v4l2_jpeg_enc_get_property (GObject * object,
Packit 8ff292
    guint prop_id, GValue * value, GParamSpec * pspec)
Packit 8ff292
{
Packit 8ff292
  /* TODO */
Packit 8ff292
}
Packit 8ff292
Packit 8ff292
static void
Packit 8ff292
gst_v4l2_jpeg_enc_init (GstV4l2JPEGEnc * self)
Packit 8ff292
{
Packit 8ff292
}
Packit 8ff292
Packit 8ff292
static void
Packit 8ff292
gst_v4l2_jpeg_enc_class_init (GstV4l2JPEGEncClass * klass)
Packit 8ff292
{
Packit 8ff292
  GstElementClass *element_class;
Packit 8ff292
  GObjectClass *gobject_class;
Packit 8ff292
  GstV4l2VideoEncClass *baseclass;
Packit 8ff292
Packit 8ff292
  parent_class = g_type_class_peek_parent (klass);
Packit 8ff292
Packit 8ff292
  element_class = (GstElementClass *) klass;
Packit 8ff292
  gobject_class = (GObjectClass *) klass;
Packit 8ff292
  baseclass = (GstV4l2VideoEncClass *) (klass);
Packit 8ff292
Packit 8ff292
  GST_DEBUG_CATEGORY_INIT (gst_v4l2_jpeg_enc_debug, "v4l2jpegenc", 0,
Packit 8ff292
      "V4L2 JPEG Encoder");
Packit 8ff292
Packit 8ff292
  gst_element_class_set_static_metadata (element_class,
Packit 8ff292
      "V4L2 JPEG Encoder",
Packit 8ff292
      "Codec/Encoder/Video/Hardware",
Packit 8ff292
      "Encode JPEG video streams via V4L2 API",
Packit 8ff292
      "Ezequiel Garcia 
Packit 8ff292
Packit 8ff292
  gobject_class->set_property =
Packit 8ff292
      GST_DEBUG_FUNCPTR (gst_v4l2_jpeg_enc_set_property);
Packit 8ff292
  gobject_class->get_property =
Packit 8ff292
      GST_DEBUG_FUNCPTR (gst_v4l2_jpeg_enc_get_property);
Packit 8ff292
Packit 8ff292
  baseclass->codec_name = "JPEG";
Packit 8ff292
}
Packit 8ff292
Packit 8ff292
/* Probing functions */
Packit 8ff292
gboolean
Packit 8ff292
gst_v4l2_is_jpeg_enc (GstCaps * sink_caps, GstCaps * src_caps)
Packit 8ff292
{
Packit 8ff292
  return gst_v4l2_is_video_enc (sink_caps, src_caps,
Packit 8ff292
      gst_static_caps_get (&src_template_caps));
Packit 8ff292
}
Packit 8ff292
Packit 8ff292
void
Packit 8ff292
gst_v4l2_jpeg_enc_register (GstPlugin * plugin, const gchar * basename,
Packit 8ff292
    const gchar * device_path, GstCaps * sink_caps, GstCaps * src_caps)
Packit 8ff292
{
Packit 8ff292
  gst_v4l2_video_enc_register (plugin, GST_TYPE_V4L2_JPEG_ENC,
Packit 8ff292
      "jpeg", basename, device_path, sink_caps,
Packit 8ff292
      gst_static_caps_get (&src_template_caps), src_caps);
Packit 8ff292
}