videoparsers: add H.265 HEVC video parser element

https://bugzilla.gnome.org/show_bug.cgi?id=708438
This commit is contained in:
Sreerenj Balachandran 2013-10-09 10:54:14 +03:00 committed by Tim-Philipp Müller
parent 33451e0791
commit d844832ec3
4 changed files with 2109 additions and 2 deletions

View file

@ -6,7 +6,8 @@ libgstvideoparsersbad_la_SOURCES = plugin.c \
gsth264parse.c gstmpegvideoparse.c \ gsth264parse.c gstmpegvideoparse.c \
gstmpeg4videoparse.c \ gstmpeg4videoparse.c \
gstpngparse.c \ gstpngparse.c \
gstvc1parse.c gstvc1parse.c \
gsth265parse.c
libgstvideoparsersbad_la_CFLAGS = \ libgstvideoparsersbad_la_CFLAGS = \
$(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \ $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
@ -29,7 +30,8 @@ noinst_HEADERS = gsth263parse.h h263parse.h \
gsth264parse.h gstmpegvideoparse.h \ gsth264parse.h gstmpegvideoparse.h \
gstmpeg4videoparse.h \ gstmpeg4videoparse.h \
gstpngparse.h \ gstpngparse.h \
gstvc1parse.h gstvc1parse.h \
gsth265parse.h
Android.mk: Makefile.am $(BUILT_SOURCES) Android.mk: Makefile.am $(BUILT_SOURCES)
androgenizer \ androgenizer \

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,102 @@
/* GStreamer H.265 Parser
* Copyright (C) 2013 Intel Corporation
* Contact: Sreerenj Balachandran <sreerenj.balachandran@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 the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_H265_PARSE_H__
#define __GST_H265_PARSE_H__
#include <gst/gst.h>
#include <gst/base/gstbaseparse.h>
#include <gst/codecparsers/gsth265parser.h>
G_BEGIN_DECLS
#define GST_TYPE_H265_PARSE \
(gst_h265_parse_get_type())
#define GST_H265_PARSE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_H265_PARSE,GstH265Parse))
#define GST_H265_PARSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_H265_PARSE,GstH265ParseClass))
#define GST_IS_H265_PARSE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_H265_PARSE))
#define GST_IS_H265_PARSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_H265_PARSE))
GType gst_h265_parse_get_type (void);
typedef struct _GstH265Parse GstH265Parse;
typedef struct _GstH265ParseClass GstH265ParseClass;
struct _GstH265Parse
{
GstBaseParse baseparse;
/* stream */
gint width, height;
gint fps_num, fps_den;
gint upstream_par_n, upstream_par_d;
gint parsed_par_n, parsed_par_d;
/* current codec_data in output caps, if any */
GstBuffer *codec_data;
/* input codec_data, if any */
GstBuffer *codec_data_in;
guint nal_length_size;
gboolean packetized;
gboolean split_packetized;
gboolean transform;
/* state */
GstH265Parser *nalparser;
guint align;
guint format;
gint current_off;
GstClockTime last_report;
gboolean push_codec;
gboolean have_vps;
gboolean have_sps;
gboolean have_pps;
/* collected SPS and PPS NALUs */
GstBuffer *vps_nals[GST_H265_MAX_VPS_COUNT];
GstBuffer *sps_nals[GST_H265_MAX_SPS_COUNT];
GstBuffer *pps_nals[GST_H265_MAX_PPS_COUNT];
/* frame parsing */
gint idr_pos, sei_pos;
gboolean update_caps;
GstAdapter *frame_out;
gboolean keyframe;
/* AU state */
gboolean picture_start;
/* props */
guint interval;
GstClockTime pending_key_unit_ts;
GstEvent *force_key_unit_event;
};
struct _GstH265ParseClass
{
GstBaseParseClass parent_class;
};
G_END_DECLS
#endif

View file

@ -29,6 +29,7 @@
#include "gstmpeg4videoparse.h" #include "gstmpeg4videoparse.h"
#include "gstpngparse.h" #include "gstpngparse.h"
#include "gstvc1parse.h" #include "gstvc1parse.h"
#include "gsth265parse.h"
static gboolean static gboolean
plugin_init (GstPlugin * plugin) plugin_init (GstPlugin * plugin)
@ -47,6 +48,8 @@ plugin_init (GstPlugin * plugin)
GST_RANK_PRIMARY + 1, GST_TYPE_MPEG4VIDEO_PARSE); GST_RANK_PRIMARY + 1, GST_TYPE_MPEG4VIDEO_PARSE);
ret |= gst_element_register (plugin, "pngparse", ret |= gst_element_register (plugin, "pngparse",
GST_RANK_PRIMARY, GST_TYPE_PNG_PARSE); GST_RANK_PRIMARY, GST_TYPE_PNG_PARSE);
ret |= gst_element_register (plugin, "h265parse",
GST_RANK_SECONDARY, GST_TYPE_H265_PARSE);
ret |= gst_element_register (plugin, "vc1parse", ret |= gst_element_register (plugin, "vc1parse",
GST_RANK_NONE, GST_TYPE_VC1_PARSE); GST_RANK_NONE, GST_TYPE_VC1_PARSE);