2020-10-08 17:39:56 +00:00
|
|
|
|
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2020 Igalia, S.L.
|
|
|
|
* Author: Víctor Jáquez <vjaquez@igalia.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 <gst/codecs/gsth264decoder.h>
|
2020-10-21 13:01:31 +00:00
|
|
|
#include <gst/codecs/gsth265decoder.h>
|
2020-12-18 14:28:41 +00:00
|
|
|
#include <gst/codecs/gstmpeg2decoder.h>
|
2020-10-08 17:39:56 +00:00
|
|
|
#include <gst/codecs/gstvp8decoder.h>
|
2020-10-12 17:20:10 +00:00
|
|
|
#include <gst/codecs/gstvp9decoder.h>
|
2021-01-19 07:36:29 +00:00
|
|
|
#include <gst/codecs/gstav1decoder.h>
|
2020-10-08 17:39:56 +00:00
|
|
|
|
|
|
|
#include "gstvadevice.h"
|
|
|
|
#include "gstvadecoder.h"
|
|
|
|
#include "gstvaprofile.h"
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
#define GST_VA_BASE_DEC(obj) ((GstVaBaseDec *)(obj))
|
|
|
|
#define GST_VA_BASE_DEC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_FROM_INSTANCE (obj), GstVaBaseDecClass))
|
|
|
|
#define GST_VA_BASE_DEC_CLASS(klass) ((GstVaBaseDecClass *)(klass))
|
|
|
|
|
|
|
|
typedef struct _GstVaBaseDec GstVaBaseDec;
|
|
|
|
typedef struct _GstVaBaseDecClass GstVaBaseDecClass;
|
|
|
|
|
|
|
|
struct _GstVaBaseDec
|
|
|
|
{
|
|
|
|
/* <private> */
|
|
|
|
union
|
|
|
|
{
|
|
|
|
GstH264Decoder h264;
|
2020-10-21 13:01:31 +00:00
|
|
|
GstH265Decoder h265;
|
2020-12-18 14:28:41 +00:00
|
|
|
GstMpeg2Decoder mpeg2;
|
2020-10-08 17:39:56 +00:00
|
|
|
GstVp8Decoder vp8;
|
2020-10-12 17:20:10 +00:00
|
|
|
GstVp9Decoder vp9;
|
2021-01-19 07:36:29 +00:00
|
|
|
GstAV1Decoder av1;
|
2020-10-08 17:39:56 +00:00
|
|
|
} parent;
|
|
|
|
|
|
|
|
GstDebugCategory *debug_category;
|
|
|
|
|
|
|
|
GstVaDisplay *display;
|
|
|
|
GstVaDecoder *decoder;
|
|
|
|
|
|
|
|
VAProfile profile;
|
|
|
|
guint rt_format;
|
|
|
|
gint width;
|
|
|
|
gint height;
|
|
|
|
|
|
|
|
guint min_buffers;
|
|
|
|
|
|
|
|
GstVideoCodecState *output_state;
|
|
|
|
GstBufferPool *other_pool;
|
|
|
|
|
|
|
|
gboolean need_valign;
|
|
|
|
GstVideoAlignment valign;
|
|
|
|
|
2020-10-09 14:00:18 +00:00
|
|
|
gboolean copy_frames;
|
2021-06-09 07:44:33 +00:00
|
|
|
|
|
|
|
gboolean apply_video_crop;
|
2021-06-09 09:14:42 +00:00
|
|
|
GstVideoConverter *convert;
|
2021-10-26 07:28:10 +00:00
|
|
|
|
|
|
|
gboolean need_negotiation;
|
2020-10-08 17:39:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstVaBaseDecClass
|
|
|
|
{
|
|
|
|
/* <private> */
|
|
|
|
union
|
|
|
|
{
|
|
|
|
GstH264DecoderClass h264;
|
2020-10-21 13:01:31 +00:00
|
|
|
GstH265DecoderClass h265;
|
2020-12-18 14:28:41 +00:00
|
|
|
GstMpeg2DecoderClass mpeg2;
|
2020-10-08 17:39:56 +00:00
|
|
|
GstVp8DecoderClass vp8;
|
2020-10-12 17:20:10 +00:00
|
|
|
GstVp9DecoderClass vp9;
|
2021-01-19 07:36:29 +00:00
|
|
|
GstAV1DecoderClass av1;
|
2020-10-08 17:39:56 +00:00
|
|
|
} parent_class;
|
|
|
|
|
|
|
|
GstVaCodecs codec;
|
|
|
|
gchar *render_device_path;
|
2021-05-09 15:42:46 +00:00
|
|
|
/* The parent class in GType hierarchy */
|
|
|
|
GstObjectClass *parent_decoder_class;
|
2020-10-08 17:39:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CData
|
|
|
|
{
|
|
|
|
gchar *render_device_path;
|
|
|
|
gchar *description;
|
|
|
|
GstCaps *sink_caps;
|
|
|
|
GstCaps *src_caps;
|
|
|
|
};
|
|
|
|
|
|
|
|
void gst_va_base_dec_init (GstVaBaseDec * base,
|
|
|
|
GstDebugCategory * cat);
|
|
|
|
void gst_va_base_dec_class_init (GstVaBaseDecClass * klass,
|
|
|
|
GstVaCodecs codec,
|
|
|
|
const gchar * render_device_path,
|
|
|
|
GstCaps * sink_caps,
|
|
|
|
GstCaps * src_caps,
|
|
|
|
GstCaps * doc_src_caps,
|
|
|
|
GstCaps * doc_sink_caps);
|
|
|
|
|
|
|
|
gboolean gst_va_base_dec_close (GstVideoDecoder * decoder);
|
|
|
|
void gst_va_base_dec_get_preferred_format_and_caps_features (GstVaBaseDec * base,
|
|
|
|
GstVideoFormat * format,
|
|
|
|
GstCapsFeatures ** capsfeatures);
|
|
|
|
gboolean gst_va_base_dec_copy_output_buffer (GstVaBaseDec * base,
|
|
|
|
GstVideoCodecFrame * codec_frame);
|
|
|
|
|
|
|
|
G_END_DECLS
|