]> git.sesse.net Git - vlc/blob - modules/misc/stats/encoder.c
Merge branch 1.0-bugfix
[vlc] / modules / misc / stats / encoder.c
1 /*****************************************************************************
2  * encoder.c: stats encoder plugin for vlc.
3  *****************************************************************************
4  * Copyright (C) 2002-2008 the VideoLAN team
5  *
6  * Authors: Gildas Bazin <gbazin@netcourrier.com>
7  *          Pierre d'Herbemont <pdherbemont@videolan.org>
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30
31 #include <vlc_common.h>
32 #include <vlc_codec.h>
33
34 #include "stats.h"
35
36 /*****************************************************************************
37  * encoder_sys_t
38  *****************************************************************************/
39 struct encoder_sys_t
40 {
41     int i;
42 };
43
44 /*****************************************************************************
45  * Local prototypes
46  *****************************************************************************/
47 static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict );
48 static block_t *EncodeAudio( encoder_t *p_enc, aout_buffer_t *p_abuff );
49
50 /*****************************************************************************
51  * OpenDecoder: open the dummy encoder.
52  *****************************************************************************/
53 int OpenEncoder ( vlc_object_t *p_this )
54 {
55     encoder_t *p_enc = (encoder_t *)p_this;
56
57     p_enc->p_sys = malloc(sizeof(encoder_sys_t));
58
59     if( !p_enc->p_sys ) return VLC_ENOMEM;
60
61     p_enc->p_sys->i = 0;
62
63     msg_Dbg( p_this, "opening stats encoder" );
64
65     p_enc->pf_encode_video = EncodeVideo;
66     p_enc->pf_encode_audio = EncodeAudio;
67
68
69     return VLC_SUCCESS;
70 }
71
72 /****************************************************************************
73  * EncodeVideo: the whole thing
74  ****************************************************************************/
75 static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
76 {
77     (void)p_pict;
78     block_t * p_block = block_New( p_enc, kBufferSize );
79
80     *(mtime_t*)p_block->p_buffer = mdate();
81     p_block->i_buffer = kBufferSize;
82     p_block->i_length = kBufferSize;
83     p_block->i_dts = p_pict->date;
84
85     msg_Dbg( p_enc, "putting %"PRIu64"ms",
86              *(mtime_t*)p_block->p_buffer / 1000 );
87     return p_block;
88 }
89
90 /****************************************************************************
91  * EncodeVideo: the whole thing
92  ****************************************************************************/
93 static block_t *EncodeAudio( encoder_t *p_enc, aout_buffer_t *p_abuff )
94 {
95     (void)p_abuff;
96     (void)p_enc;
97     return NULL;
98 }
99
100
101 /*****************************************************************************
102  * CloseDecoder: decoder destruction
103  *****************************************************************************/
104 void CloseEncoder ( vlc_object_t *p_this )
105 {
106     encoder_t *p_enc = (encoder_t *)p_this;
107
108     msg_Dbg( p_this, "closing stats encoder" );
109     free( p_enc->p_sys );
110 }