Remove RefBase from the extractor API

- Add MetaDataBase base class that MetaData derives from, but which
  does not derive from RefBase.
- MediaBuffer::meta_data() now returns a MetaDataBase& rather than an
  sp<MetaData>
- Rename MediaSourceBase to MediaTrack.
- MediaSource no longer derives from MediaSourceBase (or MediaTrack)
- MediaTrack::getFormat(), MediaExtractor::getTrackMetaData() and
  MediaExtractor::getMetaData() all take a MetaDataBase& parameter that
  they fill out, rather than returning a MetaData directly (the
  corresponding methods on MediaSource and RemoteMediaExtractor continue
  to return MetaData)

Bug: 67908544
Test: CTS MediaPlayerTest, DecoderTest, EncodeDecodeTest, manually record video

Change-Id: Ib531ab309061290be33d40d6100c9a8127e22083
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDrm.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDrm.cpp
index b7c9db7..165e483 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDrm.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDrm.cpp
@@ -265,18 +265,13 @@
     return ret;
 }
 
-NuPlayerDrm::CryptoInfo *NuPlayerDrm::getSampleCryptoInfo(sp<MetaData> meta)
+NuPlayerDrm::CryptoInfo *NuPlayerDrm::getSampleCryptoInfo(MetaDataBase &meta)
 {
     uint32_t type;
     const void *crypteddata;
     size_t cryptedsize;
 
-    if (meta == NULL) {
-        ALOGE("getSampleCryptoInfo: Unexpected. No meta data for sample.");
-        return NULL;
-    }
-
-    if (!meta->findData(kKeyEncryptedSizes, &type, &crypteddata, &cryptedsize)) {
+    if (!meta.findData(kKeyEncryptedSizes, &type, &crypteddata, &cryptedsize)) {
         return NULL;
     }
     size_t numSubSamples = cryptedsize / sizeof(size_t);
@@ -288,7 +283,7 @@
 
     const void *cleardata;
     size_t clearsize;
-    if (meta->findData(kKeyPlainSizes, &type, &cleardata, &clearsize)) {
+    if (meta.findData(kKeyPlainSizes, &type, &cleardata, &clearsize)) {
         if (clearsize != cryptedsize) {
             // The two must be of the same length.
             ALOGE("getSampleCryptoInfo mismatch cryptedsize: %zu != clearsize: %zu",
@@ -299,7 +294,7 @@
 
     const void *key;
     size_t keysize;
-    if (meta->findData(kKeyCryptoKey, &type, &key, &keysize)) {
+    if (meta.findData(kKeyCryptoKey, &type, &key, &keysize)) {
         if (keysize != kBlockSize) {
             ALOGE("getSampleCryptoInfo Keys must be %d bytes in length: %zu",
                     kBlockSize, keysize);
@@ -310,7 +305,7 @@
 
     const void *iv;
     size_t ivsize;
-    if (meta->findData(kKeyCryptoIV, &type, &iv, &ivsize)) {
+    if (meta.findData(kKeyCryptoIV, &type, &iv, &ivsize)) {
         if (ivsize != kBlockSize) {
             ALOGE("getSampleCryptoInfo IV must be %d bytes in length: %zu",
                     kBlockSize, ivsize);
@@ -320,7 +315,7 @@
     }
 
     int32_t mode;
-    if (!meta->findInt32(kKeyCryptoMode, &mode)) {
+    if (!meta.findInt32(kKeyCryptoMode, &mode)) {
         mode = CryptoPlugin::kMode_AES_CTR;
     }