Coverage Report

Created: 2025-12-31 07:55

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/vlc/modules/codec/substext.h
Line
Count
Source
1
/*****************************************************************************
2
 * subsdec.c : text subtitle decoder
3
 *****************************************************************************
4
 * Copyright © 2011-2015 VLC authors and VideoLAN
5
 *
6
 * Authors: Laurent Aimer <fenrir@videolan.org>
7
 *          Jean-Baptiste Kempf <jb@videolan.org>
8
 *
9
 * This program is free software; you can redistribute it and/or modify it
10
 * under the terms of the GNU Lesser General Public License as published by
11
 * the Free Software Foundation; either version 2.1 of the License, or
12
 * (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
 * GNU Lesser General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Lesser General Public License
20
 * along with this program; if not, write to the Free Software Foundation,
21
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22
 *****************************************************************************/
23
24
#include <vlc_strings.h>
25
#include <vlc_text_style.h>
26
#include <vlc_subpicture.h>
27
28
typedef struct substext_updater_region_t substext_updater_region_t;
29
30
enum substext_updater_region_flags_e
31
{
32
    UPDT_REGION_ORIGIN_X_IS_RATIO      = 1 << 0,
33
    UPDT_REGION_ORIGIN_Y_IS_RATIO      = 1 << 1,
34
    UPDT_REGION_EXTENT_X_IS_RATIO      = 1 << 2,
35
    UPDT_REGION_EXTENT_Y_IS_RATIO      = 1 << 3,
36
    UPDT_REGION_IGNORE_BACKGROUND      = 1 << 4,
37
    UPDT_REGION_USES_GRID_COORDINATES  = 1 << 5,
38
    UPDT_REGION_FIXED_DONE             = 1 << 31,
39
};
40
41
struct substext_updater_region_t
42
{
43
    struct
44
    {
45
        float x;
46
        float y;
47
    } origin, extent;
48
    /* store above percentile meanings as modifier flags */
49
    int flags; /* subpicture_updater_sys_region_flags_e */
50
    int align; /* alignment of the region itself */
51
    bool b_absolute;  /**< position is absolute in the movie */
52
    bool b_in_window; /**< position the region in whole window */
53
    int inner_align; /* alignment of content inside the region */
54
    text_style_t *p_region_style;
55
    text_segment_t *p_segments;
56
    substext_updater_region_t *p_next;
57
};
58
59
typedef struct
60
{
61
    /* a min of one region */
62
    substext_updater_region_t region;
63
64
    /* styling */
65
    text_style_t *p_default_style; /* decoder (full or partial) defaults */
66
    float margin_ratio;
67
    vlc_tick_t i_next_update;
68
    bool b_blink_even;
69
} subtext_updater_sys_t;
70
71
static inline void SubpictureUpdaterSysRegionClean(substext_updater_region_t *p_updtregion)
72
465k
{
73
465k
    text_segment_ChainDelete( p_updtregion->p_segments );
74
465k
    text_style_Delete( p_updtregion->p_region_style );
75
465k
}
substtml.c:SubpictureUpdaterSysRegionClean
Line
Count
Source
72
33.8k
{
73
33.8k
    text_segment_ChainDelete( p_updtregion->p_segments );
74
33.8k
    text_style_Delete( p_updtregion->p_region_style );
75
33.8k
}
subsvtt.c:SubpictureUpdaterSysRegionClean
Line
Count
Source
72
24.8k
{
73
24.8k
    text_segment_ChainDelete( p_updtregion->p_segments );
74
24.8k
    text_style_Delete( p_updtregion->p_region_style );
75
24.8k
}
cc.c:SubpictureUpdaterSysRegionClean
Line
Count
Source
72
17.8k
{
73
17.8k
    text_segment_ChainDelete( p_updtregion->p_segments );
74
17.8k
    text_style_Delete( p_updtregion->p_region_style );
75
17.8k
}
Unexecuted instantiation: cea708.c:SubpictureUpdaterSysRegionClean
Unexecuted instantiation: scte18.c:SubpictureUpdaterSysRegionClean
Unexecuted instantiation: stl.c:SubpictureUpdaterSysRegionClean
subsdec.c:SubpictureUpdaterSysRegionClean
Line
Count
Source
72
369k
{
73
369k
    text_segment_ChainDelete( p_updtregion->p_segments );
74
369k
    text_style_Delete( p_updtregion->p_region_style );
75
369k
}
Unexecuted instantiation: textst.c:SubpictureUpdaterSysRegionClean
substx3g.c:SubpictureUpdaterSysRegionClean
Line
Count
Source
72
19.6k
{
73
19.6k
    text_segment_ChainDelete( p_updtregion->p_segments );
74
19.6k
    text_style_Delete( p_updtregion->p_region_style );
75
19.6k
}
76
77
static inline void SubpictureUpdaterSysRegionInit(substext_updater_region_t *p_updtregion)
78
465k
{
79
465k
    memset(p_updtregion, 0, sizeof(*p_updtregion));
80
465k
    p_updtregion->align = SUBPICTURE_ALIGN_BOTTOM;
81
465k
    p_updtregion->b_absolute = false;
82
465k
    p_updtregion->b_in_window = false;
83
465k
    p_updtregion->inner_align = 0 ; // centered
84
465k
}
substtml.c:SubpictureUpdaterSysRegionInit
Line
Count
Source
78
33.8k
{
79
33.8k
    memset(p_updtregion, 0, sizeof(*p_updtregion));
80
33.8k
    p_updtregion->align = SUBPICTURE_ALIGN_BOTTOM;
81
33.8k
    p_updtregion->b_absolute = false;
82
    p_updtregion->b_in_window = false;
83
33.8k
    p_updtregion->inner_align = 0 ; // centered
84
33.8k
}
subsvtt.c:SubpictureUpdaterSysRegionInit
Line
Count
Source
78
24.8k
{
79
24.8k
    memset(p_updtregion, 0, sizeof(*p_updtregion));
80
24.8k
    p_updtregion->align = SUBPICTURE_ALIGN_BOTTOM;
81
24.8k
    p_updtregion->b_absolute = false;
82
    p_updtregion->b_in_window = false;
83
24.8k
    p_updtregion->inner_align = 0 ; // centered
84
24.8k
}
cc.c:SubpictureUpdaterSysRegionInit
Line
Count
Source
78
17.8k
{
79
17.8k
    memset(p_updtregion, 0, sizeof(*p_updtregion));
80
17.8k
    p_updtregion->align = SUBPICTURE_ALIGN_BOTTOM;
81
17.8k
    p_updtregion->b_absolute = false;
82
    p_updtregion->b_in_window = false;
83
17.8k
    p_updtregion->inner_align = 0 ; // centered
84
17.8k
}
Unexecuted instantiation: cea708.c:SubpictureUpdaterSysRegionInit
Unexecuted instantiation: scte18.c:SubpictureUpdaterSysRegionInit
Unexecuted instantiation: stl.c:SubpictureUpdaterSysRegionInit
subsdec.c:SubpictureUpdaterSysRegionInit
Line
Count
Source
78
369k
{
79
369k
    memset(p_updtregion, 0, sizeof(*p_updtregion));
80
369k
    p_updtregion->align = SUBPICTURE_ALIGN_BOTTOM;
81
369k
    p_updtregion->b_absolute = false;
82
    p_updtregion->b_in_window = false;
83
369k
    p_updtregion->inner_align = 0 ; // centered
84
369k
}
Unexecuted instantiation: textst.c:SubpictureUpdaterSysRegionInit
substx3g.c:SubpictureUpdaterSysRegionInit
Line
Count
Source
78
19.6k
{
79
19.6k
    memset(p_updtregion, 0, sizeof(*p_updtregion));
80
19.6k
    p_updtregion->align = SUBPICTURE_ALIGN_BOTTOM;
81
19.6k
    p_updtregion->b_absolute = false;
82
    p_updtregion->b_in_window = false;
83
19.6k
    p_updtregion->inner_align = 0 ; // centered
84
19.6k
}
85
86
static inline substext_updater_region_t *SubpictureUpdaterSysRegionNew( void )
87
30.0k
{
88
30.0k
    substext_updater_region_t *p_region = malloc(sizeof(*p_region));
89
30.0k
    if(p_region)
90
30.0k
        SubpictureUpdaterSysRegionInit(p_region);
91
30.0k
    return p_region;
92
30.0k
}
substtml.c:SubpictureUpdaterSysRegionNew
Line
Count
Source
87
10.6k
{
88
10.6k
    substext_updater_region_t *p_region = malloc(sizeof(*p_region));
89
10.6k
    if(p_region)
90
10.6k
        SubpictureUpdaterSysRegionInit(p_region);
91
10.6k
    return p_region;
92
10.6k
}
subsvtt.c:SubpictureUpdaterSysRegionNew
Line
Count
Source
87
18.7k
{
88
18.7k
    substext_updater_region_t *p_region = malloc(sizeof(*p_region));
89
18.7k
    if(p_region)
90
18.7k
        SubpictureUpdaterSysRegionInit(p_region);
91
18.7k
    return p_region;
92
18.7k
}
cc.c:SubpictureUpdaterSysRegionNew
Line
Count
Source
87
656
{
88
656
    substext_updater_region_t *p_region = malloc(sizeof(*p_region));
89
656
    if(p_region)
90
656
        SubpictureUpdaterSysRegionInit(p_region);
91
656
    return p_region;
92
656
}
Unexecuted instantiation: cea708.c:SubpictureUpdaterSysRegionNew
Unexecuted instantiation: scte18.c:SubpictureUpdaterSysRegionNew
Unexecuted instantiation: stl.c:SubpictureUpdaterSysRegionNew
Unexecuted instantiation: subsdec.c:SubpictureUpdaterSysRegionNew
Unexecuted instantiation: textst.c:SubpictureUpdaterSysRegionNew
Unexecuted instantiation: substx3g.c:SubpictureUpdaterSysRegionNew
93
94
static inline void SubpictureUpdaterSysRegionAdd(substext_updater_region_t *p_prev,
95
                                                 substext_updater_region_t *p_new)
