Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 95961de8 authored by Alin Jerpelea's avatar Alin Jerpelea
Browse files

ST_ERICSSON: Adding multimedia extension part2

manual import from
commit 151ce20c17e1a097a2edf5b467650941a1cc6287
Author: Patrik Ryd <patrik.ryd@stericsson.com>
Date:   Thu Apr 5 20:18:30 2012 +0000

    Adding multimedia extension

    More specifically:
    - ST-Ericsson audio support for multimedia.
    - Support for FM Audio in framework.

Change-Id: Iea956cb398793023cf8e8c003089ae6aef7fb843
parent dd580a0e
Loading
Loading
Loading
Loading
+73 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) ST-Ericsson SA 2010
 * Copyright (C) 2010 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Author: Andreas Gustafsson (andreas.a.gustafsson@stericsson.com)
 *         for ST-Ericsson
 */

#ifndef FMRADIO_DATA_SOURCE_H_

#define FMRADIO_DATA_SOURCE_H_

#include <stdio.h>

#include <media/stagefright/DataSource.h>
#include <media/stagefright/MediaErrors.h>
#include <utils/threads.h>
#include <hardware_legacy/AudioHardwareInterface.h>
#include <media/AudioSystem.h>
#include <system/audio.h>
#include <hardware_legacy/AudioSystemLegacy.h>

namespace android {

class FMRadioDataSource : public DataSource {
public:
    FMRadioDataSource();

    virtual status_t initCheck() const;

    virtual ssize_t readAt(off64_t offset, void *data, size_t size);

    virtual status_t getSize(off64_t *size);

    virtual uint32_t getBufferSize();

    virtual uint32_t getNumChannels();

    virtual uint32_t getSampleRate();

    virtual uint32_t getFormat();

protected:
    virtual ~FMRadioDataSource();

private:
    android_audio_legacy::AudioStreamIn *mStream;
    sp<IAudioFlinger> mAudioFlinger;
    FMRadioDataSource(const FMRadioDataSource &);
    FMRadioDataSource &operator=(const FMRadioDataSource &);
    audio_input_clients mInputClientId;
    uint32_t mFormat;
    uint32_t mChannels;
    uint32_t mSampleRate;
    uint32_t mOverwrittenBytes;
    uint32_t mFlags;
};

}  // namespace android

#endif  // FMRADIO_DATA_SOURCE_H_
+10 −0
Original line number Diff line number Diff line
@@ -31,6 +31,10 @@ struct ABitReader {
    uint32_t getBits(size_t n);
    void skipBits(size_t n);

#ifdef STE_HARDWARE
    void rewindBits(size_t n);
#endif

    void putBits(uint32_t x, size_t n);

    size_t numBitsLeft() const;
@@ -39,7 +43,13 @@ struct ABitReader {

private:
    const uint8_t *mData;
#ifdef STE_HARDWARE
    const uint8_t *mOriginalData;
#endif
    size_t mSize;
#ifdef STE_HARDWARE
    size_t mOriginalSize;
#endif

    uint32_t mReservoir;  // left-aligned bits
    size_t mNumBitsLeft;
+2 −1
Original line number Diff line number Diff line
@@ -808,7 +808,8 @@ public class MediaPlayer
    }

    /**
     * Sets the data source (file-path or http/rtsp URL) to use.
     * Sets the data source (file-path or http/rtsp URL) to use. To select FM Radio as the data
     * source, set the path to "fmradio://rx".
     *
     * @param path the path of the file, or the http/rtsp URL of the stream you want to play
     * @throws IllegalStateException if it is called in an invalid state
+3 −0
Original line number Diff line number Diff line
@@ -175,6 +175,9 @@ public class MediaRecorder
         *  is applied.
         */
        public static final int VOICE_COMMUNICATION = 7;
        /** FM Radio Rx audio source */
        /**@hide */
        public static final int FM_RADIO_RX = 8;
    }

    /**
+5 −0
Original line number Diff line number Diff line
@@ -103,6 +103,11 @@ endif
endif
endif

ifeq ($(BOARD_USES_STE_FM),true)
LOCAL_SRC_FILES+=        PCMExtractor.cpp \
                         FMRadioDataSource.cpp
endif

LOCAL_C_INCLUDES+= \
	$(JNI_H_INCLUDE) \
        $(TOP)/frameworks/base/include/media/stagefright/openmax \
Loading