[vlc-commits] [Git][videolan/vlc][master] 3 commits: vout: subpictures: patch ephemer subpics once on enqueue
François Cartegnie (@fcartegnie)
gitlab at videolan.org
Tue Jan 23 12:54:19 UTC 2024
François Cartegnie pushed to branch master at VideoLAN / VLC
Commits:
2d03d860 by François Cartegnie at 2024-01-23T12:36:15+00:00
vout: subpictures: patch ephemer subpics once on enqueue
- - - - -
f0c82c3d by François Cartegnie at 2024-01-23T12:36:15+00:00
codec: aribsub: fix ephemer stop time
Was incorrectly setting start=stop on ephemer SPU
- - - - -
30f34e33 by François Cartegnie at 2024-01-23T12:36:15+00:00
vout: subpicture: fix early cleanup of ephemer spu
- - - - -
2 changed files:
- modules/codec/arib/aribsub.c
- src/video_output/vout_subpictures.c
Changes:
=====================================
modules/codec/arib/aribsub.c
=====================================
@@ -261,9 +261,10 @@ static subpicture_t *render( decoder_t *p_dec, arib_parser_t *p_parser,
goto decoder_NewSubpictureText_failed;
}
+ vlc_tick_t i_duration = VLC_TICK_FROM_US(arib_decoder_get_time( p_arib_decoder ));
p_spu->i_start = p_block->i_pts;
- p_spu->i_stop = p_block->i_pts + VLC_TICK_FROM_US(arib_decoder_get_time( p_arib_decoder ));
- p_spu->b_ephemer = (p_spu->i_start == p_spu->i_stop);
+ p_spu->i_stop = i_duration ? p_block->i_pts + i_duration : 0;
+ p_spu->b_ephemer = i_duration == 0;
p_spu->b_absolute = true;
arib_spu_updater_sys_t *p_spu_sys = p_spu->updater.sys;
=====================================
src/video_output/vout_subpictures.c
=====================================
@@ -192,19 +192,42 @@ static void spu_channel_EarlyRemoveLate(spu_private_t *sys,
struct spu_channel *channel,
vlc_tick_t system_now)
{
- /* Trying to have a reasonable hint to remove early from queue
- * SPU that have no chance to be rendered */
- for (size_t i = 0; i < channel->entries.size;)
+ if(channel->entries.size == 0)
+ return;
+ /* Find first display time that will expire ephemer SPU and store it's enqueue
+ * order. Ephemer really expires on next SPU activation, or if it has a valid
+ * stop time */
+ const spu_render_entry_t *last = &channel->entries.data[channel->entries.size-1];
+ vlc_tick_t minactivespu = last->start;
+ int64_t minactivespuorder = last->subpic->i_order;
+ for (size_t i = 0; i < channel->entries.size - 1; i++)
{
const spu_render_entry_t *entry = &channel->entries.data[i];
-
if(spu_HasAlreadyExpired(entry->start, entry->stop, system_now))
+ continue;
+ if(minactivespu <= entry->start)
+ {
+ minactivespu = entry->start;
+ if(minactivespuorder > entry->subpic->i_order)
+ minactivespuorder = entry->subpic->i_order;
+ }
+ }
+
+ for (size_t i = 0; i < channel->entries.size;)
+ {
+ const spu_render_entry_t *entry = &channel->entries.data[i];
+ /* !warn: do not simplify using order only. There can be multiple SPU
+ * lines active at a same time, while ephemer ones are always expired
+ * by next activated SPU in enqueue order */
+ if((entry->subpic->b_ephemer &&
+ entry->subpic->i_order < minactivespuorder) ||
+ spu_HasAlreadyExpired(entry->start, entry->stop, system_now))
{
spu_Channel_CleanEntry(sys, &channel->entries.data[i]);
vlc_vector_remove(&channel->entries, i);
+ continue;
}
- else
- i++;
+ i++;
}
}
@@ -736,11 +759,6 @@ spu_SelectSubpictures(spu_t *spu, vlc_tick_t system_now,
selected_max_order = current->i_order;
}
- /* An ephemer with stop time can be ephemer,
- but a pic without stop time must be ephemer */
- if(current->i_stop < current->i_start)
- current->b_ephemer = true;
-
/* If the spu is ephemer, the stop time is invalid, but it has been converted to
system time and used in comparisons below */
const bool is_stop_valid = !current->b_ephemer || render_entry->orgstop > render_entry->orgstart;
@@ -1959,6 +1977,11 @@ void spu_PutSubpicture(spu_t *spu, subpicture_t *subpic)
}
}
+ /* An ephemer with stop time can be ephemer,
+ but a pic without stop time must be ephemer */
+ if(subpic->i_stop < subpic->i_start)
+ subpic->b_ephemer = true;
+
if (spu_channel_Push(channel, subpic, orgstart, orgstop))
{
vlc_mutex_unlock(&sys->lock);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6e8611d6138f01588c9f6012b21246fd979625da...30f34e33b53d42a830ae89eb74c4b74de0682ffa
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6e8611d6138f01588c9f6012b21246fd979625da...30f34e33b53d42a830ae89eb74c4b74de0682ffa
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list