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

Commit 7a378497 authored by Nick Kralevich's avatar Nick Kralevich Committed by Android Git Automerger
Browse files

am b9381956: am ead68d5c: Merge "Remove libdrm2. This code appears to be unused." into kraken

parents 1443edda b9381956
Loading
Loading
Loading
Loading

media/libdrm/mobile2/Android.mk

deleted100644 → 0
+0 −79
Original line number Diff line number Diff line
LOCAL_PATH:= $(call my-dir)

# ---------------------------------------
# First project
# 
# Build DRM2 core library
#
# Output: libdrm2.so
# ---------------------------------------
include $(CLEAR_VARS)

common_SRC_FILES := \
    src/util/ustl-1.0/bktrace.cpp \
    src/util/ustl-1.0/memblock.cpp \
    src/util/ustl-1.0/ofstream.cpp \
    src/util/ustl-1.0/ualgobase.cpp \
    src/util/ustl-1.0/unew.cpp \
    src/util/ustl-1.0/cmemlink.cpp \
    src/util/ustl-1.0/memlink.cpp \
    src/util/ustl-1.0/sistream.cpp \
    src/util/ustl-1.0/ubitset.cpp \
    src/util/ustl-1.0/ustdxept.cpp \
    src/util/ustl-1.0/fstream.cpp \
    src/util/ustl-1.0/mistream.cpp \
    src/util/ustl-1.0/sostream.cpp \
    src/util/ustl-1.0/uexception.cpp \
    src/util/ustl-1.0/ustring.cpp \
    src/util/xml/DomExpatAgent.cpp \
    src/util/xml/ExpatWrapper.cpp \
    src/util/xml/XMLDocumentImpl.cpp \
    src/util/xml/XMLElementImpl.cpp \
    src/util/domcore/CharacterDataImpl.cpp \
    src/util/domcore/ElementImpl.cpp \
    src/util/domcore/NodeListImpl.cpp \
    src/util/domcore/DocumentImpl.cpp \
    src/util/domcore/NodeImpl.cpp \
    src/util/domcore/TextImpl.cpp \
    src/util/domcore/DOMException.cpp \
    src/util/domcore/NodeIterator.cpp \
    src/util/crypto/DrmCrypto.cpp \
    src/rights/RoManager.cpp \
    src/rights/Asset.cpp \
    src/rights/Ro.cpp \
    src/rights/OperationPermission.cpp \
    src/rights/Right.cpp \
    src/rights/Constraint.cpp \
    src/drmmanager/DrmManager.cpp \
    src/dcf/DrmDcfCommon.cpp \
    src/dcf/DrmDcfContainer.cpp \
    src/dcf/DrmIStream.cpp \
    src/dcf/DrmRawContent.cpp \
    src/roap/RoapMessageHandler.cpp \
    src/roap/Registration.cpp

ifeq ($(TARGET_ARCH),arm)
	LOCAL_CFLAGS += -fstrict-aliasing -fomit-frame-pointer
endif

common_CFLAGS := -W -g -DPLATFORM_ANDROID

common_C_INCLUDES +=\
    $(LOCAL_PATH)/include \
    $(LOCAL_PATH)/src/util/ustl-1.0 \
    external/expat/lib \
    external/openssl    \
    external/openssl/include

LOCAL_SRC_FILES := $(common_SRC_FILES)
LOCAL_CFLAGS += $(common_CFLAGS)
LOCAL_C_INCLUDES += $(common_C_INCLUDES)

LOCAL_SHARED_LIBRARIES := libexpat libcrypto
LOCAL_MODULE := libdrm2 

ifeq ($(TARGET_OS)-$(TARGET_ARCH),linux-x86)
LOCAL_CFLAGS += -DUSTL_ANDROID_X86
endif

include $(BUILD_STATIC_LIBRARY)
+0 −28
Original line number Diff line number Diff line
/*
 * Copyright (C) 2007 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 _DRM2COMMONTYPES_H_
#define _DRM2COMMONTYPES_H_
#include <stdint.h>

#ifdef DRM2_UT
#define PROTECTED public
#define PRIVATE public
#else
#define PROTECTED protected
#define PRIVATE private
#endif

#endif
+0 −192
Original line number Diff line number Diff line
/*
 * Copyright (C) 2007 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 __DCF_COMM_H__
#define __DCF_COMM_H__

#include <Drm2CommonTypes.h>
#include <arpa/inet.h>
#include <mistream.h>
#include <ustring.h>

using namespace ustl;

////DCF box type list
const uint32_t DCF_CONTAINER_BOX = uint32_t('m' << 24 | 'r' << 16 | 'd' << 8 | 'o');
const uint32_t DCF_USER_TYPE = uint32_t('d' << 24 | 'i' << 16 | 'u' << 8 | 'u');
const uint32_t DCF_FILE_TYPE = uint32_t('p' << 24 | 'y' << 16 | 't' << 8 | 'f');
const uint32_t DCF_FILE_BRAND = uint32_t('f' << 24 | 'c' << 16 | 'd' << 8 | 'o');


/**
 * The basic box class.
 */
