1 /**********************************************************
2  * libmp3splt -- library based on mp3splt,
3  *               for mp3/ogg splitting without decoding
4  *
5  * Copyright (c) 2002-2005 M. Trotta - <mtrotta@users.sourceforge.net>
6  * Copyright (c) 2005-2014 Alexandru Munteanu - m@ioalex.net
7  *
8  *********************************************************/
9 
10 /**********************************************************
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
24  * USA.
25  *********************************************************/
26 
27 #include "splt.h"
28 
29 #include "mp3.h"
30 
31 void splt_mp3_init_stream_frame(splt_mp3_state *mp3state);
32 void splt_mp3_finish_stream_frame(splt_mp3_state *mp3state);
33 void splt_mp3_checksync(splt_mp3_state *mp3state);
34 int splt_mp3_c_bitrate(unsigned long head);
35 struct splt_header splt_mp3_makehead(unsigned long headword,
36     struct splt_mp3 mp3f, struct splt_header head, off_t ptr);
37 off_t splt_mp3_findhead(splt_mp3_state *mp3state, off_t start);
38 off_t splt_mp3_findvalidhead(splt_mp3_state *mp3state, off_t start);
39 int splt_mp3_get_frame(splt_mp3_state *mp3state);
40 int splt_mp3_get_valid_frame(splt_state *state, int *error);
41 
42 void splt_mp3_read_process_side_info_main_data_begin(splt_mp3_state *mp3state, off_t offset);
43 void splt_mp3_extract_reservoir_and_build_reservoir_frame(splt_mp3_state *mp3state,
44     splt_state *state, splt_code *error);
45 void splt_mp3_build_xing_lame_frame(splt_mp3_state *mp3state, off_t begin, off_t end,
46     unsigned long fbegin, splt_code *error, splt_state *state);
47 
48 int splt_mp3_get_mpeg_as_int(int mpgid);
49 int splt_mp3_get_samples_per_frame(struct splt_mp3 *mp3file);
50 void splt_mp3_parse_xing_lame(splt_mp3_state *mp3state);
51 
52 unsigned long splt_mp3_find_begin_frame(double fbegin_sec, splt_mp3_state *mp3state,
53     splt_state *state, splt_code *error);
54 unsigned long splt_mp3_find_end_frame(double fend_sec, splt_mp3_state *mp3state,
55     splt_state *state);
56 
57 void splt_mp3_get_overlapped_frames(long last_frame, splt_mp3_state *mp3state,
58     splt_state *state, splt_code *error);
59 int splt_mp3_handle_bit_reservoir(splt_state *state);
60 
61