comparison mpcommon.c @ 30017:7119354805e7

Use on-stack subtitle struct for temporary storage for passing subtitles on for rendering by libass. This avoids mangling the static subtitle struct that is supposed to contain the subtitles that will actually be displayed and it also minimally reduces memory usage by freeing the subtitle lines again as early as possible.
author reimar
date Fri, 18 Dec 2009 19:29:33 +0000
parents b06429c8c104
children 25ff7b370523
comparison
equal deleted inserted replaced
30016:538fb3475fa7 30017:7119354805e7
188 ass_process_chunk(ass_track, packet, len, 188 ass_process_chunk(ass_track, packet, len,
189 (long long)(subpts*1000 + 0.5), 189 (long long)(subpts*1000 + 0.5),
190 (long long)((endpts-subpts)*1000 + 0.5)); 190 (long long)((endpts-subpts)*1000 + 0.5));
191 } else { // plaintext subs with libass 191 } else { // plaintext subs with libass
192 if (subpts != MP_NOPTS_VALUE) { 192 if (subpts != MP_NOPTS_VALUE) {
193 subtitle tmp_subs = {0};
193 if (endpts == MP_NOPTS_VALUE) endpts = subpts + 3; 194 if (endpts == MP_NOPTS_VALUE) endpts = subpts + 3;
194 sub_clear_text(&subs, MP_NOPTS_VALUE); 195 sub_add_text(&tmp_subs, packet, len, endpts);
195 sub_add_text(&subs, packet, len, endpts); 196 tmp_subs.start = subpts * 100;
196 subs.start = subpts * 100; 197 tmp_subs.end = endpts * 100;
197 subs.end = endpts * 100; 198 ass_process_subtitle(ass_track, &tmp_subs);
198 ass_process_subtitle(ass_track, &subs); 199 sub_clear_text(&tmp_subs, MP_NOPTS_VALUE);
199 } 200 }
200 } 201 }
201 continue; 202 continue;
202 } 203 }
203 #endif 204 #endif