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

Commit 9084631d authored by Gloria Wang's avatar Gloria Wang Committed by Android Code Review
Browse files

Merge "DRM framework support: - add a sniffer for DRM files - add DRMSource...

Merge "DRM framework support: - add a sniffer for DRM files - add DRMSource and DRMExtractor for es_based DRM - add pread in FileSource.cpp for container_based DRM - add native DRM framework API calls in the player for   DRM audio/video playback"
parents c5371fad d5770917
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@
#include <utils/List.h>
#include <utils/List.h>
#include <utils/RefBase.h>
#include <utils/RefBase.h>
#include <utils/threads.h>
#include <utils/threads.h>
#include <drm/DrmManagerClient.h>


namespace android {
namespace android {


@@ -67,6 +68,13 @@ public:
    static void RegisterSniffer(SnifferFunc func);
    static void RegisterSniffer(SnifferFunc func);
    static void RegisterDefaultSniffers();
    static void RegisterDefaultSniffers();


    // for DRM
    virtual DecryptHandle* DrmInitialization(DrmManagerClient *client) {
        return NULL;
    }
    virtual void getDrmInfo(DecryptHandle **handle, DrmManagerClient **client) {};


protected:
protected:
    virtual ~DataSource() {}
    virtual ~DataSource() {}


+15 −0
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@
#include <media/stagefright/DataSource.h>
#include <media/stagefright/DataSource.h>
#include <media/stagefright/MediaErrors.h>
#include <media/stagefright/MediaErrors.h>
#include <utils/threads.h>
#include <utils/threads.h>
#include <drm/DrmManagerClient.h>


namespace android {
namespace android {


@@ -37,15 +38,29 @@ public:


    virtual status_t getSize(off_t *size);
    virtual status_t getSize(off_t *size);


    virtual DecryptHandle* DrmInitialization(DrmManagerClient *client);

    virtual void getDrmInfo(DecryptHandle **handle, DrmManagerClient **client);

protected:
protected:
    virtual ~FileSource();
    virtual ~FileSource();


private:
private:
    FILE *mFile;
    FILE *mFile;
    int mFd;
    int64_t mOffset;
    int64_t mOffset;
    int64_t mLength;
    int64_t mLength;
    Mutex mLock;
    Mutex mLock;


    /*for DRM*/
    DecryptHandle *mDecryptHandle;
    DrmManagerClient *mDrmManagerClient;
    int64_t mDrmBufOffset;
    int64_t mDrmBufSize;
    unsigned char *mDrmBuf;

    ssize_t readAtDRM(off_t offset, void *data, size_t size);

    FileSource(const FileSource &);
    FileSource(const FileSource &);
    FileSource &operator=(const FileSource &);
    FileSource &operator=(const FileSource &);
};
};
+2 −0
Original line number Original line Diff line number Diff line
@@ -39,6 +39,8 @@ enum {


    // Not technically an error.
    // Not technically an error.
    INFO_FORMAT_CHANGED    = MEDIA_ERROR_BASE - 12,
    INFO_FORMAT_CHANGED    = MEDIA_ERROR_BASE - 12,

    ERROR_NO_LICENSE       = MEDIA_ERROR_BASE - 13,
};
};


}  // namespace android
}  // namespace android
+6 −0
Original line number Original line Diff line number Diff line
@@ -54,6 +54,12 @@ public:
    // CAN_SEEK_BACKWARD | CAN_SEEK_FORWARD | CAN_PAUSE
    // CAN_SEEK_BACKWARD | CAN_SEEK_FORWARD | CAN_PAUSE
    virtual uint32_t flags() const;
    virtual uint32_t flags() const;


    // for DRM
    virtual void setDrmFlag(bool flag) {};
    virtual char* getDrmTrackInfo(size_t trackID, int *len) {
        return NULL;
    }

protected:
protected:
    MediaExtractor() {}
    MediaExtractor() {}
    virtual ~MediaExtractor() {}
    virtual ~MediaExtractor() {}
+2 −0
Original line number Original line Diff line number Diff line
@@ -50,6 +50,8 @@ enum {
    kKeyBufferID          = 'bfID',
    kKeyBufferID          = 'bfID',
    kKeyMaxInputSize      = 'inpS',
    kKeyMaxInputSize      = 'inpS',
    kKeyThumbnailTime     = 'thbT',  // int64_t (usecs)
    kKeyThumbnailTime     = 'thbT',  // int64_t (usecs)
    kKeyTrackID           = 'trID',
    kKeyIsDRM             = 'idrm',  // int32_t (bool)


    kKeyAlbum             = 'albu',  // cstring
    kKeyAlbum             = 'albu',  // cstring
    kKeyArtist            = 'arti',  // cstring
    kKeyArtist            = 'arti',  // cstring
Loading