本文整理汇总了C++中sp::getDrmInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ sp::getDrmInfo方法的具体用法?C++ sp::getDrmInfo怎么用?C++ sp::getDrmInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sp
的用法示例。
在下文中一共展示了sp::getDrmInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mDataSource
DRMExtractor::DRMExtractor(const sp<DataSource> &source, const char* mime)
: mDataSource(source),
mDecryptHandle(NULL),
mDrmManagerClient(NULL) {
mOriginalExtractor = MediaExtractor::Create(source, mime);
mOriginalExtractor->setDrmFlag(true);
mOriginalExtractor->getMetaData()->setInt32(kKeyIsDRM, 1);
source->getDrmInfo(mDecryptHandle, &mDrmManagerClient);
}
示例2: DRMExtractor
// static
sp<MediaExtractor> MediaExtractor::Create(
const sp<DataSource> &source, const char *mime) {
sp<AMessage> meta;
ALOGD("JB +MediaExtractor::Create");
String8 tmp;
if (mime == NULL) {
float confidence;
if (!source->sniff(&tmp, &confidence, &meta)) {
ALOGV("FAILED to autodetect media content.");
return NULL;
}
mime = tmp.string();
ALOGD("Autodetected media content as '%s' with confidence %.2f",
mime, confidence);
}
bool isDrm = false;
// DRM MIME type syntax is "drm+type+original" where
// type is "es_based" or "container_based" and
// original is the content's cleartext MIME type
if (!strncmp(mime, "drm+", 4)) {
const char *originalMime = strchr(mime+4, '+');
if (originalMime == NULL) {
// second + not found
return NULL;
}
++originalMime;
if (!strncmp(mime, "drm+es_based+", 13)) {
// DRMExtractor sets container metadata kKeyIsDRM to 1
return new DRMExtractor(source, originalMime);
} else if (!strncmp(mime, "drm+container_based+", 20)) {
mime = originalMime;
isDrm = true;
} else {
return NULL;
}
}
// M: add for OMA DRM v1.0 implementation
// explanation:
// for an OMA DRM v1.0 file, if it can be sniffed successfully, the mime type
// would be replaced by the actual type (e.g. image/jpeg) instead of drm+containder_based+<original_mime>
// Thus, the following code checks for decrypt handle and set isDrm to true
// so that it's handled correctly in AwesomePlayer.
#ifndef ANDROID_DEFAULT_CODE
#ifdef MTK_DRM_APP
DrmManagerClient *drmManagerClient = NULL;
sp<DecryptHandle> decryptHandle;
source->getDrmInfo(decryptHandle, &drmManagerClient);
// mark isDrm as true for OMA DRM v1.0 file
// the same judgement as in FileSource::flags()
if (decryptHandle.get() != NULL
&& DecryptApiType::CONTAINER_BASED == decryptHandle->decryptApiType) {
isDrm = true;
}
#endif
#endif
#ifndef ANDROID_DEFAULT_CODE
sp<MediaExtractor> ret;
#else
MediaExtractor *ret = NULL;
#endif
if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_MPEG4)
|| !strcasecmp(mime, "audio/mp4")) {
int fragmented = 0;
if (meta != NULL && meta->findInt32("fragmented", &fragmented) && fragmented) {
ret = new FragmentedMP4Extractor(source);
} else {
ret = new MPEG4Extractor(source);
}
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_MPEG)) {
ret = new MP3Extractor(source, meta);
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AMR_NB)
|| !strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AMR_WB)) {
ret = new AMRExtractor(source);
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_FLAC)) {
ret = new FLACExtractor(source);
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_WAV)) {
ret = new WAVExtractor(source);
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_OGG)) {
ret = new OggExtractor(source);
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_MATROSKA)) {
ret = new MatroskaExtractor(source);
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_MPEG2TS)) {
ret = new MPEG2TSExtractor(source);
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_MPEG2PS)) {
#ifndef ANDROID_DEFAULT_CODE
#ifdef MTK_MTKPS_PLAYBACK_SUPPORT
ret = new MPEG2PSExtractor(source);
#else //MTK_MTKPS_PLAYBACK_SUPPORT
ALOGV(" MediaExtractor::is PS file, not support playing now");
ret =NULL;
#endif //MTK_MTKPS_PLAYBACK_SUPPORT
#else //#ifndef ANDROID_DEFAULT_CODE
ret = new MPEG2PSExtractor(source);
#endif //#ifndef ANDROID_DEFAULT_CODE
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_AVI)) {
//.........这里部分代码省略.........