Commit bdf7ebf4 authored by Edward Hervey's avatar Edward Hervey

ffmpegenc/dec: Remove audio/video specific code

Makes each file more manageable, second step to porting to base classes
parent 6310ed46
......@@ -138,8 +138,10 @@ plugin_init (GstPlugin * plugin)
av_register_all ();
gst_ffmpegenc_register (plugin);
gst_ffmpegdec_register (plugin);
gst_ffmpegaudenc_register (plugin);
gst_ffmpegvidenc_register (plugin);
gst_ffmpegauddec_register (plugin);
gst_ffmpegviddec_register (plugin);
gst_ffmpegdemux_register (plugin);
gst_ffmpegmux_register (plugin);
gst_ffmpegdeinterlace_register (plugin);
......
......@@ -44,8 +44,10 @@ extern gboolean _shut_up_I_am_probing;
#endif
extern gboolean gst_ffmpegdemux_register (GstPlugin * plugin);
extern gboolean gst_ffmpegdec_register (GstPlugin * plugin);
extern gboolean gst_ffmpegenc_register (GstPlugin * plugin);
extern gboolean gst_ffmpegauddec_register (GstPlugin * plugin);
extern gboolean gst_ffmpegviddec_register (GstPlugin * plugin);
extern gboolean gst_ffmpegaudenc_register (GstPlugin * plugin);
extern gboolean gst_ffmpegvidenc_register (GstPlugin * plugin);
extern gboolean gst_ffmpegmux_register (GstPlugin * plugin);
extern gboolean gst_ffmpegcsp_register (GstPlugin * plugin);
#if 0
......
......@@ -26,7 +26,7 @@
#endif
#include "gstffmpeg.h"
#include "gstffmpegenc.h"
#include "gstffmpegvidenc.h"
#include "gstffmpegcfg.h"
#include <string.h>
......@@ -49,7 +49,7 @@ gst_ffmpeg_pass_get_type (void)
};
ffmpeg_pass_type =
g_enum_register_static ("GstFFMpegEncPass", ffmpeg_passes);
g_enum_register_static ("GstFFMpegVidEncPass", ffmpeg_passes);
}
return ffmpeg_pass_type;
......@@ -71,7 +71,7 @@ gst_ffmpeg_lim_pass_get_type (void)
};
ffmpeg_lim_pass_type =
g_enum_register_static ("GstFFMpegEncLimPass", ffmpeg_lim_passes);
g_enum_register_static ("GstFFMpegVidEncLimPass", ffmpeg_lim_passes);
}
return ffmpeg_lim_pass_type;
......@@ -94,7 +94,8 @@ gst_ffmpeg_mb_decision_get_type (void)
};
ffmpeg_mb_decision_type =
g_enum_register_static ("GstFFMpegEncMBDecision", ffmpeg_mb_decisions);
g_enum_register_static ("GstFFMpegVidEncMBDecision",
ffmpeg_mb_decisions);
}
return ffmpeg_mb_decision_type;
......@@ -207,7 +208,8 @@ gst_ffmpeg_quant_type_get_type (void)
};
ffmpeg_quant_type_type =
g_enum_register_static ("GstFFMpegEncQuantTypes", ffmpeg_quant_types);
g_enum_register_static ("GstFFMpegVidEncQuantTypes",
ffmpeg_quant_types);
}
return ffmpeg_quant_type_type;
......@@ -228,7 +230,7 @@ gst_ffmpeg_pre_me_get_type (void)
};
ffmpeg_pre_me_type =
g_enum_register_static ("GstFFMpegEncPreME", ffmpeg_pre_mes);
g_enum_register_static ("GstFFMpegVidEncPreME", ffmpeg_pre_mes);
}
return ffmpeg_pre_me_type;
......@@ -249,7 +251,8 @@ gst_ffmpeg_pred_method_get_type (void)
};
ffmpeg_pred_method =
g_enum_register_static ("GstFFMpegEncPredMethod", ffmpeg_pred_methods);
g_enum_register_static ("GstFFMpegVidEncPredMethod",
ffmpeg_pred_methods);
}
return ffmpeg_pred_method;
......@@ -325,7 +328,7 @@ struct _GParamSpecData
/* properties whose member offset is higher than the config base
* can be copied directly at context configuration time;
* and can also retrieve a default value from lavc */
#define CONTEXT_CONFIG_OFFSET G_STRUCT_OFFSET (GstFFMpegEnc, config)
#define CONTEXT_CONFIG_OFFSET G_STRUCT_OFFSET (GstFFMpegVidEnc, config)
/* additional info is named pointer specified by the quark */
static GQuark quark;
......@@ -340,7 +343,7 @@ static GList *property_list;
default, include, exclude) \
G_STMT_START { \
GParamSpecData *_qdata = g_new0 (GParamSpecData, 1); \
GstFFMpegEnc _enc; \
GstFFMpegVidEnc _enc; \
_qdata->offset = G_STRUCT_OFFSET (struct_type, member); \
_qdata->size = sizeof (_enc.member); \
_qdata->lavc_default = default; \
......@@ -351,7 +354,7 @@ G_STMT_START { \
} G_STMT_END
#define gst_ffmpeg_add_pspec(pspec, member, default, include, exclude) \
gst_ffmpeg_add_pspec_full (pspec, property_list, GstFFMpegEnc, member, \
gst_ffmpeg_add_pspec_full (pspec, property_list, GstFFMpegVidEnc, member, \
default, include, exclude)
/* ==== BEGIN CONFIGURATION SECTION ==== */
......@@ -756,7 +759,7 @@ gst_ffmpeg_cfg_codec_has_pspec (enum CodecID codec_id, GParamSpec * pspec)
/* install all properties for klass that have been registered in property_list */
void
gst_ffmpeg_cfg_install_property (GstFFMpegEncClass * klass, guint base)
gst_ffmpeg_cfg_install_property (GstFFMpegVidEncClass * klass, guint base)
{
GParamSpec *pspec;
GList *list;
......@@ -888,7 +891,7 @@ gboolean
gst_ffmpeg_cfg_set_property (GObject * object,
const GValue * value, GParamSpec * pspec)
{
GstFFMpegEnc *ffmpegenc = (GstFFMpegEnc *) (object);
GstFFMpegVidEnc *ffmpegenc = (GstFFMpegVidEnc *) (object);
GParamSpecData *qdata;
qdata = g_param_spec_get_qdata (pspec, quark);
......@@ -956,7 +959,7 @@ gboolean
gst_ffmpeg_cfg_get_property (GObject * object,
GValue * value, GParamSpec * pspec)
{
GstFFMpegEnc *ffmpegenc = (GstFFMpegEnc *) (object);
GstFFMpegVidEnc *ffmpegenc = (GstFFMpegVidEnc *) (object);
GParamSpecData *qdata;
qdata = g_param_spec_get_qdata (pspec, quark);
......@@ -1016,7 +1019,7 @@ gst_ffmpeg_cfg_get_property (GObject * object,
}
void
gst_ffmpeg_cfg_set_defaults (GstFFMpegEnc * ffmpegenc)
gst_ffmpeg_cfg_set_defaults (GstFFMpegVidEnc * ffmpegenc)
{
GParamSpec **pspecs;
guint num_props, i;
......@@ -1044,10 +1047,11 @@ gst_ffmpeg_cfg_set_defaults (GstFFMpegEnc * ffmpegenc)
void
gst_ffmpeg_cfg_fill_context (GstFFMpegEnc * ffmpegenc, AVCodecContext * context)
gst_ffmpeg_cfg_fill_context (GstFFMpegVidEnc * ffmpegenc,
AVCodecContext * context)
{
GstFFMpegEncClass *klass
= (GstFFMpegEncClass *) G_OBJECT_GET_CLASS (ffmpegenc);
GstFFMpegVidEncClass *klass
= (GstFFMpegVidEncClass *) G_OBJECT_GET_CLASS (ffmpegenc);
GParamSpec *pspec;
GParamSpecData *qdata;
GList *list;
......@@ -1079,7 +1083,7 @@ gst_ffmpeg_cfg_fill_context (GstFFMpegEnc * ffmpegenc, AVCodecContext * context)
}
void
gst_ffmpeg_cfg_finalize (GstFFMpegEnc * ffmpegenc)
gst_ffmpeg_cfg_finalize (GstFFMpegVidEnc * ffmpegenc)
{
GParamSpec **pspecs;
guint num_props, i;
......
......@@ -25,7 +25,7 @@ G_BEGIN_DECLS
void gst_ffmpeg_cfg_init (void);
void gst_ffmpeg_cfg_install_property (GstFFMpegEncClass * klass, guint base);
void gst_ffmpeg_cfg_install_property (GstFFMpegVidEncClass * klass, guint base);
gboolean gst_ffmpeg_cfg_set_property (GObject * object,
const GValue * value, GParamSpec * pspec);
......@@ -33,9 +33,9 @@ gboolean gst_ffmpeg_cfg_set_property (GObject * object,
gboolean gst_ffmpeg_cfg_get_property (GObject * object,
GValue * value, GParamSpec * pspec);
void gst_ffmpeg_cfg_fill_context (GstFFMpegEnc * ffmpegenc, AVCodecContext * context);
void gst_ffmpeg_cfg_set_defaults (GstFFMpegEnc * ffmpegenc);
void gst_ffmpeg_cfg_finalize (GstFFMpegEnc * ffmpegenc);
void gst_ffmpeg_cfg_fill_context (GstFFMpegVidEnc * ffmpegenc, AVCodecContext * context);
void gst_ffmpeg_cfg_set_defaults (GstFFMpegVidEnc * ffmpegenc);
void gst_ffmpeg_cfg_finalize (GstFFMpegVidEnc * ffmpegenc);
G_END_DECLS
......
This diff is collapsed.
This diff is collapsed.
......@@ -21,16 +21,16 @@
* object definition and other useful things.
*/
#ifndef __GST_FFMPEGENC_H__
#define __GST_FFMPEGENC_H__
#ifndef __GST_FFMPEGAUDENC_H__
#define __GST_FFMPEGAUDENC_H__
G_BEGIN_DECLS
#include <gst/base/gstadapter.h>
typedef struct _GstFFMpegEnc GstFFMpegEnc;
typedef struct _GstFFMpegAudEnc GstFFMpegAudEnc;
struct _GstFFMpegEnc
struct _GstFFMpegAudEnc
{
GstElement element;
......@@ -39,7 +39,6 @@ struct _GstFFMpegEnc
GstPad *sinkpad;
AVCodecContext *context;
AVFrame *picture;
gboolean opened;
GstClockTime adapter_ts;
guint64 adapter_consumed;
......@@ -48,39 +47,17 @@ struct _GstFFMpegEnc
/* cache */
gulong bitrate;
gint me_method;
gint gop_size;
gulong buffer_size;
gulong rtp_payload_size;
guint8 *working_buf;
gulong working_buf_size;
/* settings with some special handling */
guint pass;
gfloat quantizer;
gchar *filename;
guint lmin;
guint lmax;
gint max_key_interval;
gboolean interlaced;
/* statistics file */
FILE *file;
/* for b-frame delay handling */
GQueue *delay;
/* other settings are copied over straight,
* include a context here, rather than copy-and-past it from avcodec.h */
AVCodecContext config;
gboolean force_keyframe;
};
typedef struct _GstFFMpegEncClass GstFFMpegEncClass;
typedef struct _GstFFMpegAudEncClass GstFFMpegAudEncClass;
struct _GstFFMpegEncClass
struct _GstFFMpegAudEncClass
{
GstElementClass parent_class;
......@@ -89,17 +66,17 @@ struct _GstFFMpegEncClass
GstCaps *sinkcaps;
};
#define GST_TYPE_FFMPEGENC \
(gst_ffmpegenc_get_type())
#define GST_FFMPEGENC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGENC,GstFFMpegEnc))
#define GST_FFMPEGENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGENC,GstFFMpegEncClass))
#define GST_IS_FFMPEGENC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGENC))
#define GST_IS_FFMPEGENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGENC))
#define GST_TYPE_FFMPEGAUDENC \
(gst_ffmpegaudenc_get_type())
#define GST_FFMPEGAUDENC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGAUDENC,GstFFMpegAudEnc))
#define GST_FFMPEGAUDENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGAUDENC,GstFFMpegAudEncClass))
#define GST_IS_FFMPEGAUDENC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGAUDENC))
#define GST_IS_FFMPEGAUDENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGAUDENC))
G_END_DECLS
#endif /* __GST_FFMPEGENC_H__ */
#endif /* __GST_FFMPEGAUDENC_H__ */
This diff is collapsed.
This diff is collapsed.
......@@ -21,16 +21,14 @@
* object definition and other useful things.
*/
#ifndef __GST_FFMPEGENC_H__
#define __GST_FFMPEGENC_H__
#ifndef __GST_FFMPEGVIDENC_H__
#define __GST_FFMPEGVIDENC_H__
G_BEGIN_DECLS
#include <gst/base/gstadapter.h>
typedef struct _GstFFMpegVidEnc GstFFMpegVidEnc;
typedef struct _GstFFMpegEnc GstFFMpegEnc;
struct _GstFFMpegEnc
struct _GstFFMpegVidEnc
{
GstElement element;
......@@ -41,9 +39,6 @@ struct _GstFFMpegEnc
AVCodecContext *context;
AVFrame *picture;
gboolean opened;
GstClockTime adapter_ts;
guint64 adapter_consumed;
GstAdapter *adapter;
gboolean discont;
/* cache */
......@@ -78,9 +73,9 @@ struct _GstFFMpegEnc
gboolean force_keyframe;
};
typedef struct _GstFFMpegEncClass GstFFMpegEncClass;
typedef struct _GstFFMpegVidEncClass GstFFMpegVidEncClass;
struct _GstFFMpegEncClass
struct _GstFFMpegVidEncClass
{
GstElementClass parent_class;
......@@ -89,17 +84,17 @@ struct _GstFFMpegEncClass
GstCaps *sinkcaps;
};
#define GST_TYPE_FFMPEGENC \
(gst_ffmpegenc_get_type())
#define GST_FFMPEGENC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGENC,GstFFMpegEnc))
#define GST_FFMPEGENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGENC,GstFFMpegEncClass))
#define GST_IS_FFMPEGENC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGENC))
#define GST_IS_FFMPEGENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGENC))
#define GST_TYPE_FFMPEGVIDENC \
(gst_ffmpegvidenc_get_type())
#define GST_FFMPEGVIDENC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGVIDENC,GstFFMpegVidEnc))
#define GST_FFMPEGVIDENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGVIDENC,GstFFMpegVidEncClass))
#define GST_IS_FFMPEGVIDENC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGVIDENC))
#define GST_IS_FFMPEGVIDENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGVIDENC))
G_END_DECLS
#endif /* __GST_FFMPEGENC_H__ */
#endif /* __GST_FFMPEGVIDENC_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment