12024
|
1 /*
|
|
2 The mediastreamer library aims at providing modular media processing and I/O
|
|
3 for linphone, but also for any telephony application.
|
|
4 Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
|
|
5
|
|
6 This library is free software; you can redistribute it and/or
|
|
7 modify it under the terms of the GNU Lesser General Public
|
|
8 License as published by the Free Software Foundation; either
|
|
9 version 2.1 of the License, or (at your option) any later version.
|
|
10
|
|
11 This library is distributed in the hope that it will be useful,
|
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14 Lesser General Public License for more details.
|
|
15
|
|
16 You should have received a copy of the GNU Lesser General Public
|
|
17 License along with this library; if not, write to the Free Software
|
|
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19 */
|
|
20
|
|
21
|
|
22 #ifndef MSAVENCODER_H
|
|
23 #define MSAVENCODER_H
|
|
24
|
|
25 #include "msfilter.h"
|
|
26 #include "mscodec.h"
|
|
27 #include <avcodec.h>
|
|
28
|
|
29 /*this is the class that implements a AVencoder filter*/
|
|
30
|
|
31 #define MSAVENCODER_MAX_INPUTS 1 /* max output per filter*/
|
|
32 #define MSAVENCODER_MAX_OUTPUTS 2
|
|
33
|
|
34 struct _MSAVEncoder
|
|
35 {
|
|
36 /* the MSAVEncoder derivates from MSFilter, so the MSFilter object MUST be the first of the MSAVEncoder object
|
|
37 in order to the object mechanism to work*/
|
|
38 MSFilter filter;
|
|
39 MSQueue *q_inputs[MSAVENCODER_MAX_INPUTS];
|
|
40 MSQueue *q_outputs[MSAVENCODER_MAX_OUTPUTS];
|
|
41 AVCodec *av_codec; /*the AVCodec from which this MSFilter is related */
|
|
42 AVCodecContext av_context; /* the context of the AVCodec */
|
|
43 gint input_pix_fmt;
|
|
44 gint av_opened;
|
|
45 MSBuffer *comp_buf;
|
|
46 MSBuffer *yuv_buf;
|
|
47 };
|
|
48
|
|
49 typedef struct _MSAVEncoder MSAVEncoder;
|
|
50 /* MSAVEncoder always outputs planar YUV and accept any incoming format you should setup using
|
|
51 ms_AVencoder_set_format()
|
|
52 q_outputs[0] is the compressed video stream output
|
|
53 q_outputs[1] is a YUV planar buffer of the image it receives in input.
|
|
54 */
|
|
55
|
|
56
|
|
57 struct _MSAVEncoderClass
|
|
58 {
|
|
59 /* the MSAVEncoder derivates from MSFilter, so the MSFilter class MUST be the first of the MSAVEncoder class
|
|
60 in order to the class mechanism to work*/
|
|
61 MSFilterClass parent_class;
|
|
62 };
|
|
63
|
|
64 typedef struct _MSAVEncoderClass MSAVEncoderClass;
|
|
65
|
|
66 /* PUBLIC */
|
|
67 #define MS_AVENCODER(filter) ((MSAVEncoder*)(filter))
|
|
68 #define MS_AVENCODER_CLASS(klass) ((MSAVEncoderClass*)(klass))
|
|
69
|
|
70 MSFilter *ms_h263_encoder_new();
|
|
71 MSFilter *ms_mpeg_encoder_new();
|
|
72 MSFilter *ms_mpeg4_encoder_new();
|
|
73 MSFilter * ms_AVencoder_new_with_codec(enum CodecID codec_id, MSCodecInfo *info);
|
|
74
|
|
75 gint ms_AVencoder_set_format(MSAVEncoder *enc, gchar *fmt);
|
|
76
|
|
77 #define ms_AVencoder_set_width(av,w) (av)->av_context.width=(w)
|
|
78 #define ms_AVencoder_set_height(av,h) (av)->av_context.height=(h)
|
|
79 #define ms_AVencoder_set_bit_rate(av,r) (av)->av_context.bit_rate=(r)
|
|
80
|
|
81 void ms_AVencoder_set_frame_rate(MSAVEncoder *enc, gint frame_rate, gint frame_rate_base);
|
|
82
|
|
83 /* FOR INTERNAL USE*/
|
|
84 void ms_AVencoder_init(MSAVEncoder *r, AVCodec *codec);
|
|
85 void ms_AVencoder_uninit(MSAVEncoder *enc);
|
|
86 void ms_AVencoder_class_init(MSAVEncoderClass *klass);
|
|
87 void ms_AVencoder_destroy( MSAVEncoder *obj);
|
|
88 void ms_AVencoder_process(MSAVEncoder *r);
|
|
89
|
|
90 #endif
|