• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 1999-2010 The L.A.M.E. project
3  *
4  * Initially written by Michael Hipp, see also AUTHORS and README.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 #ifndef _MPGLIB_H_
22 #define _MPGLIB_H_
23 
24 #ifdef HAVE_CONFIG_H
25 # include <config.h>
26 #endif
27 
28 #include "lame.h"
29 
30 #ifdef HAVE_MPG123
31 #include <mpg123.h>
32 #ifndef MPG123_API_VERSION
33 #error "Seems like you got the wrong mpg123 header. No MPG123_API_VERSION defined."
34 #endif
35 #if (MPG123_API_VERSION < 45)
36 #error "Need mpg123 API >= 45."
37 #endif
38 #endif
39 
40 #ifndef plotting_data_defined
41 #define plotting_data_defined
42 struct plotting_data;
43 typedef struct plotting_data plotting_data;
44 #endif
45 
46 
47 extern void lame_report_fnc(lame_report_function f, const char *format, ...);
48 
49 #ifdef HAVE_MPGLIB
50 struct buf {
51     unsigned char *pnt;
52     long    size;
53     long    pos;
54     struct buf *next;
55     struct buf *prev;
56 };
57 
58 struct framebuf {
59     struct buf *buf;
60     long    pos;
61     struct frame *next;
62     struct frame *prev;
63 };
64 
65 #endif
66 
67 typedef struct mpstr_tag {
68 #ifdef HAVE_MPG123
69     mpg123_handle *mh;
70     struct mpg123_moreinfo mi;
71 #else
72     struct buf *head, *tail; /* buffer linked list pointers, tail points to oldest buffer */
73     int     vbr_header;      /* 1 if valid Xing vbr header detected */
74     int     num_frames;      /* set if vbr header present */
75     int     enc_delay;       /* set if vbr header present */
76     int     enc_padding;     /* set if vbr header present */
77     /* header_parsed, side_parsed and data_parsed must be all set 1
78        before the full frame has been parsed */
79     int     header_parsed;   /* 1 = header of current frame has been parsed */
80     int     side_parsed;     /* 1 = header of sideinfo of current frame has been parsed */
81     int     data_parsed;
82     int     free_format;     /* 1 = free format frame */
83     int     old_free_format; /* 1 = last frame was free format */
84     int     bsize;
85     int     framesize;
86     int     ssize;           /* number of bytes used for side information, including 2 bytes for CRC-16 if present */
87     int     dsize;
88     int     fsizeold;        /* size of previous frame, -1 for first */
89     int     fsizeold_nopadding;
90     struct frame fr;         /* holds the parameters decoded from the header */
91     struct III_sideinfo sideinfo;
92     unsigned char bsspace[2][MAXFRAMESIZE + 1024]; /* bit stream space used ???? */ /* MAXFRAMESIZE */
93     real    hybrid_block[2][2][SBLIMIT * SSLIMIT];
94     int     hybrid_blc[2];
95     unsigned long header;
96     int     bsnum;
97     real    synth_buffs[2][2][0x110];
98     int     synth_bo;
99     int     sync_bitstream;  /* 1 = bitstream is yet to be synchronized */
100 
101     int     bitindex;
102     unsigned char *wordpointer;
103 #endif
104     plotting_data *pinfo;
105 
106     lame_report_function report_msg;
107     lame_report_function report_dbg;
108     lame_report_function report_err;
109 } MPSTR, *PMPSTR;
110 
111 #ifdef HAVE_MPGLIB
112 #define MP3_ERR -1
113 #define MP3_OK  0
114 #define MP3_NEED_MORE 1
115 #endif
116 
117 
118 #endif /* _MPGLIB_H_ */
119