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.

49 lines
2.3 KiB

/*
* Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2020. All rights reserved.
* Description: NxMetadataRetrieverWrapper class implement
* Author: NxPlayer software group
* Create: 2019-11-21
*/
#ifndef ANDROID_NXMETADATARETRIEVER_WRAPPER_H
#define ANDROID_NXMETADATARETRIEVER_WRAPPER_H
#include <media/MediaMetadataRetrieverInterface.h>
#include <utils/KeyedVector.h>
#include <private/media/VideoFrame.h>
#include "NxMetadataRetrieverInterface.h"
namespace android {
class NxMetadataRetrieverWrapper : public MediaMetadataRetrieverBase {
public:
NxMetadataRetrieverWrapper();
~NxMetadataRetrieverWrapper() override;
status_t setDataSource(const sp<IMediaHTTPService> &httpService, const char *url,
const KeyedVector<String8, String8> *headers) override;
status_t setDataSource(int fd, int64_t offset, int64_t length) override;
status_t setDataSource(const sp<DataSource> &source, const char *mime) override;
sp<IMemory> getFrameAtTime(int64_t timeUs, int option, int colorFormat, bool metaOnly) override;
sp<IMemory> getImageAtIndex(int index, int colorFormat, bool metaOnly, bool thumbnail) override;
sp<IMemory> getImageRectAtIndex(int index, int colorFormat, int left,
int top, int right, int bottom) override;
#if defined(PLATFORM_SDK_VERSION) && (PLATFORM_SDK_VERSION < 31)
status_t getFrameAtIndex(std::vector<sp<IMemory>> *frames, int frameIndex, int numFrames,
int colorFormat, bool metaOnly) override;
#elif defined(PLATFORM_SDK_VERSION) && (PLATFORM_SDK_VERSION >= 31)
sp<IMemory> getFrameAtIndex(int frameIndex, int colorFormat, bool metaOnly) override;
#endif
MediaAlbumArt *extractAlbumArt() override;
const char *extractMetadata(int keyCode) override;
private:
bool Init();
sp<IMemory> GetThumbImage(sp<IMemory> &thumbnail, const ThumbnailInfo &picInfo) const;
NxMetadataRetrieverInterface *m_nxMetadataRetriever;
void *m_libHandle; /* loaded library handle */
NxMetadataRetrieverInterface::CreateNxMetadataRetrieverInterfaceInstanceFunc m_createInstance;
NxMetadataRetrieverInterface::DestroyNxMetadataRetrieverInterfaceInstanceFunc m_destroyInstance;
int m_instIdx; /* instance number */
static int g_nextInstIdx;
};
};
#endif