[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-datatype-cvs
Subject:    [Datatype-cvs] avi/fileformat avistrm.cpp, 1.10.2.13.2.29.4.1, 1.10.2.13.2.29.4.2
From:       joeli () helixcommunity ! org
Date:       2012-05-28 6:24:17
[Download RAW message or body]

Update of /cvsroot/datatype/avi/fileformat
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv8486

Modified Files:
      Tag: hxclient_3_6_1_raja
	avistrm.cpp 
Log Message:
Modified by: joeli@real.com
Date: 05/28/2012
Project: RealPlayer for Android Smartphones

Synopsis: CR:BUG15008:support subtype of the ac3 Microsoft wave format in AVI \
containerss For AVI format. 0xFFFE as Microsoft extensible wave format.
It indicate that the medias have a subtype of the Microsoft wave format. 
> From the QA teams' report. Some ac3 codec used this subtype, so we need support it. \
> 

Files Added:
N/A

File Modified:
Datatype/avi/fileformat/avistream.cpp

Image Size and Heap Use impact (Client -Only):
None

Platforms and Profiles Affected:
Platform: hxclient_3_6_1_atlas
Profile: helix-client-android-full

Distribution Libraries Affected:
None

Distribution library impact and planned action:
None



Index: avistrm.cpp
===================================================================
RCS file: /cvsroot/datatype/avi/fileformat/avistrm.cpp,v
retrieving revision 1.10.2.13.2.29.4.1
retrieving revision 1.10.2.13.2.29.4.2
diff -u -d -r1.10.2.13.2.29.4.1 -r1.10.2.13.2.29.4.2
--- avistrm.cpp	29 Mar 2012 09:49:00 -0000	1.10.2.13.2.29.4.1
+++ avistrm.cpp	28 May 2012 06:24:14 -0000	1.10.2.13.2.29.4.2
@@ -304,6 +304,29 @@
 } MP3_AUDIO_HEADER;
 
 
+typedef uint8_t wm_subtype_guid[16];
+#define WM_SUBTYPE_BASE_LEN 12
+#define WM_SUBTYPE_BASE_GUID \
+    0x00,0x00,0x10,0x00,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71
+#ifndef AVI_RL32
+#   define AVI_RL32(x)                                \
+    (((uint32_t)((const uint8_t*)(x))[3] << 24) |    \
+               (((const uint8_t*)(x))[2] << 16) |    \
+               (((const uint8_t*)(x))[1] <<  8) |    \
+                ((const uint8_t*)(x))[0])
+#endif
+
+typedef struct {
+    unsigned int id;
+    wm_subtype_guid guid;
+} AVISubtypeCodec;
+
+const AVISubtypeCodec wm_subtype_codec_wav_guids[] = {
+    {0x2000,       {0x2C,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA}},
 +    {0x2000,       \
{0xBF,0xAA,0x23,0xE9,0x58,0xCB,0x71,0x44,0xA1,0x19,0xFF,0xFA,0x01,0xE4,0xCE,0x62}}, + \
{0x2000,       {0xAF,0x87,0xFB,0xA7,0x02,0x2D,0xFB,0x42,0xA4,0xD4,0x05,0xCD,0x93,0x84,0x3B,0xDD}},
 +    {0xFFFF}
+};
 /////////////////////////////////////////////////////////////////////////
 //  CAVIStream::CAVIStream
 //
@@ -529,6 +552,8 @@
                 }
 
                 int nPadding = sizeof(WaveInfo) - len;
+                int iPos = 0;
+                int cbSize = 0;
 
                 if(nPadding < 0)
                 {
@@ -552,13 +577,56 @@
                 bi->ulSamplesPerSec     = LE32_TO_HOST(bi->ulSamplesPerSec);
                 bi->ulAvgBytesPerSec    = LE32_TO_HOST(bi->ulAvgBytesPerSec);
                 bi->usBlockAlign        = LE16_TO_HOST(bi->usBlockAlign);
+                //skip FormatTag,Channels,SamplesPerSec,AvgBytesPerSec and \
BlockAlign +                iPos += 14;
+                if(len == 14)
+                {
+                    //dealing with plain vanilla WAVEFORMAT
+                    bi->usBitsPerSample     = 8;
+                }
+                else
+                {
                 bi->usBitsPerSample     = LE16_TO_HOST(bi->usBitsPerSample);
+                    //skip BitsPerSampe
+                    iPos += 2;
+                }
 
                 if (len < sizeof(WaveInfo))
                 {
                     bi->usSize = 0;
                 }
+
+                if(len >= 18)
+                {
                 bi->usSize              = LE16_TO_HOST(bi->usSize);
+                    //skip for cbSize
+                    iPos += 2;
+                    len -= 18;
+                    cbSize = (len > bi->usSize)?bi->usSize:len;
+                    //handle for WAVEFORMATEXTENSIBLE 
+                    if(cbSize >= 22 && bi->usFormatTag == 0xfffe)
+                    {
+                        wm_subtype_guid subformat;
+                        //skip BitsPerSample and ChannelMask
+                        iPos += 6;
+                        memcpy(subformat,buf+iPos,sizeof(wm_subtype_guid));
+                        if (!memcmp(subformat + 4, (const \
uint8_t[]){WM_SUBTYPE_BASE_GUID}, WM_SUBTYPE_BASE_LEN))  +                        {
+                            bi->usFormatTag = AVI_RL32(subformat);
+                        }
+                        else 
+                        {
+                            for (int i = 0; wm_subtype_codec_wav_guids[i].id != \
0xFFFF; i++)  +                            {
+                                if (!memcmp(wm_subtype_codec_wav_guids[i].guid, \
subformat, sizeof(wm_subtype_guid))) +                                {
+                                    bi->usFormatTag = \
wm_subtype_codec_wav_guids[i].id; +                                    break;
+                                }
+                            }
+                        }						
+                    }
+                }
                 //For ADTS AAC we need to send first frame as opaque data to decoder
                 if(bi->usFormatTag == WAVE_FORMAT_AAC) 
                 {


_______________________________________________
Datatype-cvs mailing list
Datatype-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic