本文整理汇总了Java中android.provider.MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO属性的典型用法代码示例。如果您正苦于以下问题:Java FileColumns.MEDIA_TYPE_VIDEO属性的具体用法?Java FileColumns.MEDIA_TYPE_VIDEO怎么用?Java FileColumns.MEDIA_TYPE_VIDEO使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.provider.MediaStore.Files.FileColumns
的用法示例。
在下文中一共展示了FileColumns.MEDIA_TYPE_VIDEO属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMediaStoreInsert
/**
* When inserting the first item of each type, we need to trigger a roots
* refresh to clear a previously reported {@link Root#FLAG_EMPTY}.
*/
static void onMediaStoreInsert(Context context, String volumeName, int type, long id) {
if (!"external".equals(volumeName)) return;
if (type == FileColumns.MEDIA_TYPE_IMAGE && sReturnedImagesEmpty) {
sReturnedImagesEmpty = false;
notifyRootsChanged(context);
} else if (type == FileColumns.MEDIA_TYPE_VIDEO && sReturnedVideosEmpty) {
sReturnedVideosEmpty = false;
notifyRootsChanged(context);
} else if (type == FileColumns.MEDIA_TYPE_AUDIO && sReturnedAudioEmpty) {
sReturnedAudioEmpty = false;
notifyRootsChanged(context);
}
}
示例2: loadBucketEntriesFromFilesTable
private static BucketEntry[] loadBucketEntriesFromFilesTable(
ThreadPool.JobContext jc, ContentResolver resolver, int type) {
Uri uri = getFilesContentUri();
Cursor cursor = resolver.query(uri,
PROJECTION_BUCKET, BUCKET_GROUP_BY,
null, BUCKET_ORDER_BY);
if (cursor == null) {
Log.w(TAG, "cannot open local database: " + uri);
return new BucketEntry[0];
}
ArrayList<BucketEntry> buffer = new ArrayList<BucketEntry>();
int typeBits = 0;
if ((type & MediaObject.MEDIA_TYPE_IMAGE) != 0) {
typeBits |= (1 << FileColumns.MEDIA_TYPE_IMAGE);
}
if ((type & MediaObject.MEDIA_TYPE_VIDEO) != 0) {
typeBits |= (1 << FileColumns.MEDIA_TYPE_VIDEO);
}
try {
while (cursor.moveToNext()) {
if ((typeBits & (1 << cursor.getInt(INDEX_MEDIA_TYPE))) != 0) {
BucketEntry entry = new BucketEntry(
cursor.getInt(INDEX_BUCKET_ID),
cursor.getString(INDEX_BUCKET_NAME));
if (!buffer.contains(entry)) {
buffer.add(entry);
}
}
if (jc.isCancelled()) return null;
}
} finally {
Utils.closeSilently(cursor);
}
return buffer.toArray(new BucketEntry[buffer.size()]);
}
示例3: loadBucketEntries
public static BucketEntry[] loadBucketEntries(Path path, ThreadPool.JobContext jc, Context mContext) {
Uri uri = mBaseUri;
Log.v("DebugLoadingTime", "start quering media provider");
Cursor cursor = mContext.getContentResolver().query(
uri, PROJECTION_BUCKET, BUCKET_GROUP_BY, null, BUCKET_ORDER_BY);
if (cursor == null) {
Log.w(TAG, "cannot open local database: " + uri);
return new BucketEntry[0];
}
ArrayList<BucketEntry> buffer = new ArrayList<BucketEntry>();
int typeBits = 0;
int mType = getTypeFromPath(path);
if ((mType & MediaObject.MEDIA_TYPE_IMAGE) != 0) {
typeBits |= (1 << FileColumns.MEDIA_TYPE_IMAGE);
}
if ((mType & MediaObject.MEDIA_TYPE_VIDEO) != 0) {
typeBits |= (1 << FileColumns.MEDIA_TYPE_VIDEO);
}
try {
while (cursor.moveToNext()) {
if ((typeBits & (1 << cursor.getInt(INDEX_MEDIA_TYPE))) != 0) {
BucketEntry entry = new BucketEntry(
cursor.getInt(INDEX_BUCKET_ID),
cursor.getString(INDEX_BUCKET_NAME));
if (!buffer.contains(entry)) {
buffer.add(entry);
}
}
if (jc.isCancelled()) return null;
}
Log.v("DebugLoadingTime", "got " + buffer.size() + " buckets");
} finally {
cursor.close();
}
return buffer.toArray(new BucketEntry[buffer.size()]);
}
示例4: Job
public Job(String path, String id) {
mPath = path;
mId = id;
mMft = ArchosMediaFile.getFileType(path);
// default mime type / media type
int mediaType = FileColumns.MEDIA_TYPE_NONE;
String mimeType = "application/octet-stream";
boolean retrieve = false;
if (mMft != null) {
mimeType = mMft.mimeType;
if (!isNoMediaPath(path)) {
if (ArchosMediaFile.isAudioFileType(mMft.fileType)) {
mediaType = FileColumns.MEDIA_TYPE_AUDIO;
retrieve = true;
} else if (ArchosMediaFile.isVideoFileType(mMft.fileType)) {
mediaType = FileColumns.MEDIA_TYPE_VIDEO;
} else if (ArchosMediaFile.isImageFileType(mMft.fileType)) {
mediaType = FileColumns.MEDIA_TYPE_IMAGE;
} else if (ArchosMediaFile.isPlayListFileType(mMft.fileType)) {
mediaType = FileColumns.MEDIA_TYPE_PLAYLIST;
}
}
}
mMimeType = mimeType;
mMediaType = mediaType;
mRetrieve = retrieve;
}
示例5: Job
public Job(String path, String id, Blacklist blacklist) {
mPath = Uri.parse(path);
mId = id;
mMft = ArchosMediaFile.getFileType(path);
// default mime type / media type
int mediaType = FileColumns.MEDIA_TYPE_NONE;
String mimeType = "application/octet-stream";
boolean retrieve = false;
if (mMft != null) {
mimeType = mMft.mimeType;
if (!isNoMediaPath(path) && !blacklist.isBlacklisted(mPath)) {
if (ArchosMediaFile.isAudioFileType(mMft.fileType)) {
mediaType = FileColumns.MEDIA_TYPE_AUDIO;
} else if (ArchosMediaFile.isVideoFileType(mMft.fileType)) {
mediaType = FileColumns.MEDIA_TYPE_VIDEO;
retrieve = true;
} else if (ArchosMediaFile.isImageFileType(mMft.fileType)) {
mediaType = FileColumns.MEDIA_TYPE_IMAGE;
} else if (ArchosMediaFile.isPlayListFileType(mMft.fileType)) {
mediaType = FileColumns.MEDIA_TYPE_PLAYLIST;
}
}
}
mMimeType = mimeType;
mMediaType = mediaType;
mRetrieve = retrieve;
}
示例6: getItemMimetype
private String getItemMimetype(Object item) {
int type = mDelegate.getItemMediaType(item);
if (type == FileColumns.MEDIA_TYPE_IMAGE) {
return GalleryUtils.MIME_TYPE_IMAGE;
} else if (type == FileColumns.MEDIA_TYPE_VIDEO) {
return GalleryUtils.MIME_TYPE_VIDEO;
} else {
return GalleryUtils.MIME_TYPE_ALL;
}
}
示例7: loadBucketEntriesFromFilesTable
private static BucketEntry[] loadBucketEntriesFromFilesTable(
JobContext jc, ContentResolver resolver, int type) {
Uri uri = getFilesContentUri();
Cursor cursor = resolver.query(uri,
PROJECTION_BUCKET, BUCKET_GROUP_BY,
null, BUCKET_ORDER_BY);
if (cursor == null) {
Log.w(TAG, "cannot open local database: " + uri);
return new BucketEntry[0];
}
ArrayList<BucketEntry> buffer = new ArrayList<BucketEntry>();
int typeBits = 0;
if ((type & MediaObject.MEDIA_TYPE_IMAGE) != 0) {
typeBits |= (1 << FileColumns.MEDIA_TYPE_IMAGE);
}
if ((type & MediaObject.MEDIA_TYPE_VIDEO) != 0) {
typeBits |= (1 << FileColumns.MEDIA_TYPE_VIDEO);
}
try {
while (cursor.moveToNext()) {
if ((typeBits & (1 << cursor.getInt(INDEX_MEDIA_TYPE))) != 0) {
BucketEntry entry = new BucketEntry(
cursor.getInt(INDEX_BUCKET_ID),
cursor.getString(INDEX_BUCKET_NAME));
if (!buffer.contains(entry)) {
buffer.add(entry);
}
}
if (jc.isCancelled()) return null;
}
} finally {
Utils.closeSilently(cursor);
}
return buffer.toArray(new BucketEntry[buffer.size()]);
}
示例8: loadBucketEntries
private BucketEntry[] loadBucketEntries(JobContext jc) {
Uri uri = mBaseUri;
Log.v("DebugLoadingTime", "start quering media provider");
Cursor cursor = mApplication.getContentResolver().query(uri,
PROJECTION_BUCKET, BUCKET_GROUP_BY, null, BUCKET_ORDER_BY);
if (cursor == null) {
Log.w(TAG, "cannot open local database: " + uri);
return new BucketEntry[0];
}
ArrayList<BucketEntry> buffer = new ArrayList<BucketEntry>();
int typeBits = 0;
if ((mType & MEDIA_TYPE_IMAGE) != 0) {
typeBits |= (1 << FileColumns.MEDIA_TYPE_IMAGE);
}
if ((mType & MEDIA_TYPE_VIDEO) != 0) {
typeBits |= (1 << FileColumns.MEDIA_TYPE_VIDEO);
}
try {
while (cursor.moveToNext()) {
if ((typeBits & (1 << cursor.getInt(INDEX_MEDIA_TYPE))) != 0) {
BucketEntry entry = new BucketEntry(
cursor.getInt(INDEX_BUCKET_ID),
cursor.getString(INDEX_BUCKET_NAME));
if (!buffer.contains(entry)) {
buffer.add(entry);
}
}
if (jc.isCancelled())
return null;
}
Log.v("DebugLoadingTime", "got " + buffer.size() + " buckets");
} finally {
cursor.close();
}
return buffer.toArray(new BucketEntry[buffer.size()]);
}
示例9: fromRetrieverService
/** creates ContentValues via MediaRetrieverService, can't be null */
private ContentValues fromRetrieverService(Job job, String timeString) throws InterruptedException, MediaRetrieverServiceClient.ServiceManagementException {
ContentValues cv = new ContentValues();
String path = job.mPath.toString();
// tell mediaprovider that this update originates from here.
cv.put(VideoStoreInternal.KEY_SCANNER, "1");
// also put the path here so MediaProvider knows which file it is
cv.put(MediaColumns.DATA, path);
cv.put(BaseColumns._ID, job.mId);
String defaultTitle = getDefaultTitle(path);
cv.put(FileColumns.TITLE, defaultTitle);
cv.put(MediaColumns.MIME_TYPE, job.mMimeType);
cv.put(FileColumns.MEDIA_TYPE, String.valueOf(job.mMediaType));
cv.put(VideoStoreInternal.FILES_EXTRA_COLUMN_SCAN_STATE, timeString);
// try to get metadata if file is a mediafile
MediaMetadata metadata = null;
if (job.mRetrieve) {
try {
metadata = getMetadata(path);
} catch (RemoteException e) {
Log.w(TAG, "Blacklisting file because it killed metadata service:" + path);
cv.put(VideoStoreInternal.FILES_EXTRA_COLUMN_SCAN_STATE, String.valueOf(VideoStoreInternal.SCAN_STATE_SCAN_FAILED));
return cv;
}
if (metadata == null) {
// file didn't kill the service but still failed to give metadata
Log.d(TAG, "Failed to get metadata for file:" + path);
return cv;
}
}
// if we don't need to scan further also end here.
if (!job.mRetrieve)
return cv;
if (DBG) Log.d(TAG, "Scanning metadata of: " + path);
switch (job.mMediaType) {
case FileColumns.MEDIA_TYPE_VIDEO:
extract(cv, metadata, VideoColumns.ARCHOS_ENCODING_PROFILE, IMediaMetadataRetriever.METADATA_KEY_ENCODING_PROFILE, "0");
extract(cv, metadata, VideoColumns.ARCHOS_FRAMES_PER_THOUSAND_SECONDS, IMediaMetadataRetriever.METADATA_KEY_FRAMES_PER_THOUSAND_SECONDS, "0");
extract(cv, metadata, VideoColumns.ARCHOS_NUMBER_OF_AUDIO_TRACKS, IMediaMetadataRetriever.METADATA_KEY_NB_AUDIO_TRACK, "-1");
extract(cv, metadata, VideoColumns.ARCHOS_NUMBER_OF_SUBTITLE_TRACKS, IMediaMetadataRetriever.METADATA_KEY_NB_SUBTITLE_TRACK, "-1");
extract(cv, metadata, VideoColumns.ARCHOS_VIDEO_BITRATE, IMediaMetadataRetriever.METADATA_KEY_VIDEO_BITRATE, "0");
extract(cv, metadata, VideoColumns.ARCHOS_VIDEO_FOURCC_CODEC, IMediaMetadataRetriever.METADATA_KEY_VIDEO_FOURCC_CODEC, "0");
extract(cv, metadata, MediaColumns.HEIGHT, IMediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT, "0");
extract(cv, metadata, MediaColumns.WIDTH, IMediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH, "0");
extract(cv, metadata, VideoColumns.DURATION, IMediaMetadataRetriever.METADATA_KEY_DURATION, "0");
extract(cv, metadata, VideoColumns.ARCHOS_SAMPLERATE, IMediaMetadataRetriever.METADATA_KEY_SAMPLE_RATE, "0");
extract(cv, metadata, VideoColumns.ARCHOS_NUMBER_OF_CHANNELS, IMediaMetadataRetriever.METADATA_KEY_NUMBER_OF_CHANNELS, "0");
extract(cv, metadata, VideoColumns.ARCHOS_AUDIO_WAVE_CODEC, IMediaMetadataRetriever.METADATA_KEY_AUDIO_WAVE_CODEC, "0");
extract(cv, metadata, VideoColumns.ARCHOS_AUDIO_BITRATE, IMediaMetadataRetriever.METADATA_KEY_AUDIO_BITRATE, "0");
extract(cv, metadata, FileColumns.TITLE, IMediaMetadataRetriever.METADATA_KEY_TITLE, defaultTitle);
break;
}
return cv;
}
示例10: onItemSelectedStateChanged
public void onItemSelectedStateChanged(ShareActionProvider share,
int itemType, int itemSupportedOperations, boolean selected) {
int increment = selected ? 1 : -1;
mSelectedTotalCount += increment;
mCachedShareableUris = null;
if ((itemSupportedOperations & MediaObject.SUPPORT_DELETE) > 0) {
mSelectedDeletableCount += increment;
}
if ((itemSupportedOperations & MediaObject.SUPPORT_EDIT) > 0) {
mSelectedEditableCount += increment;
}
if ((itemSupportedOperations & MediaObject.SUPPORT_CROP) > 0) {
mSelectedCroppableCount += increment;
}
if ((itemSupportedOperations & MediaObject.SUPPORT_SETAS) > 0) {
mSelectedSetableCount += increment;
}
if ((itemSupportedOperations & MediaObject.SUPPORT_TRIM) > 0) {
mSelectedTrimmableCount += increment;
}
if ((itemSupportedOperations & MediaObject.SUPPORT_MUTE) > 0) {
mSelectedMuteableCount += increment;
}
if ((itemSupportedOperations & MediaObject.SUPPORT_SHARE) > 0) {
mSelectedShareableCount += increment;
if (itemType == FileColumns.MEDIA_TYPE_IMAGE) {
mSelectedShareableImageCount += increment;
} else if (itemType == FileColumns.MEDIA_TYPE_VIDEO) {
mSelectedShareableVideoCount += increment;
}
}
mShareIntent.removeExtra(Intent.EXTRA_STREAM);
if (mSelectedShareableCount == 0) {
mShareIntent.setAction(null).setType(null);
} else if (mSelectedShareableCount >= 1) {
mCachedShareableUris = mUriSource.getSelectedShareableUris();
if (mCachedShareableUris.size() == 0) {
mShareIntent.setAction(null).setType(null);
} else {
if (mSelectedShareableImageCount == mSelectedShareableCount) {
mShareIntent.setType(GalleryUtils.MIME_TYPE_IMAGE);
} else if (mSelectedShareableVideoCount == mSelectedShareableCount) {
mShareIntent.setType(GalleryUtils.MIME_TYPE_VIDEO);
} else {
mShareIntent.setType(GalleryUtils.MIME_TYPE_ALL);
}
if (mCachedShareableUris.size() == 1) {
mShareIntent.setAction(Intent.ACTION_SEND);
mShareIntent.putExtra(Intent.EXTRA_STREAM, mCachedShareableUris.get(0));
} else {
mShareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
mShareIntent.putExtra(Intent.EXTRA_STREAM, mCachedShareableUris);
}
}
}
share.setShareIntent(mShareIntent);
}