vp8: Remove plugin, moved to gst-plugins-good

This commit is contained in:
Sebastian Dröge 2012-09-16 15:48:02 +02:00
parent 12b5ef6573
commit 1419862c50
20 changed files with 2 additions and 3326 deletions

View file

@ -95,7 +95,8 @@ CRUFT_DIRS = \
$(top_srcdir)/ext/jack \
$(top_srcdir)/ext/metadata \
$(top_srcdir)/ext/tarkin \
$(top_srcdir)/ext/theora
$(top_srcdir)/ext/theora \
$(top_srcdir)/ext/vp8
include $(top_srcdir)/common/cruft.mak

View file

@ -1770,31 +1770,6 @@ AG_GST_CHECK_FEATURE(ZBAR, [ZBar barcode detector], zbar, [
AG_GST_PKG_CHECK_MODULES(ZBAR, zbar >= 0.9)
])
dnl *** vp8 ***
translit(dnm, m, l) AM_CONDITIONAL(USE_VP8, vp8)
AG_GST_CHECK_FEATURE(VP8, [VP8 decoder], vp8, [
PKG_CHECK_MODULES(VPX, vpx >= 1.1.0, [HAVE_VPX="yes"], [HAVE_VPX="no"])
if test $HAVE_VPX = "yes"; then
OLD_LIBS="$LIBS"
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $VPX_CFLAGS"
LIBS="$LIBS $VPX_LIBS"
AC_CHECK_LIB(vpx, vpx_codec_vp8_cx_algo, [
HAVE_VP8=yes
AC_DEFINE(HAVE_VP8_ENCODER, 1, [Defined if the VP8 encoder is available])
])
AC_CHECK_LIB(vpx, vpx_codec_vp8_dx_algo, [
HAVE_VP8=yes
AC_DEFINE(HAVE_VP8_DECODER, 1, [Defined if the VP8 decoder is available])
])
LIBS="$OLD_LIBS"
CFLAGS="$OLD_CFLAGS"
fi
AC_SUBST(VPX_LIBS)
AC_SUBST(VPX_CFLAGS)
])
dnl *** rtmp ***
translit(dnm, m, l) AM_CONDITIONAL(USE_RTMP, true)
AG_GST_CHECK_FEATURE(RTMP, [rtmp library], rtmp, [
@ -1903,7 +1878,6 @@ AM_CONDITIONAL(USE_ACM, false)
AM_CONDITIONAL(USE_VDPAU, false)
AM_CONDITIONAL(USE_SCHRO, false)
AM_CONDITIONAL(USE_ZBAR, false)
AM_CONDITIONAL(USE_VP8, false)
AM_CONDITIONAL(USE_RTMP, false)
AM_CONDITIONAL(USE_TELETEXTDEC, false)
AM_CONDITIONAL(USE_SNDIO, false)
@ -2159,7 +2133,6 @@ ext/gsettings/org.freedesktop.gstreamer.default-elements.gschema.xml
ext/spc/Makefile
ext/swfdec/Makefile
ext/timidity/Makefile
ext/vp8/Makefile
ext/xvid/Makefile
ext/zbar/Makefile
po/Makefile.in

View file

@ -109,8 +109,6 @@ EXTRA_HFILES = \
$(top_srcdir)/ext/timidity/gstwildmidi.h \
$(top_srcdir)/ext/voaacenc/gstvoaacenc.h \
$(top_srcdir)/ext/voamrwbenc/gstvoamrwbenc.h \
$(top_srcdir)/ext/vp8/gstvp8enc.h \
$(top_srcdir)/ext/vp8/gstvp8dec.h \
$(top_srcdir)/ext/zbar/gstzbar.h \
$(top_srcdir)/gst/aiff/aiffparse.h \
$(top_srcdir)/gst/aiff/aiffmux.h \

View file

@ -125,8 +125,6 @@
<xi:include href="xml/element-zbar.xml" />
<xi:include href="xml/element-voaacenc.xml" />
<xi:include href="xml/element-voamrwbenc.xml" />
<xi:include href="xml/element-vp8dec.xml" />
<xi:include href="xml/element-vp8enc.xml" />
<xi:include href="xml/element-wavescope.xml" />
</chapter>
@ -215,7 +213,6 @@
<xi:include href="xml/plugin-xvid.xml" />
<xi:include href="xml/plugin-voaacenc.xml" />
<xi:include href="xml/plugin-voamrwbenc.xml" />
<xi:include href="xml/plugin-vp8.xml" />
<xi:include href="xml/plugin-zbar.xml" />
</chapter>

View file

@ -1638,34 +1638,6 @@ GST_TYPE_VOAMRWBENC
gst_voamrwbenc_get_type
</SECTION>
<SECTION>
<FILE>element-vp8dec</FILE>
<TITLE>vp8dec</TITLE>
GstVP8Dec
<SUBSECTION Standard>
GstVP8DecClass
GST_VP8_DEC
GST_VP8_DEC_CLASS
GST_IS_VP8_DEC
GST_IS_VP8_DEC_CLASS
GST_TYPE_VP8_DEC
gst_vp8_dec_get_type
</SECTION>
<SECTION>
<FILE>element-vp8enc</FILE>
<TITLE>vp8enc</TITLE>
GstVP8Enc
<SUBSECTION Standard>
GstVP8EncClass
GST_VP8_ENC
GST_VP8_ENC_CLASS
GST_IS_VP8_ENC
GST_IS_VP8_ENC_CLASS
GST_TYPE_VP8_ENC
gst_vp8_enc_get_type
</SECTION>
<SECTION>
<FILE>element-zbar</FILE>
<TITLE>zbar</TITLE>

View file

@ -1,55 +0,0 @@
<plugin>
<name>vp8</name>
<description>VP8 plugin</description>
<filename>../../ext/vp8/.libs/libgstvp8.so</filename>
<basename>libgstvp8.so</basename>
<version>0.11.94.1</version>
<license>LGPL</license>
<source>gst-plugins-bad</source>
<package>GStreamer Bad Plug-ins git</package>
<origin>Unknown package origin</origin>
<elements>
<element>
<name>vp8dec</name>
<longname>On2 VP8 Decoder</longname>
<class>Codec/Decoder/Video</class>
<description>Decode VP8 video streams</description>
<author>David Schleef &lt;ds@entropywave.com&gt;</author>
<pads>
<caps>
<name>sink</name>
<direction>sink</direction>
<presence>always</presence>
<details>video/x-vp8</details>
</caps>
<caps>
<name>src</name>
<direction>source</direction>
<presence>always</presence>
<details>video/x-raw, format=(string)I420, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
</caps>
</pads>
</element>
<element>
<name>vp8enc</name>
<longname>On2 VP8 Encoder</longname>
<class>Codec/Encoder/Video</class>
<description>Encode VP8 video streams</description>
<author>David Schleef &lt;ds@entropywave.com&gt;</author>
<pads>
<caps>
<name>sink</name>
<direction>sink</direction>
<presence>always</presence>
<details>video/x-raw, format=(string)I420, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
</caps>
<caps>
<name>src</name>
<direction>source</direction>
<presence>always</presence>
<details>video/x-vp8, profile=(int){ 0, 1, 2, 3 }</details>
</caps>
</pads>
</element>
</elements>
</plugin>

View file

@ -336,12 +336,6 @@ else
TELETEXTDEC_DIR=
endif
if USE_VP8
VP8_DIR=vp8
else
VP8_DIR=
endif
if USE_GSETTINGS
GSETTINGS_DIR=gsettings
else
@ -424,7 +418,6 @@ SUBDIRS=\
$(SWFDEC_DIR) \
$(TELETEXTDEC_DIR) \
$(TIMIDITY_DIR) \
$(VP8_DIR) \
$(XVID_DIR) \
$(ZBAR_DIR) \
$(RTMP_DIR)
@ -482,7 +475,6 @@ DIST_SUBDIRS = \
timidity \
voaacenc \
voamrwbenc \
vp8 \
xvid \
zbar \
rtmp

View file

@ -1,8 +0,0 @@
[_presets_]
version=0.10
element-name=GstVP8Enc
[Profile Realtime]
deadline=1
cpu-used=4
lag-in-frames=0

View file

@ -1,30 +0,0 @@
plugin_LTLIBRARIES = \
libgstvp8.la
libgstvp8_la_SOURCES = \
gstvp8dec.c \
gstvp8enc.c \
gstvp8utils.c \
plugin.c
libgstvp8_la_CFLAGS = \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \
$(GST_CFLAGS) \
$(VPX_CFLAGS) \
-DGST_USE_UNSTABLE_API
libgstvp8_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) -lgsttag-@GST_API_VERSION@ -lgstvideo-@GST_API_VERSION@ \
$(GST_BASE_LIBS) $(GST_LIBS) $(VPX_LIBS)
libgstvp8_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstvp8_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = \
gstvp8dec.h \
gstvp8enc.h \
gstvp8utils.h
presetdir = $(datadir)/gstreamer-$(GST_API_VERSION)/presets
preset_DATA = GstVP8Enc.prs
EXTRA_DIST = $(preset_DATA)

View file

@ -1,570 +0,0 @@
/* VP8
* Copyright (C) 2006 David Schleef <ds@schleef.org>
* Copyright (C) 2008,2009,2010 Entropy Wave Inc
* Copyright (C) 2010-2012 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
/**
* SECTION:element-vp8dec
* @see_also: vp8enc, matroskademux
*
* This element decodes VP8 streams into raw video.
* <ulink url="http://www.webmproject.org">VP8</ulink> is a royalty-free
* video codec maintained by <ulink url="http://www.google.com/">Google
* </ulink>. It's the successor of On2 VP3, which was the base of the
* Theora video codec.
*
* <refsect2>
* <title>Example pipeline</title>
* |[
* gst-launch -v filesrc location=videotestsrc.webm ! matroskademux ! vp8dec ! xvimagesink
* ]| This example pipeline will decode a WebM stream and decodes the VP8 video.
* </refsect2>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_VP8_DECODER
#include <string.h>
#include "gstvp8dec.h"
#include "gstvp8utils.h"
#include <gst/video/gstvideometa.h>
#include <gst/video/gstvideopool.h>
GST_DEBUG_CATEGORY_STATIC (gst_vp8dec_debug);
#define GST_CAT_DEFAULT gst_vp8dec_debug
#define DEFAULT_POST_PROCESSING FALSE
#define DEFAULT_POST_PROCESSING_FLAGS (VP8_DEBLOCK | VP8_DEMACROBLOCK | VP8_MFQE)
#define DEFAULT_DEBLOCKING_LEVEL 4
#define DEFAULT_NOISE_LEVEL 0
#define DEFAULT_THREADS 1
enum
{
PROP_0,
PROP_POST_PROCESSING,
PROP_POST_PROCESSING_FLAGS,
PROP_DEBLOCKING_LEVEL,
PROP_NOISE_LEVEL,
PROP_THREADS
};
#define C_FLAGS(v) ((guint) v)
#define GST_VP8_DEC_TYPE_POST_PROCESSING_FLAGS (gst_vp8_dec_post_processing_flags_get_type())
static GType
gst_vp8_dec_post_processing_flags_get_type (void)
{
static const GFlagsValue values[] = {
{C_FLAGS (VP8_DEBLOCK), "Deblock", "deblock"},
{C_FLAGS (VP8_DEMACROBLOCK), "Demacroblock", "demacroblock"},
{C_FLAGS (VP8_ADDNOISE), "Add noise", "addnoise"},
{C_FLAGS (VP8_MFQE), "Multi-frame quality enhancement", "mfqe"},
{0, NULL, NULL}
};
static volatile GType id = 0;
if (g_once_init_enter ((gsize *) & id)) {
GType _id;
_id = g_flags_register_static ("GstVP8DecPostProcessingFlags", values);
g_once_init_leave ((gsize *) & id, _id);
}
return id;
}
#undef C_FLAGS
static void gst_vp8_dec_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_vp8_dec_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static gboolean gst_vp8_dec_start (GstVideoDecoder * decoder);
static gboolean gst_vp8_dec_stop (GstVideoDecoder * decoder);
static gboolean gst_vp8_dec_set_format (GstVideoDecoder * decoder,
GstVideoCodecState * state);
static gboolean gst_vp8_dec_reset (GstVideoDecoder * decoder, gboolean hard);
static GstFlowReturn gst_vp8_dec_handle_frame (GstVideoDecoder * decoder,
GstVideoCodecFrame * frame);
static gboolean gst_vp8_dec_decide_allocation (GstVideoDecoder * decoder,
GstQuery * query);
static GstStaticPadTemplate gst_vp8_dec_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-vp8")
);
static GstStaticPadTemplate gst_vp8_dec_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420"))
);
#define parent_class gst_vp8_dec_parent_class
G_DEFINE_TYPE (GstVP8Dec, gst_vp8_dec, GST_TYPE_VIDEO_DECODER);
static void
gst_vp8_dec_class_init (GstVP8DecClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *element_class;
GstVideoDecoderClass *base_video_decoder_class;
gobject_class = G_OBJECT_CLASS (klass);
element_class = GST_ELEMENT_CLASS (klass);
base_video_decoder_class = GST_VIDEO_DECODER_CLASS (klass);
gobject_class->set_property = gst_vp8_dec_set_property;
gobject_class->get_property = gst_vp8_dec_get_property;
g_object_class_install_property (gobject_class, PROP_POST_PROCESSING,
g_param_spec_boolean ("post-processing", "Post Processing",
"Enable post processing", DEFAULT_POST_PROCESSING,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_POST_PROCESSING_FLAGS,
g_param_spec_flags ("post-processing-flags", "Post Processing Flags",
"Flags to control post processing",
GST_VP8_DEC_TYPE_POST_PROCESSING_FLAGS, DEFAULT_POST_PROCESSING_FLAGS,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_DEBLOCKING_LEVEL,
g_param_spec_uint ("deblocking-level", "Deblocking Level",
"Deblocking level",
0, 16, DEFAULT_DEBLOCKING_LEVEL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_NOISE_LEVEL,
g_param_spec_uint ("noise-level", "Noise Level",
"Noise level",
0, 16, DEFAULT_NOISE_LEVEL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_THREADS,
g_param_spec_uint ("threads", "Max Threads",
"Maximum number of decoding threads",
1, 16, DEFAULT_THREADS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_vp8_dec_src_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_vp8_dec_sink_template));
gst_element_class_set_metadata (element_class,
"On2 VP8 Decoder",
"Codec/Decoder/Video",
"Decode VP8 video streams", "David Schleef <ds@entropywave.com>, "
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
base_video_decoder_class->start = GST_DEBUG_FUNCPTR (gst_vp8_dec_start);
base_video_decoder_class->stop = GST_DEBUG_FUNCPTR (gst_vp8_dec_stop);
base_video_decoder_class->reset = GST_DEBUG_FUNCPTR (gst_vp8_dec_reset);
base_video_decoder_class->set_format =
GST_DEBUG_FUNCPTR (gst_vp8_dec_set_format);
base_video_decoder_class->handle_frame =
GST_DEBUG_FUNCPTR (gst_vp8_dec_handle_frame);
base_video_decoder_class->decide_allocation = gst_vp8_dec_decide_allocation;
GST_DEBUG_CATEGORY_INIT (gst_vp8dec_debug, "vp8dec", 0, "VP8 Decoder");
}
static void
gst_vp8_dec_init (GstVP8Dec * gst_vp8_dec)
{
GstVideoDecoder *decoder = (GstVideoDecoder *) gst_vp8_dec;
GST_DEBUG_OBJECT (gst_vp8_dec, "gst_vp8_dec_init");
gst_video_decoder_set_packetized (decoder, TRUE);
gst_vp8_dec->post_processing = DEFAULT_POST_PROCESSING;
gst_vp8_dec->post_processing_flags = DEFAULT_POST_PROCESSING_FLAGS;
gst_vp8_dec->deblocking_level = DEFAULT_DEBLOCKING_LEVEL;
gst_vp8_dec->noise_level = DEFAULT_NOISE_LEVEL;
}
static void
gst_vp8_dec_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstVP8Dec *dec;
g_return_if_fail (GST_IS_VP8_DEC (object));
dec = GST_VP8_DEC (object);
GST_DEBUG_OBJECT (object, "gst_vp8_dec_set_property");
switch (prop_id) {
case PROP_POST_PROCESSING:
dec->post_processing = g_value_get_boolean (value);
break;
case PROP_POST_PROCESSING_FLAGS:
dec->post_processing_flags = g_value_get_flags (value);
break;
case PROP_DEBLOCKING_LEVEL:
dec->deblocking_level = g_value_get_uint (value);
break;
case PROP_NOISE_LEVEL:
dec->noise_level = g_value_get_uint (value);
break;
case PROP_THREADS:
dec->threads = g_value_get_uint (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_vp8_dec_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstVP8Dec *dec;
g_return_if_fail (GST_IS_VP8_DEC (object));
dec = GST_VP8_DEC (object);
switch (prop_id) {
case PROP_POST_PROCESSING:
g_value_set_boolean (value, dec->post_processing);
break;
case PROP_POST_PROCESSING_FLAGS:
g_value_set_flags (value, dec->post_processing_flags);
break;
case PROP_DEBLOCKING_LEVEL:
g_value_set_uint (value, dec->deblocking_level);
break;
case PROP_NOISE_LEVEL:
g_value_set_uint (value, dec->noise_level);
break;
case PROP_THREADS:
g_value_set_uint (value, dec->threads);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static gboolean
gst_vp8_dec_start (GstVideoDecoder * decoder)
{
GstVP8Dec *gst_vp8_dec = GST_VP8_DEC (decoder);
GST_DEBUG_OBJECT (gst_vp8_dec, "start");
gst_vp8_dec->decoder_inited = FALSE;
return TRUE;
}
static gboolean
gst_vp8_dec_stop (GstVideoDecoder * base_video_decoder)
{
GstVP8Dec *gst_vp8_dec = GST_VP8_DEC (base_video_decoder);
GST_DEBUG_OBJECT (gst_vp8_dec, "stop");
if (gst_vp8_dec->output_state) {
gst_video_codec_state_unref (gst_vp8_dec->output_state);
gst_vp8_dec->output_state = NULL;
}
if (gst_vp8_dec->input_state) {
gst_video_codec_state_unref (gst_vp8_dec->input_state);
gst_vp8_dec->input_state = NULL;
}
if (gst_vp8_dec->decoder_inited)
vpx_codec_destroy (&gst_vp8_dec->decoder);
gst_vp8_dec->decoder_inited = FALSE;
return TRUE;
}
static gboolean
gst_vp8_dec_set_format (GstVideoDecoder * decoder, GstVideoCodecState * state)
{
GstVP8Dec *gst_vp8_dec = GST_VP8_DEC (decoder);
GST_DEBUG_OBJECT (gst_vp8_dec, "set_format");
gst_vp8_dec->decoder_inited = FALSE;
if (gst_vp8_dec->input_state)
gst_video_codec_state_unref (gst_vp8_dec->input_state);
gst_vp8_dec->input_state = gst_video_codec_state_ref (state);
return TRUE;
}
static gboolean
gst_vp8_dec_reset (GstVideoDecoder * base_video_decoder, gboolean hard)
{
GstVP8Dec *decoder;
GST_DEBUG_OBJECT (base_video_decoder, "reset");
decoder = GST_VP8_DEC (base_video_decoder);
if (decoder->output_state) {
gst_video_codec_state_unref (decoder->output_state);
decoder->output_state = NULL;
}
if (hard && decoder->input_state) {
gst_video_codec_state_unref (decoder->input_state);
decoder->input_state = NULL;
}
if (decoder->decoder_inited)
vpx_codec_destroy (&decoder->decoder);
decoder->decoder_inited = FALSE;
return TRUE;
}
static void
gst_vp8_dec_send_tags (GstVP8Dec * dec)
{
GstTagList *list;
list = gst_tag_list_new_empty ();
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
GST_TAG_VIDEO_CODEC, "VP8 video", NULL);
gst_pad_push_event (GST_VIDEO_DECODER_SRC_PAD (dec),
gst_event_new_tag (list));
}
static void
gst_vp8_dec_image_to_buffer (GstVP8Dec * dec, const vpx_image_t * img,
GstBuffer * buffer)
{
int deststride, srcstride, height, width, line, comp;
guint8 *dest, *src;
GstVideoFrame frame;
GstVideoInfo *info = &dec->output_state->info;
if (!gst_video_frame_map (&frame, info, buffer, GST_MAP_WRITE)) {
GST_ERROR_OBJECT (dec, "Could not map video buffer");
}
for (comp = 0; comp < 3; comp++) {
dest = GST_VIDEO_FRAME_COMP_DATA (&frame, comp);
src = img->planes[comp];
width = GST_VIDEO_FRAME_COMP_WIDTH (&frame, comp);
height = GST_VIDEO_FRAME_COMP_HEIGHT (&frame, comp);
deststride = GST_VIDEO_FRAME_COMP_STRIDE (&frame, comp);
srcstride = img->stride[comp];
/* FIXME (Edward) : Do a plane memcpy is srcstride == deststride instead
* of copying line by line */
for (line = 0; line < height; line++) {
memcpy (dest, src, width);
dest += deststride;
src += srcstride;
}
}
gst_video_frame_unmap (&frame);
}
static GstFlowReturn
open_codec (GstVP8Dec * dec, GstVideoCodecFrame * frame)
{
int flags = 0;
vpx_codec_stream_info_t stream_info;
vpx_codec_caps_t caps;
vpx_codec_dec_cfg_t cfg;
GstVideoCodecState *state = dec->input_state;
vpx_codec_err_t status;
GstMapInfo minfo;
memset (&stream_info, 0, sizeof (stream_info));
memset (&cfg, 0, sizeof (cfg));
stream_info.sz = sizeof (stream_info);
if (!gst_buffer_map (frame->input_buffer, &minfo, GST_MAP_READ)) {
GST_ERROR_OBJECT (dec, "Failed to map input buffer");
return GST_FLOW_ERROR;
}
status = vpx_codec_peek_stream_info (&vpx_codec_vp8_dx_algo,
minfo.data, minfo.size, &stream_info);
gst_buffer_unmap (frame->input_buffer, &minfo);
if (status != VPX_CODEC_OK || !stream_info.is_kf) {
GST_WARNING_OBJECT (dec, "No keyframe, skipping");
gst_video_decoder_finish_frame (GST_VIDEO_DECODER (dec), frame);
return GST_FLOW_OK;
}
g_assert (dec->output_state == NULL);
dec->output_state =
gst_video_decoder_set_output_state (GST_VIDEO_DECODER (dec),
GST_VIDEO_FORMAT_I420, stream_info.w, stream_info.h, state);
gst_video_decoder_negotiate (GST_VIDEO_DECODER (dec));
gst_vp8_dec_send_tags (dec);
cfg.w = stream_info.w;
cfg.h = stream_info.h;
cfg.threads = dec->threads;
caps = vpx_codec_get_caps (&vpx_codec_vp8_dx_algo);
if (dec->post_processing) {
if (!(caps & VPX_CODEC_CAP_POSTPROC)) {
GST_WARNING_OBJECT (dec, "Decoder does not support post processing");
} else {
flags |= VPX_CODEC_USE_POSTPROC;
}
}
status =
vpx_codec_dec_init (&dec->decoder, &vpx_codec_vp8_dx_algo, &cfg, flags);
if (status != VPX_CODEC_OK) {
GST_ELEMENT_ERROR (dec, LIBRARY, INIT,
("Failed to initialize VP8 decoder"), ("%s",
gst_vpx_error_name (status)));
return GST_FLOW_ERROR;
}
if ((caps & VPX_CODEC_CAP_POSTPROC) && dec->post_processing) {
vp8_postproc_cfg_t pp_cfg = { 0, };
pp_cfg.post_proc_flag = dec->post_processing_flags;
pp_cfg.deblocking_level = dec->deblocking_level;
pp_cfg.noise_level = dec->noise_level;
status = vpx_codec_control (&dec->decoder, VP8_SET_POSTPROC, &pp_cfg);
if (status != VPX_CODEC_OK) {
GST_WARNING_OBJECT (dec, "Couldn't set postprocessing settings: %s",
gst_vpx_error_name (status));
}
}
dec->decoder_inited = TRUE;
return GST_FLOW_OK;
}
static GstFlowReturn
gst_vp8_dec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame)
{
GstVP8Dec *dec;
GstFlowReturn ret = GST_FLOW_OK;
vpx_codec_err_t status;
vpx_codec_iter_t iter = NULL;
vpx_image_t *img;
long decoder_deadline = 0;
GstClockTimeDiff deadline;
GstMapInfo minfo;
GST_DEBUG_OBJECT (decoder, "handle_frame");
dec = GST_VP8_DEC (decoder);
if (!dec->decoder_inited)
ret = open_codec (dec, frame);
deadline = gst_video_decoder_get_max_decode_time (decoder, frame);
if (deadline < 0) {
decoder_deadline = 1;
} else if (deadline == G_MAXINT64) {
decoder_deadline = 0;
} else {
decoder_deadline = MAX (1, deadline / GST_MSECOND);
}
if (!gst_buffer_map (frame->input_buffer, &minfo, GST_MAP_READ)) {
GST_ERROR_OBJECT (dec, "Failed to map input buffer");
return GST_FLOW_ERROR;
}
status = vpx_codec_decode (&dec->decoder,
minfo.data, minfo.size, NULL, decoder_deadline);
gst_buffer_unmap (frame->input_buffer, &minfo);
if (status) {
GST_ELEMENT_ERROR (decoder, LIBRARY, ENCODE,
("Failed to decode frame"), ("%s", gst_vpx_error_name (status)));
return GST_FLOW_ERROR;
}
img = vpx_codec_get_frame (&dec->decoder, &iter);
if (img) {
if (deadline < 0) {
GST_LOG_OBJECT (dec, "Skipping late frame (%f s past deadline)",
(double) -deadline / GST_SECOND);
gst_video_decoder_drop_frame (decoder, frame);
} else {
ret = gst_video_decoder_allocate_output_frame (decoder, frame);
if (ret == GST_FLOW_OK) {
gst_vp8_dec_image_to_buffer (dec, img, frame->output_buffer);
ret = gst_video_decoder_finish_frame (decoder, frame);
} else {
gst_video_decoder_finish_frame (decoder, frame);
}
}
vpx_img_free (img);
while ((img = vpx_codec_get_frame (&dec->decoder, &iter))) {
GST_WARNING_OBJECT (decoder, "Multiple decoded frames... dropping");
vpx_img_free (img);
}
} else {
/* Invisible frame */
GST_VIDEO_CODEC_FRAME_SET_DECODE_ONLY (frame);
gst_video_decoder_finish_frame (decoder, frame);
}
return ret;
}
static gboolean
gst_vp8_dec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query)
{
GstBufferPool *pool;
GstStructure *config;
if (!GST_VIDEO_DECODER_CLASS (parent_class)->decide_allocation (bdec, query))
return FALSE;
g_assert (gst_query_get_n_allocation_pools (query) > 0);
gst_query_parse_nth_allocation_pool (query, 0, &pool, NULL, NULL, NULL);
g_assert (pool != NULL);
config = gst_buffer_pool_get_config (pool);
if (gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL)) {
gst_buffer_pool_config_add_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
}
gst_buffer_pool_set_config (pool, config);
gst_object_unref (pool);
return TRUE;
}
#endif /* HAVE_VP8_DECODER */

