media: Add support for C2 Audio OPUS decoder and encoder

Add support for Codec 2.0 SW audio opus encoder and decoder.
Bumped up rank of only audio encoder/decoder. Rank of video
encoders and decoders will remain the same as before change

Change-Id: I48a811032a49418fd30c3bd037ee036e73ae1c91
diff --git a/conf_files/kona/kona.mk b/conf_files/kona/kona.mk
index 1c8dcb2..3a548c0 100644
--- a/conf_files/kona/kona.mk
+++ b/conf_files/kona/kona.mk
@@ -13,4 +13,14 @@
 # Enable debug mode for CLANG/LLVM integer-overflow sanitization
 TARGET_ENABLE_VIDC_INTSAN_DIAG := true
 
-# Vendor property overrides
\ No newline at end of file
+# Vendor property overrides
+ifeq ($(GENERIC_ODM_IMAGE),true)
+  $(warning "Forcing codec2.0 HW for generic odm build variant")
+  #Set default ranks and rank Codec 2.0 over OMX codecs
+  PRODUCT_ODM_PROPERTIES += debug.stagefright.ccodec=4
+  PRODUCT_ODM_PROPERTIES += debug.stagefright.omx_default_rank=1000
+else
+  $(warning "Enabling codec2.0 SW only for non-generic odm build variant")
+  #Rank SW C2 codecs first
+  PRODUCT_PROPERTY_OVERRIDES += debug.stagefright.ccodec=1
+endif
diff --git a/conf_files/kona/media_codecs_vendor_audio.xml b/conf_files/kona/media_codecs_vendor_audio.xml
index 4ce5f07..1938282 100644
--- a/conf_files/kona/media_codecs_vendor_audio.xml
+++ b/conf_files/kona/media_codecs_vendor_audio.xml
@@ -52,16 +52,17 @@
             <Limit name="sample-rate" ranges="8000-96000" />
             <Limit name="bitrate" range="32000-500000" />
         </MediaCodec>
-        <MediaCodec name="OMX.google.opus.decoder" type="audio/opus">
-            <Limit name="channel-count" max="8" />
-            <Limit name="sample-rate" ranges="48000" />
-            <Limit name="bitrate" range="6000-510000" />
-        </MediaCodec>
         <MediaCodec name="OMX.google.raw.decoder" type="audio/raw">
             <Limit name="channel-count" max="8" />
             <Limit name="sample-rate" ranges="8000-96000" />
             <Limit name="bitrate" range="1-10000000" />
         </MediaCodec>
+        <MediaCodec name="c2.android.opus.decoder" type="audio/opus">
+            <Alias name="OMX.google.opus.decoder" />
+            <Limit name="channel-count" max="8" />
+            <Limit name="sample-rate" ranges="48000" />
+            <Limit name="bitrate" range="6000-510000" />
+        </MediaCodec>
         <!-- SimpleOMXComponet based software decoder-->
         <MediaCodec name="OMX.qti.audio.decoder.flac" type="audio/flac" >
             <Limit name="concurrent-instances" max="10" />
@@ -96,5 +97,12 @@
             <Limit name="complexity" range="0-8"  default="5" />
             <Feature name="bitrate-modes" value="CQ" />
         </MediaCodec>
+        <MediaCodec name="c2.android.opus.encoder" type="audio/opus">
+            <Limit name="channel-count" max="2" />
+            <Limit name="sample-rate" ranges="8000,12000,16000,24000,48000" />
+            <Limit name="bitrate" range="500-512000" />
+            <Limit name="complexity" range="0-10"  default="5" />
+            <Feature name="bitrate-modes" value="CQ" />
+        </MediaCodec>
     </Encoders>
 </Included>