96
30.0k
{
97
30.0k
    substext_updater_region_t **pp_next = &p_prev->p_next;
98
64.9k
    for(; *pp_next; pp_next = &(*pp_next)->p_next);
99
30.0k
    *pp_next = p_new;
100
30.0k
}
substtml.c:SubpictureUpdaterSysRegionAdd
Line
Count
Source
96
10.6k
{
97
10.6k
    substext_updater_region_t **pp_next = &p_prev->p_next;
98
45.5k
    for(; *pp_next; pp_next = &(*pp_next)->p_next);
99
10.6k
    *pp_next = p_new;
100
10.6k
}
subsvtt.c:SubpictureUpdaterSysRegionAdd
Line
Count
Source
96
18.7k
{
97
18.7k
    substext_updater_region_t **pp_next = &p_prev->p_next;
98
18.7k
    for(; *pp_next; pp_next = &(*pp_next)->p_next);
99
18.7k
    *pp_next = p_new;
100
18.7k
}
cc.c:SubpictureUpdaterSysRegionAdd
Line
Count
Source
96
656
{
97
656
    substext_updater_region_t **pp_next = &p_prev->p_next;
98
656
    for(; *pp_next; pp_next = &(*pp_next)->p_next);
99
656
    *pp_next = p_new;
100
656
}
Unexecuted instantiation: cea708.c:SubpictureUpdaterSysRegionAdd
Unexecuted instantiation: scte18.c:SubpictureUpdaterSysRegionAdd
Unexecuted instantiation: stl.c:SubpictureUpdaterSysRegionAdd
Unexecuted instantiation: subsdec.c:SubpictureUpdaterSysRegionAdd
Unexecuted instantiation: textst.c:SubpictureUpdaterSysRegionAdd
Unexecuted instantiation: substx3g.c:SubpictureUpdaterSysRegionAdd
101
102
static void SubpictureTextUpdate(subpicture_t *subpic,
103
                                 const struct vlc_spu_updater_configuration *cfg)
