2010-10-27 17:30:11 +00:00
|
|
|
/*
|
2013-02-16 01:44:19 +00:00
|
|
|
* Copyright (C) 2010 Ole André Vadla Ravnås <oleavr@soundrop.com>
|
2010-10-27 17:30:11 +00:00
|
|
|
*
|
|
|
|
* 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
|
2012-11-03 20:38:00 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2010-10-27 17:30:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_VTENC_H__
|
|
|
|
#define __GST_VTENC_H__
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2023-07-04 15:39:58 +00:00
|
|
|
#include <gst/base/gstqueuearray.h>
|
2023-03-30 13:38:22 +00:00
|
|
|
#include <gst/codecparsers/gsth264parser.h>
|
2013-10-02 02:49:34 +00:00
|
|
|
#include <gst/video/video.h>
|
2014-09-16 12:02:46 +00:00
|
|
|
#include <VideoToolbox/VideoToolbox.h>
|
2010-10-27 17:30:11 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
#define GST_VTENC_CAST(obj) \
|
|
|
|
((GstVTEnc *) (obj))
|
|
|
|
#define GST_VTENC_CLASS_GET_CODEC_DETAILS(klass) \
|
|
|
|
((const GstVTEncoderDetails *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), \
|
|
|
|
GST_VTENC_CODEC_DETAILS_QDATA))
|
|
|
|
|
2024-07-24 23:06:09 +00:00
|
|
|
/**
|
|
|
|
* GstVtencRateControl:
|
|
|
|
* @GST_VTENC_RATE_CONTROL_ABR: average (variable) bitrate
|
|
|
|
* @GST_VTENC_RATE_CONTROL_CBR: constant bitrate
|
|
|
|
*
|
|
|
|
* Since: 1.26
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GST_VTENC_RATE_CONTROL_ABR,
|
|
|
|
GST_VTENC_RATE_CONTROL_CBR,
|
|
|
|
} GstVtencRateControl;
|
|
|
|
|
2010-10-27 17:30:11 +00:00
|
|
|
typedef struct _GstVTEncoderDetails GstVTEncoderDetails;
|
|
|
|
|
|
|
|
typedef struct _GstVTEncClassParams GstVTEncClassParams;
|
|
|
|
typedef struct _GstVTEncClass GstVTEncClass;
|
|
|
|
typedef struct _GstVTEnc GstVTEnc;
|
|
|
|
|
|
|
|
struct _GstVTEncoderDetails
|
|
|
|
{
|
|
|
|
const gchar * name;
|
|
|
|
const gchar * element_name;
|
|
|
|
const gchar * mimetype;
|
2014-09-16 12:02:46 +00:00
|
|
|
CMVideoCodecType format_id;
|
2016-06-01 11:43:32 +00:00
|
|
|
gboolean require_hardware;
|
2010-10-27 17:30:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstVTEncClass
|
|
|
|
{
|
2014-09-16 13:51:28 +00:00
|
|
|
GstVideoEncoderClass parent_class;
|
2010-10-27 17:30:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstVTEnc
|
|
|
|
{
|
2014-09-16 13:51:28 +00:00
|
|
|
GstVideoEncoder parent;
|
2010-10-27 17:30:11 +00:00
|
|
|
|
|
|
|
const GstVTEncoderDetails * details;
|
|
|
|
|
2021-10-17 13:24:10 +00:00
|
|
|
CMVideoCodecType specific_format_id;
|
2014-12-10 11:36:53 +00:00
|
|
|
CFStringRef profile_level;
|
2023-03-30 13:38:22 +00:00
|
|
|
GstH264Profile h264_profile;
|
2010-10-27 17:30:11 +00:00
|
|
|
guint bitrate;
|
2024-07-27 00:09:53 +00:00
|
|
|
guint max_bitrate;
|
|
|
|
float bitrate_window;
|
2014-11-06 12:22:17 +00:00
|
|
|
gboolean allow_frame_reordering;
|
|
|
|
gboolean realtime;
|
2014-11-27 12:40:56 +00:00
|
|
|
gdouble quality;
|
2014-12-05 15:33:20 +00:00
|
|
|
gint max_keyframe_interval;
|
|
|
|
GstClockTime max_keyframe_interval_duration;
|
2024-07-27 00:57:14 +00:00
|
|
|
gint max_frame_delay;
|
2014-12-10 08:44:01 +00:00
|
|
|
gint latency_frames;
|
2021-10-19 20:19:29 +00:00
|
|
|
gboolean preserve_alpha;
|
2024-07-24 23:06:09 +00:00
|
|
|
GstVtencRateControl rate_control;
|
2010-10-27 17:30:11 +00:00
|
|
|
|
|
|
|
gboolean dump_properties;
|
|
|
|
gboolean dump_attributes;
|
|
|
|
|
2021-10-19 20:49:33 +00:00
|
|
|
gboolean have_field_order;
|
2014-09-16 13:51:28 +00:00
|
|
|
GstVideoCodecState *input_state;
|
2013-10-02 02:49:34 +00:00
|
|
|
GstVideoInfo video_info;
|
2010-11-02 22:08:30 +00:00
|
|
|
VTCompressionSessionRef session;
|
2015-04-25 19:55:28 +00:00
|
|
|
CFDictionaryRef keyframe_props;
|
2023-03-30 13:38:22 +00:00
|
|
|
GstClockTime dts_offset;
|
2010-10-27 17:30:11 +00:00
|
|
|
|
2024-04-18 14:07:25 +00:00
|
|
|
GstVecDeque * output_queue;
|
2023-07-04 15:39:58 +00:00
|
|
|
/* Protects output_queue, is_flushing and pause_task */
|
|
|
|
GMutex queue_mutex;
|
|
|
|
GCond queue_cond;
|
2024-04-16 18:37:23 +00:00
|
|
|
|
|
|
|
/* Temporary workaround for HEVCWithAlpha encoder not throttling input */
|
|
|
|
GMutex encoding_mutex;
|
|
|
|
GCond encoding_cond;
|
|
|
|
|
2023-07-04 15:39:58 +00:00
|
|
|
/* downstream_ret is protected by the STREAM_LOCK */
|
|
|
|
GstFlowReturn downstream_ret;
|
|
|
|
gboolean negotiate_downstream;
|
|
|
|
gboolean is_flushing;
|
|
|
|
gboolean pause_task;
|
2010-10-27 17:30:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void gst_vtenc_register_elements (GstPlugin * plugin);
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GST_VTENC_H__ */
|