| - -( dyne // software :: culture :: events :: planet :: discussion :: museum \\ freaknet )- - |
00001 /* MuSE - Multiple Streaming Engine 00002 * Copyright (C) 2000-2002 Denis Rojo aka jaromil <jaromil@dyne.org> 00003 * 00004 * This source code is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Public License as published 00006 * by the Free Software Foundation; either version 2 of the License, 00007 * or (at your option) any later version. 00008 * 00009 * This source code is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 * Please refer to the GNU Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Public License along with 00015 * this source code; if not, write to: 00016 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 * 00018 * "$Id: out_vorbis.h,v 1.3 2004/12/13 00:26:37 jaromil Exp $" 00019 * 00020 */ 00021 00022 #ifndef __OUT_VORBIS_H__ 00023 #define __OUT_VORBIS_H__ 00024 00025 #include <outchannels.h> 00026 00027 #include <config.h> 00028 #ifdef HAVE_VORBIS 00029 00030 extern "C" { 00031 #include <vorbis/vorbisenc.h> 00032 } 00033 00034 /* safe bounds! */ 00035 #define INBUF OUT_CHUNK*sizeof(float)*8 00036 #define RSMPBUF INBUF*sizeof(float)*12 00037 00038 class OutVorbis : public OutChannel { 00039 private: 00040 ogg_stream_state os; 00041 ogg_page og; 00042 ogg_packet op; 00043 00044 vorbis_dsp_state vd; 00045 vorbis_block vb; 00046 vorbis_info vi; 00047 vorbis_comment vc; 00048 00049 ogg_packet header_main; 00050 ogg_packet header_comments; 00051 ogg_packet header_codebooks; 00052 00053 short int header[8192]; 00054 int headersize; 00055 00056 /* the audio jumps in three buffers, with the resampling in between 00057 one step could be saved if the resampling routine would result in a bidimensional array 00058 or if vorbis library could accept interleaved float. 00059 to save steps i did my best with the pipe class, which now read in intl|bidi float. */ 00060 float *pcm; /* read from pipe to here */ 00061 float *rsmpled; /* resample from pcm to here */ 00062 float **_intbuf; /* process from resampled to a bidimensional array here */ 00063 int8_t *_pbyte; 00064 00065 int out_chunk_len; 00066 int prepare(float *buf, float **fbuf, int num); 00067 00068 SRC_STATE *rsmp_state; 00069 SRC_DATA rsmp_data; 00070 00071 bool encoder_initialized; 00072 00073 public: 00074 OutVorbis(); 00075 ~OutVorbis(); 00076 int encode(); 00077 bool init(); 00078 void flush(); 00079 00080 bool apply_profile(); 00081 00082 00083 }; 00084 00085 #endif 00086 #endif
|
|
|
|
| Copyleft 2000 - 2008 dyne.org foundation and respective authors. Verbatim copying and distribution is permitted in any medium, provided this notice is preserved. Send inquiries & questions to dyne.org's hackers. |
|