summaryrefslogtreecommitdiffstats
path: root/libhb/decmpeg2.c
diff options
context:
space:
mode:
authoreddyg <[email protected]>2009-05-07 23:52:25 +0000
committereddyg <[email protected]>2009-05-07 23:52:25 +0000
commitf923df5d7f32362798f2660378b40ea4dd91869e (patch)
tree41f8d6f4b252aa8087c5587e340c746a0bcc6f24 /libhb/decmpeg2.c
parent166ebbdc3752de708a72a7c4826713a804b3d507 (diff)
Combine multiple CC lines into one, trimming whitespace, and adding proper language code based on first audio track language.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2402 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/decmpeg2.c')
-rw-r--r--libhb/decmpeg2.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libhb/decmpeg2.c b/libhb/decmpeg2.c
index 2d5c7c494..6340ca61b 100644
--- a/libhb/decmpeg2.c
+++ b/libhb/decmpeg2.c
@@ -458,7 +458,18 @@ static int hb_libmpeg2_decode( hb_libmpeg2_t * m, hb_buffer_t * buf_es,
subtitle->track = 0;
subtitle->id = 0x0;
snprintf( subtitle->lang, sizeof( subtitle->lang ), "Closed Captions");
- snprintf( subtitle->iso639_2, sizeof( subtitle->iso639_2 ), "und");
+ /*
+ * The language of the subtitles will be the same as the first audio
+ * track, i.e. the same as the video.
+ */
+ hb_audio_t *audio = hb_list_item( m->title->list_audio, 0 );
+ if( audio )
+ {
+ snprintf( subtitle->iso639_2, sizeof( subtitle->iso639_2 ),
+ audio->config.lang.iso639_2);
+ } else {
+ snprintf( subtitle->iso639_2, sizeof( subtitle->iso639_2 ), "und");
+ }
subtitle->format = TEXTSUB;
subtitle->source = CC608SUB;
subtitle->dest = PASSTHRUSUB;