OSDN Git Service

stagefright-plugins: Parse additional FLAC metadata
authorSteve Kondik <steve@cyngn.com>
Mon, 14 Dec 2015 09:03:13 +0000 (01:03 -0800)
committerSteve Kondik <steve@cyngn.com>
Mon, 14 Dec 2015 09:03:13 +0000 (01:03 -0800)
  * Parse the min/max frame and block sizes from the streaminfo and
    report it in the metadata
  * This is needed for FLAC offload support on new Qualcomm DSPs.

Change-Id: Ib37891a5766066306adf18a6c23af9c9ac7dcdb1

utils/codec_utils.cpp

index 2444673..6be4e4f 100644 (file)
@@ -31,6 +31,7 @@ extern "C" {
 #endif
 
 #include <utils/Errors.h>
+#include <media/stagefright/foundation/ABitReader.h>
 #include <media/stagefright/foundation/ADebug.h>
 #include <media/stagefright/MediaDefs.h>
 #include <media/stagefright/MediaErrors.h>
@@ -486,6 +487,17 @@ sp<MetaData> setFLACFormat(AVCodecContext *avctx)
     meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_FLAC);
     meta->setData(kKeyRawCodecSpecificData, 0, avctx->extradata, avctx->extradata_size);
 
+    ABitReader br(avctx->extradata, avctx->extradata_size);
+    int32_t minBlockSize = br.getBits(16);
+    int32_t maxBlockSize = br.getBits(16);
+    int32_t minFrameSize = br.getBits(24);
+    int32_t maxFrameSize = br.getBits(24);
+
+    meta->setInt32('mibs', minBlockSize);
+    meta->setInt32('mabs', maxBlockSize);
+    meta->setInt32('mifs', minFrameSize);
+    meta->setInt32('mafs', maxFrameSize);
+
     return meta;
 }