diff options
Diffstat (limited to 'libhb/decssasub.c')
-rw-r--r-- | libhb/decssasub.c | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/libhb/decssasub.c b/libhb/decssasub.c index 7027926e8..98f62d4fe 100644 --- a/libhb/decssasub.c +++ b/libhb/decssasub.c @@ -226,7 +226,9 @@ void hb_ssa_style_init(hb_subtitle_style_t *style) style->bg_alpha = 0xFF; } -static hb_buffer_t *ssa_decode_line_to_mkv_ssa( hb_work_object_t * w, uint8_t *in_data, int in_size ); +static hb_buffer_t * +ssa_decode_line_to_mkv_ssa( hb_work_object_t * w, int scr_sequence, + uint8_t *in_data, int in_size ); /* * Decodes a single SSA packet to one or more TEXTSUB or PICTURESUB subtitle packets. @@ -256,37 +258,11 @@ static hb_buffer_t *ssa_decode_packet( hb_work_object_t * w, hb_buffer_t *in ) continue; // Decode an individual SSA line - buf = ssa_decode_line_to_mkv_ssa(w, (uint8_t *)curLine, - strlen(curLine)); + buf = ssa_decode_line_to_mkv_ssa(w, in->s.scr_sequence, + (uint8_t *)curLine, strlen(curLine)); hb_buffer_list_append(&list, buf); } - // For point-to-point encoding, when the start time of the stream - // may be offset, the timestamps of the subtitles must be offset as well. - // - // HACK: Here we are making the assumption that, under normal circumstances, - // the output display time of the first output packet is equal to the - // display time of the input packet. - // - // During point-to-point encoding, the display time of the input - // packet will be offset to compensate. - // - // Therefore we offset all of the output packets by a slip amount - // such that first output packet's display time aligns with the - // input packet's display time. This should give the correct time - // when point-to-point encoding is in effect. - buf = hb_buffer_list_head(&list); - if (buf && buf->s.start > in->s.start) - { - int64_t slip = buf->s.start - in->s.start; - while (buf != NULL) - { - buf->s.start -= slip; - buf->s.stop -= slip; - buf = buf->next; - } - } - return hb_buffer_list_clear(&list); } @@ -346,7 +322,9 @@ static uint8_t *find_field( uint8_t *pos, uint8_t *end, int fieldNum ) * ReadOrder,Marked, Style,Name,MarginL,MarginR,MarginV,Effect,Text '\0' * 1 2 3 4 5 6 7 8 9 */ -static hb_buffer_t *ssa_decode_line_to_mkv_ssa( hb_work_object_t * w, uint8_t *in_data, int in_size ) +static hb_buffer_t * +ssa_decode_line_to_mkv_ssa( hb_work_object_t * w, int scr_sequence, + uint8_t *in_data, int in_size ) { hb_work_private_t * pv = w->private_data; hb_buffer_t * out; @@ -393,10 +371,11 @@ static hb_buffer_t *ssa_decode_line_to_mkv_ssa( hb_work_object_t * w, uint8_t *i strcat( mkvIn, "," ); strcat( mkvIn, (char *)styleToTextFields ); - out->size = strlen(mkvIn) + 1; - out->s.frametype = HB_FRAME_SUBTITLE; - out->s.start = in_start; - out->s.stop = in_stop; + out->size = strlen(mkvIn) + 1; + out->s.frametype = HB_FRAME_SUBTITLE; + out->s.start = in_start; + out->s.stop = in_stop; + out->s.scr_sequence = scr_sequence; if( out->size == 0 ) { |