Coverage Report

Created: 2026-02-26 08:10

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
1.03M
{
73
1.03M
    text_segment_ChainDelete( p_updtregion->p_segments );
74
1.03M
    text_style_Delete( p_updtregion->p_region_style );
75
1.03M
}
substtml.c:SubpictureUpdaterSysRegionClean
Line
Count
Source
72
43.9k
{
73
43.9k
    text_segment_ChainDelete( p_updtregion->p_segments );
74
43.9k
    text_style_Delete( p_updtregion->p_region_style );
75
43.9k
}
subsvtt.c:SubpictureUpdaterSysRegionClean
Line
Count
Source
72
48.1k
{
73
48.1k
    text_segment_ChainDelete( p_updtregion->p_segments );
74
48.1k
    text_style_Delete( p_updtregion->p_region_style );
75
48.1k
}
cc.c:SubpictureUpdaterSysRegionClean
Line
Count
Source
72
30.7k
{
73
30.7k
    text_segment_ChainDelete( p_updtregion->p_segments );
74
30.7k
    text_style_Delete( p_updtregion->p_region_style );
75
30.7k
}
Unexecuted instantiation: cea708.c:SubpictureUpdaterSysRegionClean
Unexecuted instantiation: scte18.c:SubpictureUpdaterSysRegionClean
Unexecuted instantiation: stl.c:SubpictureUpdaterSysRegionClean
subsdec.c:SubpictureUpdaterSysRegionClean
Line
Count
Source
72
903k
{
73
903k
    text_segment_ChainDelete( p_updtregion->p_segments );
74
903k
    text_style_Delete( p_updtregion->p_region_style );
75
903k
}
Unexecuted instantiation: textst.c:SubpictureUpdaterSysRegionClean
substx3g.c:SubpictureUpdaterSysRegionClean
Line
Count
Source
72
7.28k
{
73
7.28k
    text_segment_ChainDelete( p_updtregion->p_segments );
74
7.28k
    text_style_Delete( p_updtregion->p_region_style );
75
7.28k
}
76
77
static inline void SubpictureUpdaterSysRegionInit(substext_updater_region_t *p_updtregion)
78
1.03M
{
79
1.03M
    memset(p_updtregion, 0, sizeof(*p_updtregion));
80
1.03M
    p_updtregion->align = SUBPICTURE_ALIGN_BOTTOM;
81
1.03M
    p_updtregion->b_absolute = false;
82
1.03M
    p_updtregion->b_in_window = false;
83
1.03M
    p_updtregion->inner_align = 0 ; // centered
84
1.03M
}
substtml.c:SubpictureUpdaterSysRegionInit
Line
Count
Source
78
43.9k
{
79
43.9k
    memset(p_updtregion, 0, sizeof(*p_updtregion));
80
43.9k
    p_updtregion->align = SUBPICTURE_ALIGN_BOTTOM;
81
43.9k
    p_updtregion->b_absolute = false;
82
    p_updtregion->b_in_window = false;
83
43.9k
    p_updtregion->inner_align = 0 ; // centered
84
43.9k
}
subsvtt.c:SubpictureUpdaterSysRegionInit
Line
Count
Source
78
48.1k
{
79
48.1k
    memset(p_updtregion, 0, sizeof(*p_updtregion));
80
48.1k
    p_updtregion->align = SUBPICTURE_ALIGN_BOTTOM;
81
48.1k
    p_updtregion->b_absolute = false;
82
    p_updtregion->b_in_window = false;
83
48.1k
    p_updtregion->inner_align = 0 ; // centered
84
48.1k
}
cc.c:SubpictureUpdaterSysRegionInit
Line
Count
Source
78
30.7k
{
79
30.7k
    memset(p_updtregion, 0, sizeof(*p_updtregion));
80
30.7k
    p_updtregion->align = SUBPICTURE_ALIGN_BOTTOM;
81
30.7k
    p_updtregion->b_absolute = false;
82
    p_updtregion->b_in_window = false;
83
30.7k
    p_updtregion->inner_align = 0 ; // centered
84
30.7k
}
Unexecuted instantiation: cea708.c:SubpictureUpdaterSysRegionInit
Unexecuted instantiation: scte18.c:SubpictureUpdaterSysRegionInit
Unexecuted instantiation: stl.c:SubpictureUpdaterSysRegionInit
subsdec.c:SubpictureUpdaterSysRegionInit
Line
Count
Source
78
903k
{
79
903k
    memset(p_updtregion, 0, sizeof(*p_updtregion));
80
903k
    p_updtregion->align = SUBPICTURE_ALIGN_BOTTOM;
81
903k
    p_updtregion->b_absolute = false;
82
    p_updtregion->b_in_window = false;
83
903k
    p_updtregion->inner_align = 0 ; // centered
84
903k
}
Unexecuted instantiation: textst.c:SubpictureUpdaterSysRegionInit
substx3g.c:SubpictureUpdaterSysRegionInit
Line
Count
Source
78
7.28k
{
79
7.28k
    memset(p_updtregion, 0, sizeof(*p_updtregion));
80
7.28k
    p_updtregion->align = SUBPICTURE_ALIGN_BOTTOM;
81
7.28k
    p_updtregion->b_absolute = false;
82
    p_updtregion->b_in_window = false;
83
7.28k
    p_updtregion->inner_align = 0 ; // centered
84
7.28k
}
85
86
static inline substext_updater_region_t *SubpictureUpdaterSysRegionNew( void )
87
40.2k
{
88
40.2k
    substext_updater_region_t *p_region = malloc(sizeof(*p_region));
89
40.2k
    if(p_region)
90
40.2k
        SubpictureUpdaterSysRegionInit(p_region);
91
40.2k
    return p_region;
92
40.2k
}
substtml.c:SubpictureUpdaterSysRegionNew
Line
Count
Source
87
11.3k
{
88
11.3k
    substext_updater_region_t *p_region = malloc(sizeof(*p_region));
89
11.3k
    if(p_region)
90
11.3k
        SubpictureUpdaterSysRegionInit(p_region);
91
11.3k
    return p_region;
92
11.3k
}
subsvtt.c:SubpictureUpdaterSysRegionNew
Line
Count
Source
87
27.5k
{
88
27.5k
    substext_updater_region_t *p_region = malloc(sizeof(*p_region));
89
27.5k
    if(p_region)
90
27.5k
        SubpictureUpdaterSysRegionInit(p_region);
91
27.5k
    return p_region;
92
27.5k
}
cc.c:SubpictureUpdaterSysRegionNew
Line
Count
Source
87
1.29k
{
88
1.29k
    substext_updater_region_t *p_region = malloc(sizeof(*p_region));
89
1.29k
    if(p_region)
90
1.29k
        SubpictureUpdaterSysRegionInit(p_region);
91
1.29k
    return p_region;
92
1.29k
}
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
40.2k
{
97
40.2k
    substext_updater_region_t **pp_next = &p_prev->p_next;
98
54.0k
    for(; *pp_next; pp_next = &(*pp_next)->p_next);
99
40.2k
    *pp_next = p_new;
100
40.2k
}
substtml.c:SubpictureUpdaterSysRegionAdd
Line
Count
Source
96
11.3k
{
97
11.3k
    substext_updater_region_t **pp_next = &p_prev->p_next;
98
25.2k
    for(; *pp_next; pp_next = &(*pp_next)->p_next);
99
11.3k
    *pp_next = p_new;
100
11.3k
}
subsvtt.c:SubpictureUpdaterSysRegionAdd
Line
Count
Source
96
27.5k
{
97
27.5k
    substext_updater_region_t **pp_next = &p_prev->p_next;
98
27.5k
    for(; *pp_next; pp_next = &(*pp_next)->p_next);
99
27.5k
    *pp_next = p_new;
100
27.5k
}
cc.c:SubpictureUpdaterSysRegionAdd
Line
Count
Source
96
1.29k
{
97
1.29k
    substext_updater_region_t **pp_next = &p_prev->p_next;
98
1.29k
    for(; *pp_next; pp_next = &(*pp_next)->p_next);
99
1.29k
    *pp_next = p_new;
100
1.29k
}
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
971k
{
301
971k
    subtext_updater_sys_t *sys = subpic->updater.sys;
302
303
971k
    SubpictureUpdaterSysRegionClean( &sys->region );
304
971k
    substext_updater_region_t *p_region = sys->region.p_next;
305
1.01M
    while( p_region )
306
40.2k
    {
307
40.2k
        substext_updater_region_t *p_next = p_region->p_next;
308
40.2k
        SubpictureUpdaterSysRegionClean( p_region );
309
40.2k
        free( p_region );
310
40.2k
        p_region = p_next;
311
40.2k
    }
312
971k
    text_style_Delete( sys->p_default_style );
313
971k
    free(sys);
314
971k
}
substtml.c:SubpictureTextDestroy
Line
Count
Source
300
10.6k
{
301
10.6k
    subtext_updater_sys_t *sys = subpic->updater.sys;
302
303
10.6k
    SubpictureUpdaterSysRegionClean( &sys->region );
304
10.6k
    substext_updater_region_t *p_region = sys->region.p_next;
305
21.9k
    while( p_region )
306
11.3k
    {
307
11.3k
        substext_updater_region_t *p_next = p_region->p_next;
308
11.3k
        SubpictureUpdaterSysRegionClean( p_region );
309
11.3k
        free( p_region );
310
11.3k
        p_region = p_next;
311
11.3k
    }
312
10.6k
    text_style_Delete( sys->p_default_style );
313
10.6k
    free(sys);
314
10.6k
}
subsvtt.c:SubpictureTextDestroy
Line
Count
Source
300
20.6k
{
301
20.6k
    subtext_updater_sys_t *sys = subpic->updater.sys;
302
303
20.6k
    SubpictureUpdaterSysRegionClean( &sys->region );
304
20.6k
    substext_updater_region_t *p_region = sys->region.p_next;
305
48.1k
    while( p_region )
306
27.5k
    {
307
27.5k
        substext_updater_region_t *p_next = p_region->p_next;
308
27.5k
        SubpictureUpdaterSysRegionClean( p_region );
309
27.5k
        free( p_region );
310
27.5k
        p_region = p_next;
311
27.5k
    }
312
20.6k
    text_style_Delete( sys->p_default_style );
313
20.6k
    free(sys);
314
20.6k
}
cc.c:SubpictureTextDestroy
Line
Count
Source
300
29.4k
{
301
29.4k
    subtext_updater_sys_t *sys = subpic->updater.sys;
302
303
29.4k
    SubpictureUpdaterSysRegionClean( &sys->region );
304
29.4k
    substext_updater_region_t *p_region = sys->region.p_next;
305
30.7k
    while( p_region )
306
1.29k
    {
307
1.29k
        substext_updater_region_t *p_next = p_region->p_next;
308
1.29k
        SubpictureUpdaterSysRegionClean( p_region );
309
1.29k
        free( p_region );
310
1.29k
        p_region = p_next;
311
1.29k
    }
312
29.4k
    text_style_Delete( sys->p_default_style );
313
29.4k
    free(sys);
314
29.4k
}
Unexecuted instantiation: cea708.c:SubpictureTextDestroy
Unexecuted instantiation: scte18.c:SubpictureTextDestroy
Unexecuted instantiation: stl.c:SubpictureTextDestroy
subsdec.c:SubpictureTextDestroy
Line
Count
Source
300
903k
{
301
903k
    subtext_updater_sys_t *sys = subpic->updater.sys;
302
303
903k
    SubpictureUpdaterSysRegionClean( &sys->region );
304
903k
    substext_updater_region_t *p_region = sys->region.p_next;
305
903k
    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
903k
    text_style_Delete( sys->p_default_style );
313
903k
    free(sys);
314
903k
}
Unexecuted instantiation: textst.c:SubpictureTextDestroy
substx3g.c:SubpictureTextDestroy
Line
Count
Source
300
7.28k
{
301
7.28k
    subtext_updater_sys_t *sys = subpic->updater.sys;
302
303
7.28k
    SubpictureUpdaterSysRegionClean( &sys->region );
304
7.28k
    substext_updater_region_t *p_region = sys->region.p_next;
305
7.28k
    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
7.28k
    text_style_Delete( sys->p_default_style );
313
7.28k
    free(sys);
314
7.28k
}
315
316
static inline subpicture_t *decoder_NewSubpictureText(decoder_t *decoder)
317
971k
{
318
971k
    subtext_updater_sys_t *sys = calloc(1, sizeof(*sys));
319
320
971k
    static const struct vlc_spu_updater_ops spu_ops =
321
971k
    {
322
971k
        .update   = SubpictureTextUpdate,
323
971k
        .destroy  = SubpictureTextDestroy,
324
971k
    };
325
326
971k
    subpicture_updater_t updater = {
327
971k
        .sys = sys,
328
971k
        .ops = &spu_ops,
329
971k
    };
330
331
971k
    SubpictureUpdaterSysRegionInit( &sys->region );
332
971k
    sys->margin_ratio = 0.04f;
333
971k
    sys->p_default_style = text_style_Create( STYLE_NO_DEFAULTS );
334
971k
    if(unlikely(!sys->p_default_style))
335
0
    {
336
0
        free(sys);
337
0
        return NULL;
338
0
    }
339
971k
    subpicture_t *subpic = decoder_NewSubpicture(decoder, &updater);
340
971k
    if (!subpic)
341
0
    {
342
0
        text_style_Delete(sys->p_default_style);
343
0
        free(sys);
344
0
        return NULL;
345
0
    }
346
971k
    sys->region.b_absolute = true; sys->region.b_in_window = false;
347
    sys->i_next_update = VLC_TICK_INVALID;
348
971k
    return subpic;
349
971k
}
substtml.c:decoder_NewSubpictureText
Line
Count
Source
317
10.6k
{
318
10.6k
    subtext_updater_sys_t *sys = calloc(1, sizeof(*sys));
319
320
10.6k
    static const struct vlc_spu_updater_ops spu_ops =
321
10.6k
    {
322
10.6k
        .update   = SubpictureTextUpdate,
323
10.6k
        .destroy  = SubpictureTextDestroy,
324
10.6k
    };
325
326
10.6k
    subpicture_updater_t updater = {
327
10.6k
        .sys = sys,
328
10.6k
        .ops = &spu_ops,
329
10.6k
    };
330
331
10.6k
    SubpictureUpdaterSysRegionInit( &sys->region );
332
10.6k
    sys->margin_ratio = 0.04f;
333
10.6k
    sys->p_default_style = text_style_Create( STYLE_NO_DEFAULTS );
334
10.6k
    if(unlikely(!sys->p_default_style))
335
0
    {
336
0
        free(sys);
337
0
        return NULL;
338
0
    }
339
10.6k
    subpicture_t *subpic = decoder_NewSubpicture(decoder, &updater);
340
10.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
10.6k
    sys->region.b_absolute = true; sys->region.b_in_window = false;
347
    sys->i_next_update = VLC_TICK_INVALID;
348
10.6k
    return subpic;
349
10.6k
}
subsvtt.c:decoder_NewSubpictureText
Line
Count
Source
317
20.6k
{
318
20.6k
    subtext_updater_sys_t *sys = calloc(1, sizeof(*sys));
319
320
20.6k
    static const struct vlc_spu_updater_ops spu_ops =
321
20.6k
    {
322
20.6k
        .update   = SubpictureTextUpdate,
323
20.6k
        .destroy  = SubpictureTextDestroy,
324
20.6k
    };
325
326
20.6k
    subpicture_updater_t updater = {
327
20.6k
        .sys = sys,
328
20.6k
        .ops = &spu_ops,
329
20.6k
    };
330
331
20.6k
    SubpictureUpdaterSysRegionInit( &sys->region );
332
20.6k
    sys->margin_ratio = 0.04f;
333
20.6k
    sys->p_default_style = text_style_Create( STYLE_NO_DEFAULTS );
334
20.6k
    if(unlikely(!sys->p_default_style))
335
0
    {
336
0
        free(sys);
337
0
        return NULL;
338
0
    }
339
20.6k
    subpicture_t *subpic = decoder_NewSubpicture(decoder, &updater);
340
20.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
20.6k
    sys->region.b_absolute = true; sys->region.b_in_window = false;
347
    sys->i_next_update = VLC_TICK_INVALID;
348
20.6k
    return subpic;
349
20.6k
}
cc.c:decoder_NewSubpictureText
Line
Count
Source
317
29.4k
{
318
29.4k
    subtext_updater_sys_t *sys = calloc(1, sizeof(*sys));
319
320
29.4k
    static const struct vlc_spu_updater_ops spu_ops =
321
29.4k
    {
322
29.4k
        .update   = SubpictureTextUpdate,
323
29.4k
        .destroy  = SubpictureTextDestroy,
324
29.4k
    };
325
326
29.4k
    subpicture_updater_t updater = {
327
29.4k
        .sys = sys,
328
29.4k
        .ops = &spu_ops,
329
29.4k
    };
330
331
29.4k
    SubpictureUpdaterSysRegionInit( &sys->region );
332
29.4k
    sys->margin_ratio = 0.04f;
333
29.4k
    sys->p_default_style = text_style_Create( STYLE_NO_DEFAULTS );
334
29.4k
    if(unlikely(!sys->p_default_style))
335
0
    {
336
0
        free(sys);
337
0
        return NULL;
338
0
    }
339
29.4k
    subpicture_t *subpic = decoder_NewSubpicture(decoder, &updater);
340
29.4k
    if (!subpic)
341
0
    {
342
0
        text_style_Delete(sys->p_default_style);
343
0
        free(sys);
344
0
        return NULL;
345
0
    }
346
29.4k
    sys->region.b_absolute = true; sys->region.b_in_window = false;
347
    sys->i_next_update = VLC_TICK_INVALID;
348
29.4k
    return subpic;
349
29.4k
}
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
903k
{
318
903k
    subtext_updater_sys_t *sys = calloc(1, sizeof(*sys));
319
320
903k
    static const struct vlc_spu_updater_ops spu_ops =
321
903k
    {
322
903k
        .update   = SubpictureTextUpdate,
323
903k
        .destroy  = SubpictureTextDestroy,
324
903k
    };
325
326
903k
    subpicture_updater_t updater = {
327
903k
        .sys = sys,
328
903k
        .ops = &spu_ops,
329
903k
    };
330
331
903k
    SubpictureUpdaterSysRegionInit( &sys->region );
332
903k
    sys->margin_ratio = 0.04f;
333
903k
    sys->p_default_style = text_style_Create( STYLE_NO_DEFAULTS );
334
903k
    if(unlikely(!sys->p_default_style))
335
0
    {
336
0
        free(sys);
337
0
        return NULL;
338
0
    }
339
903k
    subpicture_t *subpic = decoder_NewSubpicture(decoder, &updater);
340
903k
    if (!subpic)
341
0
    {
342
0
        text_style_Delete(sys->p_default_style);
343
0
        free(sys);
344
0
        return NULL;
345
0
    }
346
903k
    sys->region.b_absolute = true; sys->region.b_in_window = false;
347
    sys->i_next_update = VLC_TICK_INVALID;
348
903k
    return subpic;
349
903k
}
Unexecuted instantiation: textst.c:decoder_NewSubpictureText
substx3g.c:decoder_NewSubpictureText
Line
Count
Source
317
7.28k
{
318
7.28k
    subtext_updater_sys_t *sys = calloc(1, sizeof(*sys));
319
320
7.28k
    static const struct vlc_spu_updater_ops spu_ops =
321
7.28k
    {
322
7.28k
        .update   = SubpictureTextUpdate,
323
7.28k
        .destroy  = SubpictureTextDestroy,
324
7.28k
    };
325
326
7.28k
    subpicture_updater_t updater = {
327
7.28k
        .sys = sys,
328
7.28k
        .ops = &spu_ops,
329
7.28k
    };
330
331
7.28k
    SubpictureUpdaterSysRegionInit( &sys->region );
332
7.28k
    sys->margin_ratio = 0.04f;
333
7.28k
    sys->p_default_style = text_style_Create( STYLE_NO_DEFAULTS );
334
7.28k
    if(unlikely(!sys->p_default_style))
335
0
    {
336
0
        free(sys);
337
0
        return NULL;
338
0
    }
339
7.28k
    subpicture_t *subpic = decoder_NewSubpicture(decoder, &updater);
340
7.28k
    if (!subpic)
341
0
    {
342
0
        text_style_Delete(sys->p_default_style);
343
0
        free(sys);
344
0
        return NULL;
345
0
    }
346
7.28k
    sys->region.b_absolute = true; sys->region.b_in_window = false;
347
    sys->i_next_update = VLC_TICK_INVALID;
348
7.28k
    return subpic;
349
7.28k
}