You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
3.5 KiB
91 lines
3.5 KiB
/*
|
|
* Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2020. All rights reserved.
|
|
* Description: NxMetadataRetriever class implement
|
|
* Author: NxPlayer software group
|
|
* Create: 2019-11-21
|
|
*/
|
|
|
|
#ifndef ANDROID_NXMETADATARETRIEVER_H
|
|
#define ANDROID_NXMETADATARETRIEVER_H
|
|
|
|
#include "NxMetadataRetrieverInterface.h"
|
|
|
|
#include <vendor/hardware/hwnxmediaplayerhal/1.0/INxPlayerMetadataStore.h>
|
|
#include <vendor/hardware/hwnxmediaplayerhal/1.0/INxPlayerMetadata.h>
|
|
#include <vendor/hardware/hwnxmediaplayerhal/1.0/types.h>
|
|
|
|
#include <android/hidl/memory/1.0/IMemory.h>
|
|
#include <hidlmemory/mapping.h>
|
|
#include <binder/MemoryBase.h>
|
|
#include <binder/MemoryHeapBase.h>
|
|
#include <utils/KeyedVector.h>
|
|
#include <securec.h>
|
|
#include "NxMediaDefine.h"
|
|
|
|
namespace android {
|
|
using HMemory = ::android::hidl::memory::V1_0::IMemory;
|
|
using ::android::hardware::hidl_memory;
|
|
|
|
using ::android::sp;
|
|
using android::status_t;
|
|
|
|
using ::android::hardware::hidl_string;
|
|
using ::android::hardware::hidl_vec;
|
|
using ::android::hardware::Return;
|
|
using ::android::hardware::Void;
|
|
using ::android::hardware::hidl_array;
|
|
|
|
using ::vendor::hardware::hwnxmediaplayerhal::V1_0::INxPlayerMetadataStore;
|
|
using ::vendor::hardware::hwnxmediaplayerhal::V1_0::INxPlayerMetadata;
|
|
using ::vendor::hardware::hwnxmediaplayerhal::V1_0::MediaBuffer;
|
|
using ::vendor::hardware::hwnxmediaplayerhal::V1_0::Header;
|
|
|
|
class NxMetadataRetriever : public NxMetadataRetrieverInterface {
|
|
public:
|
|
explicit NxMetadataRetriever(int idx);
|
|
~NxMetadataRetriever() override;
|
|
status_t setDataSource(const char *url, const KeyedVector<String8, String8> *headers = nullptr) override;
|
|
status_t setDataSource(int fd, int64_t offset, int64_t length) override;
|
|
sp<IMemory> getFrameAtTime(int64_t timeUs, ThumbnailParam &inParam, ThumbnailInfo &outInfo) override;
|
|
sp<IMemory> getImageAtIndex(int index, ThumbnailParam &inParam, ThumbnailInfo &outInfo) override;
|
|
sp<IMemory> getImageRectAtIndex(int index, ThumbnailParam &inParam,
|
|
ThumbnailRect &rectInfo, ThumbnailInfo &outInfo) override;
|
|
status_t getFrameAtIndex(std::vector<sp<IMemory>> *frames, int frameIndex, int numFrames,
|
|
ThumbnailParam &inParam, std::vector<ThumbnailInfo> &outInfo) override;
|
|
sp<IMemory> getFrameAtIndex(int frameIndex, ThumbnailParam &inParam, ThumbnailInfo &outInfo) override;
|
|
std::string extractAlbumArt() override;
|
|
const char *extractMetadata(int keyCode) override;
|
|
private:
|
|
struct PIC_INFO {
|
|
uint32_t picWidth;
|
|
uint32_t picHeight;
|
|
uint32_t picRotation;
|
|
uint32_t picSize;
|
|
hidl_memory picData;
|
|
};
|
|
class DeathRecipient : public android::hardware::hidl_death_recipient {
|
|
public:
|
|
explicit DeathRecipient(NxMetadataRetriever *retriever, int idx)
|
|
:m_nxMetadataRetriever(retriever), m_instIdx(idx) { }
|
|
~DeathRecipient() override;
|
|
void serviceDied(uint64_t cookie, const wp< ::android::hidl::base::V1_0::IBase> &) override; /* who */
|
|
|
|
private:
|
|
NxMetadataRetriever *m_nxMetadataRetriever;
|
|
int m_instIdx;
|
|
};
|
|
|
|
void InitDeathRecipient();
|
|
void DeInitDeathRecipient();
|
|
void InitPicInfo(PIC_INFO &picInfo, const MediaBuffer &pic) const;
|
|
void CopyFrameInfo(ThumbnailInfo &outInfo, const PIC_INFO &picInfo) const;
|
|
sp<DeathRecipient> m_deathRecipient;
|
|
#ifdef NXMEDIAPLAYER_ENABLE
|
|
sp<INxPlayerMetadataStore> m_nxMetadataStore;
|
|
sp<INxPlayerMetadata> m_nxMetadata;
|
|
#endif
|
|
int m_instIdx;
|
|
};
|
|
};
|
|
#endif
|