Tizen 2.1 base
[profile/ivi/gst-ffmpeg0.10.git] / ext / ffmpeg / gstffmpegenc.h
1 /* GStreamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /* First, include the header file for the plugin, to bring in the
21  * object definition and other useful things.
22  */
23
24 #ifndef __GST_FFMPEGENC_H__
25 #define __GST_FFMPEGENC_H__
26
27 G_BEGIN_DECLS
28
29 #include <gst/base/gstadapter.h>
30
31 typedef struct _GstFFMpegEnc GstFFMpegEnc;
32
33 struct _GstFFMpegEnc
34 {
35   GstElement element;
36
37   /* We need to keep track of our pads, so we do so here. */
38   GstPad *srcpad;
39   GstPad *sinkpad;
40
41   AVCodecContext *context;
42   AVFrame *picture;
43   gboolean opened;
44   GstClockTime adapter_ts;
45   guint64 adapter_consumed;
46   GstAdapter *adapter;
47   gboolean discont;
48
49   /* cache */
50   gulong bitrate;
51   gint me_method;
52   gint gop_size;
53   gulong buffer_size;
54   gulong rtp_payload_size;
55
56   guint8 *working_buf;
57   gulong working_buf_size;
58
59   /* settings with some special handling */
60   guint pass;
61   gfloat quantizer;
62   gchar *filename;
63   guint lmin;
64   guint lmax;
65   gint max_key_interval;
66   gboolean interlaced;
67
68   /* statistics file */
69   FILE *file;
70
71   /* for b-frame delay handling */
72   GQueue *delay;
73
74   /* other settings are copied over straight,
75    * include a context here, rather than copy-and-past it from avcodec.h */
76   AVCodecContext config;
77
78   gboolean force_keyframe;
79 };
80
81 typedef struct _GstFFMpegEncClass GstFFMpegEncClass;
82
83 struct _GstFFMpegEncClass
84 {
85   GstElementClass parent_class;
86
87   AVCodec *in_plugin;
88   GstPadTemplate *srctempl, *sinktempl;
89   GstCaps *sinkcaps;
90 };
91
92 #define GST_TYPE_FFMPEGENC \
93   (gst_ffmpegenc_get_type())
94 #define GST_FFMPEGENC(obj) \
95   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGENC,GstFFMpegEnc))
96 #define GST_FFMPEGENC_CLASS(klass) \
97   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGENC,GstFFMpegEncClass))
98 #define GST_IS_FFMPEGENC(obj) \
99   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGENC))
100 #define GST_IS_FFMPEGENC_CLASS(klass) \
101   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGENC))
102
103 G_END_DECLS
104
105 #endif /* __GST_FFMPEGENC_H__ */