19066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* 29066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Copyright (C) 2008 The Android Open Source Project 39066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 49066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License"); 59066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * you may not use this file except in compliance with the License. 69066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * You may obtain a copy of the License at 79066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 89066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * http://www.apache.org/licenses/LICENSE-2.0 99066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Unless required by applicable law or agreed to in writing, software 119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS, 129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * See the License for the specific language governing permissions and 149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * limitations under the License. 159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectpackage android.media; 189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.content.ContentResolver; 209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.content.Context; 219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.content.res.AssetFileDescriptor; 229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.graphics.Bitmap; 239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.net.Uri; 24d2506a506303ed94fd1991cf986b825b870a67c5Andreas Huberimport android.os.IBinder; 25c5d5ee34d7c1026ca8d5cd8b186e5a73c5230247Marco Nelissen 269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport java.io.FileDescriptor; 270041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dongimport java.io.FileInputStream; 289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport java.io.FileNotFoundException; 29c5d5ee34d7c1026ca8d5cd8b186e5a73c5230247Marco Nelissenimport java.io.IOException; 309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 315b7ced6a4ebcec34a36d0779773bc9e671732dbfAndreas Huberimport java.util.Map; 325b7ced6a4ebcec34a36d0779773bc9e671732dbfAndreas Huber 339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/** 349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * MediaMetadataRetriever class provides a unified interface for retrieving 359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * frame and meta data from an input media file. 369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectpublic class MediaMetadataRetriever 389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{ 399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project static { 409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project System.loadLibrary("media_jni"); 414935d05eaa306cef88cf0ab13eca386f270409ecMarco Nelissen native_init(); 429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project // The field below is accessed by native methods 459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project @SuppressWarnings("unused") 46075e9a19ce645752f8282bc19c91b25978a7dc52Ashok Bhat private long mNativeContext; 479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 48df9b349b960fff95dff4fcf8b2661899e33059daJames Dong private static final int EMBEDDED_PICTURE_TYPE_ANY = 0xFFFF; 49df9b349b960fff95dff4fcf8b2661899e33059daJames Dong 509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public MediaMetadataRetriever() { 519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project native_setup(); 529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Sets the data source (file pathname) to use. Call this 569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * method before the rest of the methods in this class. This method may be 579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * time-consuming. 589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param path The path of the input media file. 609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @throws IllegalArgumentException If the path is invalid. 619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 620041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong public void setDataSource(String path) throws IllegalArgumentException { 63425916e4c5305b9bfff5b5d60d203363afcb7b89Oscar Rydhé if (path == null) { 64425916e4c5305b9bfff5b5d60d203363afcb7b89Oscar Rydhé throw new IllegalArgumentException(); 65425916e4c5305b9bfff5b5d60d203363afcb7b89Oscar Rydhé } 66425916e4c5305b9bfff5b5d60d203363afcb7b89Oscar Rydhé 670041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong FileInputStream is = null; 680041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong try { 690041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong is = new FileInputStream(path); 700041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong FileDescriptor fd = is.getFD(); 710041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong setDataSource(fd, 0, 0x7ffffffffffffffL); 720041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong } catch (FileNotFoundException fileEx) { 730041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong throw new IllegalArgumentException(); 740041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong } catch (IOException ioEx) { 750041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong throw new IllegalArgumentException(); 760041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong } 770041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong 780041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong try { 790041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong if (is != null) { 800041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong is.close(); 810041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong } 820041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong } catch (Exception e) {} 830041b5c561a48ed8f63c4fe8ae3bff5196f68d0fJames Dong } 845b7ced6a4ebcec34a36d0779773bc9e671732dbfAndreas Huber 855b7ced6a4ebcec34a36d0779773bc9e671732dbfAndreas Huber /** 865b7ced6a4ebcec34a36d0779773bc9e671732dbfAndreas Huber * Sets the data source (URI) to use. Call this 875b7ced6a4ebcec34a36d0779773bc9e671732dbfAndreas Huber * method before the rest of the methods in this class. This method may be 885b7ced6a4ebcec34a36d0779773bc9e671732dbfAndreas Huber * time-consuming. 895b7ced6a4ebcec34a36d0779773bc9e671732dbfAndreas Huber * 905b7ced6a4ebcec34a36d0779773bc9e671732dbfAndreas Huber * @param uri The URI of the input media. 915b7ced6a4ebcec34a36d0779773bc9e671732dbfAndreas Huber * @param headers the headers to be sent together with the request for the data 925b7ced6a4ebcec34a36d0779773bc9e671732dbfAndreas Huber * @throws IllegalArgumentException If the URI is invalid. 935b7ced6a4ebcec34a36d0779773bc9e671732dbfAndreas Huber */ 9417524dc0d296146c8ffb3f692dc8ab05fee5b1e0James Dong public void setDataSource(String uri, Map<String, String> headers) 9517524dc0d296146c8ffb3f692dc8ab05fee5b1e0James Dong throws IllegalArgumentException { 9617524dc0d296146c8ffb3f692dc8ab05fee5b1e0James Dong int i = 0; 9717524dc0d296146c8ffb3f692dc8ab05fee5b1e0James Dong String[] keys = new String[headers.size()]; 9817524dc0d296146c8ffb3f692dc8ab05fee5b1e0James Dong String[] values = new String[headers.size()]; 9917524dc0d296146c8ffb3f692dc8ab05fee5b1e0James Dong for (Map.Entry<String, String> entry: headers.entrySet()) { 10017524dc0d296146c8ffb3f692dc8ab05fee5b1e0James Dong keys[i] = entry.getKey(); 10117524dc0d296146c8ffb3f692dc8ab05fee5b1e0James Dong values[i] = entry.getValue(); 10217524dc0d296146c8ffb3f692dc8ab05fee5b1e0James Dong ++i; 10317524dc0d296146c8ffb3f692dc8ab05fee5b1e0James Dong } 104d2506a506303ed94fd1991cf986b825b870a67c5Andreas Huber 105d2506a506303ed94fd1991cf986b825b870a67c5Andreas Huber _setDataSource( 106d2506a506303ed94fd1991cf986b825b870a67c5Andreas Huber MediaHTTPService.createHttpServiceBinderIfNecessary(uri), 107d2506a506303ed94fd1991cf986b825b870a67c5Andreas Huber uri, 108d2506a506303ed94fd1991cf986b825b870a67c5Andreas Huber keys, 109d2506a506303ed94fd1991cf986b825b870a67c5Andreas Huber values); 11017524dc0d296146c8ffb3f692dc8ab05fee5b1e0James Dong } 11117524dc0d296146c8ffb3f692dc8ab05fee5b1e0James Dong 11217524dc0d296146c8ffb3f692dc8ab05fee5b1e0James Dong private native void _setDataSource( 113d2506a506303ed94fd1991cf986b825b870a67c5Andreas Huber IBinder httpServiceBinder, String uri, String[] keys, String[] values) 1145b7ced6a4ebcec34a36d0779773bc9e671732dbfAndreas Huber throws IllegalArgumentException; 1155b7ced6a4ebcec34a36d0779773bc9e671732dbfAndreas Huber 1169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 1179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Sets the data source (FileDescriptor) to use. It is the caller's 1189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * responsibility to close the file descriptor. It is safe to do so as soon 1199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * as this call returns. Call this method before the rest of the methods in 1209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * this class. This method may be time-consuming. 1219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 1229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param fd the FileDescriptor for the file you want to play 1239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param offset the offset into the file where the data to be played starts, 1249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * in bytes. It must be non-negative 1259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param length the length in bytes of the data to be played. It must be 1269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * non-negative. 1279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @throws IllegalArgumentException if the arguments are invalid 1289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 1299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public native void setDataSource(FileDescriptor fd, long offset, long length) 1309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project throws IllegalArgumentException; 1319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 1329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 1339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Sets the data source (FileDescriptor) to use. It is the caller's 1349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * responsibility to close the file descriptor. It is safe to do so as soon 1359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * as this call returns. Call this method before the rest of the methods in 1369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * this class. This method may be time-consuming. 1379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 1389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param fd the FileDescriptor for the file you want to play 1399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @throws IllegalArgumentException if the FileDescriptor is invalid 1409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 1419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public void setDataSource(FileDescriptor fd) 1429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project throws IllegalArgumentException { 1439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project // intentionally less than LONG_MAX 1449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project setDataSource(fd, 0, 0x7ffffffffffffffL); 1459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 1469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 1479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 1489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Sets the data source as a content Uri. Call this method before 1499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * the rest of the methods in this class. This method may be time-consuming. 1509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 1519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param context the Context to use when resolving the Uri 1529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param uri the Content URI of the data you want to play 1539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @throws IllegalArgumentException if the Uri is invalid 1549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @throws SecurityException if the Uri cannot be used due to lack of 1559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * permission. 1569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 1579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public void setDataSource(Context context, Uri uri) 1589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project throws IllegalArgumentException, SecurityException { 1599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project if (uri == null) { 1609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project throw new IllegalArgumentException(); 1619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 1629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 1639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project String scheme = uri.getScheme(); 1649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project if(scheme == null || scheme.equals("file")) { 1659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project setDataSource(uri.getPath()); 1669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project return; 1679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 1689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 1699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project AssetFileDescriptor fd = null; 1709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project try { 1719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project ContentResolver resolver = context.getContentResolver(); 1729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project try { 1739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project fd = resolver.openAssetFileDescriptor(uri, "r"); 1749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } catch(FileNotFoundException e) { 1759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project throw new IllegalArgumentException(); 1769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 1779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project if (fd == null) { 1789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project throw new IllegalArgumentException(); 1799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 1809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project FileDescriptor descriptor = fd.getFileDescriptor(); 1819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project if (!descriptor.valid()) { 1829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project throw new IllegalArgumentException(); 1839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 1849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project // Note: using getDeclaredLength so that our behavior is the same 1859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project // as previous versions when the content provider is returning 1869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project // a full file. 1879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project if (fd.getDeclaredLength() < 0) { 1889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project setDataSource(descriptor); 1899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } else { 1909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project setDataSource(descriptor, fd.getStartOffset(), fd.getDeclaredLength()); 1919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 1929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project return; 1939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } catch (SecurityException ex) { 1949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } finally { 1959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project try { 1969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project if (fd != null) { 1979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project fd.close(); 1989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 1999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } catch(IOException ioEx) { 2009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 2019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 2029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project setDataSource(uri.toString()); 2039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 2049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 2059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 2069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Call this method after setDataSource(). This method retrieves the 2079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * meta data value associated with the keyCode. 2089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 2099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * The keyCode currently supported is listed below as METADATA_XXX 2109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * constants. With any other value, it returns a null pointer. 2119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 2129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param keyCode One of the constants listed below at the end of the class. 2139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @return The meta data value associate with the given keyCode on success; 2149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * null on failure. 2159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 2169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public native String extractMetadata(int keyCode); 2179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 2189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 2199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Call this method after setDataSource(). This method finds a 220faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * representative frame close to the given time position by considering 221faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * the given option if possible, and returns it as a bitmap. This is 222faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * useful for generating a thumbnail for an input data source or just 223faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * obtain and display a frame at the given time position. 224faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * 225faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * @param timeUs The time position where the frame will be retrieved. 226faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * When retrieving the frame at the given time position, there is no 227faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * guarantee that the data source has a frame located at the position. 228faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * When this happens, a frame nearby will be returned. If timeUs is 229faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * negative, time position and option will ignored, and any frame 230faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * that the implementation considers as representative may be returned. 231faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * 232faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * @param option a hint on how the frame is found. Use 23311eab056dd0133a390169d3581edf3eef26d6a54James Dong * {@link #OPTION_PREVIOUS_SYNC} if one wants to retrieve a sync frame 234faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * that has a timestamp earlier than or the same as timeUs. Use 23511eab056dd0133a390169d3581edf3eef26d6a54James Dong * {@link #OPTION_NEXT_SYNC} if one wants to retrieve a sync frame 236faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * that has a timestamp later than or the same as timeUs. Use 23711eab056dd0133a390169d3581edf3eef26d6a54James Dong * {@link #OPTION_CLOSEST_SYNC} if one wants to retrieve a sync frame 238faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * that has a timestamp closest to or the same as timeUs. Use 23911eab056dd0133a390169d3581edf3eef26d6a54James Dong * {@link #OPTION_CLOSEST} if one wants to retrieve a frame that may 240faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * or may not be a sync frame but is closest to or the same as timeUs. 24111eab056dd0133a390169d3581edf3eef26d6a54James Dong * {@link #OPTION_CLOSEST} often has larger performance overhead compared 242faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * to the other options if there is no sync frame located at timeUs. 243faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * 2449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @return A Bitmap containing a representative video frame, which 2459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * can be null, if such a frame cannot be retrieved. 2469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 247faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong public Bitmap getFrameAtTime(long timeUs, int option) { 248faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong if (option < OPTION_PREVIOUS_SYNC || 249faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong option > OPTION_CLOSEST) { 250faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong throw new IllegalArgumentException("Unsupported option: " + option); 251faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong } 252faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong 253faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong return _getFrameAtTime(timeUs, option); 254faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong } 255faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong 256faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong /** 257faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * Call this method after setDataSource(). This method finds a 258faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * representative frame close to the given time position if possible, 259faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * and returns it as a bitmap. This is useful for generating a thumbnail 260faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * for an input data source. Call this method if one does not care 261faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * how the frame is found as long as it is close to the given time; 26211eab056dd0133a390169d3581edf3eef26d6a54James Dong * otherwise, please call {@link #getFrameAtTime(long, int)}. 263faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * 264faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * @param timeUs The time position where the frame will be retrieved. 265faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * When retrieving the frame at the given time position, there is no 266faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * guarentee that the data source has a frame located at the position. 267faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * When this happens, a frame nearby will be returned. If timeUs is 268faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * negative, time position and option will ignored, and any frame 269faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * that the implementation considers as representative may be returned. 270faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * 271faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * @return A Bitmap containing a representative video frame, which 272faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * can be null, if such a frame cannot be retrieved. 273faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * 274faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * @see #getFrameAtTime(long, int) 275faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong */ 276faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong public Bitmap getFrameAtTime(long timeUs) { 277faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong return getFrameAtTime(timeUs, OPTION_CLOSEST_SYNC); 278faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong } 279faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong 280faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong /** 281faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * Call this method after setDataSource(). This method finds a 282faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * representative frame at any time position if possible, 283faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * and returns it as a bitmap. This is useful for generating a thumbnail 284faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * for an input data source. Call this method if one does not 285faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * care about where the frame is located; otherwise, please call 28611eab056dd0133a390169d3581edf3eef26d6a54James Dong * {@link #getFrameAtTime(long)} or {@link #getFrameAtTime(long, int)} 287faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * 288faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * @return A Bitmap containing a representative video frame, which 289faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * can be null, if such a frame cannot be retrieved. 290faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * 291faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * @see #getFrameAtTime(long) 292faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * @see #getFrameAtTime(long, int) 293faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong */ 294faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong public Bitmap getFrameAtTime() { 295faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong return getFrameAtTime(-1, OPTION_CLOSEST_SYNC); 296faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong } 297faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong 298faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong private native Bitmap _getFrameAtTime(long timeUs, int option); 299faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong 3009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 3019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 3029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Call this method after setDataSource(). This method finds the optional 303e8b26dcec7765786bbf063b3ae6b967b8b547ab6James Dong * graphic or album/cover art associated associated with the data source. If 30411eab056dd0133a390169d3581edf3eef26d6a54James Dong * there are more than one pictures, (any) one of them is returned. 3059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 3069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @return null if no such graphic is found. 3079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 308df9b349b960fff95dff4fcf8b2661899e33059daJames Dong public byte[] getEmbeddedPicture() { 309df9b349b960fff95dff4fcf8b2661899e33059daJames Dong return getEmbeddedPicture(EMBEDDED_PICTURE_TYPE_ANY); 310df9b349b960fff95dff4fcf8b2661899e33059daJames Dong } 311df9b349b960fff95dff4fcf8b2661899e33059daJames Dong 312df9b349b960fff95dff4fcf8b2661899e33059daJames Dong private native byte[] getEmbeddedPicture(int pictureType); 3139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 3149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 3159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Call it when one is done with the object. This method releases the memory 3169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * allocated internally. 3179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 3189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public native void release(); 3194935d05eaa306cef88cf0ab13eca386f270409ecMarco Nelissen private native void native_setup(); 3204935d05eaa306cef88cf0ab13eca386f270409ecMarco Nelissen private static native void native_init(); 3219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 3229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project private native final void native_finalize(); 3239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 3249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project @Override 3259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project protected void finalize() throws Throwable { 3269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project try { 3279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project native_finalize(); 3289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } finally { 3299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project super.finalize(); 3309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 3319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 3329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 333faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong /** 33411eab056dd0133a390169d3581edf3eef26d6a54James Dong * Option used in method {@link #getFrameAtTime(long, int)} to get a 335faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * frame at a specified location. 336faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * 337faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * @see #getFrameAtTime(long, int) 338faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong */ 33911eab056dd0133a390169d3581edf3eef26d6a54James Dong /* Do not change these option values without updating their counterparts 340faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong * in include/media/stagefright/MediaSource.h! 341faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong */ 34211eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 34311eab056dd0133a390169d3581edf3eef26d6a54James Dong * This option is used with {@link #getFrameAtTime(long, int)} to retrieve 34411eab056dd0133a390169d3581edf3eef26d6a54James Dong * a sync (or key) frame associated with a data source that is located 34511eab056dd0133a390169d3581edf3eef26d6a54James Dong * right before or at the given time. 34611eab056dd0133a390169d3581edf3eef26d6a54James Dong * 34711eab056dd0133a390169d3581edf3eef26d6a54James Dong * @see #getFrameAtTime(long, int) 34811eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 349faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong public static final int OPTION_PREVIOUS_SYNC = 0x00; 35011eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 35111eab056dd0133a390169d3581edf3eef26d6a54James Dong * This option is used with {@link #getFrameAtTime(long, int)} to retrieve 35211eab056dd0133a390169d3581edf3eef26d6a54James Dong * a sync (or key) frame associated with a data source that is located 35311eab056dd0133a390169d3581edf3eef26d6a54James Dong * right after or at the given time. 35411eab056dd0133a390169d3581edf3eef26d6a54James Dong * 35511eab056dd0133a390169d3581edf3eef26d6a54James Dong * @see #getFrameAtTime(long, int) 35611eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 357faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong public static final int OPTION_NEXT_SYNC = 0x01; 35811eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 35911eab056dd0133a390169d3581edf3eef26d6a54James Dong * This option is used with {@link #getFrameAtTime(long, int)} to retrieve 36011eab056dd0133a390169d3581edf3eef26d6a54James Dong * a sync (or key) frame associated with a data source that is located 36111eab056dd0133a390169d3581edf3eef26d6a54James Dong * closest to (in time) or at the given time. 36211eab056dd0133a390169d3581edf3eef26d6a54James Dong * 36311eab056dd0133a390169d3581edf3eef26d6a54James Dong * @see #getFrameAtTime(long, int) 36411eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 365faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong public static final int OPTION_CLOSEST_SYNC = 0x02; 36611eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 36711eab056dd0133a390169d3581edf3eef26d6a54James Dong * This option is used with {@link #getFrameAtTime(long, int)} to retrieve 36811eab056dd0133a390169d3581edf3eef26d6a54James Dong * a frame (not necessarily a key frame) associated with a data source that 36911eab056dd0133a390169d3581edf3eef26d6a54James Dong * is located closest to or at the given time. 37011eab056dd0133a390169d3581edf3eef26d6a54James Dong * 37111eab056dd0133a390169d3581edf3eef26d6a54James Dong * @see #getFrameAtTime(long, int) 37211eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 373faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong public static final int OPTION_CLOSEST = 0x03; 374faf09ba9405ff019b5ca7e2317debe4ff269d4f8James Dong 3759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /* 37611eab056dd0133a390169d3581edf3eef26d6a54James Dong * Do not change these metadata key values without updating their 37711eab056dd0133a390169d3581edf3eef26d6a54James Dong * counterparts in include/media/mediametadataretriever.h! 37811eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 37911eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 38024e22d19a2316ff89be2530eb9bde5b3607ecf4cJeff Brown * The metadata key to retrieve the numeric string describing the 38111eab056dd0133a390169d3581edf3eef26d6a54James Dong * order of the audio data source on its original recording. 3829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 3839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public static final int METADATA_KEY_CD_TRACK_NUMBER = 0; 38411eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 38511eab056dd0133a390169d3581edf3eef26d6a54James Dong * The metadata key to retrieve the information about the album title 38611eab056dd0133a390169d3581edf3eef26d6a54James Dong * of the data source. 38711eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 3889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public static final int METADATA_KEY_ALBUM = 1; 38911eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 39011eab056dd0133a390169d3581edf3eef26d6a54James Dong * The metadata key to retrieve the information about the artist of 39111eab056dd0133a390169d3581edf3eef26d6a54James Dong * the data source. 39211eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 3939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public static final int METADATA_KEY_ARTIST = 2; 39411eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 39511eab056dd0133a390169d3581edf3eef26d6a54James Dong * The metadata key to retrieve the information about the author of 39611eab056dd0133a390169d3581edf3eef26d6a54James Dong * the data source. 39711eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 3989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public static final int METADATA_KEY_AUTHOR = 3; 39911eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 40011eab056dd0133a390169d3581edf3eef26d6a54James Dong * The metadata key to retrieve the information about the composer of 40111eab056dd0133a390169d3581edf3eef26d6a54James Dong * the data source. 40211eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 4039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public static final int METADATA_KEY_COMPOSER = 4; 40411eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 40511eab056dd0133a390169d3581edf3eef26d6a54James Dong * The metadata key to retrieve the date when the data source was created 40611eab056dd0133a390169d3581edf3eef26d6a54James Dong * or modified. 40711eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 4089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public static final int METADATA_KEY_DATE = 5; 40911eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 41011eab056dd0133a390169d3581edf3eef26d6a54James Dong * The metadata key to retrieve the content type or genre of the data 41111eab056dd0133a390169d3581edf3eef26d6a54James Dong * source. 41211eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 4139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public static final int METADATA_KEY_GENRE = 6; 41411eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 41511eab056dd0133a390169d3581edf3eef26d6a54James Dong * The metadata key to retrieve the data source title. 41611eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 4179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public static final int METADATA_KEY_TITLE = 7; 41811eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 41911eab056dd0133a390169d3581edf3eef26d6a54James Dong * The metadata key to retrieve the year when the data source was created 42011eab056dd0133a390169d3581edf3eef26d6a54James Dong * or modified. 42111eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 4229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public static final int METADATA_KEY_YEAR = 8; 42311eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 42411eab056dd0133a390169d3581edf3eef26d6a54James Dong * The metadata key to retrieve the playback duration of the data source. 42511eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 4269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public static final int METADATA_KEY_DURATION = 9; 42711eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 42811eab056dd0133a390169d3581edf3eef26d6a54James Dong * The metadata key to retrieve the number of tracks, such as audio, video, 42911eab056dd0133a390169d3581edf3eef26d6a54James Dong * text, in the data source, such as a mp4 or 3gpp file. 43011eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 4319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public static final int METADATA_KEY_NUM_TRACKS = 10; 43211eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 43311eab056dd0133a390169d3581edf3eef26d6a54James Dong * The metadata key to retrieve the information of the writer (such as 43411eab056dd0133a390169d3581edf3eef26d6a54James Dong * lyricist) of the data source. 43511eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 43611eab056dd0133a390169d3581edf3eef26d6a54James Dong public static final int METADATA_KEY_WRITER = 11; 43711eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 43811eab056dd0133a390169d3581edf3eef26d6a54James Dong * The metadata key to retrieve the mime type of the data source. Some 43911eab056dd0133a390169d3581edf3eef26d6a54James Dong * example mime types include: "video/mp4", "audio/mp4", "audio/amr-wb", 44011eab056dd0133a390169d3581edf3eef26d6a54James Dong * etc. 44111eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 44211eab056dd0133a390169d3581edf3eef26d6a54James Dong public static final int METADATA_KEY_MIMETYPE = 12; 44311eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 44411eab056dd0133a390169d3581edf3eef26d6a54James Dong * The metadata key to retrieve the information about the performers or 44511eab056dd0133a390169d3581edf3eef26d6a54James Dong * artist associated with the data source. 44611eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 44711eab056dd0133a390169d3581edf3eef26d6a54James Dong public static final int METADATA_KEY_ALBUMARTIST = 13; 44811eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 44911eab056dd0133a390169d3581edf3eef26d6a54James Dong * The metadata key to retrieve the numberic string that describes which 45011eab056dd0133a390169d3581edf3eef26d6a54James Dong * part of a set the audio data source comes from. 45111eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 45211eab056dd0133a390169d3581edf3eef26d6a54James Dong public static final int METADATA_KEY_DISC_NUMBER = 14; 45311eab056dd0133a390169d3581edf3eef26d6a54James Dong /** 45411eab056dd0133a390169d3581edf3eef26d6a54James Dong * The metadata key to retrieve the music album compilation status. 45511eab056dd0133a390169d3581edf3eef26d6a54James Dong */ 45611eab056dd0133a390169d3581edf3eef26d6a54James Dong public static final int METADATA_KEY_COMPILATION = 15; 457c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber /** 458c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber * If this key exists the media contains audio content. 459c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber */ 460c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber public static final int METADATA_KEY_HAS_AUDIO = 16; 461c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber /** 462c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber * If this key exists the media contains video content. 463c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber */ 464c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber public static final int METADATA_KEY_HAS_VIDEO = 17; 465c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber /** 466c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber * If the media contains video, this key retrieves its width. 467c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber */ 468c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber public static final int METADATA_KEY_VIDEO_WIDTH = 18; 469c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber /** 470c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber * If the media contains video, this key retrieves its height. 471c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber */ 472c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber public static final int METADATA_KEY_VIDEO_HEIGHT = 19; 473c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber /** 474c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber * This key retrieves the average bitrate (in bits/sec), if available. 475c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber */ 476c4c38fc1ea06086ea3c7ba12f59ecfacd5fa716bAndreas Huber public static final int METADATA_KEY_BITRATE = 20; 477c6091ddd3a22da98b5e83d4b5d864939b451b752Gloria Wang /** 478c6091ddd3a22da98b5e83d4b5d864939b451b752Gloria Wang * This key retrieves the language code of text tracks, if available. 479c6091ddd3a22da98b5e83d4b5d864939b451b752Gloria Wang * If multiple text tracks present, the return value will look like: 480c6091ddd3a22da98b5e83d4b5d864939b451b752Gloria Wang * "eng:chi" 481c6091ddd3a22da98b5e83d4b5d864939b451b752Gloria Wang * @hide 482c6091ddd3a22da98b5e83d4b5d864939b451b752Gloria Wang */ 483c6091ddd3a22da98b5e83d4b5d864939b451b752Gloria Wang public static final int METADATA_KEY_TIMED_TEXT_LANGUAGES = 21; 48482428a862f325238cfb5646bbd65de3f1a11e7ccGloria Wang /** 48582428a862f325238cfb5646bbd65de3f1a11e7ccGloria Wang * If this key exists the media is drm-protected. 48682428a862f325238cfb5646bbd65de3f1a11e7ccGloria Wang * @hide 48782428a862f325238cfb5646bbd65de3f1a11e7ccGloria Wang */ 48882428a862f325238cfb5646bbd65de3f1a11e7ccGloria Wang public static final int METADATA_KEY_IS_DRM = 22; 48977c500c9a1f763b31fb5a03c803b3523fcb72310James Dong /** 49077c500c9a1f763b31fb5a03c803b3523fcb72310James Dong * This key retrieves the location information, if available. 49177c500c9a1f763b31fb5a03c803b3523fcb72310James Dong * The location should be specified according to ISO-6709 standard, under 49277c500c9a1f763b31fb5a03c803b3523fcb72310James Dong * a mp4/3gp box "@xyz". Location with longitude of -90 degrees and latitude 49377c500c9a1f763b31fb5a03c803b3523fcb72310James Dong * of 180 degrees will be retrieved as "-90.0000+180.0000", for instance. 49477c500c9a1f763b31fb5a03c803b3523fcb72310James Dong */ 49577c500c9a1f763b31fb5a03c803b3523fcb72310James Dong public static final int METADATA_KEY_LOCATION = 23; 496998483319195f903529363ebbad0e694acd0a21bJames Dong /** 497998483319195f903529363ebbad0e694acd0a21bJames Dong * This key retrieves the video rotation angle in degrees, if available. 498998483319195f903529363ebbad0e694acd0a21bJames Dong * The video rotation angle may be 0, 90, 180, or 270 degrees. 499998483319195f903529363ebbad0e694acd0a21bJames Dong */ 500998483319195f903529363ebbad0e694acd0a21bJames Dong public static final int METADATA_KEY_VIDEO_ROTATION = 24; 5019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project // Add more here... 5029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project} 503