View file

@ -1,84 +0,0 @@
/* VP8
* Copyright (C) 2006 David Schleef <ds@schleef.org>
* Copyright (C) 2008,2009,2010 Entropy Wave Inc
* Copyright (C) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __GST_VP8_DEC_H__
#define __GST_VP8_DEC_H__
#include <gst/gst.h>
#include <gst/video/gstvideodecoder.h>
/* FIXME: Undef HAVE_CONFIG_H because vpx_codec.h uses it,
* which causes compilation failures */
#ifdef HAVE_CONFIG_H
#undef HAVE_CONFIG_H
#endif
#include <vpx/vpx_decoder.h>
#include <vpx/vp8dx.h>
G_BEGIN_DECLS
#define GST_TYPE_VP8_DEC \
(gst_vp8_dec_get_type())
#define GST_VP8_DEC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VP8_DEC,GstVP8Dec))
#define GST_VP8_DEC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VP8_DEC,GstVP8DecClass))
#define GST_IS_VP8_DEC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VP8_DEC))
#define GST_IS_VP8_DEC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VP8_DEC))
typedef struct _GstVP8Dec GstVP8Dec;
typedef struct _GstVP8DecClass GstVP8DecClass;
struct _GstVP8Dec
{
GstVideoDecoder base_video_decoder;
/* < private > */
vpx_codec_ctx_t decoder;
/* state */
gboolean decoder_inited;
/* properties */
gboolean post_processing;
enum vp8_postproc_level post_processing_flags;
gint deblocking_level;
gint noise_level;
gint threads;
GstVideoCodecState *input_state;
GstVideoCodecState *output_state;
};
struct _GstVP8DecClass
{
GstVideoDecoderClass base_video_decoder_class;
};
GType gst_vp8_dec_get_type (void);
G_END_DECLS
#endif /* __GST_VP8_DEC_H__ */

