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

Commit dcd25efb authored by Gloria Wang's avatar Gloria Wang
Browse files

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

Change-Id: I4b9ef19165c9b4f44ff40eeededb9a665e78a90f
parent 2272ee27
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <utils/List.h>
#include <utils/RefBase.h>
#include <utils/threads.h>
#include <drm/DrmManagerClient.h>

namespace android {

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

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


protected:
    virtual ~DataSource() {}

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

namespace android {

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

    virtual status_t getSize(off_t *size);

    virtual DecryptHandle* DrmInitialization(DrmManagerClient *client);

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

protected:
    virtual ~FileSource();

private:
    FILE *mFile;
    int mFd;
    int64_t mOffset;
    int64_t mLength;
    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 &operator=(const FileSource &);
};
+2 −0
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ enum {

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

    ERROR_NO_LICENSE       = MEDIA_ERROR_BASE - 13,
};

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

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

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

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