]> granicus.if.org Git - handbrake/commitdiff
Fix dropped audio when embedded CC sub is selected
authorJohn Stebbins <jstebbins.hb@gmail.com>
Mon, 15 Jul 2019 16:32:29 +0000 (09:32 -0700)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Mon, 15 Jul 2019 16:32:29 +0000 (09:32 -0700)
The subtitle ID assigned to CC embedded in video collided with regular
track IDs in some file types.

Fixes https://github.com/HandBrake/HandBrake/issues/2103

libhb/common.c
libhb/common.h
libhb/decavcodec.c
libhb/stream.c

index 747b911fda739485154a01c9068a468286542717..63f34971f7053b6209c53ff4c93e1c5a410121f8 100644 (file)
@@ -4919,7 +4919,8 @@ int hb_import_subtitle_add( const hb_job_t * job,
         return 0;
     }
 
-    subtitle->id = (hb_list_count(job->list_subtitle) << 8) | 0xFF;
+    subtitle->id = (hb_list_count(job->list_subtitle) << 8) |
+                   HB_SUBTITLE_IMPORT_TAG;
     subtitle->format = TEXTSUB;
     subtitle->source = source;
     subtitle->codec = source == IMPORTSRT ? WORK_DECSRTSUB : WORK_DECSSASUB;
index 5b77cbed4f6927dd4ed36b3cc3d4689f9f53b533..69b2854671fa368e330549f10dee358d8436a00f 100644 (file)
@@ -950,6 +950,9 @@ struct hb_chapter_s
 #define HB_SUBTITLE_ATTR_PANSCAN    0x0200
 #define HB_SUBTITLE_ATTR_DEFAULT    0x0400
 
+#define HB_SUBTITLE_IMPORT_TAG      0xFF000000
+#define HB_SUBTITLE_EMBEDDED_CC_TAG 0xFE000000
+
 struct hb_subtitle_s
 {
     int  id;
index 0b851e842b354e5390858aa4349215e7fd578bbe..5771a9b1e7b1572025d24aa4e46aa4639b110b4a 100644 (file)
@@ -1069,7 +1069,7 @@ static hb_buffer_t *copy_frame( hb_work_private_t *pv )
 
                 subtitle        = calloc(sizeof( hb_subtitle_t ), 1);
                 subtitle->track = hb_list_count(pv->title->list_subtitle);
-                subtitle->id          = 0;
+                subtitle->id          = HB_SUBTITLE_EMBEDDED_CC_TAG;
                 subtitle->format      = TEXTSUB;
                 subtitle->source      = CC608SUB;
                 subtitle->config.dest = PASSTHRUSUB;
@@ -1529,7 +1529,8 @@ static int decavcodecvInit( hb_work_object_t * w, hb_job_t * job )
 
         while ((subtitle = hb_list_item(job->list_subtitle, i++)) != NULL)
         {
-            if (subtitle->source == CC608SUB)
+            if (subtitle->source == CC608SUB &&
+                subtitle->id == HB_SUBTITLE_EMBEDDED_CC_TAG)
             {
                 if (pv->list_subtitle == NULL)
                 {
index ca87391909842743ebfdc3303dc16a79b1d6ee87..1fa7018270961f74a24a0abe17c0115080fda264 100644 (file)
@@ -968,8 +968,8 @@ hb_stream_t * hb_bd_stream_open( hb_handle_t *h, hb_title_t *title )
     {
         // If the subtitle track is CC embedded in the video stream, then
         // it does not have an independent pid.  In this case, we assigned
-        // the subtitle->id to 0.
-        if (subtitle->id != 0)
+        // the subtitle->id to HB_SUBTITLE_EMBEDDED_CC_TAG.
+        if (subtitle->id != HB_SUBTITLE_EMBEDDED_CC_TAG)
         {
             pid = subtitle->id & 0xFFFF;
             stream_type = subtitle->stream_type;