[MOVED FROM BAD 051/134] vp8: Move structure definitions, etc to public header files for gtk-doc

This commit is contained in:
Sebastian Dröge 2010-07-03 17:34:58 +02:00
parent 83ffb384d0
commit 2856d8a6fa
6 changed files with 185 additions and 142 deletions

View file

@ -20,4 +20,6 @@ libgstvp8_la_LIBADD += $(top_builddir)/gst-libs/gst/video/libgstbasevideo-@GST_M
libgstvp8_la_LIBADD += $(VPX_LIBS)
noinst_HEADERS = \
gstvp8dec.h \
gstvp8enc.h \
gstvp8utils.h

View file

@ -1,4 +1,4 @@
/* VP8 plugin
/* 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>
@ -26,73 +26,14 @@
#ifdef HAVE_VP8_DECODER
#include <gst/gst.h>
#include <gst/video/gstbasevideodecoder.h>
#include <gst/video/gstbasevideoutils.h>
#include <gst/base/gstbasetransform.h>
#include <gst/base/gstadapter.h>
#include <gst/video/video.h>
#include <string.h>
#include <math.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>
#include "gstvp8dec.h"
#include "gstvp8utils.h"
GST_DEBUG_CATEGORY_STATIC (gst_vp8dec_debug);
#define GST_CAT_DEFAULT gst_vp8dec_debug
#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_GST_VP8_DEC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VP8_DEC))
#define GST_IS_GST_VP8_DEC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VP8_DEC))
typedef struct _GstVP8Dec GstVP8Dec;
typedef struct _GstVP8DecClass GstVP8DecClass;
struct _GstVP8Dec
{
GstBaseVideoDecoder base_video_decoder;
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;
};
struct _GstVP8DecClass
{
GstBaseVideoDecoderClass base_video_decoder_class;
};
/* GstVP8Dec signals and args */
enum
{
LAST_SIGNAL
};
#define DEFAULT_POST_PROCESSING FALSE
#define DEFAULT_POST_PROCESSING_FLAGS (VP8_DEBLOCK | VP8_DEMACROBLOCK)
#define DEFAULT_DEBLOCKING_LEVEL 4
@ -147,8 +88,6 @@ static GstFlowReturn gst_vp8_dec_parse_data (GstBaseVideoDecoder * decoder,
static GstFlowReturn gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder,
GstVideoFrame * frame, GstClockTimeDiff deadline);
GType gst_vp8_dec_get_type (void);
static GstStaticPadTemplate gst_vp8_dec_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,

81
ext/vp8/gstvp8dec.h Normal file
View file

@ -0,0 +1,81 @@
/* 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/gstbasevideodecoder.h>
#include <gst/video/gstbasevideoutils.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_GST_VP8_DEC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VP8_DEC))
#define GST_IS_GST_VP8_DEC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VP8_DEC))
typedef struct _GstVP8Dec GstVP8Dec;
typedef struct _GstVP8DecClass GstVP8DecClass;
struct _GstVP8Dec
{
GstBaseVideoDecoder 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;
};
struct _GstVP8DecClass
{
GstBaseVideoDecoderClass base_video_decoder_class;
};
GType gst_vp8_dec_get_type (void);
G_END_DECLS
#endif /* __GST_VP8_DEC_H__ */

View file

