4 strack_t(int zid, video_t *vid)
13 if( offsets ) delete [] offsets;
17 strack_t(zstrack_t &strack)
21 allocated_offsets = strack.allocated_offsets;
22 total_offsets = strack.total_offsets;
23 offsets = new int64_t[allocated_offsets];
24 for( int i=0; i<total_offsets; ++i )
25 offsets[i] = strack.offsets[i];
31 if( allocated_offsets <= total_offsets ) {
32 long new_allocation = ZMAX(2*total_offsets, 16);
33 int64_t *new_offsets = new int64_t[new_allocation];
34 for( int i=0; i<total_offsets; ++i )
35 new_offsets[i] = offsets[i];
37 offsets = new_offsets;
38 allocated_offsets = new_allocation;
43 append_subtitle_offset(int64_t program_offset)
46 offsets[total_offsets++] = program_offset;
50 append_subtitle(zsubtitle_t *subtitle, int lock)
53 rwlock.write_enter(lock);
54 if( total_subtitles < MAX_SUBTITLES ) {
55 subtitles[total_subtitles++] = subtitle;
59 rwlock.write_leave(lock);
64 del_subtitle(subtitle_t *subtitle, int lock)
66 rwlock.write_enter(lock);
68 while( i<total_subtitles && subtitles[i]!=subtitle ) ++i;
69 if( i < total_subtitles ) {
70 while( ++i<total_subtitles ) subtitles[i-1] = subtitles[i];
73 subtitle->draw = subtitle->done = -1;
74 rwlock.write_leave(lock);
81 for( int i=0; i<total_subtitles; ++i ) {
82 subtitle_t *sp = subtitles[i];
83 sp->draw = sp->done = -1;
84 if( sp->force < 0 ) delete sp;
91 del_subtitle(int idx, int lock)
93 del_subtitle(subtitles[idx], lock);