Commit c5d0264b authored by Nicolas Dufresne's avatar Nicolas Dufresne

v4l2: Add interface for MPEG4 encoding

parent 1762c2e7
......@@ -16,6 +16,7 @@ libgstvideo4linux2_la_SOURCES = gstv4l2.c \
gstv4l2videodec.c \
gstv4l2videoenc.c \
gstv4l2h264enc.c \
gstv4l2mpeg4enc.c \
gstv4l2vidorient.c \
v4l2_calls.c \
v4l2-utils.c \
......
......@@ -48,6 +48,7 @@
#include "gstv4l2radio.h"
#include "gstv4l2videodec.h"
#include "gstv4l2h264enc.h"
#include "gstv4l2mpeg4enc.h"
#include "gstv4l2deviceprovider.h"
#include "gstv4l2transform.h"
......@@ -185,9 +186,14 @@ gst_v4l2_probe_and_register (GstPlugin * plugin)
if (gst_v4l2_is_video_dec (sink_caps, src_caps)) {
gst_v4l2_video_dec_register (plugin, basename, it->device_path,
sink_caps, src_caps);
} else if (gst_v4l2_is_h264_enc (sink_caps, src_caps)) {
gst_v4l2_h264_enc_register (plugin, basename, it->device_path,
sink_caps, src_caps);
} else if (gst_v4l2_is_video_enc (sink_caps, src_caps)) {
if (gst_v4l2_is_h264_enc (sink_caps, src_caps))
gst_v4l2_h264_enc_register (plugin, basename, it->device_path,
sink_caps, src_caps);
if (gst_v4l2_is_mpeg4_enc (sink_caps, src_caps))
gst_v4l2_mpeg4_enc_register (plugin, basename, it->device_path,
sink_caps, src_caps);
} else if (gst_v4l2_is_transform (sink_caps, src_caps)) {
gst_v4l2_transform_register (plugin, basename, it->device_path,
sink_caps, src_caps);
......
This diff is collapsed.
/*
* Copyright (C) 2017 Collabora Inc.
* Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef __GST_V4L2_MPEG4_ENC_H__
#define __GST_V4L2_MPEG4_ENC_H__
#include <gst/gst.h>
#include "gstv4l2videoenc.h"
GST_DEBUG_CATEGORY_EXTERN (v4l2mpeg4enc_debug);
G_BEGIN_DECLS
#define GST_TYPE_V4L2_MPEG4_ENC \
(gst_v4l2_mpeg4_enc_get_type())
#define GST_V4L2_MPEG4_ENC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4L2_MPEG4_ENC,GstV4l2Mpeg4Enc))
#define GST_V4L2_MPEG4_ENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4L2_MPEG4_ENC,GstV4l2Mpeg4EncClass))
#define GST_IS_V4L2_MPEG4_ENC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4L2_MPEG4_ENC))
#define GST_IS_V4L2_MPEG4_ENC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4L2_MPEG4_ENC))
typedef struct _GstV4l2Mpeg4Enc GstV4l2Mpeg4Enc;
typedef struct _GstV4l2Mpeg4EncClass GstV4l2Mpeg4EncClass;
struct _GstV4l2Mpeg4Enc
{
GstV4l2VideoEnc parent;
};
struct _GstV4l2Mpeg4EncClass
{
GstV4l2VideoEncClass parent_class;
};
GType gst_v4l2_mpeg4_enc_get_type (void);
gboolean gst_v4l2_is_mpeg4_enc (GstCaps * sink_caps, GstCaps * src_caps);
void gst_v4l2_mpeg4_enc_register (GstPlugin * plugin, const gchar * basename,
const gchar * device_path, GstCaps * sink_caps, GstCaps * src_caps);
G_END_DECLS
#endif /* __GST_V4L2_MPEG4_ENC_H__ */
......@@ -903,6 +903,18 @@ gst_v4l2_video_enc_subclass_init (gpointer g_class, gpointer data)
}
/* Probing functions */
gboolean
gst_v4l2_is_video_enc (GstCaps * sink_caps, GstCaps * src_caps)
{
gboolean ret = FALSE;
if (gst_caps_is_subset (sink_caps, gst_v4l2_object_get_raw_caps ())
&& gst_caps_is_subset (src_caps, gst_v4l2_object_get_codec_caps ()))
ret = TRUE;
return ret;
}
void
gst_v4l2_video_enc_register (GstPlugin * plugin, GType type,
const char *codec, const gchar * basename, const gchar * device_path,
......
......@@ -79,6 +79,8 @@ struct _GstV4l2VideoEncClass
GType gst_v4l2_video_enc_get_type (void);
gboolean gst_v4l2_is_video_enc (GstCaps * sink_caps, GstCaps * src_caps);
void gst_v4l2_video_enc_register (GstPlugin * plugin, GType type,
const char *codec, const gchar * basename, const gchar * device_path,
GstCaps * sink_caps, GstCaps *codec_caps, GstCaps * src_caps);
......
......@@ -13,6 +13,7 @@ v4l2_sources = [
'gstv4l2videodec.c',
'gstv4l2videoenc.c',
'gstv4l2h264enc.c',
'gstv4l2mpeg4enc.c',
'gstv4l2vidorient.c',
'v4l2_calls.c',
'v4l2-utils.c',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment