From 2856d8a6facda273cf2e5b5810ebab19ffad10ca Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 3 Jul 2010 17:34:58 +0200 Subject: [PATCH] [MOVED FROM BAD 051/134] vp8: Move structure definitions, etc to public header files for gtk-doc --- ext/vp8/Makefile.am | 2 ++ ext/vp8/gstvp8dec.c | 65 ++---------------------------------- ext/vp8/gstvp8dec.h | 81 +++++++++++++++++++++++++++++++++++++++++++++ ext/vp8/gstvp8enc.c | 80 ++------------------------------------------ ext/vp8/gstvp8enc.h | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++ ext/vp8/plugin.c | 4 +-- 6 files changed, 185 insertions(+), 142 deletions(-) create mode 100644 ext/vp8/gstvp8dec.h create mode 100644 ext/vp8/gstvp8enc.h diff --git a/ext/vp8/Makefile.am b/ext/vp8/Makefile.am index cd58e28..43989d6 100644 --- a/ext/vp8/Makefile.am +++ b/ext/vp8/Makefile.am @@ -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 diff --git a/ext/vp8/gstvp8dec.c b/ext/vp8/gstvp8dec.c index e1720a3..3a5673f 100644 --- a/ext/vp8/gstvp8dec.c +++ b/ext/vp8/gstvp8dec.c @@ -1,4 +1,4 @@ -/* VP8 plugin +/* VP8 * Copyright (C) 2006 David Schleef * Copyright (C) 2008,2009,2010 Entropy Wave Inc * Copyright (C) 2010 Sebastian Dröge @@ -26,73 +26,14 @@ #ifdef HAVE_VP8_DECODER -#include -#include -#include -#include -#include -#include #include -#include - -/* 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 -#include +#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, diff --git a/ext/vp8/gstvp8dec.h b/ext/vp8/gstvp8dec.h new file mode 100644 index 0000000..afcf9b3 --- /dev/null +++ b/ext/vp8/gstvp8dec.h @@ -0,0 +1,81 @@ +/* VP8 + * Copyright (C) 2006 David Schleef + * Copyright (C) 2008,2009,2010 Entropy Wave Inc + * Copyright (C) 2010 Sebastian Dröge + * + * 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 +#include +#include + +/* 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 +#include + +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__ */ diff --git a/ext/vp8/gstvp8enc.c b/ext/vp8/gstvp8enc.c index 42af0d0..7839fdd 100644 --- a/ext/vp8/gstvp8enc.c +++ b/ext/vp8/gstvp8enc.c @@ -26,93 +26,21 @@ #ifdef HAVE_VP8_ENCODER -#include -#include -#include -#include -#include -#include #include #include -#include - -/* 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 -#include #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; diff --git a/ext/vp8/gstvp8enc.h b/ext/vp8/gstvp8enc.h new file mode 100644 index 0000000..c84df91 --- /dev/null +++ b/ext/vp8/gstvp8enc.h @@ -0,0 +1,95 @@ +/* VP8 + * Copyright (C) 2006 David Schleef + * Copyright (C) 2010 Entropy Wave Inc + * Copyright (C) 2010 Sebastian Dröge + * + * 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 +#include +#include + +/* 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 +#include + +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__ */ diff --git a/ext/vp8/plugin.c b/ext/vp8/plugin.c index 5ee0dc9..cdecdc3 100644 --- a/ext/vp8/plugin.c +++ b/ext/vp8/plugin.c @@ -25,8 +25,8 @@ #include -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) -- 2.7.4