class Box
{
public:
    /**
     * constructor for Box, used to parse Box
     * \param box  Box data
     */
    Box(const uint8_t* box);

    /**
     * copy constructor for Box
     * \param dcfBox  Box object used to init a new Box object
     */
    Box(const Box& dcfBox);

    /**
     * assignment operator for Box
     * \param other  Box object used to assign to a exist Box object
     */
    Box& operator=(const Box& other);

    /** Destructor for Box */
    virtual ~Box();

    /**
     * get the size of Box
     * \param none
     * \return
     *   the size
     */
    uint64_t getSize(void) const;

    /**
     * get the type of Box
     * \param none
     * \return
     *   the type
     */
    uint32_t getType(void) const;

    /**
     * get the user type of Box
     * \param none
     * \return
     *   the user type
     */
    const uint8_t* getUsertype(void) const;

    /**
     * get the length of Box
     * \param none
     * \return
     *   the length
     */
    virtual uint32_t getLen(void) const;
PRIVATE:
    static const uint32_t USER_TYPE_LEN = 16;

    uint32_t mSize;
    uint32_t mType;
    uint64_t mLargeSize;
    uint8_t* mUserType;
    uint32_t mBoxLength;
};

/**
 * The fullBox class.
 */
class FullBox : public Box
{
public:
    /**
     * constructor for FullBox, used to parse FullBox
     * \param fullBox  FullBox data
     */
    FullBox(const uint8_t* fullBox);

    /** Destructor for FullBox */
    virtual ~FullBox(){}

    /**
     * get the version of FullBox
     * \param none
     * \return
     *   the version
     */
    uint8_t getVersion(void) const;

    /**
     * get the flag of FullBox
     * \param none
     * \return
     *   the flag
     */
    const uint8_t* getFlag(void) const;

    /**
     * get the length of FullBox
     * \param none
     * \return
     *   the length
     */
    virtual uint32_t getLen(void) const;
PRIVATE:
    static const uint32_t FLAG_LEN = 3;

    uint8_t mVersion;
    uint8_t mFlag[FLAG_LEN];
    uint32_t mFullBoxLength;
};

////// textal header class
class TextualHeader
{
public:
    /** default constructor of DrmInStream */
    TextualHeader(){};

    /**
     * constructor for TextualHeader, used to parse textal header
     * \param inData  textal header data
     */
    TextualHeader(const string& inData);

    /**
     * get the name of textal header
     * \param none
     * \return
     *   the name
     */
    string getName() const;

    /**
     * get the value of textal header
     * \param none
     * \return
     *   the value
     */
    string getValue() const;

    /**
     * get the parameter of textal header
     * \param none
     * \return
     *   the parameter
     */
    string getParam() const;
PRIVATE:
    string name;
    string value;
    string param;
};

extern int64_t ntoh_int64(int64_t in);