File diff suppressed because it is too large Load diff

View file

@ -1,153 +0,0 @@
/* VP8
* Copyright (C) 2006 David Schleef <ds@schleef.org>
* Copyright (C) 2010 Entropy Wave Inc
* Copyright (C) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __GST_VP8_ENC_H__
#define __GST_VP8_ENC_H__
#include <gst/gst.h>
#include <gst/video/gstvideoencoder.h>
/* FIXME: Undef HAVE_CONFIG_H because vpx_codec.h uses it,
* which causes compilation failures */
#ifdef HAVE_CONFIG_H
#undef HAVE_CONFIG_H
#endif
#include <vpx/vpx_encoder.h>
#include <vpx/vp8cx.h>
G_BEGIN_DECLS
#define GST_TYPE_VP8_ENC \
(gst_vp8_enc_get_type())
#define GST_VP8_ENC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VP8_ENC,GstVP8Enc))
#define GST_VP8_ENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VP8_ENC,GstVP8EncClass))
#define GST_IS_VP8_ENC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VP8_ENC))
#define GST_IS_VP8_ENC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VP8_ENC))
typedef struct _GstVP8Enc GstVP8Enc;
typedef struct _GstVP8EncClass GstVP8EncClass;
struct _GstVP8Enc
{
GstVideoEncoder base_video_encoder;
/* < private > */
vpx_codec_ctx_t encoder;
/* from downstream caps */
int profile;
/* properties */
/* Rate control options */
enum vpx_rc_mode rc_end_usage;
unsigned int rc_target_bitrate;
gboolean rc_target_bitrate_set;
unsigned int rc_min_quantizer, rc_max_quantizer;
unsigned int rc_dropframe_thresh;
gboolean rc_resize_allowed;
unsigned int rc_resize_up_thresh;
unsigned int rc_resize_down_thresh;
unsigned int rc_undershoot_pct;
unsigned int rc_overshoot_pct;
unsigned int rc_buf_sz;
unsigned int rc_buf_initial_sz;
unsigned int rc_buf_optimal_sz;
unsigned int rc_2pass_vbr_bias_pct;
unsigned int rc_2pass_vbr_minsection_pct;
unsigned int rc_2pass_vbr_maxsection_pct;
/* Global keyframe options */
enum vpx_kf_mode kf_mode;
unsigned int kf_max_dist;
/* Global two-pass options */
enum vpx_enc_pass multipass_mode;
gchar *multipass_cache_file;
GByteArray *first_pass_cache_content;
vpx_fixed_buf_t last_pass_cache_content;
/* Global temporal scalability options */
unsigned int ts_number_layers;
unsigned int ts_target_bitrate[VPX_TS_MAX_LAYERS];
int n_ts_target_bitrate;
unsigned int ts_rate_decimator[VPX_TS_MAX_LAYERS];
int n_ts_rate_decimator;
unsigned int ts_periodicity;
unsigned int ts_layer_id[VPX_TS_MAX_PERIODICITY];
int n_ts_layer_id;
/* Global, other options */
vpx_codec_er_flags_t error_resilient;
unsigned int lag_in_frames;
int threads;
#if 0
/* Only usage 0 is defined right now */
int usage;
#endif
/* Encode parameter */
gint64 deadline;
/* Controls */
VPX_SCALING_MODE h_scaling_mode;
VPX_SCALING_MODE v_scaling_mode;
int cpu_used;
gboolean enable_auto_alt_ref;
unsigned int noise_sensitivity;
unsigned int sharpness;
unsigned int static_threshold;
vp8e_token_partitions token_partitions;
unsigned int arnr_maxframes;
unsigned int arnr_strength;
unsigned int arnr_type;
vp8e_tuning tuning;
unsigned int cq_level;
unsigned int max_intra_bitrate_pct;
/* state */
gboolean inited;
vpx_image_t image;
int n_frames;
int keyframe_distance;
GstVideoCodecState *input_state;
};
struct _GstVP8EncClass
{
GstVideoEncoderClass base_video_encoder_class;
};
GType gst_vp8_enc_get_type (void);
G_END_DECLS
#endif /* __GST_VP8_ENC_H__ */

