1 /*****************************************************************************
2 * encoder.c: dummy encoder plugin for vlc.
3 *****************************************************************************
4 * Copyright (C) 2002 the VideoLAN team
7 * Authors: Gildas Bazin <gbazin@netcourrier.com>
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.
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.
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 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
32 #include <vlc_codec.h>
37 /*****************************************************************************
39 *****************************************************************************/
45 /*****************************************************************************
47 *****************************************************************************/
48 static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict );
49 static block_t *EncodeAudio( encoder_t *p_enc, picture_t *p_pict );
51 /*****************************************************************************
52 * OpenDecoder: open the dummy encoder.
53 *****************************************************************************/
54 int OpenEncoder ( vlc_object_t *p_this )
56 encoder_t *p_enc = (encoder_t *)p_this;
58 p_enc->p_sys = malloc(sizeof(encoder_sys_t));
60 if( !p_enc->p_sys ) return VLC_ENOMEM;
64 msg_Dbg( p_this, "opening stats encoder" );
66 p_enc->pf_encode_video = EncodeVideo;
67 p_enc->pf_encode_audio = EncodeAudio;
73 /****************************************************************************
74 * EncodeVideo: the whole thing
75 ****************************************************************************/
76 static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
79 block_t * p_block = block_New( p_enc, kBufferSize );
81 *(mtime_t*)p_block->p_buffer = mdate();
82 p_block->i_buffer = kBufferSize;
83 p_block->i_length = kBufferSize;
84 p_block->i_dts = p_pict->date;
86 msg_Dbg( p_enc, "putting %dms", *(mtime_t*)p_block->p_buffer / 1000 );
91 /****************************************************************************
92 * EncodeVideo: the whole thing
93 ****************************************************************************/
94 static block_t *EncodeAudio( encoder_t *p_enc, picture_t *p_pict )
102 /*****************************************************************************
103 * CloseDecoder: decoder destruction
104 *****************************************************************************/
105 void CloseEncoder ( vlc_object_t *p_this )
107 encoder_t *p_enc = (encoder_t *)p_this;
109 msg_Dbg( p_this, "closing stats encoder" );
110 free( p_enc->p_sys );