1 /*
2   Copyright (c) 2005-2009, The Musepack Development Team
3   All rights reserved.
4 
5   Redistribution and use in source and binary forms, with or without
6   modification, are permitted provided that the following conditions are
7   met:
8 
9   * Redistributions of source code must retain the above copyright
10   notice, this list of conditions and the following disclaimer.
11 
12   * Redistributions in binary form must reproduce the above
13   copyright notice, this list of conditions and the following
14   disclaimer in the documentation and/or other materials provided
15   with the distribution.
16 
17   * Neither the name of the The Musepack Development Team nor the
18   names of its contributors may be used to endorse or promote
19   products derived from this software without specific prior
20   written permission.
21 
22   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34 /// \file streaminfo.h
35 #ifndef _MPCDEC_STREAMINFO_H_
36 #define _MPCDEC_STREAMINFO_H_
37 #ifdef WIN32
38 #pragma once
39 #endif
40 
41 #include "mpc_types.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 
48 typedef mpc_int32_t mpc_streaminfo_off_t;
49 
50 /// \brief mpc stream properties structure
51 ///
52 /// Structure containing all the properties of an mpc stream.  Populated
53 /// by the streaminfo_read function.
54 typedef struct mpc_streaminfo {
55     /// @name Core mpc stream properties
56     //@{
57     mpc_uint32_t         sample_freq;        ///< Sample frequency of stream
58     mpc_uint32_t         channels;           ///< Number of channels in stream
59     mpc_uint32_t         stream_version;     ///< Streamversion of stream
60     mpc_uint32_t         bitrate;            ///< Bitrate of stream file (in bps)
61     double               average_bitrate;    ///< Average bitrate of stream (in bits/sec)
62     mpc_uint32_t         max_band;           ///< Maximum band-index used in stream (0...31)
63     mpc_uint32_t         ms;                 ///< Mid/side stereo (0: off, 1: on)
64 	mpc_uint32_t         fast_seek;          ///< True if stream supports fast-seeking (sv7)
65 	mpc_uint32_t         block_pwr;          ///< Number of frames in a block = 2^block_pwr (sv8)
66     //@}
67 
68     /// @name Replaygain properties
69     //@{
70     mpc_uint16_t         gain_title;         ///< Replaygain title value
71     mpc_uint16_t         gain_album;         ///< Replaygain album value
72     mpc_uint16_t         peak_album;         ///< Peak album loudness level
73     mpc_uint16_t         peak_title;         ///< Peak title loudness level
74     //@}
75 
76     /// @name True gapless properties
77     //@{
78     mpc_uint32_t         is_true_gapless;    ///< True gapless? (0: no, 1: yes)
79 	mpc_uint64_t         samples;            ///< Number of samples in the stream
80 	mpc_uint64_t         beg_silence;        ///< Number of samples that must not be played at the beginning of the stream
81     //@}
82 
83 	/// @name Encoder informations
84     //@{
85     mpc_uint32_t         encoder_version;    ///< Version of encoder used
86     char                 encoder[256];       ///< Encoder name
87 	mpc_bool_t           pns;                ///< pns used
88 	float                profile;            ///< Quality profile of stream
89 	const char*          profile_name;       ///< Name of profile used by stream
90 	//@}
91 
92 
93 	mpc_streaminfo_off_t header_position;    ///< Byte offset of position of header in stream
94     mpc_streaminfo_off_t tag_offset;         ///< Offset to file tags
95     mpc_streaminfo_off_t total_file_length;  ///< Total length of underlying file
96 } mpc_streaminfo;
97 
98 /// Gets length of stream si, in seconds.
99 /// \return length of stream in seconds
100 MPC_API double mpc_streaminfo_get_length(mpc_streaminfo *si);
101 
102 /// Returns length of stream si, in samples.
103 /// \return length of stream in samples
104 MPC_API mpc_int64_t mpc_streaminfo_get_length_samples(mpc_streaminfo *si);
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 #endif
110