13508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat/* 23508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * Copyright (C) 2014 The Android Open Source Project 33508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * All rights reserved. 43508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * 53508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * Redistribution and use in source and binary forms, with or without 63508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * modification, are permitted provided that the following conditions 73508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * are met: 83508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * * Redistributions of source code must retain the above copyright 93508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * notice, this list of conditions and the following disclaimer. 103508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * * Redistributions in binary form must reproduce the above copyright 113508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * notice, this list of conditions and the following disclaimer in 123508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * the documentation and/or other materials provided with the 133508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * distribution. 143508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * 153508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 163508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 173508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 183508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 193508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 203508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 213508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 223508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 233508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 243508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 253508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 263508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat * SUCH DAMAGE. 273508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat */ 283508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat 293508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat#ifndef MP3READER_H_ 303508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat#define MP3READER_H_ 313508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat 323508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhatclass Mp3Reader { 333508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhatpublic: 343508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat Mp3Reader(); 353508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat bool init(const char *file); 363508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat bool getFrame(void *buffer, uint32_t *size); 373508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat uint32_t getSampleRate() { return mSampleRate;} 383508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat uint32_t getNumChannels() { return mNumChannels;} 393508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat void close(); 403508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat ~Mp3Reader(); 413508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhatprivate: 423508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat FILE *mFp; 433508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat uint32_t mFixedHeader; 443508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat off64_t mCurrentPos; 453508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat uint32_t mSampleRate; 463508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat uint32_t mNumChannels; 473508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat uint32_t mBitrate; 483508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat}; 493508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat 503508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat 513508d77cf7b619d33d236533a45eea1a7321cc5aAshok Bhat#endif /* MP3READER_H_ */ 52