summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2019-07-15 09:32:29 -0700
committerJohn Stebbins <[email protected]>2019-07-15 09:32:29 -0700
commit3f9531974c9a8d6c0f43a5ee536c419ac407401b (patch)
tree99dd820772f30a2af60fd0af1d05dd5ea433fe6d
parentf99a5981027c1393638ea6b547cf3258ec5dfcda (diff)
Fix dropped audio when embedded CC sub is selected
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
-rw-r--r--libhb/common.c3
-rw-r--r--libhb/common.h3
-rw-r--r--libhb/decavcodec.c5
-rw-r--r--libhb/stream.c4
4 files changed, 10 insertions, 5 deletions
diff --git a/libhb/common.c b/libhb/common.c
index 747b911fd..63f34971f 100644
--- a/libhb/common.c
+++ b/libhb/common.c
@@ -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;
diff --git a/libhb/common.h b/libhb/common.h
index 5b77cbed4..69b285467 100644
--- a/libhb/common.h
+++ b/libhb/common.h
@@ -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;
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c
index 0b851e842..5771a9b1e 100644
--- a/libhb/decavcodec.c
+++ b/libhb/decavcodec.c
@@ -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)
{
diff --git a/libhb/stream.c b/libhb/stream.c
index ca8739190..1fa701827 100644
--- a/libhb/stream.c
+++ b/libhb/stream.c
@@ -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;