From d6ffd5bc350707dd51f778e10e615fb7dcfce1f9 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Mon, 30 Oct 2023 08:32:08 +0100 Subject: [PATCH] subpicture: use helper functions for vlc_spu_regions --- modules/access/bluray.c | 19 +++++++++---------- modules/codec/arib/libaribcaption.c | 2 +- modules/codec/arib/substext.h | 2 +- modules/codec/avcodec/subtitle.c | 2 +- modules/codec/cvdsub.c | 2 +- modules/codec/dvbsub.c | 18 +++++++++--------- modules/codec/kate.c | 6 +++--- modules/codec/libass.c | 4 ++-- modules/codec/scte27.c | 2 +- modules/codec/spudec/parse.c | 4 ++-- modules/codec/substext.h | 7 ++++--- modules/codec/substx3g.c | 2 +- modules/codec/subsusf.c | 6 +++--- modules/codec/svcdsub.c | 2 +- modules/codec/t140.c | 2 +- modules/codec/telx.c | 2 +- modules/codec/ttml/imageupdater.h | 2 +- modules/codec/webvtt/encvtt.c | 2 +- modules/codec/zvbi.c | 4 ++-- modules/hw/mmal/vout.c | 2 +- modules/spu/audiobargraph_v.c | 2 +- modules/spu/dynamicoverlay/dynamicoverlay.c | 2 +- modules/spu/logo.c | 2 +- modules/spu/marq.c | 2 +- modules/spu/mosaic.c | 2 +- modules/spu/rss.c | 4 ++-- modules/spu/subsdelay.c | 10 +++++----- modules/video_output/android/display.c | 6 +++--- .../apple/VLCSampleBufferDisplay.m | 6 +++--- modules/video_output/libplacebo/display.c | 4 ++-- modules/video_output/opengl/sub_renderer.c | 4 ++-- modules/video_output/win32/direct3d11.cpp | 4 ++-- modules/video_output/win32/direct3d9.c | 4 ++-- modules/video_output/xcb/render.c | 2 +- src/misc/subpicture.c | 8 ++++---- src/video_output/video_epg.c | 16 ++++++++-------- src/video_output/video_text.c | 2 +- src/video_output/video_widgets.c | 2 +- src/video_output/vout_subpictures.c | 14 +++++++------- .../video_output/opengl/sub_renderer.c | 2 +- .../input/decoder/input_decoder_scenarios.c | 2 +- 41 files changed, 96 insertions(+), 96 deletions(-) diff --git a/modules/access/bluray.c b/modules/access/bluray.c index 36540452d7..8031b53a86 100644 --- a/modules/access/bluray.c +++ b/modules/access/bluray.c @@ -1675,17 +1675,17 @@ static void subpictureUpdaterUpdate(subpicture_t *p_subpic, * We need to duplicate our regions (stored internally) to this subpic. */ subpicture_region_t *p_src; - if (vlc_list_is_empty(&p_overlay->regions)) { + if (vlc_spu_regions_is_empty(&p_overlay->regions)) { updater_unlock_overlay(p_upd_sys); return; } subpicture_region_t *p_dst; - vlc_list_foreach(p_src, &p_overlay->regions, node) { + vlc_spu_regions_foreach(p_src, &p_overlay->regions) { p_dst = subpicture_region_Copy(p_src); if (p_dst == NULL) break; - vlc_list_append(&p_dst->node, &p_subpic->regions); + vlc_spu_regions_push(&p_subpic->regions, p_dst); } p_overlay->status = Displayed; @@ -1874,7 +1874,7 @@ static void blurayInitOverlay(demux_t *p_demux, int plane, uint16_t width, uint1 ov->width = width; ov->height = height; ov->b_on_vout = false; - vlc_list_init(&ov->regions); + vlc_spu_regions_init(&ov->regions); vlc_mutex_init(&ov->lock); @@ -1901,7 +1901,7 @@ static void blurayDrawOverlay(demux_t *p_demux, const BD_OVERLAY* const eventov) /* Find a region to update */ subpicture_region_t *p_reg; - vlc_list_foreach(p_reg, &ov->regions, node) { + vlc_spu_regions_foreach(p_reg, &ov->regions) { if (p_reg->i_x == eventov->x && p_reg->i_y == eventov->y && p_reg->fmt.i_width == eventov->w && @@ -1913,7 +1913,7 @@ static void blurayDrawOverlay(demux_t *p_demux, const BD_OVERLAY* const eventov) if (!eventov->img) { if (p_reg) { /* drop region */ - vlc_list_remove(&p_reg->node); + vlc_spu_regions_remove(&ov->regions, p_reg); subpicture_region_Delete(p_reg); } vlc_mutex_unlock(&ov->lock); @@ -1931,7 +1931,7 @@ static void blurayDrawOverlay(demux_t *p_demux, const BD_OVERLAY* const eventov) p_reg->i_x = eventov->x; p_reg->i_y = eventov->y; /* Append it to our list. */ - vlc_list_append(&p_reg->node, &ov->regions); + vlc_spu_regions_push(&ov->regions, p_reg); } else { @@ -2034,8 +2034,7 @@ static void blurayDrawArgbOverlay(demux_t *p_demux, const BD_ARGB_OVERLAY* const #else const vlc_fourcc_t rgbchroma = VLC_CODEC_BGRA; #endif - subpicture_region_t *p_reg = - vlc_list_first_entry_or_null(&ov->regions, subpicture_region_t, node); + subpicture_region_t *p_reg = vlc_spu_regions_first_or_null(&ov->regions); if (!p_reg) { video_format_t fmt; @@ -2049,7 +2048,7 @@ static void blurayDrawArgbOverlay(demux_t *p_demux, const BD_ARGB_OVERLAY* const vlc_mutex_unlock(&ov->lock); return; } - vlc_list_append(&p_reg->node, &ov->regions); + vlc_spu_regions_push(&ov->regions, p_reg); } /* Find a region to update */ diff --git a/modules/codec/arib/libaribcaption.c b/modules/codec/arib/libaribcaption.c index 6044844dcb..5eb74b4a5e 100644 --- a/modules/codec/arib/libaribcaption.c +++ b/modules/codec/arib/libaribcaption.c @@ -201,7 +201,7 @@ static void SubpictureUpdate(subpicture_t *p_subpic, CopyImageToRegion(region->p_picture, image); - vlc_list_append(®ion->node, &p_subpic->regions); + vlc_spu_regions_push(&p_subpic->regions, region); } aribcc_render_result_cleanup(&p_spusys->render_result); diff --git a/modules/codec/arib/substext.h b/modules/codec/arib/substext.h index 6a5685e3b8..d7d54a617b 100644 --- a/modules/codec/arib/substext.h +++ b/modules/codec/arib/substext.h @@ -82,7 +82,7 @@ static void SubpictureTextUpdate(subpicture_t *subpic, { return; } - vlc_list_append(&r->node, &subpic->regions); + vlc_spu_regions_push(&subpic->regions, r); r->fmt.i_sar_num = 1; r->fmt.i_sar_den = 1; diff --git a/modules/codec/avcodec/subtitle.c b/modules/codec/avcodec/subtitle.c index 77eac75e8e..d3e88fe8eb 100644 --- a/modules/codec/avcodec/subtitle.c +++ b/modules/codec/avcodec/subtitle.c @@ -356,7 +356,7 @@ static subpicture_t *ConvertSubtitle(decoder_t *dec, AVSubtitle *ffsub, vlc_tick break; } if (region) { - vlc_list_append(®ion->node, &spu->regions); + vlc_spu_regions_push(&spu->regions, region); } } avsubtitle_free(ffsub); diff --git a/modules/codec/cvdsub.c b/modules/codec/cvdsub.c index e9b56e26ae..88b5dfe4c3 100644 --- a/modules/codec/cvdsub.c +++ b/modules/codec/cvdsub.c @@ -545,7 +545,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data ) return NULL; } - vlc_list_append(&p_region->node, &p_spu->regions); + vlc_spu_regions_push(&p_spu->regions, p_region); p_region->i_x = p_sys->i_x_start; p_region->i_x = p_region->i_x * 3 / 4; /* FIXME: use aspect ratio for x? */ p_region->i_y = p_sys->i_y_start; diff --git a/modules/codec/dvbsub.c b/modules/codec/dvbsub.c index 112bdace88..1afadb1e50 100644 --- a/modules/codec/dvbsub.c +++ b/modules/codec/dvbsub.c @@ -1604,7 +1604,7 @@ static subpicture_t *render( decoder_t *p_dec ) p_spu_region->i_x = i_base_x + p_regiondef->i_x; p_spu_region->i_y = i_base_y + p_regiondef->i_y; p_spu_region->i_align = p_sys->i_spu_position; - vlc_list_append(&p_spu_region->node, &p_spu->regions); + vlc_spu_regions_push(&p_spu->regions, p_spu_region); p_src = p_region->p_pixbuf; p_dst = p_spu_region->p_picture->Y_PIXELS; @@ -1644,7 +1644,7 @@ static subpicture_t *render( decoder_t *p_dec ) p_spu_region->i_x = i_base_x + p_regiondef->i_x + p_object_def->i_x; p_spu_region->i_y = i_base_y + p_regiondef->i_y + p_object_def->i_y; p_spu_region->i_align = p_sys->i_spu_position; - vlc_list_append(&p_spu_region->node, &p_spu->regions); + vlc_spu_regions_push(&p_spu->regions, p_spu_region); } } @@ -1734,7 +1734,7 @@ static void YuvaYuvp( subpicture_t *p_subpic ) { subpicture_region_t *p_region = NULL; - vlc_list_foreach(p_region, &p_subpic->regions, node) + vlc_spu_regions_foreach(p_region, &p_subpic->regions) { video_format_t *p_fmt = &p_region->fmt; int i = 0, j = 0, n = 0, p = 0; @@ -1933,12 +1933,12 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic ) bs_t bits, *s = &bits; block_t *p_block; - if( !p_subpic || !vlc_list_is_empty(&p_subpic->regions) ) return NULL; + if( !p_subpic || !vlc_spu_regions_is_empty(&p_subpic->regions) ) return NULL; /* FIXME: this is a hack to convert VLC_CODEC_YUVA into * VLC_CODEC_YUVP */ - p_region = vlc_list_first_entry_or_null(&p_subpic->regions, subpicture_region_t, node); + p_region = vlc_spu_regions_first_or_null(&p_subpic->regions); if( p_region->fmt.i_chroma == VLC_CODEC_YUVA ) { YuvaYuvp( p_subpic ); @@ -2051,7 +2051,7 @@ static void encode_page_composition( encoder_t *p_enc, bs_t *s, i_regions = 0; if (p_subpic) - vlc_list_foreach(p_region, &p_subpic->regions, node) + vlc_spu_regions_foreach(p_region, &p_subpic->regions) { if( i_regions >= p_sys->i_regions ) { @@ -2104,7 +2104,7 @@ static void encode_page_composition( encoder_t *p_enc, bs_t *s, i_regions = 0; if (p_subpic) - vlc_list_foreach(p_region, &p_subpic->regions, node) + vlc_spu_regions_foreach(p_region, &p_subpic->regions) { bs_write( s, 8, i_regions ); bs_write( s, 8, 0 ); /* Reserved */ @@ -2170,7 +2170,7 @@ static void encode_region_composition( encoder_t *p_enc, bs_t *s, unsigned int i_region; i_region = 0; - vlc_list_foreach(p_region, &p_subpic->regions, node) + vlc_spu_regions_foreach(p_region, &p_subpic->regions) { int i_entries = 4, i_depth = 0x1, i_bg = 0; bool b_text = subpicture_region_IsText( p_region ); @@ -2246,7 +2246,7 @@ static void encode_object( encoder_t *p_enc, bs_t *s, subpicture_t *p_subpic ) int i_length_pos, i_update_pos, i_pixel_data_pos; i_region = 0; - vlc_list_foreach(p_region, &p_subpic->regions, node) + vlc_spu_regions_foreach(p_region, &p_subpic->regions) { bs_write( s, 8, 0x0f ); /* Sync byte */ bs_write( s, 8, DVBSUB_ST_OBJECT_DATA ); /* Segment type */ diff --git a/modules/codec/kate.c b/modules/codec/kate.c index 7590fa9fd1..bddb605ffa 100644 --- a/modules/codec/kate.c +++ b/modules/codec/kate.c @@ -899,7 +899,7 @@ static void TigerUpdateSubpicture( subpicture_t *p_subpic, PROFILE_STOP( tiger_renderer_render ); PostprocessTigerImage( p_plane, fmt.i_width ); - vlc_list_append( &p_r->node, &p_subpic->regions ); + vlc_spu_regions_push( &p_subpic->regions, p_r ); p_sys->b_dirty = false; PROFILE_STOP( TigerUpdateSubpicture ); @@ -1187,9 +1187,9 @@ static subpicture_t *SetupSimpleKateSPU( decoder_t *p_dec, subpicture_t *p_spu, /* if we have a bitmap, chain it before the text */ if (p_bitmap_region) { - vlc_list_append(&p_bitmap_region->node, &p_spu->regions); + vlc_spu_regions_push(&p_spu->regions, p_bitmap_region); } - vlc_list_append(&p_region->node, &p_spu->regions); + vlc_spu_regions_push(&p_spu->regions, p_region); return p_spu; } diff --git a/modules/codec/libass.c b/modules/codec/libass.c index 70bef37044..54de1dfff5 100644 --- a/modules/codec/libass.c +++ b/modules/codec/libass.c @@ -454,7 +454,7 @@ static int SubpictureValidate( subpicture_t *p_subpic, MS_FROM_VLC_TICK( i_stream_date ), &i_changed ); if( !i_changed && !b_fmt_src && !b_fmt_dst && - (p_img != NULL) == (!vlc_list_is_empty(&p_subpic->regions)) ) + (p_img != NULL) == (!vlc_spu_regions_is_empty(&p_subpic->regions)) ) { vlc_mutex_unlock( &p_sys->lock ); return VLC_SUCCESS; @@ -522,7 +522,7 @@ static void SubpictureUpdate( subpicture_t *p_subpic, RegionDraw( r, p_img ); /* */ - vlc_list_append(&r->node, &p_subpic->regions); + vlc_spu_regions_push(&p_subpic->regions, r); } vlc_mutex_unlock( &p_sys->lock ); diff --git a/modules/codec/scte27.c b/modules/codec/scte27.c index 89ca3e1627..acbf49e70b 100644 --- a/modules/codec/scte27.c +++ b/modules/codec/scte27.c @@ -391,7 +391,7 @@ static subpicture_t *DecodeSubtitleMessage(decoder_t *dec, sub->b_ephemer = true; sub->i_start = date; sub->i_stop = date + display_duration * frame_duration; - vlc_list_append(®ion->node, &sub->regions); + vlc_spu_regions_push(&sub->regions, region); return sub; } else { diff --git a/modules/codec/spudec/parse.c b/modules/codec/spudec/parse.c index 9b342ffb15..00efc3eb62 100644 --- a/modules/codec/spudec/parse.c +++ b/modules/codec/spudec/parse.c @@ -254,7 +254,7 @@ static void OutputPicture( decoder_t *p_dec, if( p_spu_data->p_pxctli && p_spu ) ParsePXCTLI( p_dec, p_spu_data, - vlc_list_first_entry_or_null(&p_spu->regions, subpicture_region_t, node) ); + vlc_spu_regions_first_or_null(&p_spu->regions) ); pf_queue( p_dec, p_spu ); } @@ -868,7 +868,7 @@ static int Render( decoder_t *p_dec, subpicture_t *p_spu, msg_Err( p_dec, "cannot allocate SPU region" ); return VLC_EGENERIC; } - vlc_list_append(&p_region->node, &p_spu->regions); + vlc_spu_regions_push(&p_spu->regions, p_region); p_region->i_x = p_spu_properties->i_x; p_region->i_y = p_spu_properties->i_y + p_spu_data->i_y_top_offset; diff --git a/modules/codec/substext.h b/modules/codec/substext.h index bcb99225d7..9fc9bcc401 100644 --- a/modules/codec/substext.h +++ b/modules/codec/substext.h @@ -110,11 +110,12 @@ static int SubpictureTextValidate(subpicture_t *subpic, substext_updater_region_t *p_updtregion = &sys->region; if (!(p_updtregion->flags & UPDT_REGION_FIXED_DONE) && - subpic->b_absolute && !vlc_list_is_empty(&subpic->regions) && + subpic->b_absolute && !vlc_spu_regions_is_empty(&subpic->regions) && subpic->i_original_picture_width > 0 && subpic->i_original_picture_height > 0) { - subpicture_region_t *p_region = vlc_list_first_entry_or_null(&subpic->regions, subpicture_region_t, node); + subpicture_region_t *p_region = + vlc_spu_regions_first_or_null(&subpic->regions); p_updtregion->flags |= UPDT_REGION_FIXED_DONE; p_updtregion->origin.x = p_region->i_x; p_updtregion->origin.y = p_region->i_y; @@ -171,7 +172,7 @@ static void SubpictureTextUpdate(subpicture_t *subpic, subpicture_region_t *r = subpicture_region_NewText(); if (!r) return; - vlc_list_append(&r->node, &subpic->regions); + vlc_spu_regions_push(&subpic->regions, r); video_format_Copy( &r->fmt, &fmt ); r->p_text = text_segment_Copy( p_updtregion->p_segments ); diff --git a/modules/codec/substx3g.c b/modules/codec/substx3g.c index b88d83bd2a..566e2c22b9 100644 --- a/modules/codec/substx3g.c +++ b/modules/codec/substx3g.c @@ -703,7 +703,7 @@ static block_t * Encode( encoder_t *p_enc, subpicture_t *p_spu ) { VLC_UNUSED(p_enc); subpicture_region_t *p_region = - vlc_list_first_entry_or_null(&p_spu->regions, subpicture_region_t, node); + vlc_spu_regions_first_or_null(&p_spu->regions); const text_segment_t *p_segments = p_region ? p_region->p_text : NULL; size_t i_len = 0; size_t i_styles = 0; diff --git a/modules/codec/subsusf.c b/modules/codec/subsusf.c index 326ec862da..9ffdb94194 100644 --- a/modules/codec/subsusf.c +++ b/modules/codec/subsusf.c @@ -841,7 +841,7 @@ static void ParseUSFString( decoder_t *p_dec, p_sys->i_align ); if( p_text_region ) { - vlc_list_append(&p_text_region->node, regions); + vlc_spu_regions_push(regions, p_text_region); } else free( psz_flat ); } @@ -891,7 +891,7 @@ static void ParseUSFString( decoder_t *p_dec, if( p_image_region ) { SetupPositions( p_image_region, psz_subtitle ); - vlc_list_append(&p_image_region->node, regions); + vlc_spu_regions_push(regions, p_image_region); } } else @@ -909,7 +909,7 @@ static void ParseUSFString( decoder_t *p_dec, p_sys->i_align ); if( p_text_region ) { - vlc_list_append(&p_text_region->node, regions); + vlc_spu_regions_push(regions, p_text_region); } else free( psz_flat ); } diff --git a/modules/codec/svcdsub.c b/modules/codec/svcdsub.c index ac39d7d2fc..d94f84771c 100644 --- a/modules/codec/svcdsub.c +++ b/modules/codec/svcdsub.c @@ -496,7 +496,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data ) return NULL; } - vlc_list_append(&p_region->node, &p_spu->regions); + vlc_spu_regions_push(&p_spu->regions, p_region); p_region->i_x = p_sys->i_x_start; p_region->i_y = p_sys->i_y_start; diff --git a/modules/codec/t140.c b/modules/codec/t140.c index 6fb3f2b72f..f5a979643f 100644 --- a/modules/codec/t140.c +++ b/modules/codec/t140.c @@ -83,7 +83,7 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_spu ) if( p_spu == NULL ) return NULL; - p_region = vlc_list_first_entry_or_null(&p_spu->regions, subpicture_region_t, node); + p_region = vlc_spu_regions_first_or_null(&p_spu->regions); if( ( p_region == NULL ) || (!subpicture_region_IsText( p_region )) || ( p_region->p_text == NULL ) diff --git a/modules/codec/telx.c b/modules/codec/telx.c index af920cdcea..15878eb249 100644 --- a/modules/codec/telx.c +++ b/modules/codec/telx.c @@ -735,7 +735,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block ) msg_Err( p_dec, "cannot allocate SPU region" ); goto error; } - vlc_list_append( &p_region->node, &p_spu->regions ); + vlc_spu_regions_push( &p_spu->regions, p_region ); /* Normal text subs, easy markup */ p_region->i_align = SUBPICTURE_ALIGN_BOTTOM | p_sys->i_align; diff --git a/modules/codec/ttml/imageupdater.h b/modules/codec/ttml/imageupdater.h index 968fa8151d..af9e6b285b 100644 --- a/modules/codec/ttml/imageupdater.h +++ b/modules/codec/ttml/imageupdater.h @@ -116,7 +116,7 @@ static void TTML_ImageSpuUpdate(subpicture_t *p_spu, else r->i_y = p_updtregion->origin.y; - vlc_list_append(&r->node, &p_spu->regions); + vlc_spu_regions_push(&p_spu->regions, r); } } diff --git a/modules/codec/webvtt/encvtt.c b/modules/codec/webvtt/encvtt.c index 858486e5bd..e76076c41e 100644 --- a/modules/codec/webvtt/encvtt.c +++ b/modules/codec/webvtt/encvtt.c @@ -85,7 +85,7 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_spu ) return NULL; subpicture_region_t *p_region; - vlc_list_foreach(p_region, &p_spu->regions, node) + vlc_spu_regions_foreach(p_region, &p_spu->regions) { if(!subpicture_region_IsText( p_region )|| p_region->p_text == NULL || diff --git a/modules/codec/zvbi.c b/modules/codec/zvbi.c index d00d8835e3..4d0157dad5 100644 --- a/modules/codec/zvbi.c +++ b/modules/codec/zvbi.c @@ -479,7 +479,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block ) else { subpicture_region_t *p_region = - vlc_list_first_entry_or_null(&p_spu->regions, subpicture_region_t, node); + vlc_spu_regions_first_or_null(&p_spu->regions); picture_t *p_pic = p_region->p_picture; /* ZVBI is stupid enough to assume pitch == width */ @@ -558,7 +558,7 @@ static subpicture_t *Subpicture( decoder_t *p_dec, subpicture_Delete( p_spu ); return NULL; } - vlc_list_append(&p_region->node, &p_spu->regions); + vlc_spu_regions_push(&p_spu->regions, p_region); p_spu->i_start = i_pts; p_spu->i_stop = b_text ? i_pts + VLC_TICK_FROM_SEC(10): 0; diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c index 701e9af242..490d6e05b0 100644 --- a/modules/hw/mmal/vout.c +++ b/modules/hw/mmal/vout.c @@ -758,7 +758,7 @@ static int attach_subpics(vout_display_t * const vd, vout_display_sys_t * const for (subpicture_t * spic = subpicture; spic != NULL; spic = spic->p_next) { subpicture_region_t *sreg; - vlc_list_foreach(sreg, &spic->regions, node) { + vlc_spu_regions_foreach(sreg, &spic->regions) { picture_t *const src = sreg->p_picture; // At this point I think the subtitles are being placed in the diff --git a/modules/spu/audiobargraph_v.c b/modules/spu/audiobargraph_v.c index e4521644b4..860ef474fb 100644 --- a/modules/spu/audiobargraph_v.c +++ b/modules/spu/audiobargraph_v.c @@ -399,7 +399,7 @@ static subpicture_t *FilterSub(filter_t *p_filter, vlc_tick_t date) p_region->i_x = p_sys->i_pos_x > 0 ? p_sys->i_pos_x : 0; p_region->i_y = p_sys->i_pos_y > 0 ? p_sys->i_pos_y : 0; - vlc_list_append(&p_region->node, &p_spu->regions); + vlc_spu_regions_push(&p_spu->regions, p_region); p_spu->i_alpha = p_BarGraph->i_alpha ; diff --git a/modules/spu/dynamicoverlay/dynamicoverlay.c b/modules/spu/dynamicoverlay/dynamicoverlay.c index 37b3251ff1..27f3c32366 100644 --- a/modules/spu/dynamicoverlay/dynamicoverlay.c +++ b/modules/spu/dynamicoverlay/dynamicoverlay.c @@ -381,7 +381,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date ) p_region->i_y = p_overlay->i_y; p_region->i_align = SUBPICTURE_ALIGN_LEFT | SUBPICTURE_ALIGN_TOP; p_region->i_alpha = p_overlay->i_alpha; - vlc_list_append( &p_region->node, &p_spu->regions ); + vlc_spu_regions_push( &p_spu->regions, p_region ); } p_sys->b_updated = false; diff --git a/modules/spu/logo.c b/modules/spu/logo.c index 2a97f02b70..fc0e4814e3 100644 --- a/modules/spu/logo.c +++ b/modules/spu/logo.c @@ -392,7 +392,7 @@ static subpicture_t *FilterSub( filter_t *p_filter, vlc_tick_t date ) p_region->i_x = p_sys->i_pos_x > 0 ? p_sys->i_pos_x : 0; p_region->i_y = p_sys->i_pos_y > 0 ? p_sys->i_pos_y : 0; - vlc_list_append( &p_region->node, &p_spu->regions ); + vlc_spu_regions_push( &p_spu->regions, p_region ); p_spu->i_alpha = ( p_logo->i_alpha != -1 ? p_logo->i_alpha : p_list->i_alpha ); diff --git a/modules/spu/marq.c b/modules/spu/marq.c index caf66cce24..c43c7bf47b 100644 --- a/modules/spu/marq.c +++ b/modules/spu/marq.c @@ -291,7 +291,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date ) p_spu = NULL; goto out; } - vlc_list_append( &p_region->node, &p_spu->regions ); + vlc_spu_regions_push( &p_spu->regions, p_region ); p_region->fmt.i_sar_den = p_region->fmt.i_sar_num = 1; p_sys->last_time = date; diff --git a/modules/spu/mosaic.c b/modules/spu/mosaic.c index 510fe0ca4e..37f85d0b5b 100644 --- a/modules/spu/mosaic.c +++ b/modules/spu/mosaic.c @@ -709,7 +709,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date ) p_region->i_align = p_sys->i_align; p_region->i_alpha = p_es->i_alpha; - vlc_list_append(&p_region->node, &p_spu->regions); + vlc_spu_regions_push(&p_spu->regions, p_region); video_format_Clean( &fmt_in ); video_format_Clean( &fmt_out ); diff --git a/modules/spu/rss.c b/modules/spu/rss.c index 562f7b7d63..523e13a0db 100644 --- a/modules/spu/rss.c +++ b/modules/spu/rss.c @@ -409,7 +409,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date ) vlc_mutex_unlock( &p_sys->lock ); return NULL; } - vlc_list_append( ®ion->node, &p_spu->regions ); + vlc_spu_regions_push( &p_spu->regions, region ); /* Generate the string that will be displayed. This string is supposed to be p_sys->i_length characters long. */ @@ -519,7 +519,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date ) { p_region->i_x = region->i_x; p_region->i_y = region->i_y; - vlc_list_append( &p_region->node, &p_spu->regions ); + vlc_spu_regions_push( &p_spu->regions, p_region ); /* Offset text to display right next to the image */ region->i_x += fmt_out.i_visible_width; diff --git a/modules/spu/subsdelay.c b/modules/spu/subsdelay.c index 9ea9355991..6e0a77cf7e 100644 --- a/modules/spu/subsdelay.c +++ b/modules/spu/subsdelay.c @@ -941,7 +941,7 @@ static int SubpicValidateWrapper( subpicture_t *p_subpic, bool has_src_changed, p_entry->b_last_region_saved = false; subpicture_region_t *p_region = - vlc_list_first_entry_or_null(&p_subpic->regions, subpicture_region_t, node); + vlc_spu_regions_first_or_null(&p_subpic->regions); if( p_region ) { /* save copy */ @@ -1045,7 +1045,7 @@ static void SubpicLocalUpdate( subpicture_t* p_subpic, vlc_tick_t i_ts ) SubsdelayHeapLock( p_heap ); subpicture_region_t *p_region = - vlc_list_first_entry_or_null(&p_subpic->regions, subpicture_region_t, node); + vlc_spu_regions_first_or_null(&p_subpic->regions); if( p_entry->b_check_empty && p_region ) { if( SubsdelayIsTextEmpty( p_region ) ) @@ -1112,7 +1112,7 @@ static void SubpicLocalUpdate( subpicture_t* p_subpic, vlc_tick_t i_ts ) static bool SubpicIsEmpty( subpicture_t* p_subpic ) { subpicture_region_t *p_region = - vlc_list_first_entry_or_null(&p_subpic->regions, subpicture_region_t, node); + vlc_spu_regions_first_or_null(&p_subpic->regions); return p_region != NULL && SubsdelayIsTextEmpty( p_region ); } @@ -1152,7 +1152,7 @@ static subpicture_t *SubpicClone( subpicture_t *p_source, subpicture_updater_t * *****************************************************************************/ static void SubpicDestroyClone( subpicture_t *p_subpic ) { - vlc_list_init(&p_subpic->regions); /* don't destroy region */ + vlc_spu_regions_init(&p_subpic->regions); /* don't destroy region */ subpicture_Delete( p_subpic ); } @@ -1179,7 +1179,7 @@ static vlc_tick_t SubsdelayEstimateDelay( filter_t *p_filter, subsdelay_heap_ent if( p_entry->p_subpic ) { subpicture_region_t *p_region = - vlc_list_first_entry_or_null( &p_entry->p_subpic->regions, subpicture_region_t, node ); + vlc_spu_regions_first_or_null( &p_entry->p_subpic->regions ); if( p_region && ( p_region->p_text ) ) { //FIXME: We only use a single segment here diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c index 7e1b1d097e..29fd031d70 100644 --- a/modules/video_output/android/display.c +++ b/modules/video_output/android/display.c @@ -132,7 +132,7 @@ static bool subpicture_NeedDraw(vout_display_t *vd, subpicture_t *subpicture) subpicture_region_t *r; size_t count = 0; - vlc_list_foreach(r, &subpicture->regions, node) + vlc_spu_regions_foreach(r, &subpicture->regions) count++; if (subpicture->i_order != sub->last_order) @@ -147,7 +147,7 @@ static bool subpicture_NeedDraw(vout_display_t *vd, subpicture_t *subpicture) if (count == sub->regions.size) { size_t i = 0; - vlc_list_foreach(r, &subpicture->regions, node) + vlc_spu_regions_foreach(r, &subpicture->regions) { struct sub_region *cmp = &sub->regions.data[i++]; if (cmp->x != r->i_x || cmp->y != r->i_y @@ -177,7 +177,7 @@ end: sub->regions.size = 0; - vlc_list_foreach(r, &subpicture->regions, node) + vlc_spu_regions_foreach(r, &subpicture->regions) { struct sub_region reg = { .x = r->i_x, diff --git a/modules/video_output/apple/VLCSampleBufferDisplay.m b/modules/video_output/apple/VLCSampleBufferDisplay.m index 2dddcedd98..39b5accf47 100644 --- a/modules/video_output/apple/VLCSampleBufferDisplay.m +++ b/modules/video_output/apple/VLCSampleBufferDisplay.m @@ -433,7 +433,7 @@ static void UpdateSubpictureRegions(vout_display_t *vd, NSMutableArray *regions = [NSMutableArray new]; CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB(); subpicture_region_t *r; - vlc_list_foreach(r, &subpicture->regions, node) { + vlc_spu_regions_foreach(r, &subpicture->regions) { CFIndex length = r->fmt.i_height * r->p_picture->p->i_pitch; const size_t pixels_offset = r->fmt.i_y_offset * r->p_picture->p->i_pitch + @@ -481,7 +481,7 @@ static bool IsSubpictureDrawNeeded(vout_display_t *vd, subpicture_t *subpicture) size_t count = 0; subpicture_region_t *r; - vlc_list_foreach(r, &subpicture->regions, node) + vlc_spu_regions_foreach(r, &subpicture->regions) count++; if (!sys.subpicture || subpicture->i_order != sys.subpicture.order) @@ -499,7 +499,7 @@ static bool IsSubpictureDrawNeeded(vout_display_t *vd, subpicture_t *subpicture) if (count == sys.subpicture.regions.count) { size_t i = 0; - vlc_list_foreach(r, &subpicture->regions, node) + vlc_spu_regions_foreach(r, &subpicture->regions) { VLCSampleBufferSubpictureRegion *region = sys.subpicture.regions[i++]; diff --git a/modules/video_output/libplacebo/display.c b/modules/video_output/libplacebo/display.c index 4acf3a8265..64aa7e5172 100644 --- a/modules/video_output/libplacebo/display.c +++ b/modules/video_output/libplacebo/display.c @@ -366,7 +366,7 @@ static void PictureRender(vout_display_t *vd, picture_t *pic, if (subpicture) { int num_regions = 0; subpicture_region_t *r; - vlc_list_foreach(r, &subpicture->regions, node) + vlc_spu_regions_foreach(r, &subpicture->regions) num_regions++; // Grow the overlays array if needed @@ -388,7 +388,7 @@ static void PictureRender(vout_display_t *vd, picture_t *pic, // Upload all of the regions int i = 0; - vlc_list_foreach(r, &subpicture->regions, node) { + vlc_spu_regions_foreach(r, &subpicture->regions) { assert(r->p_picture->i_planes == 1); struct pl_plane_data subdata[4]; if (!vlc_placebo_PlaneData(r->p_picture, subdata, NULL)) diff --git a/modules/video_output/opengl/sub_renderer.c b/modules/video_output/opengl/sub_renderer.c index a6fd498dd5..da30502ff7 100644 --- a/modules/video_output/opengl/sub_renderer.c +++ b/modules/video_output/opengl/sub_renderer.c @@ -232,7 +232,7 @@ vlc_gl_sub_renderer_Prepare(struct vlc_gl_sub_renderer *sr, subpicture_t *subpic if (subpicture) { int count = 0; subpicture_region_t *r; - vlc_list_foreach(r, &subpicture->regions, node) + vlc_spu_regions_foreach(r, &subpicture->regions) count++; gl_region_t *regions = calloc(count, sizeof(*regions)); @@ -243,7 +243,7 @@ vlc_gl_sub_renderer_Prepare(struct vlc_gl_sub_renderer *sr, subpicture_t *subpic sr->regions = regions; int i = 0; - vlc_list_foreach(r, &subpicture->regions, node) { + vlc_spu_regions_foreach(r, &subpicture->regions) { gl_region_t *glr = &sr->regions[i]; glr->width = r->fmt.i_visible_width; diff --git a/modules/video_output/win32/direct3d11.cpp b/modules/video_output/win32/direct3d11.cpp index e76af10ea3..e46e78a107 100644 --- a/modules/video_output/win32/direct3d11.cpp +++ b/modules/video_output/win32/direct3d11.cpp @@ -1284,7 +1284,7 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co int count = 0; subpicture_region_t *r; - vlc_list_foreach(r, &subpicture->regions, node) + vlc_spu_regions_foreach(r, &subpicture->regions) count++; *region = static_cast(calloc(count, sizeof(picture_t *))); @@ -1293,7 +1293,7 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co *subpicture_region_count = count; int i = 0; - vlc_list_foreach(r, &subpicture->regions, node) { + vlc_spu_regions_foreach(r, &subpicture->regions) { if (!r->fmt.i_visible_width || !r->fmt.i_visible_height) { i++; diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c index d36836e306..8196c0419a 100644 --- a/modules/video_output/win32/direct3d9.c +++ b/modules/video_output/win32/direct3d9.c @@ -874,7 +874,7 @@ static void Direct3D9ImportSubpicture(vout_display_t *vd, size_t count = 0; subpicture_region_t *r; - vlc_list_foreach(r, &subpicture->regions, node) + vlc_spu_regions_foreach(r, &subpicture->regions) count++; *count_ptr = count; @@ -885,7 +885,7 @@ static void Direct3D9ImportSubpicture(vout_display_t *vd, } int i = 0; - vlc_list_foreach(r, &subpicture->regions, node) { + vlc_spu_regions_foreach(r, &subpicture->regions) { d3d_region_t *d3dr = &(*region)[i]; HRESULT hr; diff --git a/modules/video_output/xcb/render.c b/modules/video_output/xcb/render.c index 3b37060dfd..c9f03ad411 100644 --- a/modules/video_output/xcb/render.c +++ b/modules/video_output/xcb/render.c @@ -236,7 +236,7 @@ static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t *subpic, if (subpic != NULL) { subpicture_region_t *r; - vlc_list_foreach(r, &subpic->regions, node) + vlc_spu_regions_foreach(r, &subpic->regions) RenderRegion(vd, subpic, r); } diff --git a/src/misc/subpicture.c b/src/misc/subpicture.c index 649b8f7b31..b7fa83b114 100644 --- a/src/misc/subpicture.c +++ b/src/misc/subpicture.c @@ -51,7 +51,7 @@ subpicture_t *subpicture_New( const subpicture_updater_t *p_upd ) p_subpic->b_fade = false; p_subpic->b_subtitle = false; p_subpic->i_alpha = 0xFF; - vlc_list_init(&p_subpic->regions); + vlc_spu_regions_init(&p_subpic->regions); if( p_upd ) { @@ -316,9 +316,9 @@ void subpicture_region_Delete( subpicture_region_t *p_region ) void vlc_spu_regions_Clear( vlc_spu_regions *regions ) { subpicture_region_t *p_head; - vlc_list_foreach(p_head, regions, node) + vlc_spu_regions_foreach(p_head, regions) { - vlc_list_remove( &p_head->node ); + vlc_spu_regions_remove( regions, p_head ); subpicture_region_Delete( p_head ); } } @@ -333,7 +333,7 @@ unsigned picture_BlendSubpicture(picture_t *dst, assert(src && !src->b_fade && src->b_absolute); subpicture_region_t *r; - vlc_list_foreach(r, &src->regions, node) { + vlc_spu_regions_foreach(r, &src->regions) { assert(r->p_picture && r->i_align == 0); if (filter_ConfigureBlend(blend, dst->format.i_width, dst->format.i_height, &r->fmt) diff --git a/src/video_output/video_epg.c b/src/video_output/video_epg.c index 186c00717f..6936638db2 100644 --- a/src/video_output/video_epg.c +++ b/src/video_output/video_epg.c @@ -328,7 +328,7 @@ static void vout_FillRightPanel(epg_spu_updater_sys_t *p_sys, height * EPGOSD_TEXTSIZE_NAME, 0x00ffffff); if(last) - vlc_list_append(&last->node, regions); + vlc_spu_regions_push(regions, last); const vlc_epg_event_t *p_current = p_sys->epg->p_current; vlc_epg_event_t *p_next = NULL; @@ -355,7 +355,7 @@ static void vout_FillRightPanel(epg_spu_updater_sys_t *p_sys, { /* region rendering limits */ vout_OSDRegionConstrain(last, width, 0); - vlc_list_append(&last->node, regions); + vlc_spu_regions_push(regions, last); } } @@ -370,7 +370,7 @@ static void vout_FillRightPanel(epg_spu_updater_sys_t *p_sys, { /* region rendering limits */ vout_OSDRegionConstrain(last, width, 0); - vlc_list_append(&last->node, regions); + vlc_spu_regions_push(regions, last); } } @@ -387,7 +387,7 @@ static void vout_FillRightPanel(epg_spu_updater_sys_t *p_sys, height * OSDEPG_ROWS(1), f_progress); if (last) - vlc_list_append(&last->node, regions); + vlc_spu_regions_push(regions, last); /* Format the hours */ if(p_sys->time) @@ -404,7 +404,7 @@ static void vout_FillRightPanel(epg_spu_updater_sys_t *p_sys, if(last) { last->i_align = SUBPICTURE_ALIGN_TOP|SUBPICTURE_ALIGN_RIGHT; - vlc_list_append(&last->node, regions); + vlc_spu_regions_push(regions, last); } } } @@ -426,7 +426,7 @@ static void vout_BuildOSDEpg(epg_spu_updater_sys_t *p_sys, visible_height * OSDEPG_HEIGHT, ARGB_BGCOLOR); if(last) - vlc_list_append(&last->node, regions); + vlc_spu_regions_push(regions, last); struct { @@ -467,7 +467,7 @@ static void vout_BuildOSDEpg(epg_spu_updater_sys_t *p_sys, logo.h, 0xFF000000 | RGB_COLOR1); if(last) - vlc_list_append(&last->node, regions); + vlc_spu_regions_push(regions, last); int logo_padding = visible_height * (OSDEPG_LOGO_SIZE * OSDEPG_PADDING); last = vout_OSDImage( p_sys->obj, @@ -477,7 +477,7 @@ static void vout_BuildOSDEpg(epg_spu_updater_sys_t *p_sys, logo.h - 2 * logo_padding, p_sys->art ); if(last) - vlc_list_append(&last->node, regions); + vlc_spu_regions_push(regions, last); /* shrink */ panel.x += logo.w + i_padding; diff --git a/src/video_output/video_text.c b/src/video_output/video_text.c index c3d7f319c6..b47d496aa9 100644 --- a/src/video_output/video_text.c +++ b/src/video_output/video_text.c @@ -69,7 +69,7 @@ static void OSDTextUpdate(subpicture_t *subpic, subpicture_region_t *r = subpicture_region_NewText(); if (!r) return; - vlc_list_append(&r->node, &subpic->regions); + vlc_spu_regions_push(&subpic->regions, r); r->fmt.i_sar_num = 1; r->fmt.i_sar_den = 1; diff --git a/src/video_output/video_widgets.c b/src/video_output/video_widgets.c index 1e5bae1951..31b075c147 100644 --- a/src/video_output/video_widgets.c +++ b/src/video_output/video_widgets.c @@ -290,7 +290,7 @@ static void OSDWidgetUpdate(subpicture_t *subpic, else p_region = OSDIcon(sys->type, &fmt); if (p_region) - vlc_list_append(&p_region->node, &subpic->regions); + vlc_spu_regions_push(&subpic->regions, p_region); } static void OSDWidgetDestroy(subpicture_t *subpic) diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c index 314535f296..638b9d04ab 100644 --- a/src/video_output/vout_subpictures.c +++ b/src/video_output/vout_subpictures.c @@ -1151,7 +1151,7 @@ static subpicture_t *SpuRenderSubpictures(spu_t *spu, size_t count = 0; subpicture_region_t *p_head; - vlc_list_foreach(p_head, &subpic->regions, node) + vlc_spu_regions_foreach(p_head, &subpic->regions) count++; if (subpic->b_subtitle) @@ -1185,7 +1185,7 @@ static subpicture_t *SpuRenderSubpictures(spu_t *spu, subpicture_t *subpic = entry->subpic; subpicture_region_t *region; - if (vlc_list_is_empty(&subpic->regions)) + if (vlc_spu_regions_is_empty(&subpic->regions)) continue; if (subpic->i_original_picture_width == 0 || @@ -1209,7 +1209,7 @@ static subpicture_t *SpuRenderSubpictures(spu_t *spu, * We always transform non absolute subtitle into absolute one on the * first rendering to allow good subtitle overlap support. */ - vlc_list_foreach(region, &subpic->regions, node) { + vlc_spu_regions_foreach(region, &subpic->regions) { spu_area_t area; /* Compute region scale AR */ @@ -1277,7 +1277,7 @@ static subpicture_t *SpuRenderSubpictures(spu_t *spu, } } - vlc_list_append(&output_last_ptr->node, &output->regions); + vlc_spu_regions_push(&output->regions, output_last_ptr); } if (subpic->b_subtitle) { @@ -1290,7 +1290,7 @@ static subpicture_t *SpuRenderSubpictures(spu_t *spu, subtitle_area[subtitle_area_count++] = area; } } - if (subpic->b_subtitle && vlc_list_is_empty(&subpic->regions)) + if (subpic->b_subtitle && vlc_spu_regions_is_empty(&subpic->regions)) subpic->b_absolute = true; } @@ -1523,7 +1523,7 @@ static void spu_PrerenderText(spu_t *spu, subpicture_t *p_subpic, const unsigned i_original_picture_height = p_subpic->i_original_picture_height; subpicture_region_t *region; - vlc_list_foreach(region, &p_subpic->regions, node) + vlc_spu_regions_foreach(region, &p_subpic->regions) { if(!subpicture_region_IsText( region )) continue; @@ -1885,7 +1885,7 @@ void spu_PutSubpicture(spu_t *spu, subpicture_t *subpic) /* p_private is for spu only and cannot be non NULL here */ subpicture_region_t *r; - vlc_list_foreach(r, &subpic->regions, node) + vlc_spu_regions_foreach(r, &subpic->regions) assert(r->p_private == NULL); /* */ diff --git a/test/modules/video_output/opengl/sub_renderer.c b/test/modules/video_output/opengl/sub_renderer.c index 19b349491a..93662dcf1b 100644 --- a/test/modules/video_output/opengl/sub_renderer.c +++ b/test/modules/video_output/opengl/sub_renderer.c @@ -180,7 +180,7 @@ static void test_opengl_offscreen( subpicture_region_t *p_region = subpicture_region_ForPicture(&fmt, picture); assert(p_region != NULL); - vlc_list_append( &p_region->node, &subpicture->regions ); + vlc_spu_regions_push( &subpicture->regions, p_region ); ret = vlc_gl_sub_renderer_Prepare(sr, subpicture); assert(ret == VLC_SUCCESS); diff --git a/test/src/input/decoder/input_decoder_scenarios.c b/test/src/input/decoder/input_decoder_scenarios.c index 0fc05b6e18..c23acf4c16 100644 --- a/test/src/input/decoder/input_decoder_scenarios.c +++ b/test/src/input/decoder/input_decoder_scenarios.c @@ -484,7 +484,7 @@ static int cc_decoder_decode_common(decoder_t *dec, vlc_frame_t *in, subpicture_region_t *p_region = subpicture_region_NewText();; assert(p_region != NULL); - vlc_list_append( &p_region->node, &subpic->regions ); + vlc_spu_regions_push( &subpic->regions, p_region ); p_region->p_text = text_segment_New(text); assert(p_region->p_text != NULL);