x265enc: add x265 encoder element

This commit is contained in:
Thijs Vermeir 2014-03-05 16:39:30 +01:00
parent 771b94b3ca
commit f241294662
5 changed files with 1373 additions and 2 deletions

View file

@ -3026,6 +3026,12 @@ AG_GST_CHECK_FEATURE(HLS, [http live streaming plugin], hls, [
])
])
dnl *** x265 (H.265/HEVC encoder) ***
translit(dnm, m, l) AM_CONDITIONAL(USE_X265, true)
AG_GST_CHECK_FEATURE(X265, [x265 plug-in], x265, [
AG_GST_PKG_CHECK_MODULES(X265, x265)
])
else
dnl not building plugins with external dependencies,
@ -3108,6 +3114,7 @@ AM_CONDITIONAL(USE_SNDIO, false)
AM_CONDITIONAL(USE_UVCH264, false)
AM_CONDITIONAL(USE_WEBP, false)
AM_CONDITIONAL(USE_OPENH264, false)
AM_CONDITIONAL(USE_X265, false)
fi dnl of EXT plugins
@ -3401,6 +3408,7 @@ ext/gsettings/org.freedesktop.gstreamer.default-elements.gschema.xml
ext/spc/Makefile
ext/timidity/Makefile
ext/webp/Makefile
ext/x265/Makefile
ext/xvid/Makefile
ext/zbar/Makefile
po/Makefile.in

View file

@ -406,6 +406,12 @@ else
WEBP_DIR=
endif
if USE_X265
X265_DIR=x265
else
X265_DIR=
endif
SUBDIRS=\
$(VOAACENC_DIR) \
$(ASSRENDER_DIR) \
@ -473,7 +479,8 @@ SUBDIRS=\
$(ZBAR_DIR) \
$(RTMP_DIR) \
$(HLS_DIR) \
$(WEBP_DIR)
$(WEBP_DIR) \
$(X265_DIR)
DIST_SUBDIRS = \
assrender \
@ -538,6 +545,7 @@ DIST_SUBDIRS = \
xvid \
zbar \
rtmp \
webp
webp \
x265
include $(top_srcdir)/common/parallel-subdirs.mak

32
ext/x265/Makefile.am Normal file
View file

@ -0,0 +1,32 @@
plugin_LTLIBRARIES = libgstx265.la
libgstx265_la_SOURCES = gstx265enc.c
libgstx265_la_CFLAGS = \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_CFLAGS) \
$(X265_CFLAGS)
libgstx265_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) \
-lgstvideo-$(GST_API_VERSION) \
-lgstpbutils-$(GST_API_VERSION) \
$(GST_LIBS) \
$(X265_LIBS)
libgstx265_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstx265_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
noinst_HEADERS = gstx265enc.h
Android.mk: Makefile.am $(BUILT_SOURCES)
androgenizer \
-:PROJECT libgstx265 -:SHARED libgstx265 \
-:TAGS eng debug \
-:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
-:SOURCES $(libgstx265_la_SOURCES) \
-:CPPFLAGS $(CPPFLAGS) \
-:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstx265_la_CFLAGS) -I'$$(GSTREAMER_AGGREGATE_TOP)/x265' \
-:LDFLAGS $(libgstx265_la_LDFLAGS) \
$(libgstx265_la_LIBADD) \
-ldl \
-:PASSTHROUGH LOCAL_ARM_MODE:=arm \
LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \
> $@

1236
ext/x265/gstx265enc.c Normal file

File diff suppressed because it is too large Load diff

87
ext/x265/gstx265enc.h Normal file
View file

@ -0,0 +1,87 @@
/* GStreamer H265 encoder plugin
* Copyright (C) 2005 Michal Benes <michal.benes@itonis.tv>
* Copyright (C) 2005 Josef Zlomek <josef.zlomek@itonis.tv>
* Copyright (C) 2014 Thijs Vermeir <thijs.vermeir@barco.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_X265_ENC_H__
#define __GST_X265_ENC_H__
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/video/gstvideoencoder.h>
#include "_stdint.h"
#include <x265.h>
G_BEGIN_DECLS
#define GST_TYPE_X265_ENC \
(gst_x265_enc_get_type())
#define GST_X265_ENC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_X265_ENC,GstX265Enc))
#define GST_X265_ENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_X265_ENC,GstX265EncClass))
#define GST_IS_X265_ENC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_X265_ENC))
#define GST_IS_X265_ENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_X265_ENC))
typedef struct _GstX265Enc GstX265Enc;
typedef struct _GstX265EncClass GstX265EncClass;
struct _GstX265Enc
{
GstVideoEncoder element;
/*< private > */
x265_encoder *x265enc;
x265_param x265param;
GstClockTime dts_offset;
gboolean push_header;
/* List of frame/buffer mapping structs for
* pending frames */
GList *pending_frames;
/* properties */
guint bitrate;
gint log_level;
gint tune;
gint speed_preset;
GString *option_string_prop; /* option-string property */
/*GString *option_string; *//* used by set prop */
/* input description */
GstVideoCodecState *input_state;
/* configuration changed while playing */
gboolean reconfig;
/* from the downstream caps */
const gchar *peer_profile;
gboolean peer_intra_profile;
/*const x265_level_t *peer_level; */
};
struct _GstX265EncClass
{
GstVideoEncoderClass parent_class;
};
GType gst_x265_enc_get_type (void);
G_END_DECLS
#endif /* __GST_X265_ENC_H__ */