diff options
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/common.c | 32 | ||||
-rw-r--r-- | libhb/common.h | 9 | ||||
-rw-r--r-- | libhb/hb.c | 2 | ||||
-rw-r--r-- | libhb/internal.h | 1 | ||||
-rw-r--r-- | libhb/module.defs | 4 | ||||
-rw-r--r-- | libhb/sync.c | 3 | ||||
-rw-r--r-- | libhb/work.c | 9 |
7 files changed, 55 insertions, 5 deletions
diff --git a/libhb/common.c b/libhb/common.c index cea4a5064..824996352 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -9,6 +9,7 @@ #include <sys/time.h> #include "common.h" +#include "lang.h" #include "hb.h" /********************************************************************** @@ -864,8 +865,37 @@ int hb_subtitle_add(const hb_job_t * job, const hb_subtitle_config_t * subtitlec /* We fail! */ return 0; } - subtitle->config = *subtitlecfg; + subtitle->config = *subtitlecfg; hb_list_add(job->list_subtitle, subtitle); return 1; } +int hb_srt_add( const hb_job_t * job, + const hb_subtitle_config_t * subtitlecfg, + const char *lang ) +{ + hb_subtitle_t *subtitle; + iso639_lang_t *language = NULL; + int retval = 0; + + subtitle = calloc( 1, sizeof( *subtitle ) ); + + subtitle->format = TEXTSUB; + subtitle->source = SRTSUB; + + language = lang_for_code2( lang ); + + if( language ) + { + + strcpy( subtitle->lang, language->eng_name ); + strncpy( subtitle->iso639_2, lang, 4 ); + + subtitle->config = *subtitlecfg; + subtitle->config.dest = PASSTHRUSUB; + + hb_list_add(job->list_subtitle, subtitle); + retval = 1; + } + return retval; +} diff --git a/libhb/common.h b/libhb/common.h index 488004f7a..808714ee7 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -96,6 +96,9 @@ 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); +int hb_srt_add(const hb_job_t * job, const hb_subtitle_config_t * subtitlecfg, + const char *lang); + struct hb_rate_s { @@ -115,7 +118,10 @@ struct hb_subtitle_config_s { enum subdest { RENDERSUB, PASSTHRUSUB } dest; int force; - int default_track; + int default_track; + char src_filename[128]; + char src_codeset[40]; + int64_t offset; }; #define HB_VIDEO_RATE_BASE 27000000 @@ -671,6 +677,7 @@ extern hb_work_object_t hb_decmpeg2; extern hb_work_object_t hb_decvobsub; extern hb_work_object_t hb_encvobsub; extern hb_work_object_t hb_deccc608; +extern hb_work_object_t hb_decsrtsub; extern hb_work_object_t hb_render; extern hb_work_object_t hb_encavcodec; extern hb_work_object_t hb_encx264; diff --git a/libhb/hb.c b/libhb/hb.c index df04aea3e..898650ac2 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -162,6 +162,7 @@ hb_handle_t * hb_init( int verbose, int update_check ) hb_register( &hb_decvobsub ); hb_register( &hb_encvobsub ); hb_register( &hb_deccc608 ); + hb_register( &hb_decsrtsub ); hb_register( &hb_render ); hb_register( &hb_encavcodec ); hb_register( &hb_encx264 ); @@ -258,6 +259,7 @@ hb_handle_t * hb_init_dl( int verbose, int update_check ) hb_register( &hb_decvobsub ); hb_register( &hb_encvobsub ); hb_register( &hb_deccc608 ); + hb_register( &hb_decsrtsub ); hb_register( &hb_render ); hb_register( &hb_encavcodec ); hb_register( &hb_encx264 ); diff --git a/libhb/internal.h b/libhb/internal.h index 397883d3c..a00142b8f 100644 --- a/libhb/internal.h +++ b/libhb/internal.h @@ -256,6 +256,7 @@ enum WORK_DECMPEG2, WORK_DECCC608, WORK_DECVOBSUB, + WORK_DECSRTSUB, WORK_ENCVOBSUB, WORK_RENDER, WORK_ENCAVCODEC, diff --git a/libhb/module.defs b/libhb/module.defs index c79e70bfb..f3da3c0ba 100644 --- a/libhb/module.defs +++ b/libhb/module.defs @@ -1,5 +1,5 @@ __deps__ := A52DEC BZIP2 FAAC FAAD2 FFMPEG LAME LIBDCA \ - LIBDVDREAD LIBDVDNAV LIBMKV LIBOGG LIBSAMPLERATE LIBTHEORA LIBVORBIS \ + LIBDVDREAD LIBDVDNAV LIBICONV LIBMKV LIBOGG LIBSAMPLERATE LIBTHEORA LIBVORBIS \ MP4V2 MPEG2DEC PTHREADW32 X264 ZLIB $(eval $(call import.MODULE.defs,LIBHB,libhb,$(__deps__))) @@ -88,7 +88,7 @@ LIBHB.dll = $(LIBHB.build/)hb.dll LIBHB.lib = $(LIBHB.build/)hb.lib LIBHB.dll.libs = $(foreach n, \ - a52 bz2 avcodec avformat avutil dca dvdnav dvdread faac faad mkv mpeg2 mp3lame mp4v2 \ + a52 bz2 avcodec avformat avutil dca dvdnav dvdread faac faad iconv mkv mpeg2 mp3lame mp4v2 \ ogg pthreadGC2 samplerate swscale theora vorbis vorbisenc x264 z, \ $(CONTRIB.build/)lib/lib$(n).a ) diff --git a/libhb/sync.c b/libhb/sync.c index 2043b9dd1..14e5048dc 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -446,7 +446,8 @@ static void SyncVideo( hb_work_object_t * w ) * Rewrite timestamps on subtitles that need it (on raw queue). */ if( subtitle->source == CC608SUB || - subtitle->source == CC708SUB ) + subtitle->source == CC708SUB || + subtitle->source == SRTSUB ) { /* * Rewrite timestamps on subtitles that came from Closed Captions diff --git a/libhb/work.c b/libhb/work.c index 486b8a305..d0afb500d 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -589,6 +589,15 @@ static void do_job( hb_job_t * job, int cpu_count ) hb_list_add( job->list_work, w ); } + if( !job->indepth_scan && subtitle->source == SRTSUB ) + { + w = hb_get_work( WORK_DECSRTSUB ); + w->fifo_in = subtitle->fifo_in; + w->fifo_out = subtitle->fifo_raw; + w->subtitle = subtitle; + hb_list_add( job->list_work, w ); + } + if( !job->indepth_scan && subtitle->format == PICTURESUB && subtitle->config.dest == PASSTHRUSUB ) |