Commit 3246856f authored by Jan Gerber's avatar Jan Gerber
Browse files

forces the EOS packet to be on its own page - otherwise, it could

mean that the last text packet would arrive too late (after its
presentation time) (ogg.k.ogg.k)
parent e830937f
......@@ -942,8 +942,7 @@ void ff2theora_output(ff2theora this) {
be held till the right time. If we don't do that, we can insert late and
oggz-validate moans */
while (ks->subtitles_count < ks->num_subtitles && sub->t0-1.0 <= avtime+this->start_time) {
int eos = (ks->subtitles_count == ks->num_subtitles-1);
oggmux_add_kate_text(&info, i, sub->t0, sub->t1, sub->text, sub->len, eos);
oggmux_add_kate_text(&info, i, sub->t0, sub->t1, sub->text, sub->len);
ks->subtitles_count++;
++sub;
}
......@@ -959,7 +958,7 @@ void ff2theora_output(ff2theora this) {
for (i=0; i<this->n_kate_streams; ++i) {
ff2theora_kate_stream *ks = this->kate_streams+i;
if (ks->num_subtitles > 0 && ks->subtitles_count<ks->num_subtitles) {
if (ks->num_subtitles > 0) {
double t = (info.videotime<info.audiotime?info.audiotime:info.videotime)+this->start_time;
oggmux_add_kate_end_packet(&info, i, t);
oggmux_flush (&info, e_o_s);
......
......@@ -552,9 +552,8 @@ void oggmux_add_audio (oggmux_info *info, int16_t * buffer, int bytes, int sampl
* @param t1 the hide time of the text
* @param text the utf-8 text
* @param len the number of bytes in the text
* @param e_o_s 1 indicates end of stream
*/
void oggmux_add_kate_text (oggmux_info *info, int idx, double t0, double t1, const char *text, size_t len, int e_o_s){
void oggmux_add_kate_text (oggmux_info *info, int idx, double t0, double t1, const char *text, size_t len){
#ifdef HAVE_KATE
ogg_packet op;
oggmux_kate_stream *ks=info->kate_streams+idx;
......@@ -569,17 +568,6 @@ void oggmux_add_kate_text (oggmux_info *info, int idx, double t0, double t1, con
fprintf(stderr, "Failed to encode kate data packet (%f --> %f, [%s]): %d",
t0, t1, text, ret);
}
if(e_o_s) {
ret = kate_ogg_encode_finish(&ks->k, -1, &op);
if (ret>=0) {
ogg_stream_packetin (&ks->ko, &op);
ogg_packet_clear (&op);
info->k_pkg++;
}
else {
fprintf(stderr, "Failed to encode kate end packet: %d", ret);
}
}
#endif
}
......
......@@ -134,7 +134,7 @@ extern void oggmux_setup_kate_streams(oggmux_info *info, int n_kate_streams);
extern void oggmux_init (oggmux_info *info);
extern void oggmux_add_video (oggmux_info *info, yuv_buffer *yuv, int e_o_s);
extern void oggmux_add_audio (oggmux_info *info, int16_t * readbuffer, int bytesread, int samplesread,int e_o_s);
extern void oggmux_add_kate_text (oggmux_info *info, int idx, double t0, double t1, const char *text, size_t len,int e_o_s);
extern void oggmux_add_kate_text (oggmux_info *info, int idx, double t0, double t1, const char *text, size_t len);
extern void oggmux_add_kate_end_packet (oggmux_info *info, int idx, double t);
extern void oggmux_flush (oggmux_info *info, int e_o_s);
extern void oggmux_close (oggmux_info *info);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment