]> git.sesse.net Git - vlc/blob - include/encoder.h
- added a NULL pointer test
[vlc] / include / encoder.h
1 /*****************************************************************************
2  * encoder.h :
3  *****************************************************************************
4  * Copyright (C) 2002 VideoLAN
5  * $Id: encoder.h,v 1.1 2003/01/22 10:41:57 fenrir Exp $
6  *
7  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23 #ifndef _ENCODER_H
24 #define _ENCODER_H
25
26 typedef struct encoder_sys_t encoder_sys_t;
27
28 typedef struct video_encoder_s
29 {
30     VLC_COMMON_MEMBERS
31
32     module_t * p_module;
33
34     vlc_fourcc_t  i_codec;          /* in */
35     vlc_fourcc_t  i_chroma;         /* in/out */
36     int           i_width;          /* in/out */
37     int           i_height;         /* in/out */
38     int           i_aspect;         /* in/out */
39
40     size_t        i_buffer_size;    /* in/out */
41
42     encoder_sys_t *p_sys;
43
44     int  (*pf_init)     ( struct video_encoder_s *p_enc );
45     int  (*pf_encode)   ( struct video_encoder_s *p_enc, picture_t *p_pic, void *p_data, size_t *pi_data );
46     void (*pf_end)      ( struct video_encoder_s *p_enc );
47
48 } video_encoder_t;
49
50 /*
51  * Video decoder:
52  *
53  *  = at loading a video decoder must
54  *      * see if i_codec is supporte, if not => failling
55  *      * modify i_width/i_height/i_chroma/i_aspect if required (for example,
56  *          if a video codec required %8 size)
57  *      * init/check the library
58  *      * set pf_init, pf_encode and pf_end
59  *      * set i_buffer_size to the max buffer size required to output a single frame
60  *
61  *  = pf_init must
62  *      * start encoding processing 
63  *      * doesn't change any parameters (i_chroma/i_width/i_height/i_aspect)
64  *      * check for passed parameters (no one for the moment)
65  *
66  *  = pf_encode must
67  *      * encode a single frame
68  *      * doesn't change any parameters (...)
69  *      * doesn't look for passed paramters
70  *
71  *  = pf_end must
72  *      * end the encoding process
73  *      * revert all that pf_init (and pf_encode) has done (memory...)
74  *
75  * = at unloading, a video decoder must revert all that was done while loading
76  *
77  *  XXX: pf_init/pf_end could be called multiple time without the plugin unloaded.
78  *  XXX: all memory allocated by video encoder MUST be unallocated by video encoder
79  *
80  */
81
82 #endif