OSDN Git Service

Add code to recognize eac3 streams in TS
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 5 Oct 2010 22:27:28 +0000 (22:27 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 5 Oct 2010 22:27:28 +0000 (22:27 +0000)
Recognizes BD, HDDVD, and DVB variations of signalling eac3 streams.
Let me know if you find streams that don't work.

git-svn-id: svn://localhost/HandBrake/trunk@3572 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/stream.c

index f379854..d53bf45 100644 (file)
@@ -72,11 +72,11 @@ static const stream2codec_t st2codec[256] = {
     st(0x80, N, HB_ACODEC_MPGA,    CODEC_ID_PCM_BLURAY, "DigiCipher II Video"),
     st(0x81, A, HB_ACODEC_AC3,     0,              "AC-3"),
     st(0x82, A, HB_ACODEC_DCA,     0,              "HDMV DTS"),
-    st(0x83, A, HB_ACODEC_LPCM,    0,              "LPCM"),
-    st(0x84, A, 0,                 0,              "SDDS"),
+    st(0x83, A, HB_ACODEC_LPCM,    0,              "LPCM/TrueHD"),
+    st(0x84, A, 0,                 0,              "SDDS/EAC3"),
     st(0x85, U, 0,                 0,              "ATSC Program ID"),
     st(0x86, A, HB_ACODEC_DCA,     0,              "DTS-HD"),
-    st(0x87, A, 0,                 0,              "E-AC-3"),
+    st(0x87, A, HB_ACODEC_MPGA,    CODEC_ID_EAC3,  "EAC3"),
 
     st(0x8a, A, HB_ACODEC_DCA,     0,              "DTS"),
 
@@ -699,6 +699,14 @@ hb_stream_t * hb_bd_stream_open( hb_title_t *title )
             d->ts_multiplexed[d->ts_number_pids] = 0x71;
             d->ts_stream_type[d->ts_number_pids] = 0x82;
         }
+        if ( d->ts_stream_type[d->ts_number_pids] == 0x84 &&
+             title->reg_desc == STR4_TO_UINT32("HDMV") )
+        {
+            // EAC3 audio in bluray has an stype of 0x84
+            // which conflicts with SDDS
+            // To distinguish, Bluray streams have a reg_desc of HDMV
+            d->ts_stream_type[d->ts_number_pids] = 0x87;
+        }
 
         d->ts_number_pids++;
     }
@@ -1684,6 +1692,16 @@ static hb_audio_t *hb_ts_stream_set_audio_id_and_codec(hb_stream_t *stream,
                 stream->ts_stream_type[idx] = 0x82;
                 kind = A;
             }
+            if ( stype == 0x84 && 
+                 stream->pmt_info.reg_desc == STR4_TO_UINT32("HDMV") )
+            {
+                // EAC3 audio in bluray has an stype of 0x84
+                // which conflicts with SDDS
+                // To distinguish, Bluray streams have a reg_desc of HDMV
+                stype = 0x87;
+                stream->ts_stream_type[idx] = 0x87;
+                kind = A;
+            }
         }
         else if ((buf[3] & 0xe0) == 0xc0)
         {
@@ -1980,6 +1998,10 @@ static void decode_element_descriptors(hb_stream_t* stream, int esindx,
                 stream->ts_stream_type[esindx] = 0x81;
                 break;
 
+            case 0x7a:  // DVB EAC-3 descriptor
+                stream->ts_stream_type[esindx] = 0x87;
+                break;
+
             default:
                 break;
         }
@@ -3192,7 +3214,7 @@ static void add_ffmpeg_subtitle( hb_title_t *title, hb_stream_t *stream, int id
 static char *get_ffmpeg_metadata_value( AVMetadata *m, char *key )
 {
     AVMetadataTag *tag = NULL;
-    while ( tag = av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX) )
+    while ( (tag = av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX)) )
     {
         if ( !strcmp( key, tag->key ) )
         {