104
0
{
105
0
    subtext_updater_sys_t *sys = subpic->updater.sys;
106
0
    const video_format_t *fmt_src = cfg->video_src;
107
0
    const video_format_t *fmt_dst = cfg->video_dst;
108
109
0
    if (fmt_src->i_visible_height == cfg->prev_src->i_visible_height &&
110
0
        video_format_IsSimilar(cfg->prev_dst, fmt_dst) &&
111
0
        (sys->i_next_update == VLC_TICK_INVALID || sys->i_next_update > cfg->pts))
112
0
        return;
113
114
0
    substext_updater_region_t *p_updtregion = &sys->region;
115
116
0
    if (!(p_updtregion->flags & UPDT_REGION_FIXED_DONE) &&
117
0
        p_updtregion->b_absolute && !vlc_spu_regions_is_empty(&subpic->regions) &&
118
0
        subpic->i_original_picture_width > 0 &&
119
0
        subpic->i_original_picture_height > 0)
120
0
    {
121
0
        subpicture_region_t *p_region =
122
0
            vlc_spu_regions_first_or_null(&subpic->regions);
123
0
        p_updtregion->flags |= UPDT_REGION_FIXED_DONE;
124
0
        p_updtregion->origin.x = p_region->i_x;
125
0
        p_updtregion->origin.y = p_region->i_y;
126
0
        p_updtregion->extent.x = subpic->i_original_picture_width;
127
0
        p_updtregion->extent.y = subpic->i_original_picture_height;
128
0
        p_updtregion->flags &= ~(UPDT_REGION_ORIGIN_X_IS_RATIO|UPDT_REGION_ORIGIN_Y_IS_RATIO|
129
0
                                 UPDT_REGION_EXTENT_X_IS_RATIO|UPDT_REGION_EXTENT_Y_IS_RATIO);
130
0
    }
131
0
    vlc_spu_regions_Clear( &subpic->regions );
132
133
0
    assert(fmt_dst->i_sar_num && fmt_dst->i_sar_den);
134
135
0
    vlc_rational_t sar;
136
137
    /* NOTE about fmt_dst:
138
     * fmt_dst area and A/R will change to display once WxH of the
139
     * display is greater than the source video in direct rendering.
140
     * This will cause weird sudded region "moves" or "linebreaks" when
141
     * resizing window, mostly vertically.
142
     * see changes by 4a49754d943560fe79bc42f107d8ce566ea24898 */
143
144
0
    if( sys->region.flags & UPDT_REGION_USES_GRID_COORDINATES )
145
0
    {
146
0
        sar.num = 4;
147
0
        sar.den = 3;
148
0
    }
149
0
    else
150
0
    {
151
0
        sar.num = 1;
152
0
        sar.den = 1;
153
0
    }
154
155
0
    if ( p_updtregion->b_in_window )
156
0
    {
157
0
        subpic->i_original_picture_width  = cfg->display_width;
158
0
        subpic->i_original_picture_height = cfg->display_height;
159
0
    }
160
0
    else if( sys->region.flags & UPDT_REGION_USES_GRID_COORDINATES )
161
0
    {
162
0
        subpic->i_original_picture_width  = fmt_dst->i_visible_height * sar.num / sar.den;
163
0
        subpic->i_original_picture_height = fmt_dst->i_visible_height;
164
0
    }
165
0
    else
166
0
    {
167
0
        subpic->i_original_picture_width  = fmt_dst->i_width * fmt_dst->i_sar_num / fmt_dst->i_sar_den;
168
0
        subpic->i_original_picture_height = fmt_dst->i_height;
169
0
    }
170
171
0
    bool b_schedule_blink_update = false;
172
173
0
    video_format_t render_fmt = *fmt_dst;
174
0
    if (p_updtregion->b_in_window)
175
0
    {
176
0
        render_fmt.i_x_offset = render_fmt.i_y_offset = 0;
177
0
        render_fmt.i_width  = render_fmt.i_visible_width  = cfg->display_width;
178
0
        render_fmt.i_height = render_fmt.i_visible_height = cfg->display_height;
179
0
    }
180
181
0
    for( substext_updater_region_t *update_region = &sys->region;
182
0
                                    update_region; update_region = update_region->p_next )
183
0
    {
184
0
        subpicture_region_t *r = subpicture_region_NewText();
185
0
        if (!r)
186
0
            return;
187
0
        vlc_spu_regions_push(&subpic->regions, r);
188
0
        r->fmt.i_sar_num = sar.num;
189
0
        r->fmt.i_sar_den = sar.den;
190
191
0
        r->p_text = text_segment_Copy( update_region->p_segments );
192
0
        r->b_absolute = update_region->b_absolute;
193
0
        r->b_in_window = update_region->b_in_window;
194
0
        r->i_align = update_region->align;
195
0
        r->text_flags |= update_region->inner_align & SUBPICTURE_ALIGN_MASK;
196
0
        if (update_region->flags & UPDT_REGION_IGNORE_BACKGROUND)
197
0
            r->text_flags |= VLC_SUBPIC_TEXT_FLAG_NO_REGION_BG;
198
0
        bool b_gridmode = (update_region->flags & UPDT_REGION_USES_GRID_COORDINATES) != 0;
199
0
        if (b_gridmode)
200
0
            r->text_flags |= VLC_SUBPIC_TEXT_FLAG_GRID_MODE;
201
202
0
        if (!(update_region->flags & UPDT_REGION_FIXED_DONE))
203
0
        {
204
0
            const float margin_ratio = sys->margin_ratio;
205
0
            const int   margin_h     = margin_ratio * ( b_gridmode ? subpic->i_original_picture_width
206
0
                                                                   : render_fmt.i_visible_width );
207
0
            const int   margin_v     = margin_ratio * render_fmt.i_visible_height;
208
209
            /* subpic invisible margins sizes */
210
0
            const int outerright_h = render_fmt.i_width - (render_fmt.i_visible_width + render_fmt.i_x_offset);
211
0
            const int outerbottom_v = render_fmt.i_height - (render_fmt.i_visible_height + render_fmt.i_y_offset);
212
            /* regions usable */
213
0
            const int inner_w = render_fmt.i_visible_width - margin_h * 2;
214
0
            const int inner_h = render_fmt.i_visible_height - margin_v * 2;
215
216
0
            if (r->i_align & SUBPICTURE_ALIGN_LEFT)
217
0
                r->i_x = margin_h + render_fmt.i_x_offset;
218
0
            else if (r->i_align & SUBPICTURE_ALIGN_RIGHT)
219
0
                r->i_x = margin_h + outerright_h;
220
0
            else
221
0
                r->i_x = 0;
222
223
0
            if (r->i_align & SUBPICTURE_ALIGN_TOP )
224
0
                r->i_y = margin_v + render_fmt.i_y_offset;
225
0
            else if (r->i_align & SUBPICTURE_ALIGN_BOTTOM )
226
0
                r->i_y = margin_v + outerbottom_v;
227
0
            else
228
0
                r->i_y = 0;
229
230
0
            if( update_region->flags & UPDT_REGION_ORIGIN_X_IS_RATIO )
231
0
                r->i_x += update_region->origin.x * inner_w;
232
0
            else
233
0
                r->i_x += update_region->origin.x;
234
235
0
            if( update_region->flags & UPDT_REGION_ORIGIN_Y_IS_RATIO )
236
0
                r->i_y += update_region->origin.y * inner_h;
237
0
            else
238
0
                r->i_y += update_region->origin.y;
239
240
0
            if( update_region->flags & UPDT_REGION_EXTENT_X_IS_RATIO )
241
0
                r->i_max_width += update_region->extent.x * inner_w;
242
0
            else
243
0
                r->i_max_width += update_region->extent.x;
244
245
0
            if( update_region->flags & UPDT_REGION_EXTENT_Y_IS_RATIO )
246
0
                r->i_max_height += update_region->extent.y * inner_h;
247
0
            else
248
0
                r->i_max_height += update_region->extent.y;
249
250
0
        } else {
251
            /* FIXME it doesn't adapt on crop settings changes */
252
0
            r->i_x = update_region->origin.x * render_fmt.i_width  / update_region->extent.x;
253
0
            r->i_y = update_region->origin.y * render_fmt.i_height / update_region->extent.y;
254
0
        }
255
256
        /* Add missing default style, if any, to all segments */
257
0
        for ( text_segment_t* p_segment = r->p_text; p_segment; p_segment = p_segment->p_next )
258
0
        {
259
            /* Add decoder defaults */
260
0
            if( p_segment->style )
261
0
                text_style_Merge( p_segment->style, sys->p_default_style, false );
262
0
            else
263
0
                p_segment->style = text_style_Duplicate( sys->p_default_style );
264
265
0
            if( p_segment->style )
266
0
            {
267
                /* Update all segments font sizes in video source %,
268
                 * so we can handle HiDPI properly and have consistent rendering limits */
269
0
                 if( p_segment->style->i_font_size > 0 && fmt_src->i_visible_height > 0 )
270
0
                {
271
0
                    p_segment->style->f_font_relsize = 100.0 * p_segment->style->i_font_size / fmt_src->i_visible_height;
272
0
                    p_segment->style->i_font_size = 0;
273
0
                }
274
275
0
                if( p_segment->style->i_style_flags & (STYLE_BLINK_BACKGROUND|STYLE_BLINK_FOREGROUND) )
276
0
                {
277
0
                    if( sys->b_blink_even ) /* do nothing at first */
278
0
                    {
279
0
                        if( p_segment->style->i_style_flags & STYLE_BLINK_BACKGROUND )
280
0
                            p_segment->style->i_background_alpha =
281
0
                                    (~p_segment->style->i_background_alpha) & 0xFF;
282
0
                        if( p_segment->style->i_style_flags & STYLE_BLINK_FOREGROUND )
283
0
                            p_segment->style->i_font_alpha =
284
0
                                    (~p_segment->style->i_font_alpha) & 0xFF;
285
0
                    }
286
0
                    b_schedule_blink_update = true;
287
0
                }
288
0
            }
289
0
        }
290
0
    }
291
292
0
    if( b_schedule_blink_update &&
293
0
        (sys->i_next_update == VLC_TICK_INVALID || sys->i_next_update < cfg->pts) )
294
0
    {
295
0
        sys->i_next_update = cfg->pts + VLC_TICK_FROM_SEC(1);
296
0
        sys->b_blink_even = !sys->b_blink_even;
297
0
    }
298
0
}
Unexecuted instantiation: substtml.c:SubpictureTextUpdate
Unexecuted instantiation: subsvtt.c:SubpictureTextUpdate
Unexecuted instantiation: cc.c:SubpictureTextUpdate
Unexecuted instantiation: cea708.c:SubpictureTextUpdate
Unexecuted instantiation: scte18.c:SubpictureTextUpdate
Unexecuted instantiation: stl.c:SubpictureTextUpdate
Unexecuted instantiation: subsdec.c:SubpictureTextUpdate
Unexecuted instantiation: textst.c:SubpictureTextUpdate
Unexecuted instantiation: substx3g.c:SubpictureTextUpdate
299
static void SubpictureTextDestroy(subpicture_t *subpic)
300
418k
{
301
418k
    subtext_updater_sys_t *sys = subpic->updater.sys;
302
303
418k
    SubpictureUpdaterSysRegionClean( &sys->region );
304
418k
    substext_updater_region_t *p_region = sys->region.p_next;
305
448k
    while( p_region )
306
30.0k
    {
307
30.0k
        substext_updater_region_t *p_next = p_region->p_next;
308
30.0k
        SubpictureUpdaterSysRegionClean( p_region );
309
30.0k
        free( p_region );
310
30.0k
        p_region = p_next;
311
30.0k
    }
312
418k
    text_style_Delete( sys->p_default_style );
313
418k
    free(sys);
314
418k
}
substtml.c:SubpictureTextDestroy
Line
Count
Source
300
6.32k
{
301
6.32k
    subtext_updater_sys_t *sys = subpic->updater.sys;
302
303
6.32k
    SubpictureUpdaterSysRegionClean( &sys->region );
304
6.32k
    substext_updater_region_t *p_region = sys->region.p_next;
305
16.9k
    while( p_region )
306
10.6k
    {
307
10.6k
        substext_updater_region_t *p_next = p_region->p_next;
308
10.6k
        SubpictureUpdaterSysRegionClean( p_region );
309
10.6k
        free( p_region );
310
10.6k
        p_region = p_next;
311
10.6k
    }
312
6.32k
    text_style_Delete( sys->p_default_style );
313
6.32k
    free(sys);
314
6.32k
}
subsvtt.c:SubpictureTextDestroy
Line
Count
Source
300
6.05k
{
301
6.05k
    subtext_updater_sys_t *sys = subpic->updater.sys;
302
303
6.05k
    SubpictureUpdaterSysRegionClean( &sys->region );
304
6.05k
    substext_updater_region_t *p_region = sys->region.p_next;
305
24.8k
    while( p_region )
306
18.7k
    {
307
18.7k
        substext_updater_region_t *p_next = p_region->p_next;
308
18.7k
        SubpictureUpdaterSysRegionClean( p_region );
309
18.7k
        free( p_region );
310
18.7k
        p_region = p_next;
311
18.7k
    }
312
6.05k
    text_style_Delete( sys->p_default_style );
313
6.05k
    free(sys);
314
6.05k
}
cc.c:SubpictureTextDestroy
Line
Count
Source
300
17.1k
{
301
17.1k
    subtext_updater_sys_t *sys = subpic->updater.sys;
302
303
17.1k
    SubpictureUpdaterSysRegionClean( &sys->region );
304
17.1k
    substext_updater_region_t *p_region = sys->region.p_next;
305
17.8k
    while( p_region )
306
656
    {
307
656
        substext_updater_region_t *p_next = p_region->p_next;
308
656
        SubpictureUpdaterSysRegionClean( p_region );
309
656
        free( p_region );
310
656
        p_region = p_next;
311
656
    }
312
17.1k
    text_style_Delete( sys->p_default_style );
313
17.1k
    free(sys);
314
17.1k
}
Unexecuted instantiation: cea708.c:SubpictureTextDestroy
Unexecuted instantiation: scte18.c:SubpictureTextDestroy
Unexecuted instantiation: stl.c:SubpictureTextDestroy
subsdec.c:SubpictureTextDestroy
Line
Count
Source
300
369k
{
301
369k
    subtext_updater_sys_t *sys = subpic->updater.sys;
302
303
369k
    SubpictureUpdaterSysRegionClean( &sys->region );
304
369k
    substext_updater_region_t *p_region = sys->region.p_next;
305
369k
    while( p_region )
306
0
    {
307
0
        substext_updater_region_t *p_next = p_region->p_next;
308
0
        SubpictureUpdaterSysRegionClean( p_region );
309
0
        free( p_region );
310
0
        p_region = p_next;
311
0
    }
312
369k
    text_style_Delete( sys->p_default_style );
313
369k
    free(sys);
314
369k
}
Unexecuted instantiation: textst.c:SubpictureTextDestroy
substx3g.c:SubpictureTextDestroy
Line
Count
Source
300
19.6k
{
301
19.6k
    subtext_updater_sys_t *sys = subpic->updater.sys;
302
303
19.6k
    SubpictureUpdaterSysRegionClean( &sys->region );
304
19.6k
    substext_updater_region_t *p_region = sys->region.p_next;
305
19.6k
    while( p_region )
306
0
    {
307
0
        substext_updater_region_t *p_next = p_region->p_next;
308
0
        SubpictureUpdaterSysRegionClean( p_region );
309
0
        free( p_region );
310
0
        p_region = p_next;
311
0
    }
312
19.6k
    text_style_Delete( sys->p_default_style );
313
19.6k
    free(sys);
314
19.6k
}
315
316
static inline subpicture_t *decoder_NewSubpictureText(decoder_t *decoder)
317
418k
{
318
418k
    subtext_updater_sys_t *sys = calloc(1, sizeof(*sys));
319
320
418k
    static const struct vlc_spu_updater_ops spu_ops =
321
418k
    {
322
418k
        .update   = SubpictureTextUpdate,
323
418k
        .destroy  = SubpictureTextDestroy,
324
418k
    };
325
326
418k
    subpicture_updater_t updater = {
327
418k
        .sys = sys,
328
418k
        .ops = &spu_ops,
329
418k
    };
330
331
418k
    SubpictureUpdaterSysRegionInit( &sys->region );
332
418k
    sys->margin_ratio = 0.04f;
333
418k
    sys->p_default_style = text_style_Create( STYLE_NO_DEFAULTS );
334
418k
    if(unlikely(!sys->p_default_style))
335
0
    {
336
0
        free(sys);
337
0
        return NULL;
338
0
    }
339
418k
    subpicture_t *subpic = decoder_NewSubpicture(decoder, &updater);
340
418k
    if (!subpic)
341
0
    {
342
0
        text_style_Delete(sys->p_default_style);
343
0
        free(sys);
344
0
        return NULL;
345
0
    }
346
418k
    sys->region.b_absolute = true; sys->region.b_in_window = false;
347
    sys->i_next_update = VLC_TICK_INVALID;
348
418k
    return subpic;
349
418k
}
substtml.c:decoder_NewSubpictureText
Line
Count
Source
317
6.32k
{
318
6.32k
    subtext_updater_sys_t *sys = calloc(1, sizeof(*sys));
319
320
6.32k
    static const struct vlc_spu_updater_ops spu_ops =
321
6.32k
    {
322
6.32k
        .update   = SubpictureTextUpdate,
323
6.32k
        .destroy  = SubpictureTextDestroy,
324
6.32k
    };
325
326
6.32k
    subpicture_updater_t updater = {
327
6.32k
        .sys = sys,
328
6.32k
        .ops = &spu_ops,
329
6.32k
    };
330
331
6.32k
    SubpictureUpdaterSysRegionInit( &sys->region );
332
6.32k
    sys->margin_ratio = 0.04f;
333
6.32k
    sys->p_default_style = text_style_Create( STYLE_NO_DEFAULTS );
334
6.32k
    if(unlikely(!sys->p_default_style))
335
0
    {
336
0
        free(sys);
337
0
        return NULL;
338
0
    }
339
6.32k
    subpicture_t *subpic = decoder_NewSubpicture(decoder, &updater);
340
6.32k
    if (!subpic)
341
0
    {
342
0
        text_style_Delete(sys->p_default_style);
343
0
        free(sys);
344
0
        return NULL;
345
0
    }
346
6.32k
    sys->region.b_absolute = true; sys->region.b_in_window = false;
347
    sys->i_next_update = VLC_TICK_INVALID;
348
6.32k
    return subpic;
349
6.32k
}
subsvtt.c:decoder_NewSubpictureText
Line
Count
Source
317
6.05k
{
318
6.05k
    subtext_updater_sys_t *sys = calloc(1, sizeof(*sys));
319
320
6.05k
    static const struct vlc_spu_updater_ops spu_ops =
321
6.05k
    {
322
6.05k
        .update   = SubpictureTextUpdate,
323
6.05k
        .destroy  = SubpictureTextDestroy,
324
6.05k
    };
325
326
6.05k
    subpicture_updater_t updater = {
327
6.05k
        .sys = sys,
328
6.05k
        .ops = &spu_ops,
329
6.05k
    };
330
331
6.05k
    SubpictureUpdaterSysRegionInit( &sys->region );
332
6.05k
    sys->margin_ratio = 0.04f;
333
6.05k
    sys->p_default_style = text_style_Create( STYLE_NO_DEFAULTS );
334
6.05k
    if(unlikely(!sys->p_default_style))
335
0
    {
336
0
        free(sys);
337
0
        return NULL;
338
0
    }
339
6.05k
    subpicture_t *subpic = decoder_NewSubpicture(decoder, &updater);
340
6.05k
    if (!subpic)
341
0
    {
342
0
        text_style_Delete(sys->p_default_style);
343
0
        free(sys);
344
0
        return NULL;
345
0
    }
346
6.05k
    sys->region.b_absolute = true; sys->region.b_in_window = false;
347
    sys->i_next_update = VLC_TICK_INVALID;
348
6.05k
    return subpic;
349
6.05k
}
cc.c:decoder_NewSubpictureText
Line
Count
Source
317
17.1k
{
318
17.1k
    subtext_updater_sys_t *sys = calloc(1, sizeof(*sys));
319
320
17.1k
    static const struct vlc_spu_updater_ops spu_ops =
321
17.1k
    {
322
17.1k
        .update   = SubpictureTextUpdate,
323
17.1k
        .destroy  = SubpictureTextDestroy,
324
17.1k
    };
325
326
17.1k
    subpicture_updater_t updater = {
327
17.1k
        .sys = sys,
328
17.1k
        .ops = &spu_ops,
329
17.1k
    };
330
331
17.1k
    SubpictureUpdaterSysRegionInit( &sys->region );
332
17.1k
    sys->margin_ratio = 0.04f;
333
17.1k
    sys->p_default_style = text_style_Create( STYLE_NO_DEFAULTS );
334
17.1k
    if(unlikely(!sys->p_default_style))
335
0
    {
336
0
        free(sys);
337
0
        return NULL;
338
0
    }
339
17.1k
    subpicture_t *subpic = decoder_NewSubpicture(decoder, &updater);
340
17.1k
    if (!subpic)
341
0
    {
342
0
        text_style_Delete(sys->p_default_style);
343
0
        free(sys);
344
0
        return NULL;
345
0
    }
346
17.1k
    sys->region.b_absolute = true; sys->region.b_in_window = false;
347
    sys->i_next_update = VLC_TICK_INVALID;
348
17.1k
    return subpic;
349
17.1k
}
Unexecuted instantiation: cea708.c:decoder_NewSubpictureText
Unexecuted instantiation: scte18.c:decoder_NewSubpictureText
Unexecuted instantiation: stl.c:decoder_NewSubpictureText
subsdec.c:decoder_NewSubpictureText
Line
Count
Source
317
369k
{
318
369k
    subtext_updater_sys_t *sys = calloc(1, sizeof(*sys));
319
320
369k
    static const struct vlc_spu_updater_ops spu_ops =
321
369k
    {
322
369k
        .update   = SubpictureTextUpdate,
323
369k
        .destroy  = SubpictureTextDestroy,
324
369k
    };
325
326
369k
    subpicture_updater_t updater = {
327
369k
        .sys = sys,
328
369k
        .ops = &spu_ops,
329
369k
    };
330
331
369k
    SubpictureUpdaterSysRegionInit( &sys->region );
332
369k
    sys->margin_ratio = 0.04f;
333
369k
    sys->p_default_style = text_style_Create( STYLE_NO_DEFAULTS );
334
369k
    if(unlikely(!sys->p_default_style))
335
0
    {
336
0
        free(sys);
337
0
        return NULL;
338
0
    }
339
369k
    subpicture_t *subpic = decoder_NewSubpicture(decoder, &updater);
340
369k
    if (!subpic)
341
0
    {
342
0
        text_style_Delete(sys->p_default_style);
343
0
        free(sys);
344
0
        return NULL;
345
0
    }
346
369k
    sys->region.b_absolute = true; sys->region.b_in_window = false;
347
    sys->i_next_update = VLC_TICK_INVALID;
348
369k
    return subpic;
349
369k
}
Unexecuted instantiation: textst.c:decoder_NewSubpictureText
substx3g.c:decoder_NewSubpictureText
Line
Count
Source
317
19.6k
{
318
19.6k
    subtext_updater_sys_t *sys = calloc(1, sizeof(*sys));
319
320
19.6k
    static const struct vlc_spu_updater_ops spu_ops =
321
19.6k
    {
322
19.6k
        .update   = SubpictureTextUpdate,
323
19.6k
        .destroy  = SubpictureTextDestroy,
324
19.6k
    };
325
326
19.6k
    subpicture_updater_t updater = {
327
19.6k
        .sys = sys,
328
19.6k
        .ops = &spu_ops,
329
19.6k
    };
330
331
19.6k
    SubpictureUpdaterSysRegionInit( &sys->region );
332
19.6k
    sys->margin_ratio = 0.04f;
333
19.6k
    sys->p_default_style = text_style_Create( STYLE_NO_DEFAULTS );
334
19.6k
    if(unlikely(!sys->p_default_style))
335
0
    {
336
0
        free(sys);
337
0
        return NULL;
338
0
    }
339
19.6k
    subpicture_t *subpic = decoder_NewSubpicture(decoder, &updater);
340
19.6k
    if (!subpic)
341
0
    {
342
0
        text_style_Delete(sys->p_default_style);
343
0
        free(sys);
344
0
        return NULL;
345
0
    }
346
19.6k
    sys->region.b_absolute = true; sys->region.b_in_window = false;
347
    sys->i_next_update = VLC_TICK_INVALID;
348
19.6k
    return subpic;
349
19.6k
}