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

Commit c224ec53 authored by Chris Watkins's avatar Chris Watkins Committed by Android (Google) Code Review
Browse files

Merge "Unhide the android.media.[Media]DataSource interface."

parents f2326ac9 99f31604
Loading
Loading
Loading
Loading
+61 −0
Original line number Diff line number Diff line
/*
 * Copyright 2015 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.
 */

#ifndef ANDROID_IDATASOURCE_H
#define ANDROID_IDATASOURCE_H

#include <binder/IInterface.h>
#include <media/stagefright/foundation/ABase.h>
#include <utils/Errors.h>

namespace android {

class IMemory;

// A binder interface for implementing a stagefright DataSource remotely.
class IDataSource : public IInterface {
public:
    DECLARE_META_INTERFACE(DataSource);

    // Get the memory that readAt writes into.
    virtual sp<IMemory> getIMemory() = 0;
    // Read up to |size| bytes into the memory returned by getIMemory(). Returns
    // the number of bytes read, or -1 on error. |size| must not be larger than
    // the buffer.
    virtual ssize_t readAt(off64_t offset, size_t size) = 0;
    // Get the size, or -1 if the size is unknown.
    virtual status_t getSize(off64_t* size) = 0;
    // This should be called before deleting |this|. The other methods may
    // return errors if they're called after calling close().
    virtual void close() = 0;

private:
    DISALLOW_EVIL_CONSTRUCTORS(IDataSource);
};

// ----------------------------------------------------------------------------

class BnDataSource : public BnInterface<IDataSource> {
public:
    virtual status_t onTransact(uint32_t code,
                                const Parcel& data,
                                Parcel* reply,
                                uint32_t flags = 0);
};

}; // namespace android

#endif // ANDROID_IDATASOURCE_H
+3 −1
Original line number Diff line number Diff line
@@ -26,7 +26,8 @@

namespace android {

struct IMediaHTTPService;
class IDataSource;
class IMediaHTTPService;

class IMediaMetadataRetriever: public IInterface
{
@@ -40,6 +41,7 @@ public:
            const KeyedVector<String8, String8> *headers = NULL) = 0;

    virtual status_t        setDataSource(int fd, int64_t offset, int64_t length) = 0;
    virtual status_t        setDataSource(const sp<IDataSource>& dataSource) = 0;
    virtual sp<IMemory>     getFrameAtTime(int64_t timeUs, int option) = 0;
    virtual sp<IMemory>     extractAlbumArt() = 0;
    virtual const char*     extractMetadata(int keyCode) = 0;
+2 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ namespace android {

class Parcel;
class Surface;
class IDataSource;
class IStreamSource;
class IGraphicBufferProducer;
struct IMediaHTTPService;
@@ -49,6 +50,7 @@ public:

    virtual status_t        setDataSource(int fd, int64_t offset, int64_t length) = 0;
    virtual status_t        setDataSource(const sp<IStreamSource>& source) = 0;
    virtual status_t        setDataSource(const sp<IDataSource>& source) = 0;
    virtual status_t        setVideoSurfaceTexture(
                                    const sp<IGraphicBufferProducer>& bufferProducer) = 0;
    virtual status_t        prepareAsync() = 0;
+3 −1
Original line number Diff line number Diff line
@@ -25,7 +25,8 @@

namespace android {

struct IMediaHTTPService;
class DataSource;
class IMediaHTTPService;

// Abstract base class
class MediaMetadataRetrieverBase : public RefBase
@@ -40,6 +41,7 @@ public:
            const KeyedVector<String8, String8> *headers = NULL) = 0;

    virtual status_t    setDataSource(int fd, int64_t offset, int64_t length) = 0;
    virtual status_t setDataSource(const sp<DataSource>& source) = 0;
    virtual VideoFrame* getFrameAtTime(int64_t timeUs, int option) = 0;
    virtual MediaAlbumArt* extractAlbumArt() = 0;
    virtual const char* extractMetadata(int keyCode) = 0;
+5 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ struct sockaddr_in;

namespace android {

class DataSource;
class Parcel;
class Surface;
class IGraphicBufferProducer;
@@ -158,6 +159,10 @@ public:
        return INVALID_OPERATION;
    }

    virtual status_t    setDataSource(const sp<DataSource> &source) {
        return INVALID_OPERATION;
    }

    // pass the buffered IGraphicBufferProducer to the media player service
    virtual status_t    setVideoSurfaceTexture(
                                const sp<IGraphicBufferProducer>& bufferProducer) = 0;
Loading