View file

@ -1,64 +0,0 @@
/* VP8
* Copyright (C) 2006 David Schleef <ds@schleef.org>
* Copyright (C) 2010 Entropy Wave Inc
* Copyright (C) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
/* FIXME: Undef HAVE_CONFIG_H because vpx_codec.h uses it,
* which causes compilation failures */
#ifdef HAVE_CONFIG_H
#undef HAVE_CONFIG_H
#endif
#include <vpx/vpx_codec.h>
#include "gstvp8utils.h"
const char *
gst_vpx_error_name (vpx_codec_err_t status)
{
switch (status) {
case VPX_CODEC_OK:
return "OK";
case VPX_CODEC_ERROR:
return "error";
case VPX_CODEC_MEM_ERROR:
return "mem error";
case VPX_CODEC_ABI_MISMATCH:
return "abi mismatch";
case VPX_CODEC_INCAPABLE:
return "incapable";
case VPX_CODEC_UNSUP_BITSTREAM:
return "unsupported bitstream";
case VPX_CODEC_UNSUP_FEATURE:
return "unsupported feature";
case VPX_CODEC_CORRUPT_FRAME:
return "corrupt frame";
case VPX_CODEC_INVALID_PARAM:
return "invalid parameter";
default:
return "unknown";
}
}

