libmp3splt
plugins/ogg.h
00001 /**********************************************************
00002  *
00003  * libmp3splt -- library based on mp3splt,
00004  *               for mp3/ogg splitting without decoding
00005  *
00006  * Copyright (c) 2002-2005 M. Trotta - <mtrotta@users.sourceforge.net>
00007  * Copyright (c) 2005-2011 Alexandru Munteanu - io_fx@yahoo.fr
00008  *
00009  * http://mp3splt.sourceforge.net
00010  *
00011  *********************************************************/
00012 
00013 /**********************************************************
00014  *
00015  * This program is free software; you can redistribute it and/or
00016  * modify it under the terms of the GNU General Public License
00017  * as published by the Free Software Foundation; either version 2
00018  * of the License, or (at your option) any later version.
00019  *
00020  * This program is distributed in the hope that it will be useful,
00021  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  * GNU General Public License for more details.
00024  *
00025  * You should have received a copy of the GNU General Public License
00026  * along with this program; if not, write to the Free Software
00027  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00028  * 02111-1307,
00029  * USA.
00030  *
00031  *********************************************************/
00032 
00033 #ifndef MP3SPLT_OGG_H
00034 
00035 #include <vorbis/codec.h>
00036 #include <vorbis/vorbisfile.h>
00037 
00038 #define SPLT_OGGEXT ".ogg"
00039 
00040 /**********************************/
00041 /* Ogg structures                 */
00042 
00043 typedef struct {
00044   int length;
00045   unsigned char *packet;
00046 } splt_v_packet;
00047 
00048 typedef struct {
00049   ogg_sync_state *sync_in;
00050   ogg_stream_state *stream_in;
00051   vorbis_dsp_state *vd;
00052   vorbis_info *vi;
00053   vorbis_block *vb;
00054   int prevW;
00055   ogg_int64_t initialgranpos;
00056   ogg_int64_t len;
00057   ogg_int64_t cutpoint_begin;
00058   unsigned int serial;
00059   splt_v_packet **packets; /* 2 */
00060   splt_v_packet **headers; /* 3 */
00061   OggVorbis_File vf;
00062   vorbis_comment vc;
00063   FILE *in,*out;
00064   short end;
00065   float off;
00066   float temp_level;
00067   //the granpos at the end of the first page of the stream
00068   ogg_int64_t stream_granpos;
00069   ogg_int64_t first_granpos;
00070   long total_blocksize;
00071 } splt_ogg_state;
00072 
00073 #define SPLT_OGG_BUFSIZE 4096
00074 
00075 #define MP3SPLT_OGG_H
00076 
00077 #endif
00078