diff options
author | jstebbins <[email protected]> | 2009-06-03 22:07:49 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2009-06-03 22:07:49 +0000 |
commit | 705ea262b0f53fd19df594dfc8026798cf001155 (patch) | |
tree | 30c8fa07c6bc3808f9081356eb7850e33519e9c9 /libhb | |
parent | fa937f5aab19995d36ffbb59eb017d9428a5037f (diff) |
softsubs:
- add ability to have 1 source subtitle feed many output subtitles
use hb_subtitle_add() to add output tracks.
example use case:
you want forced subtitles from a source track on one output track and
the entire subtitle stream from the same source track on a second
output track
- LinGui: make subtitle tab resemble functionality of the audio tab
any track can be added multiple times with different settings.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2476 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/common.c | 39 | ||||
-rw-r--r-- | libhb/common.h | 4 |
2 files changed, 42 insertions, 1 deletions
diff --git a/libhb/common.c b/libhb/common.c index c8e4e07b0..350132bae 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -816,3 +816,42 @@ hb_audio_config_t * hb_list_audio_config_item(hb_list_t * list, int i) return NULL; } + +/********************************************************************** + * hb_subtitle_copy + ********************************************************************** + * + *********************************************************************/ +hb_subtitle_t *hb_subtitle_copy(const hb_subtitle_t *src) +{ + hb_subtitle_t *subtitle = NULL; + + if( src ) + { + subtitle = calloc(1, sizeof(*subtitle)); + memcpy(subtitle, src, sizeof(*subtitle)); + } + return subtitle; +} + +/********************************************************************** + * hb_subtitle_add + ********************************************************************** + * + *********************************************************************/ +int hb_subtitle_add(const hb_job_t * job, const hb_subtitle_config_t * subtitlecfg, int track) +{ + hb_title_t *title = job->title; + hb_subtitle_t *subtitle; + + subtitle = hb_subtitle_copy( hb_list_item( title->list_subtitle, track ) ); + if( subtitle == NULL ) + { + /* We fail! */ + return 0; + } + subtitle->config = *subtitlecfg; + hb_list_add(job->list_subtitle, subtitle); + return 1; +} + diff --git a/libhb/common.h b/libhb/common.h index b9e26682e..f677d8bb5 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -95,6 +95,8 @@ void hb_audio_config_init(hb_audio_config_t * audiocfg); int hb_audio_add(const hb_job_t * job, const hb_audio_config_t * audiocfg); hb_audio_config_t * hb_list_audio_config_item(hb_list_t * list, int i); +int hb_subtitle_add(const hb_job_t * job, const hb_subtitle_config_t * subtitlecfg, int track); + struct hb_rate_s { char * string; @@ -449,7 +451,7 @@ struct hb_chapter_s struct hb_subtitle_s { int id; - int track; + int track; hb_subtitle_config_t config; |