View file

@ -1,47 +0,0 @@
/* VP8
* Copyright (C) 2006 David Schleef <ds@schleef.org>
* Copyright (C) 2010 Entropy Wave Inc
* Copyright (C) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#include <gst/gst.h>
#include <vpx/vpx_codec.h>
G_BEGIN_DECLS
/* Some compatibility defines for older libvpx versions */
#ifndef VPX_IMG_FMT_I420
#define VPX_IMG_FMT_I420 IMG_FMT_I420
#endif
#ifndef VPX_PLANE_Y
#define VPX_PLANE_Y PLANE_Y
#endif
#ifndef VPX_PLANE_U
#define VPX_PLANE_U PLANE_U
#endif
#ifndef VPX_PLANE_V
#define VPX_PLANE_V PLANE_V
#endif
const char * gst_vpx_error_name (vpx_codec_err_t status);
G_END_DECLS

View file

@ -1,51 +0,0 @@
/* VP8
* Copyright (C) 2006 David Schleef <ds@schleef.org>
* Copyright (C) 2010 Entropy Wave Inc
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
#include "gstvp8dec.h"
#include "gstvp8enc.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
#ifdef HAVE_VP8_DECODER
gst_element_register (plugin, "vp8dec", GST_RANK_PRIMARY,
gst_vp8_dec_get_type ());
#endif
#ifdef HAVE_VP8_ENCODER
gst_element_register (plugin, "vp8enc", GST_RANK_PRIMARY,
gst_vp8_enc_get_type ());
#endif
return TRUE;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
vp8,
"VP8 plugin",
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)

View file

@ -123,12 +123,6 @@ else
check_mimic=
endif
if USE_VP8
check_vp8=elements/vp8enc elements/vp8dec
else
check_vp8=
endif
if HAVE_ORC
check_orc = orc/cog orc/bayer
else
@ -229,7 +223,6 @@ check_PROGRAMS = \
$(check_uvch264) \
libs/vc1parser \
$(check_schro) \
$(check_vp8) \
elements/viewfinderbin \
$(check_zbar) \
$(check_orc) \

View file

@ -49,6 +49,4 @@ videorecordingbin
viewfinderbin
voaacenc
voamrwbenc
vp8dec
vp8enc
zbar

View file

@ -1,178 +0,0 @@
/* GStreamer
*
* Copyright (c) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gst/check/gstcheck.h>
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw, "
"format = (string) I420, "
"width = (int) [1, MAX], "
"height = (int) [1, MAX], " "framerate = (fraction) [0, MAX]"));
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw, "
"format = (string) I420, "
"width = (int) [1, MAX], "
"height = (int) [1, MAX], " "framerate = (fraction) [0, MAX]"));
static GstPad *sinkpad, *srcpad;
static GstElement *
setup_vp8dec (const gchar * src_caps_str)
{
GstElement *bin;
GstElement *vp8enc, *vp8dec;
GstCaps *srccaps = NULL;
GstBus *bus;
GstPad *ghostpad, *targetpad;
if (src_caps_str) {
srccaps = gst_caps_from_string (src_caps_str);
fail_unless (srccaps != NULL);
}
bin = gst_bin_new ("bin");
vp8enc = gst_check_setup_element ("vp8enc");
fail_unless (vp8enc != NULL);
vp8dec = gst_check_setup_element ("vp8dec");
fail_unless (vp8dec != NULL);
gst_bin_add_many (GST_BIN (bin), vp8enc, vp8dec, NULL);
fail_unless (gst_element_link_pads (vp8enc, "src", vp8dec, "sink"));
targetpad = gst_element_get_static_pad (vp8enc, "sink");
fail_unless (targetpad != NULL);
ghostpad = gst_ghost_pad_new ("sink", targetpad);
fail_unless (ghostpad != NULL);
gst_element_add_pad (bin, ghostpad);
gst_object_unref (targetpad);
targetpad = gst_element_get_static_pad (vp8dec, "src");
fail_unless (targetpad != NULL);
ghostpad = gst_ghost_pad_new ("src", targetpad);
fail_unless (ghostpad != NULL);
gst_element_add_pad (bin, ghostpad);
gst_object_unref (targetpad);
srcpad = gst_check_setup_src_pad (bin, &srctemplate);
sinkpad = gst_check_setup_sink_pad (bin, &sinktemplate);
gst_pad_set_active (srcpad, TRUE);
gst_pad_set_active (sinkpad, TRUE);
fail_unless (gst_pad_set_caps (srcpad, srccaps));
bus = gst_bus_new ();
gst_element_set_bus (bin, bus);
fail_unless (gst_element_set_state (bin,
GST_STATE_PLAYING) != GST_STATE_CHANGE_FAILURE,
"could not set to playing");
if (srccaps)
gst_caps_unref (srccaps);
buffers = NULL;
return bin;
}
static void
cleanup_vp8dec (GstElement * bin)
{
GstBus *bus;
/* Free parsed buffers */
gst_check_drop_buffers ();
bus = GST_ELEMENT_BUS (bin);
gst_bus_set_flushing (bus, TRUE);
gst_object_unref (bus);
gst_pad_set_active (srcpad, FALSE);
gst_pad_set_active (sinkpad, FALSE);
gst_check_teardown_src_pad (bin);
gst_check_teardown_sink_pad (bin);
gst_check_teardown_element (bin);
}
GST_START_TEST (test_decode_simple)
{
GstElement *bin;
GstBuffer *buffer;
gint i;
GList *l;
GstSegment seg;
bin =
setup_vp8dec
("video/x-raw,format=(string)I420,width=(int)320,height=(int)240,framerate=(fraction)25/1");
gst_segment_init (&seg, GST_FORMAT_TIME);
seg.stop = gst_util_uint64_scale (20, GST_SECOND, 25);
fail_unless (gst_pad_push_event (srcpad, gst_event_new_segment (&seg)));
buffer = gst_buffer_new_and_alloc (320 * 240 + 2 * 160 * 120);
gst_buffer_memset (buffer, 0, 0, -1);
for (i = 0; i < 20; i++) {
GST_BUFFER_TIMESTAMP (buffer) = gst_util_uint64_scale (i, GST_SECOND, 25);
GST_BUFFER_DURATION (buffer) = gst_util_uint64_scale (1, GST_SECOND, 25);
fail_unless (gst_pad_push (srcpad, gst_buffer_ref (buffer)) == GST_FLOW_OK);
}
gst_buffer_unref (buffer);
fail_unless (gst_pad_push_event (srcpad, gst_event_new_eos ()));
/* All buffers must be there now */
fail_unless_equals_int (g_list_length (buffers), 20);
for (l = buffers, i = 0; l; l = l->next, i++) {
buffer = l->data;
fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (buffer),
gst_util_uint64_scale (i, GST_SECOND, 25));
fail_unless_equals_uint64 (GST_BUFFER_DURATION (buffer),
gst_util_uint64_scale (1, GST_SECOND, 25));
}
cleanup_vp8dec (bin);
}
GST_END_TEST;
static Suite *
vp8dec_suite (void)
{
Suite *s = suite_create ("vp8dec");
TCase *tc_chain = tcase_create ("general");
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_decode_simple);
return s;
}
GST_CHECK_MAIN (vp8dec);