@ -26,93 +26,21 @@
#ifdef HAVE_VP8_ENCODER
#include <gst/gst.h>
#include <gst/video/gstbasevideoencoder.h>
#include <gst/video/gstbasevideoutils.h>
#include <gst/base/gstbasetransform.h>
#include <gst/base/gstadapter.h>
#include <gst/video/video.h>
#include <gst/tag/tag.h>
#include <string.h>
#include <math.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>
#include "gstvp8utils.h"
#include "gstvp8enc.h"
GST_DEBUG_CATEGORY_STATIC (gst_vp8enc_debug);
#define GST_CAT_DEFAULT gst_vp8enc_debug
#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_GST_VP8_ENC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VP8_ENC))
#define GST_IS_GST_VP8_ENC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VP8_ENC))
typedef struct _GstVP8Enc GstVP8Enc;
typedef struct _GstVP8EncClass GstVP8EncClass;
struct _GstVP8Enc
{
GstBaseVideoEncoder base_video_encoder;
vpx_codec_ctx_t encoder;
/* properties */
int bitrate;
enum vpx_rc_mode mode;
double quality;
gboolean error_resilient;
int max_latency;
int max_keyframe_distance;
int speed;
int threads;
enum vpx_enc_pass multipass_mode;
gchar *multipass_cache_file;
GByteArray *first_pass_cache_content;
vpx_fixed_buf_t last_pass_cache_content;
/* state */
gboolean force_keyframe;
gboolean inited;
int resolution_id;
int n_frames;
int keyframe_distance;
GstPadEventFunction base_sink_event_func;
};
struct _GstVP8EncClass
{
GstBaseVideoEncoderClass base_video_encoder_class;
};
typedef struct
{
vpx_image_t *image;
GList *invisible;
} GstVP8EncCoderHook;
/* GstVP8Enc signals and args */
enum
{
LAST_SIGNAL
};
#define DEFAULT_BITRATE 0
#define DEFAULT_MODE VPX_VBR
#define DEFAULT_QUALITY 5
@ -203,8 +131,6 @@ static GstCaps *gst_vp8_enc_get_caps (GstBaseVideoEncoder * base_video_encoder);
static gboolean gst_vp8_enc_sink_event (GstPad * pad, GstEvent * event);
GType gst_vp8_enc_get_type (void);
static GstStaticPadTemplate gst_vp8_enc_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
@ -766,8 +692,8 @@ gst_vp8_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder,
state = gst_base_video_encoder_get_state (base_video_encoder);
encoder->n_frames++;
GST_DEBUG_OBJECT (base_video_encoder, "res id %d size %d %d",
encoder->resolution_id, state->width, state->height);
GST_DEBUG_OBJECT (base_video_encoder, "size %d %d", state->width,
state->height);
if (!encoder->inited) {
vpx_codec_enc_cfg_t cfg;

95
ext/vp8/gstvp8enc.h Normal file
View file

@ -0,0 +1,95 @@
/* 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/gstbasevideoencoder.h>
#include <gst/video/gstbasevideoutils.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_GST_VP8_ENC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VP8_ENC))
#define GST_IS_GST_VP8_ENC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VP8_ENC))
typedef struct _GstVP8Enc GstVP8Enc;
typedef struct _GstVP8EncClass GstVP8EncClass;
struct _GstVP8Enc
{
GstBaseVideoEncoder base_video_encoder;
/* < private > */
vpx_codec_ctx_t encoder;
/* properties */
int bitrate;
enum vpx_rc_mode mode;
double quality;
gboolean error_resilient;
int max_latency;
int max_keyframe_distance;
int speed;
int threads;
enum vpx_enc_pass multipass_mode;
gchar *multipass_cache_file;
GByteArray *first_pass_cache_content;
vpx_fixed_buf_t last_pass_cache_content;
/* state */
gboolean force_keyframe;
gboolean inited;
int n_frames;
int keyframe_distance;
/* FIXME: Get a event vfunc in BaseVideoEncoder */
GstPadEventFunction base_sink_event_func;
};
struct _GstVP8EncClass
{
GstBaseVideoEncoderClass base_video_encoder_class;
};
GType gst_vp8_enc_get_type (void);
G_END_DECLS
#endif /* __GST_VP8_ENC_H__ */

View file

@ -25,8 +25,8 @@
#include <gst/gst.h>
GType gst_vp8_dec_get_type (void);
GType gst_vp8_enc_get_type (void);
#include "gstvp8dec.h"
#include "gstvp8enc.h"
static gboolean
plugin_init (GstPlugin * plugin)