Mercurial > hg > svcore
comparison data/fileio/MP3FileReader.h @ 1288:5ef9b4d4bbdb 3.0-integration
Filter out Xing/LAME info frames, rather than letting them go to the mp3 decoder as if they were audio frames. Fixes the 1152-sample zero pad at start of some decoded mp3 files (distinct from decoder delay). The logic here is based on the madplay code.
author | Chris Cannam |
---|---|
date | Thu, 24 Nov 2016 13:32:04 +0000 |
parents | 16a8e97179d7 |
children | fa574c909c3d |
comparison
equal
deleted
inserted
replaced
1287:97f21b03269b | 1288:5ef9b4d4bbdb |
---|---|
69 QString m_maker; | 69 QString m_maker; |
70 TagMap m_tags; | 70 TagMap m_tags; |
71 sv_frame_t m_fileSize; | 71 sv_frame_t m_fileSize; |
72 double m_bitrateNum; | 72 double m_bitrateNum; |
73 int m_bitrateDenom; | 73 int m_bitrateDenom; |
74 int m_mp3FrameCount; | |
74 int m_completion; | 75 int m_completion; |
75 bool m_done; | 76 bool m_done; |
76 | 77 |
77 unsigned char *m_filebuffer; | 78 unsigned char *m_filebuffer; |
78 float **m_samplebuffer; | 79 float **m_samplebuffer; |
84 bool m_decodeErrorShown; | 85 bool m_decodeErrorShown; |
85 | 86 |
86 struct DecoderData | 87 struct DecoderData |
87 { | 88 { |
88 unsigned char const *start; | 89 unsigned char const *start; |
89 unsigned long length; | 90 sv_frame_t length; |
90 MP3FileReader *reader; | 91 MP3FileReader *reader; |
91 }; | 92 }; |
92 | 93 |
93 bool decode(void *mm, sv_frame_t sz); | 94 bool decode(void *mm, sv_frame_t sz); |
95 enum mad_flow filter(struct mad_stream const *, struct mad_frame *); | |
94 enum mad_flow accept(struct mad_header const *, struct mad_pcm *); | 96 enum mad_flow accept(struct mad_header const *, struct mad_pcm *); |
95 | 97 |
96 static enum mad_flow input(void *, struct mad_stream *); | 98 static enum mad_flow input_callback(void *, struct mad_stream *); |
97 static enum mad_flow output(void *, struct mad_header const *, struct mad_pcm *); | 99 static enum mad_flow output_callback(void *, struct mad_header const *, |
98 static enum mad_flow error(void *, struct mad_stream *, struct mad_frame *); | 100 struct mad_pcm *); |
101 static enum mad_flow filter_callback(void *, struct mad_stream const *, | |
102 struct mad_frame *); | |
103 static enum mad_flow error_callback(void *, struct mad_stream *, | |
104 struct mad_frame *); | |
99 | 105 |
100 class DecodeThread : public Thread | 106 class DecodeThread : public Thread |
101 { | 107 { |
102 public: | 108 public: |
103 DecodeThread(MP3FileReader *reader) : m_reader(reader) { } | 109 DecodeThread(MP3FileReader *reader) : m_reader(reader) { } |