mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
va: Add the GstVaBaseEnc common object for all va encoders.
Just like the GstVaBaseDec and GstVaBaseTransform, this base encoder will handle all common logic for all va encoders. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2330>
This commit is contained in:
parent
e5ba099fd8
commit
21a9ba7e7e
3 changed files with 1225 additions and 0 deletions
1092
subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c
Normal file
1092
subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c
Normal file
File diff suppressed because it is too large
Load diff
132
subprojects/gst-plugins-bad/sys/va/gstvabaseenc.h
Normal file
132
subprojects/gst-plugins-bad/sys/va/gstvabaseenc.h
Normal file
|
@ -0,0 +1,132 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
* Author: He Junyan <junyan.he@intel.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 the0
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gstvadevice.h"
|
||||
#include "gstvaencoder.h"
|
||||
#include "gstvaprofile.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_VA_BASE_ENC (gst_va_base_enc_get_type())
|
||||
#define GST_VA_BASE_ENC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_VA_BASE_ENC, GstVaBaseEnc))
|
||||
#define GST_IS_VA_BASE_ENC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VA_BASE_ENC))
|
||||
#define GST_VA_BASE_ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VA_BASE_ENC, GstVaBaseEncClass))
|
||||
#define GST_IS_VA_BASE_ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VA_BASE_ENC))
|
||||
#define GST_VA_BASE_ENC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_VA_BASE_ENC, GstVaBaseEncClass))
|
||||
|
||||
typedef struct _GstVaBaseEnc GstVaBaseEnc;
|
||||
typedef struct _GstVaBaseEncClass GstVaBaseEncClass;
|
||||
typedef struct _GstVaBaseEncPrivate GstVaBaseEncPrivate;
|
||||
|
||||
struct _GstVaBaseEnc
|
||||
{
|
||||
GstVideoEncoder parent_instance;
|
||||
|
||||
GstVaDisplay *display;
|
||||
GstVaEncoder *encoder;
|
||||
|
||||
VAProfile profile;
|
||||
VAEntrypoint entrypoint;
|
||||
gint width;
|
||||
gint height;
|
||||
guint rt_format;
|
||||
guint codedbuf_size;
|
||||
|
||||
GstClockTime start_pts;
|
||||
GstClockTime frame_duration;
|
||||
/* Total frames we handled since reconfig. */
|
||||
guint input_frame_count;
|
||||
guint output_frame_count;
|
||||
|
||||
GQueue reorder_list;
|
||||
GQueue ref_list;
|
||||
GQueue output_list;
|
||||
|
||||
GstVideoCodecState *input_state;
|
||||
|
||||
/*< private >*/
|
||||
GstVaBaseEncPrivate *priv;
|
||||
|
||||
gpointer _padding[GST_PADDING];
|
||||
};
|
||||
|
||||
struct _GstVaBaseEncClass
|
||||
{
|
||||
GstVideoEncoderClass parent_class;
|
||||
|
||||
gboolean (*reconfig) (GstVaBaseEnc * encoder);
|
||||
gboolean (*new_frame) (GstVaBaseEnc * encoder,
|
||||
GstVideoCodecFrame * frame);
|
||||
gboolean (*reorder_frame) (GstVaBaseEnc * base,
|
||||
GstVideoCodecFrame * frame,
|
||||
gboolean bump_all,
|
||||
GstVideoCodecFrame ** out_frame);
|
||||
gboolean (*encode_frame) (GstVaBaseEnc * encoder,
|
||||
GstVideoCodecFrame * frame,
|
||||
gboolean is_last);
|
||||
void (*prepare_output) (GstVaBaseEnc * encoder,
|
||||
GstVideoCodecFrame * frame);
|
||||
|
||||
GstVaCodecs codec;
|
||||
gchar *render_device_path;
|
||||
|
||||
gpointer _padding[GST_PADDING];
|
||||
};
|
||||
|
||||
struct CData
|
||||
{
|
||||
gchar *render_device_path;
|
||||
gchar *description;
|
||||
GstCaps *sink_caps;
|
||||
GstCaps *src_caps;
|
||||
};
|
||||
|
||||
GType gst_va_base_enc_get_type (void);
|
||||
void gst_va_base_enc_reset_state (GstVaBaseEnc * base);
|
||||
|
||||
gboolean gst_va_base_enc_add_rate_control_parameter (GstVaBaseEnc * base,
|
||||
GstVaEncodePicture * picture,
|
||||
guint32 rc_mode,
|
||||
guint max_bitrate_bits,
|
||||
guint target_percentage,
|
||||
guint32 qp_i,
|
||||
guint32 min_qp,
|
||||
guint32 max_qp,
|
||||
guint32 mbbrc);
|
||||
gboolean gst_va_base_enc_add_quality_level_parameter (GstVaBaseEnc * base,
|
||||
GstVaEncodePicture * picture,
|
||||
guint target_usage);
|
||||
gboolean gst_va_base_enc_add_frame_rate_parameter (GstVaBaseEnc * base,
|
||||
GstVaEncodePicture * picture);
|
||||
gboolean gst_va_base_enc_add_hrd_parameter (GstVaBaseEnc * base,
|
||||
GstVaEncodePicture * picture,
|
||||
guint32 rc_mode,
|
||||
guint cpb_length_bits);
|
||||
gboolean gst_va_base_enc_add_trellis_parameter (GstVaBaseEnc * base,
|
||||
GstVaEncodePicture * picture,
|
||||
gboolean use_trellis);
|
||||
void gst_va_base_enc_add_codec_tag (GstVaBaseEnc * base,
|
||||
const gchar * codec_name);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVaBaseEnc, gst_object_unref)
|
||||
|
||||
G_END_DECLS
|
|
@ -2,6 +2,7 @@ va_sources = [
|
|||
'plugin.c',
|
||||
'gstvabasedec.c',
|
||||
'gstvabasetransform.c',
|
||||
'gstvabaseenc.c',
|
||||
'gstvacaps.c',
|
||||
'gstvadecoder.c',
|
||||
'gstvadeinterlace.c',
|
||||
|
|
Loading…
Reference in a new issue