#endif
+0 −213
Original line number Diff line number Diff line
/*
 * Copyright (C) 2007 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 __DCF_CONTAINER_H__
#define __DCF_CONTAINER_H__

#include <Drm2CommonTypes.h>
#include <uvector.h>
#include <dcf/DrmIStream.h>
#include <dcf/DrmDcfCommon.h>

class DrmInStream;

/////////dcf container
class DcfContainer : public FullBox
{
public:
    friend class DrmInStream;

    /** default constructor of DcfContainer */
    DcfContainer(istream& inRawData):FullBox(NULL),mConStream(inRawData){}

    /**
     * constructor for DcfContainer, used to parse DCF container
     * \param data  DCF container data
     * \param len   DCF container data len
     * \param off   the offset from the start of DCF container
     */
    DcfContainer(const uint8_t* data,istream& inRawData,uint64_t conOff);

    /** Destructor for DcfContainer */
    ~DcfContainer();

    /**
     * get the content type of one content
     * \param none
     * \return
     *   the content type
     */
    string getContentType(void) const;

    /**
     * get the encryption method apply to content
     * \param none
     * \return
     *   the encryption method
     */
    uint8_t getEncryptionMethod(void) const;

    /**
     * get the padding scheme apply to content
     * \param none
     * \return
     *   the padding scheme
     */
    uint8_t getPaddingScheme(void) const;

    /**
     * get the length of plain content
     * \param none
     * \return
     *   the length of plain content
     */
    uint64_t getPlaintextLength(void) const;

    /**
     * get the length of content ID
     * \param none
     * \return
     *   the length of content ID
     */
    uint16_t getContentIDLength(void) const;

    /**
     * get the length of rights issuer URL
     * \param none
     * \return
     *   the length of rights issuer URL
     */
    uint16_t getRightsIssuerURLLength(void) const;

    /**
     * get the length of textal header
     * \param none
     * \return
     *   the length of textal header
     */
    uint16_t getTextualHeadersLength(void) const;

    /**
     * get the content ID of one content
     * \param none
     * \return
     *   the content ID
     */
    string getContentID(void) const;

    /**
     * get the rights issuer URL
     * \param none
     * \return
     *   the rights issuer URL
     */
    string getRightsIssuerURL(void) const;

    /**
     * get the preview method
     * \param none
     * \return
     *   the preview method
     */
    string getPreviewMethod(void) const;

    /**
     * get the location of content
     * \param none
     * \return
     *   the location of content
     */
    string getContentLocation(void) const;

    /**
     * get the URL of content
     * \param none
     * \return
     *   the URL of content
     */
    string getContentURL(void) const;

    /**
     * get the customer head
     * \param none
     * \return
     *   the customer head
     */
    vector<string> getCustomerHead(void) const;

    /**
     * get the preview element data
     * \param none
     * \return
     *   the DRM Instream of preview element data
     */
    DrmInStream getPreviewElementData(void) const;

    /**
     * get the plain content
     * \param none
     * \return
     *   the DRM Instream of plain content
     */
    DrmInStream getDecryptContent(uint8_t* decryptKey) const;

    /**
     * get the istream of DCF
     * \param none
     * \return
     *   the istream of DCF
     */
    istream& getStream(void) const;

PRIVATE:
    static const uint32_t USER_DATA_FLAG = 0x01;

    uint8_t mContentTypeLen;
    string mContentType;
    uint8_t mEncryptionMethod;
    uint8_t mPaddingScheme;
    uint64_t mPlaintextLength;
    uint16_t mContentIDLength;
    uint16_t mRightsIssuerURLLength;
    uint16_t mTextualHeadersLength;
    string mContentID;
    string mRightsIssuerURL;
    vector<TextualHeader*> mTextualHeaders;
    bool mSilentFirst;
    string mSlientMethod;
    string mSilentRightsURL;
    string mPreviewMethod;
    string mPreviewElementURI;
    string mPreviewRightsURL;
    string mContentURL;
    string mContentVersion;
    string mContentLocation;
    vector<string> mCustomHeader;
    bool mHasUserData;
    uint64_t mDataLen;
    istream& mConStream;
    uint64_t mDecOffset;

PRIVATE:
    // parse text header
    bool parseTextualHeaders(const uint8_t* data, uint32_t len);
    void copy(const DcfContainer& container);
    DcfContainer(const DcfContainer& container):FullBox(NULL),mConStream(container.mConStream){}
    DcfContainer& operator=(const DcfContainer& other){return *this;}
};


#endif
+0 −77
Original line number Diff line number Diff line
/*
 * Copyright (C) 2007 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 __DRM_ISTREAM_H__
#define __DRM_ISTREAM_H__

#include <Drm2CommonTypes.h>
#include <util/crypto/DrmCrypto.h>
#include <dcf/DrmDcfContainer.h>
#include <ustring.h>

using namespace ustl;

class DcfContainer;

class DrmInStream
{
public:
    /** default constructor of DrmInStream */
    DrmInStream():mDecryptPos(0){}

    /**
     * constructor for DrmInStream, used to read DCF content
     * \param encFile  DCF container data
     * \param len   DCF container data len
     * \param off   the offset from the start of DCF container
     */
    DrmInStream(const DcfContainer* container,uint8_t* Key);

    /**
     * get the size of DRM Instream
     * \param none
     * \return
     *   the size of DRM Instream
     */
    uint64_t size() const;

    /**
     * read data from DRM Instream
     * \param  data  the buffer to store read data
     * \param  len   how much data need to read
     * \return
     *   the actual len of read data
     */
    uint64_t read(uint8_t* data,uint64_t len);

PRIVATE:
    static const uint32_t AES_IV_LEN = 16;
    static const uint32_t AES_KEY_LEN = 16;
    static const uint32_t AES_BLOCK_LEN = 16;

    const DcfContainer* mDcfCon;
    uint64_t mDecryptPos;
    uint8_t mAesKey[AES_KEY_LEN];
};



#endif




Loading