View file

@ -1,168 +0,0 @@
/* GStreamer
*
* Copyright (c) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gst/check/gstcheck.h>
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-vp8, "
"width = (int) [1, MAX], "
"height = (int) [1, MAX], " "framerate = (fraction) [0, MAX]"));
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw, "
"format = (string) I420, "
"width = (int) [1, MAX], "
"height = (int) [1, MAX], " "framerate = (fraction) [0, MAX]"));
static GstPad *sinkpad, *srcpad;
static GstElement *
setup_vp8enc (const gchar * src_caps_str)
{
GstElement *vp8enc;
GstCaps *srccaps = NULL;
GstBus *bus;
if (src_caps_str) {
srccaps = gst_caps_from_string (src_caps_str);
fail_unless (srccaps != NULL);
}
vp8enc = gst_check_setup_element ("vp8enc");
fail_unless (vp8enc != NULL);
srcpad = gst_check_setup_src_pad (vp8enc, &srctemplate);
sinkpad = gst_check_setup_sink_pad (vp8enc, &sinktemplate);
gst_pad_set_active (srcpad, TRUE);
gst_pad_set_active (sinkpad, TRUE);
fail_unless (gst_pad_set_caps (srcpad, srccaps));
bus = gst_bus_new ();
gst_element_set_bus (vp8enc, bus);
fail_unless (gst_element_set_state (vp8enc,
GST_STATE_PLAYING) != GST_STATE_CHANGE_FAILURE,
"could not set to playing");
if (srccaps)
gst_caps_unref (srccaps);
buffers = NULL;
return vp8enc;
}
static void
cleanup_vp8enc (GstElement * vp8enc)
{
GstBus *bus;
/* Free parsed buffers */
gst_check_drop_buffers ();
bus = GST_ELEMENT_BUS (vp8enc);
gst_bus_set_flushing (bus, TRUE);
gst_object_unref (bus);
gst_pad_set_active (srcpad, FALSE);
gst_pad_set_active (sinkpad, FALSE);
gst_check_teardown_src_pad (vp8enc);
gst_check_teardown_sink_pad (vp8enc);
gst_check_teardown_element (vp8enc);
}
GST_START_TEST (test_encode_simple)
{
GstElement *vp8enc;
GstBuffer *buffer;
gint i;
GList *l;
GstCaps *outcaps;
GstSegment seg;
vp8enc =
setup_vp8enc
("video/x-raw,format=(string)I420,width=(int)320,height=(int)240,framerate=(fraction)25/1");
g_object_set (vp8enc, "max-latency", 5, NULL);
gst_segment_init (&seg, GST_FORMAT_TIME);
seg.stop = gst_util_uint64_scale (20, GST_SECOND, 25);
fail_unless (gst_pad_push_event (srcpad, gst_event_new_segment (&seg)));
buffer = gst_buffer_new_and_alloc (320 * 240 + 2 * 160 * 120);
gst_buffer_memset (buffer, 0, 0, -1);
for (i = 0; i < 20; i++) {
GST_BUFFER_TIMESTAMP (buffer) = gst_util_uint64_scale (i, GST_SECOND, 25);
GST_BUFFER_DURATION (buffer) = gst_util_uint64_scale (1, GST_SECOND, 25);
fail_unless (gst_pad_push (srcpad, gst_buffer_ref (buffer)) == GST_FLOW_OK);
}
gst_buffer_unref (buffer);
/* Only 5 buffers are allowed to be queued now */
fail_unless (g_list_length (buffers) > 15);
fail_unless (gst_pad_push_event (srcpad, gst_event_new_eos ()));
/* All buffers must be there now */
fail_unless_equals_int (g_list_length (buffers), 20);
outcaps =
gst_caps_from_string
("video/x-vp8,width=(int)320,height=(int)240,framerate=(fraction)25/1");
for (l = buffers, i = 0; l; l = l->next, i++) {
buffer = l->data;
if (i == 0)
fail_if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT));
fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (buffer),
gst_util_uint64_scale (i, GST_SECOND, 25));
fail_unless_equals_uint64 (GST_BUFFER_DURATION (buffer),
gst_util_uint64_scale (1, GST_SECOND, 25));
}
gst_caps_unref (outcaps);
cleanup_vp8enc (vp8enc);
}
GST_END_TEST;
static Suite *
vp8enc_suite (void)
{
Suite *s = suite_create ("vp8enc");
TCase *tc_chain = tcase_create ("general");
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_encode_simple);
return s;
}
GST_CHECK_MAIN (vp8enc);