scan.cpp: sync audio/video detection with current pmt.cpp code
authorghost <andreas.monzner@multimedia-labs.de>
Thu, 25 Jun 2009 20:13:52 +0000 (22:13 +0200)
committerghost <andreas.monzner@multimedia-labs.de>
Thu, 25 Jun 2009 20:13:52 +0000 (22:13 +0200)
lib/dvb/scan.cpp

index 0948c50..1c8e4d2 100644 (file)
@@ -281,6 +281,7 @@ void eDVBScan::PMTready(int err)
                bool have_video = false;
                unsigned short pcrpid = 0xFFFF;
                std::vector<ProgramMapSection*>::const_iterator i;
+
                for (i = m_PMT->getSections().begin(); i != m_PMT->getSections().end(); ++i)
                {
                        const ProgramMapSection &pmt = **i;
@@ -294,50 +295,68 @@ void eDVBScan::PMTready(int err)
                                int isaudio = 0, isvideo = 0, is_scrambled = 0;
                                switch ((*es)->getType())
                                {
+                               case 0xEA: // TS_PSI_ST_SMPTE_VC1
                                case 0x1b: // AVC Video Stream (MPEG4 H264)
+                               case 0x10: // MPEG 4 Part 2
                                case 0x01: // MPEG 1 video
                                case 0x02: // MPEG 2 video
                                        isvideo = 1;
                                        //break; fall through !!!
                                case 0x03: // MPEG 1 audio
-                               case 0x04: // MPEG 2 audio:
+                               case 0x04: // MPEG 2 audio
+                               case 0x0f: // MPEG 2 AAC
+                               case 0x11: // MPEG 4 AAC
                                        if (!isvideo)
                                                isaudio = 1;
-                                       //break; fall through !!!
                                case 0x06: // PES Private
                                case 0x81: // user private
-                                               /* PES private can contain AC-3, DTS or lots of other stuff.
-                                                  check descriptors to get the exact type. */
                                        for (DescriptorConstIterator desc = (*es)->getDescriptors()->begin();
                                                        desc != (*es)->getDescriptors()->end(); ++desc)
                                        {
                                                uint8_t tag = (*desc)->getTag();
                                                if (!isaudio && !isvideo)
                                                {
+                                                       /* PES private can contain AC-3, DTS or lots of other stuff.
+                                                          check descriptors to get the exakt type. */
                                                        switch (tag)
                                                        {
-                                                       case DTS_DESCRIPTOR:
+                                                       case 0x1C: // TS_PSI_DT_MPEG4_Audio
+                                                       case 0x2B: // TS_PSI_DT_MPEG2_AAC
                                                        case AAC_DESCRIPTOR:
                                                        case AC3_DESCRIPTOR:
+                                                       case DTS_DESCRIPTOR:
+                                                       case AUDIO_STREAM_DESCRIPTOR:
                                                                isaudio = 1;
                                                                break;
+                                                       case 0x28: // TS_PSI_DT_AVC
+                                                       case 0x1B: // TS_PSI_DT_MPEG4_Video
+                                                       case VIDEO_STREAM_DESCRIPTOR:
+                                                               isvideo = 1;
+                                                               break;
                                                        case REGISTRATION_DESCRIPTOR: /* some services don't have a separate AC3 descriptor */
                                                        {
-                                                                       /* libdvbsi++ doesn't yet support this descriptor type, so work around. */
-                                                               if ((*desc)->getLength() != 4)
+                                                               /* libdvbsi++ doesn't yet support this descriptor type, so work around. */
+                                                               if ((*desc)->getLength() < 4)
                                                                        break;
                                                                unsigned char descr[6];
                                                                (*desc)->writeToBuffer(descr);
                                                                int format_identifier = (descr[2] << 24) | (descr[3] << 16) | (descr[4] << 8) | (descr[5]);
                                                                switch (format_identifier)
                                                                {
-                                                               case 0x41432d33:
+                                                               case 0x41432d33: // == 'AC-3'
+                                                               case 0x44545331 ... 0x44545333: // DTS1/DTS2/DTS3
+                                                               case 0x42535344: // == 'BSSD' (LPCM)
                                                                        isaudio = 1;
+                                                                       break;
+                                                               case 0x56432d31: // == 'VC-1'
+                                                                       isvideo = 1;
+                                                                       break;
                                                                default:
                                                                        break;
                                                                }
-                                                               break;
                                                        }
+                                                       default:
+                                                               break;
                                                        }
                                                }
                                                if (tag == CA_DESCRIPTOR)