Coverage Report

Created: 2026-10-17 07:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/vlc/modules/codec/cc.h
Line
Count
Source
1
/*****************************************************************************
2
 * cc.h
3
 *****************************************************************************
4
 * Copyright (C) 2007 Laurent Aimar
5
 *
6
 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
7
 *
8
 * This program is free software; you can redistribute it and/or modify it
9
 * under the terms of the GNU Lesser General Public License as published by
10
 * the Free Software Foundation; either version 2.1 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
 * GNU Lesser General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Lesser General Public License
19
 * along with this program; if not, write to the Free Software Foundation,
20
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21
 *****************************************************************************/
22
23
#ifndef VLC_CC_H_
24
#define VLC_CC_H_
25
26
#include <vlc_bits.h>
27
28
372k
#define CC_PKT_BYTE0(field) (0xFC | (0x03 & field))
29
30
/* CC have a maximum rate of 9600 bit/s (per field?) */
31
#define CC_MAX_DATA_SIZE (2 * 3*600)
32
enum cc_payload_type_e
33
{
34
    CC_PAYLOAD_NONE,
35
    CC_PAYLOAD_RAW,
36
    CC_PAYLOAD_GA94,
37
    CC_PAYLOAD_DVD,
38
    CC_PAYLOAD_REPLAYTV,
39
    CC_PAYLOAD_SCTE20,
40
    CC_PAYLOAD_CDP,
41
};
42
typedef struct
43
{
44
    /* Which channel are present */
45
    uint64_t i_708channels;
46
    uint8_t  i_608channels;
47
48
    /* */
49
    bool b_reorder;
50
    struct
51
    {
52
        uint8_t pktsize;
53
        uint8_t seq;
54
        uint8_t sid_bs;
55
        enum
56
        {
57
            CEA708_PKT_END,
58
            CEA708_PKT_WAIT_BLOCK_HEADER,
59
            CEA708_PKT_WAIT_EXT_BLOCK_HEADER,
60
            CEA708_PKT_IN_BLOCK,
61
        } state;
62
    } cea708;
63
64
    /* */
65
    enum cc_payload_type_e i_payload_type;
66
    int i_payload_other_count;
67
68
    /* CC data per field
69
     *  byte[x+0]: field (0/1)
70
     *  byte[x+1]: cc data 1
71
     *  byte[x+2]: cc data 2
72
     */
73
    size_t  i_data;
74
    uint8_t p_data[CC_MAX_DATA_SIZE];
75
} cc_data_t;
76
77
static inline void cc_Init( cc_data_t *c )
78
612k
{
79
612k
    c->i_608channels = 0;
80
612k
    c->i_708channels = 0;
81
612k
    c->i_data = 0;
82
612k
    c->b_reorder = false;
83
612k
    c->cea708.pktsize = 0;
84
612k
    c->cea708.seq = 0;
85
612k
    c->cea708.sid_bs = 0;
86
612k
    c->cea708.state = CEA708_PKT_END;
87
612k
    c->i_payload_type = CC_PAYLOAD_NONE;
88
612k
    c->i_payload_other_count = 0;
89
612k
}
Unexecuted instantiation: mp4.c:cc_Init
Unexecuted instantiation: ty.c:cc_Init
hxxx_common.c:cc_Init
Line
Count
Source
78
163k
{
79
163k
    c->i_608channels = 0;
80
163k
    c->i_708channels = 0;
81
163k
    c->i_data = 0;
82
    c->b_reorder = false;
83
163k
    c->cea708.pktsize = 0;
84
163k
    c->cea708.seq = 0;
85
163k
    c->cea708.sid_bs = 0;
86
163k
    c->cea708.state = CEA708_PKT_END;
87
163k
    c->i_payload_type = CC_PAYLOAD_NONE;
88
163k
    c->i_payload_other_count = 0;
89
163k
}
mpegvideo.c:cc_Init
Line
Count
Source
78
70.4k
{
79
70.4k
    c->i_608channels = 0;
80
70.4k
    c->i_708channels = 0;
81
70.4k
    c->i_data = 0;
82
    c->b_reorder = false;
83
70.4k
    c->cea708.pktsize = 0;
84
70.4k
    c->cea708.seq = 0;
85
70.4k
    c->cea708.sid_bs = 0;
86
70.4k
    c->cea708.state = CEA708_PKT_END;
87
70.4k
    c->i_payload_type = CC_PAYLOAD_NONE;
88
70.4k
    c->i_payload_other_count = 0;
89
70.4k
}
vc1.c:cc_Init
Line
Count
Source
78
11.1k
{
79
11.1k
    c->i_608channels = 0;
80
11.1k
    c->i_708channels = 0;
81
11.1k
    c->i_data = 0;
82
    c->b_reorder = false;
83
11.1k
    c->cea708.pktsize = 0;
84
11.1k
    c->cea708.seq = 0;
85
11.1k
    c->cea708.sid_bs = 0;
86
11.1k
    c->cea708.state = CEA708_PKT_END;
87
11.1k
    c->i_payload_type = CC_PAYLOAD_NONE;
88
11.1k
    c->i_payload_other_count = 0;
89
11.1k
}
dav1d.c:cc_Init
Line
Count
Source
78
21.2k
{
79
21.2k
    c->i_608channels = 0;
80
21.2k
    c->i_708channels = 0;
81
21.2k
    c->i_data = 0;
82
    c->b_reorder = false;
83
21.2k
    c->cea708.pktsize = 0;
84
21.2k
    c->cea708.seq = 0;
85
21.2k
    c->cea708.sid_bs = 0;
86
21.2k
    c->cea708.state = CEA708_PKT_END;
87
21.2k
    c->i_payload_type = CC_PAYLOAD_NONE;
88
21.2k
    c->i_payload_other_count = 0;
89
21.2k
}
video.c:cc_Init
Line
Count
Source
78
346k
{
79
346k
    c->i_608channels = 0;
80
346k
    c->i_708channels = 0;
81
346k
    c->i_data = 0;
82
    c->b_reorder = false;
83
346k
    c->cea708.pktsize = 0;
84
346k
    c->cea708.seq = 0;
85
346k
    c->cea708.sid_bs = 0;
86
346k
    c->cea708.state = CEA708_PKT_END;
87
346k
    c->i_payload_type = CC_PAYLOAD_NONE;
88
346k
    c->i_payload_other_count = 0;
89
346k
}
90
static inline void cc_Exit( cc_data_t *c )
91
174k
{
92
174k
    VLC_UNUSED(c);
93
174k
    return;
94
174k
}
Unexecuted instantiation: mp4.c:cc_Exit
Unexecuted instantiation: ty.c:cc_Exit
hxxx_common.c:cc_Exit
Line
Count
Source
91
163k
{
92
163k
    VLC_UNUSED(c);
93
163k
    return;
94
163k
}
Unexecuted instantiation: mpegvideo.c:cc_Exit
vc1.c:cc_Exit
Line
Count
Source
91
11.1k
{
92
11.1k
    VLC_UNUSED(c);
93
11.1k
    return;
94
11.1k
}
Unexecuted instantiation: dav1d.c:cc_Exit
Unexecuted instantiation: video.c:cc_Exit
95
static inline void cc_Flush( cc_data_t *c )
96
6.29M
{
97
6.29M
    c->i_data = 0;
98
6.29M
    c->cea708.state = CEA708_PKT_END;
99
6.29M
}
Unexecuted instantiation: mp4.c:cc_Flush
Unexecuted instantiation: ty.c:cc_Flush
hxxx_common.c:cc_Flush
Line
Count
Source
96
4.12M
{
97
4.12M
    c->i_data = 0;
98
4.12M
    c->cea708.state = CEA708_PKT_END;
99
4.12M
}
mpegvideo.c:cc_Flush
Line
Count
Source
96
767k
{
97
767k
    c->i_data = 0;
98
767k
    c->cea708.state = CEA708_PKT_END;
99
767k
}
vc1.c:cc_Flush
Line
Count
Source
96
992k
{
97
992k
    c->i_data = 0;
98
992k
    c->cea708.state = CEA708_PKT_END;
99
992k
}
dav1d.c:cc_Flush
Line
Count
Source
96
21.2k
{
97
21.2k
    c->i_data = 0;
98
21.2k
    c->cea708.state = CEA708_PKT_END;
99
21.2k
}
video.c:cc_Flush
Line
Count
Source
96
388k
{
97
388k
    c->i_data = 0;
98
388k
    c->cea708.state = CEA708_PKT_END;
99
388k
}
100
101
static inline void cc_ProbeCEA708OneByte( cc_data_t *c, bool b_start, const uint8_t cc )
102
1.66M
{
103
1.66M
    if( b_start )
104
518k
    {
105
518k
        const uint8_t i_pkt_sequence = cc >> 6;
106
518k
        if( i_pkt_sequence > 0 && ((c->cea708.seq + 1) % 4) != i_pkt_sequence )
107
261k
        {
108
261k
            c->cea708.pktsize = 0;
109
261k
            c->cea708.seq = i_pkt_sequence;
110
261k
            c->cea708.state = CEA708_PKT_END;
111
261k
        }
112
257k
        else
113
257k
        {
114
257k
            c->cea708.seq = i_pkt_sequence;
115
257k
            c->cea708.pktsize = cc & 63;
116
257k
            if( c->cea708.pktsize == 0 )
117
112k
                c->cea708.pktsize = 127;
118
144k
            else
119
144k
                c->cea708.pktsize = c->cea708.pktsize * 2 - 1;
120
257k
            c->cea708.state = CEA708_PKT_WAIT_BLOCK_HEADER;
121
257k
        }
122
518k
    }
123
1.14M
    else if( c->cea708.pktsize == 0 ) /* empty pkt reading service blocks */
124
338k
    {
125
338k
        c->cea708.state = CEA708_PKT_END;
126
338k
    }
127
805k
    else if( c->cea708.state != CEA708_PKT_END )
128
652k
    {
129
652k
        switch( c->cea708.state )
130
652k
        {
131
311k
            case CEA708_PKT_WAIT_BLOCK_HEADER: /* Byte is service block header */
132
311k
            {
133
311k
                uint8_t i_sid = cc >> 5;
134
311k
                c->cea708.sid_bs = cc & 0x1F;
135
311k
                if( i_sid != 0x00 && c->cea708.sid_bs != 0 )
136
187k
                {
137
187k
                    if( i_sid != 0x07 )
138
99.0k
                    {
139
99.0k
                        const uint8_t mask = (1 << --i_sid);
140
99.0k
                        c->i_708channels |= (mask + (mask - 1));
141
99.0k
                        c->cea708.state = CEA708_PKT_IN_BLOCK;
142
99.0k
                    }
143
88.7k
                    else if( c->cea708.sid_bs < 2 )
144
7.42k
                    {
145
7.42k
                        c->cea708.state = CEA708_PKT_END;
146
7.42k
                    }
147
81.2k
                    else
148
81.2k
                    {
149
                        /* need to look up next byte in next pkt */
150
81.2k
                        c->cea708.state = CEA708_PKT_WAIT_EXT_BLOCK_HEADER;
151
81.2k
                    }
152
187k
                }
153
123k
                else c->cea708.state = CEA708_PKT_END;
154
311k
            } break;
155
156
32.9k
            case CEA708_PKT_WAIT_EXT_BLOCK_HEADER:
157
32.9k
            {
158
32.9k
                uint8_t i_extsid = cc & 0x3F;
159
32.9k
                if( i_extsid >= 0x07 )
160
21.8k
                {
161
21.8k
                    const uint64_t mask = (INT64_C(1) << --i_extsid);
162
21.8k
                    c->i_708channels |= (mask + (mask - 1));
163
21.8k
                }
164
32.9k
                if( c->cea708.sid_bs == 0 )
165
0
                    c->cea708.state = CEA708_PKT_WAIT_BLOCK_HEADER;
166
32.9k
                else
167
32.9k
                    c->cea708.state = CEA708_PKT_IN_BLOCK;
168
32.9k
            } break;
169
170
307k
            case CEA708_PKT_IN_BLOCK:
171
307k
            {
172
307k
                c->cea708.sid_bs--;
173
307k
                if( c->cea708.sid_bs == 0 )
174
55.5k
                    c->cea708.state = CEA708_PKT_WAIT_BLOCK_HEADER;
175
307k
            } break;
176
177
0
            default:
178
0
                vlc_assert_unreachable();
179
0
                break;
180
652k
        }
181
652k
        c->cea708.pktsize--;
182
183
652k
        if(c->cea708.pktsize == 0)
184
38.6k
            c->cea708.state = CEA708_PKT_END;
185
652k
    }
186
1.66M
}
Unexecuted instantiation: mp4.c:cc_ProbeCEA708OneByte
Unexecuted instantiation: ty.c:cc_ProbeCEA708OneByte
hxxx_common.c:cc_ProbeCEA708OneByte
Line
Count
Source
102
76.2k
{
103
76.2k
    if( b_start )
104
23.1k
    {
105
23.1k
        const uint8_t i_pkt_sequence = cc >> 6;
106
23.1k
        if( i_pkt_sequence > 0 && ((c->cea708.seq + 1) % 4) != i_pkt_sequence )
107
13.9k
        {
108
13.9k
            c->cea708.pktsize = 0;
109
13.9k
            c->cea708.seq = i_pkt_sequence;
110
13.9k
            c->cea708.state = CEA708_PKT_END;
111
13.9k
        }
112
9.18k
        else
113
9.18k
        {
114
9.18k
            c->cea708.seq = i_pkt_sequence;
115
9.18k
            c->cea708.pktsize = cc & 63;
116
9.18k
            if( c->cea708.pktsize == 0 )
117
4.00k
                c->cea708.pktsize = 127;
118
5.18k
            else
119
5.18k
                c->cea708.pktsize = c->cea708.pktsize * 2 - 1;
120
9.18k
            c->cea708.state = CEA708_PKT_WAIT_BLOCK_HEADER;
121
9.18k
        }
122
23.1k
    }
123
53.0k
    else if( c->cea708.pktsize == 0 ) /* empty pkt reading service blocks */
124
16.8k
    {
125
16.8k
        c->cea708.state = CEA708_PKT_END;
126
16.8k
    }
127
36.1k
    else if( c->cea708.state != CEA708_PKT_END )
128
31.2k
    {
129
31.2k
        switch( c->cea708.state )
130
31.2k
        {
131
11.5k
            case CEA708_PKT_WAIT_BLOCK_HEADER: /* Byte is service block header */
132
11.5k
            {
133
11.5k
                uint8_t i_sid = cc >> 5;
134
11.5k
                c->cea708.sid_bs = cc & 0x1F;
135
11.5k
                if( i_sid != 0x00 && c->cea708.sid_bs != 0 )
136
7.71k
                {
137
7.71k
                    if( i_sid != 0x07 )
138
3.75k
                    {
139
3.75k
                        const uint8_t mask = (1 << --i_sid);
140
3.75k
                        c->i_708channels |= (mask + (mask - 1));
141
3.75k
                        c->cea708.state = CEA708_PKT_IN_BLOCK;
142
3.75k
                    }
143
3.96k
                    else if( c->cea708.sid_bs < 2 )
144
388
                    {
145
388
                        c->cea708.state = CEA708_PKT_END;
146
388
                    }
147
3.57k
                    else
148
3.57k
                    {
149
                        /* need to look up next byte in next pkt */
150
3.57k
                        c->cea708.state = CEA708_PKT_WAIT_EXT_BLOCK_HEADER;
151
3.57k
                    }
152
7.71k
                }
153
3.80k
                else c->cea708.state = CEA708_PKT_END;
154
11.5k
            } break;
155
156
1.44k
            case CEA708_PKT_WAIT_EXT_BLOCK_HEADER:
157
1.44k
            {
158
1.44k
                uint8_t i_extsid = cc & 0x3F;
159
1.44k
                if( i_extsid >= 0x07 )
160
571
                {
161
571
                    const uint64_t mask = (INT64_C(1) << --i_extsid);
162
571
                    c->i_708channels |= (mask + (mask - 1));
163
571
                }
164
1.44k
                if( c->cea708.sid_bs == 0 )
165
0
                    c->cea708.state = CEA708_PKT_WAIT_BLOCK_HEADER;
166
1.44k
                else
167
1.44k
                    c->cea708.state = CEA708_PKT_IN_BLOCK;
168
1.44k
            } break;
169
170
18.2k
            case CEA708_PKT_IN_BLOCK:
171
18.2k
            {
172
18.2k
                c->cea708.sid_bs--;
173
18.2k
                if( c->cea708.sid_bs == 0 )
174
2.36k
                    c->cea708.state = CEA708_PKT_WAIT_BLOCK_HEADER;
175
18.2k
            } break;
176
177
0
            default:
178
0
                vlc_assert_unreachable();
179
0
                break;
180
31.2k
        }
181
31.2k
        c->cea708.pktsize--;
182
183
31.2k
        if(c->cea708.pktsize == 0)
184
819
            c->cea708.state = CEA708_PKT_END;
185
31.2k
    }
186
76.2k
}
mpegvideo.c:cc_ProbeCEA708OneByte
Line
Count
Source
102
648k
{
103
648k
    if( b_start )
104
154k
    {
105
154k
        const uint8_t i_pkt_sequence = cc >> 6;
106
154k
        if( i_pkt_sequence > 0 && ((c->cea708.seq + 1) % 4) != i_pkt_sequence )
107
95.8k
        {
108
95.8k
            c->cea708.pktsize = 0;
109
95.8k
            c->cea708.seq = i_pkt_sequence;
110
95.8k
            c->cea708.state = CEA708_PKT_END;
111
95.8k
        }
112
58.8k
        else
113
58.8k
        {
114
58.8k
            c->cea708.seq = i_pkt_sequence;
115
58.8k
            c->cea708.pktsize = cc & 63;
116
58.8k
            if( c->cea708.pktsize == 0 )
117
12.8k
                c->cea708.pktsize = 127;
118
45.9k
            else
119
45.9k
                c->cea708.pktsize = c->cea708.pktsize * 2 - 1;
120
58.8k
            c->cea708.state = CEA708_PKT_WAIT_BLOCK_HEADER;
121
58.8k
        }
122
154k
    }
123
493k
    else if( c->cea708.pktsize == 0 ) /* empty pkt reading service blocks */
124
140k
    {
125
140k
        c->cea708.state = CEA708_PKT_END;
126
140k
    }
127
352k
    else if( c->cea708.state != CEA708_PKT_END )
128
305k
    {
129
305k
        switch( c->cea708.state )
130
305k
        {
131
92.9k
            case CEA708_PKT_WAIT_BLOCK_HEADER: /* Byte is service block header */
132
92.9k
            {
133
92.9k
                uint8_t i_sid = cc >> 5;
134
92.9k
                c->cea708.sid_bs = cc & 0x1F;
135
92.9k
                if( i_sid != 0x00 && c->cea708.sid_bs != 0 )
136
72.0k
                {
137
72.0k
                    if( i_sid != 0x07 )
138
44.5k
                    {
139
44.5k
                        const uint8_t mask = (1 << --i_sid);
140
44.5k
                        c->i_708channels |= (mask + (mask - 1));
141
44.5k
                        c->cea708.state = CEA708_PKT_IN_BLOCK;
142
44.5k
                    }
143
27.4k
                    else if( c->cea708.sid_bs < 2 )
144
3.72k
                    {
145
3.72k
                        c->cea708.state = CEA708_PKT_END;
146
3.72k
                    }
147
23.7k
                    else
148
23.7k
                    {
149
                        /* need to look up next byte in next pkt */
150
23.7k
                        c->cea708.state = CEA708_PKT_WAIT_EXT_BLOCK_HEADER;
151
23.7k
                    }
152
72.0k
                }
153
20.8k
                else c->cea708.state = CEA708_PKT_END;
154
92.9k
            } break;
155
156
14.8k
            case CEA708_PKT_WAIT_EXT_BLOCK_HEADER:
157
14.8k
            {
158
14.8k
                uint8_t i_extsid = cc & 0x3F;
159
14.8k
                if( i_extsid >= 0x07 )
160
12.6k
                {
161
12.6k
                    const uint64_t mask = (INT64_C(1) << --i_extsid);
162
12.6k
                    c->i_708channels |= (mask + (mask - 1));
163
12.6k
                }
164
14.8k
                if( c->cea708.sid_bs == 0 )
165
0
                    c->cea708.state = CEA708_PKT_WAIT_BLOCK_HEADER;
166
14.8k
                else
167
14.8k
                    c->cea708.state = CEA708_PKT_IN_BLOCK;
168
14.8k
            } break;
169
170
197k
            case CEA708_PKT_IN_BLOCK:
171
197k
            {
172
197k
                c->cea708.sid_bs--;
173
197k
                if( c->cea708.sid_bs == 0 )
174
34.6k
                    c->cea708.state = CEA708_PKT_WAIT_BLOCK_HEADER;
175
197k
            } break;
176
177
0
            default:
178
0
                vlc_assert_unreachable();
179
0
                break;
180
305k
        }
181
305k
        c->cea708.pktsize--;
182
183
305k
        if(c->cea708.pktsize == 0)
184
10.0k
            c->cea708.state = CEA708_PKT_END;
185
305k
    }
186
648k
}
vc1.c:cc_ProbeCEA708OneByte
Line
Count
Source
102
180k
{
103
180k
    if( b_start )
104
53.1k
    {
105
53.1k
        const uint8_t i_pkt_sequence = cc >> 6;
106
53.1k
        if( i_pkt_sequence > 0 && ((c->cea708.seq + 1) % 4) != i_pkt_sequence )
107
30.1k
        {
108
30.1k
            c->cea708.pktsize = 0;
109
30.1k
            c->cea708.seq = i_pkt_sequence;
110
30.1k
            c->cea708.state = CEA708_PKT_END;
111
30.1k
        }
112
23.0k
        else
113
23.0k
        {
114
23.0k
            c->cea708.seq = i_pkt_sequence;
115
23.0k
            c->cea708.pktsize = cc & 63;
116
23.0k
            if( c->cea708.pktsize == 0 )
117
9.64k
                c->cea708.pktsize = 127;
118
13.4k
            else
119
13.4k
                c->cea708.pktsize = c->cea708.pktsize * 2 - 1;
120
23.0k
            c->cea708.state = CEA708_PKT_WAIT_BLOCK_HEADER;
121
23.0k
        }
122
53.1k
    }
123
126k
    else if( c->cea708.pktsize == 0 ) /* empty pkt reading service blocks */
124
44.6k
    {
125
44.6k
        c->cea708.state = CEA708_PKT_END;
126
44.6k
    }
127
82.2k
    else if( c->cea708.state != CEA708_PKT_END )
128
70.6k
    {
129
70.6k
        switch( c->cea708.state )
130
70.6k
        {
131
28.4k
            case CEA708_PKT_WAIT_BLOCK_HEADER: /* Byte is service block header */
132
28.4k
            {
133
28.4k
                uint8_t i_sid = cc >> 5;
134
28.4k
                c->cea708.sid_bs = cc & 0x1F;
135
28.4k
                if( i_sid != 0x00 && c->cea708.sid_bs != 0 )
136
19.6k
                {
137
19.6k
                    if( i_sid != 0x07 )
138
9.18k
                    {
139
9.18k
                        const uint8_t mask = (1 << --i_sid);
140
9.18k
                        c->i_708channels |= (mask + (mask - 1));
141
9.18k
                        c->cea708.state = CEA708_PKT_IN_BLOCK;
142
9.18k
                    }
143
10.4k
                    else if( c->cea708.sid_bs < 2 )
144
1.28k
                    {
145
1.28k
                        c->cea708.state = CEA708_PKT_END;
146
1.28k
                    }
147
9.18k
                    else
148
9.18k
                    {
149
                        /* need to look up next byte in next pkt */
150
9.18k
                        c->cea708.state = CEA708_PKT_WAIT_EXT_BLOCK_HEADER;
151
9.18k
                    }
152
19.6k
                }
153
8.78k
                else c->cea708.state = CEA708_PKT_END;
154
28.4k
            } break;
155
156
5.99k
            case CEA708_PKT_WAIT_EXT_BLOCK_HEADER:
157
5.99k
            {
158
5.99k
                uint8_t i_extsid = cc & 0x3F;
159
5.99k
                if( i_extsid >= 0x07 )
160
3.10k
                {
161
3.10k
                    const uint64_t mask = (INT64_C(1) << --i_extsid);
162
3.10k
                    c->i_708channels |= (mask + (mask - 1));
163
3.10k
                }
164
5.99k
                if( c->cea708.sid_bs == 0 )
165
0
                    c->cea708.state = CEA708_PKT_WAIT_BLOCK_HEADER;
166
5.99k
                else
167
5.99k
                    c->cea708.state = CEA708_PKT_IN_BLOCK;
168
5.99k
            } break;
169
170
36.2k
            case CEA708_PKT_IN_BLOCK:
171
36.2k
            {
172
36.2k
                c->cea708.sid_bs--;
173
36.2k
                if( c->cea708.sid_bs == 0 )
174
5.40k
                    c->cea708.state = CEA708_PKT_WAIT_BLOCK_HEADER;
175
36.2k
            } break;
176
177
0
            default:
178
0
                vlc_assert_unreachable();
179
0
                break;
180
70.6k
        }
181
70.6k
        c->cea708.pktsize--;
182
183
70.6k
        if(c->cea708.pktsize == 0)
184
662
            c->cea708.state = CEA708_PKT_END;
185
70.6k
    }
186
180k
}
Unexecuted instantiation: dav1d.c:cc_ProbeCEA708OneByte
video.c:cc_ProbeCEA708OneByte
Line
Count
Source
102
757k
{
103
757k
    if( b_start )
104
287k
    {
105
287k
        const uint8_t i_pkt_sequence = cc >> 6;
106
287k
        if( i_pkt_sequence > 0 && ((c->cea708.seq + 1) % 4) != i_pkt_sequence )
107
121k
        {
108
121k
            c->cea708.pktsize = 0;
109
121k
            c->cea708.seq = i_pkt_sequence;
110
121k
            c->cea708.state = CEA708_PKT_END;
111
121k
        }
112
166k
        else
113
166k
        {
114
166k
            c->cea708.seq = i_pkt_sequence;
115
166k
            c->cea708.pktsize = cc & 63;
116
166k
            if( c->cea708.pktsize == 0 )
117
86.1k
                c->cea708.pktsize = 127;
118
79.8k
            else
119
79.8k
                c->cea708.pktsize = c->cea708.pktsize * 2 - 1;
120
166k
            c->cea708.state = CEA708_PKT_WAIT_BLOCK_HEADER;
121
166k
        }
122
287k
    }
123
470k
    else if( c->cea708.pktsize == 0 ) /* empty pkt reading service blocks */
124
135k
    {
125
135k
        c->cea708.state = CEA708_PKT_END;
126
135k
    }
127
334k
    else if( c->cea708.state != CEA708_PKT_END )
128
245k
    {
129
245k
        switch( c->cea708.state )
130
245k
        {
131
178k
            case CEA708_PKT_WAIT_BLOCK_HEADER: /* Byte is service block header */
132
178k
            {
133
178k
                uint8_t i_sid = cc >> 5;
134
178k
                c->cea708.sid_bs = cc & 0x1F;
135
178k
                if( i_sid != 0x00 && c->cea708.sid_bs != 0 )
136
88.3k
                {
137
88.3k
                    if( i_sid != 0x07 )
138
41.4k
                    {
139
41.4k
                        const uint8_t mask = (1 << --i_sid);
140
41.4k
                        c->i_708channels |= (mask + (mask - 1));
141
41.4k
                        c->cea708.state = CEA708_PKT_IN_BLOCK;
142
41.4k
                    }
143
46.8k
                    else if( c->cea708.sid_bs < 2 )
144
2.02k
                    {
145
2.02k
                        c->cea708.state = CEA708_PKT_END;
146
2.02k
                    }
147
44.8k
                    else
148
44.8k
                    {
149
                        /* need to look up next byte in next pkt */
150
44.8k
                        c->cea708.state = CEA708_PKT_WAIT_EXT_BLOCK_HEADER;
151
44.8k
                    }
152
88.3k
                }
153
90.3k
                else c->cea708.state = CEA708_PKT_END;
154
178k
            } break;
155
156
10.5k
            case CEA708_PKT_WAIT_EXT_BLOCK_HEADER:
157
10.5k
            {
158
10.5k
                uint8_t i_extsid = cc & 0x3F;
159
10.5k
                if( i_extsid >= 0x07 )
160
5.51k
                {
161
5.51k
                    const uint64_t mask = (INT64_C(1) << --i_extsid);
162
5.51k
                    c->i_708channels |= (mask + (mask - 1));
163
5.51k
                }
164
10.5k
                if( c->cea708.sid_bs == 0 )
165
0
                    c->cea708.state = CEA708_PKT_WAIT_BLOCK_HEADER;
166
10.5k
                else
167
10.5k
                    c->cea708.state = CEA708_PKT_IN_BLOCK;
168
10.5k
            } break;
169
170
56.1k
            case CEA708_PKT_IN_BLOCK:
171
56.1k
            {
172
56.1k
                c->cea708.sid_bs--;
173
56.1k
                if( c->cea708.sid_bs == 0 )
174
13.2k
                    c->cea708.state = CEA708_PKT_WAIT_BLOCK_HEADER;
175
56.1k
            } break;
176
177
0
            default:
178
0
                vlc_assert_unreachable();
179
0
                break;
180
245k
        }
181
245k
        c->cea708.pktsize--;
182
183
245k
        if(c->cea708.pktsize == 0)
184
27.0k
            c->cea708.state = CEA708_PKT_END;
185
245k
    }
186
757k
}
187
188
static inline void cc_ProbeCEA708( cc_data_t *c, uint8_t i_field, const uint8_t cc[2] )
189
831k
{
190
831k
    if( i_field == 3 ) /* DTVCC_PACKET_START */
191
518k
        cc_ProbeCEA708OneByte( c, true,  cc[0] );
192
312k
    else /* DTVCC_PACKET_DATA */
193
312k
        cc_ProbeCEA708OneByte( c, false, cc[0] );
194
831k
    cc_ProbeCEA708OneByte( c, false, cc[1] );
195
831k
}
Unexecuted instantiation: mp4.c:cc_ProbeCEA708
Unexecuted instantiation: ty.c:cc_ProbeCEA708
hxxx_common.c:cc_ProbeCEA708
Line
Count
Source
189
38.1k
{
190
38.1k
    if( i_field == 3 ) /* DTVCC_PACKET_START */
191
23.1k
        cc_ProbeCEA708OneByte( c, true,  cc[0] );
192
14.9k
    else /* DTVCC_PACKET_DATA */
193
14.9k
        cc_ProbeCEA708OneByte( c, false, cc[0] );
194
    cc_ProbeCEA708OneByte( c, false, cc[1] );
195
38.1k
}
mpegvideo.c:cc_ProbeCEA708
Line
Count
Source
189
324k
{
190
324k
    if( i_field == 3 ) /* DTVCC_PACKET_START */
191
154k
        cc_ProbeCEA708OneByte( c, true,  cc[0] );
192
169k
    else /* DTVCC_PACKET_DATA */
193
169k
        cc_ProbeCEA708OneByte( c, false, cc[0] );
194
    cc_ProbeCEA708OneByte( c, false, cc[1] );
195
324k
}
vc1.c:cc_ProbeCEA708
Line
Count
Source
189
90.0k
{
190
90.0k
    if( i_field == 3 ) /* DTVCC_PACKET_START */
191
53.1k
        cc_ProbeCEA708OneByte( c, true,  cc[0] );
192
36.8k
    else /* DTVCC_PACKET_DATA */
193
36.8k
        cc_ProbeCEA708OneByte( c, false, cc[0] );
194
    cc_ProbeCEA708OneByte( c, false, cc[1] );
195
90.0k
}
Unexecuted instantiation: dav1d.c:cc_ProbeCEA708
video.c:cc_ProbeCEA708
Line
Count
Source
189
378k
{
190
378k
    if( i_field == 3 ) /* DTVCC_PACKET_START */
191
287k
        cc_ProbeCEA708OneByte( c, true,  cc[0] );
192
91.6k
    else /* DTVCC_PACKET_DATA */
193
91.6k
        cc_ProbeCEA708OneByte( c, false, cc[0] );
194
    cc_ProbeCEA708OneByte( c, false, cc[1] );
195
378k
}
196
197
static inline bool cc_AppendData( cc_data_t *c, uint8_t cc_preamble, const uint8_t cc[2] )
198
2.17M
{
199
2.17M
    if (c->i_data + 3 > ARRAY_SIZE(c->p_data))
200
15.0k
        return false;
201
202
2.16M
    const uint8_t i_field = cc_preamble & 0x03;
203
2.16M
    if( i_field == 0 || i_field == 1 ) /* NTSC_CC_FIELD_1 NTSC_CC_FIELD_2 */
204
1.32M
    {
205
1.32M
        c->i_608channels |= (3 << (2 * i_field));
206
1.32M
    }
207
831k
    else
208
831k
    {
209
831k
        cc_ProbeCEA708( c, i_field, cc );
210
        /* By default enable at least channel 1 */
211
831k
        c->i_708channels |= 1;
212
831k
    }
213
214
2.16M
    c->p_data[c->i_data++] = cc_preamble;
215
2.16M
    c->p_data[c->i_data++] = cc[0];
216
2.16M
    c->p_data[c->i_data++] = cc[1];
217
2.16M
    return true;
218
2.17M
}
Unexecuted instantiation: mp4.c:cc_AppendData
Unexecuted instantiation: ty.c:cc_AppendData
hxxx_common.c:cc_AppendData
Line
Count
Source
198
49.5k
{
199
49.5k
    if (c->i_data + 3 > ARRAY_SIZE(c->p_data))
200
209
        return false;
201
202
49.3k
    const uint8_t i_field = cc_preamble & 0x03;
203
49.3k
    if( i_field == 0 || i_field == 1 ) /* NTSC_CC_FIELD_1 NTSC_CC_FIELD_2 */
204
11.1k
    {
205
11.1k
        c->i_608channels |= (3 << (2 * i_field));
206
11.1k
    }
207
38.1k
    else
208
38.1k
    {
209
38.1k
        cc_ProbeCEA708( c, i_field, cc );
210
        /* By default enable at least channel 1 */
211
38.1k
        c->i_708channels |= 1;
212
38.1k
    }
213
214
49.3k
    c->p_data[c->i_data++] = cc_preamble;
215
49.3k
    c->p_data[c->i_data++] = cc[0];
216
49.3k
    c->p_data[c->i_data++] = cc[1];
217
    return true;
218
49.5k
}
mpegvideo.c:cc_AppendData
Line
Count
Source
198
814k
{
199
814k
    if (c->i_data + 3 > ARRAY_SIZE(c->p_data))
200
12.8k
        return false;
201
202
801k
    const uint8_t i_field = cc_preamble & 0x03;
203
801k
    if( i_field == 0 || i_field == 1 ) /* NTSC_CC_FIELD_1 NTSC_CC_FIELD_2 */
204
477k
    {
205
477k
        c->i_608channels |= (3 << (2 * i_field));
206
477k
    }
207
324k
    else
208
324k
    {
209
324k
        cc_ProbeCEA708( c, i_field, cc );
210
        /* By default enable at least channel 1 */
211
324k
        c->i_708channels |= 1;
212
324k
    }
213
214
801k
    c->p_data[c->i_data++] = cc_preamble;
215
801k
    c->p_data[c->i_data++] = cc[0];
216
801k
    c->p_data[c->i_data++] = cc[1];
217
    return true;
218
814k
}
vc1.c:cc_AppendData
Line
Count
Source
198
177k
{
199
177k
    if (c->i_data + 3 > ARRAY_SIZE(c->p_data))
200
1.43k
        return false;
201
202
176k
    const uint8_t i_field = cc_preamble & 0x03;
203
176k
    if( i_field == 0 || i_field == 1 ) /* NTSC_CC_FIELD_1 NTSC_CC_FIELD_2 */
204
86.2k
    {
205
86.2k
        c->i_608channels |= (3 << (2 * i_field));
206
86.2k
    }
207
90.0k
    else
208
90.0k
    {
209
90.0k
        cc_ProbeCEA708( c, i_field, cc );
210
        /* By default enable at least channel 1 */
211
90.0k
        c->i_708channels |= 1;
212
90.0k
    }
213
214
176k
    c->p_data[c->i_data++] = cc_preamble;
215
176k
    c->p_data[c->i_data++] = cc[0];
216
176k
    c->p_data[c->i_data++] = cc[1];
217
    return true;
218
177k
}
Unexecuted instantiation: dav1d.c:cc_AppendData
video.c:cc_AppendData
Line
Count
Source
198
1.13M
{
199
1.13M
    if (c->i_data + 3 > ARRAY_SIZE(c->p_data))
200
542
        return false;
201
202
1.13M
    const uint8_t i_field = cc_preamble & 0x03;
203
1.13M
    if( i_field == 0 || i_field == 1 ) /* NTSC_CC_FIELD_1 NTSC_CC_FIELD_2 */
204
754k
    {
205
754k
        c->i_608channels |= (3 << (2 * i_field));
206
754k
    }
207
378k
    else
208
378k
    {
209
378k
        cc_ProbeCEA708( c, i_field, cc );
210
        /* By default enable at least channel 1 */
211
378k
        c->i_708channels |= 1;
212
378k
    }
213
214
1.13M
    c->p_data[c->i_data++] = cc_preamble;
215
1.13M
    c->p_data[c->i_data++] = cc[0];
216
1.13M
    c->p_data[c->i_data++] = cc[1];
217
    return true;
218
1.13M
}
219
220
static inline void cc_Extract( cc_data_t *c, enum cc_payload_type_e i_payload_type,
221
                               bool b_top_field_first, const uint8_t *p_src, int i_src )
222
355k
{
223
355k
    if( c->i_payload_type != CC_PAYLOAD_NONE && c->i_payload_type != i_payload_type )
224
59.7k
    {
225
59.7k
        c->i_payload_other_count++;
226
59.7k
        if( c->i_payload_other_count < 50 )
227
59.2k
            return;
228
59.7k
    }
229
295k
    c->i_payload_type        = i_payload_type;
230
295k
    c->i_payload_other_count = 0;
231
232
295k
    if( i_payload_type == CC_PAYLOAD_RAW )
233
5.78k
    {
234
1.13M
        for( int i = 0; i + 2 < i_src; i += 3 )
235
1.13M
        {
236
1.13M
            const uint8_t *cc = &p_src[i];
237
1.13M
            if (!cc_AppendData( c, cc[0], &cc[1] ))
238
542
                break;
239
1.13M
        }
240
5.78k
        c->b_reorder = true;
241
5.78k
    }
242
290k
    else if( i_payload_type == CC_PAYLOAD_GA94 )
243
139k
    {
244
        /* cc_data()
245
         *          u1 reserved(1)
246
         *          u1 process_cc_data_flag
247
         *          u1 additional_data_flag
248
         *          u5 cc_count
249
         *          u8 reserved(1111 1111)
250
         *          for cc_count
251
         *              u5 marker bit(1111 1)
252
         *              u1 cc_valid
253
         *              u2 cc_type
254
         *              u8 cc_data_1
255
         *              u8 cc_data_2
256
         *          u8 marker bit(1111 1111)
257
         *          if additional_data_flag
258
         *              unknown
259
         */
260
        /* cc_type:
261
         *  0x00: field 1
262
         *  0x01: field 2
263
         */
264
139k
        if(i_src < 1)
265
244
            return;
266
139k
        const uint8_t *cc = &p_src[0];
267
139k
        const int i_count_cc = cc[0]&0x1f;
268
139k
        int i;
269
270
139k
        if( !(cc[0]&0x40) ) // process flag
271
3.36k
            return;
272
136k
        if( i_src < 1+1 + i_count_cc*3 + 1)  // broken packet
273
86.4k
            return;
274
49.7k
        if( i_count_cc <= 0 )   // no cc present
275
1.88k
            return;
276
47.8k
        if( cc[2+i_count_cc * 3] != 0xff )  // marker absent
277
9.76k
            return;
278
38.0k
        cc += 2;
279
280
485k
        for( i = 0; i < i_count_cc; i++, cc += 3 )
281
449k
        {
282
449k
            if (!cc_AppendData( c, cc[0], &cc[1] ))
283
2.25k
                break;
284
449k
        }
285
38.0k
        c->b_reorder = true;
286
38.0k
    }
287
150k
    else if( i_payload_type == CC_PAYLOAD_DVD )
288
24.6k
    {
289
        /* user_data
290
         *          (u32 stripped earlier)
291
         *          u32 (0x43 0x43 0x01 0xf8)
292
         *          u1 caption_odd_field_first (CC1/CC2)
293
         *          u1 caption_filler
294
         *          u5 cc_block_count  (== cc_count / 2)
295
         *          u1 caption_extra_field_added (because odd cc_count)
296
         *          for cc_block_count * 2 + caption_extra_field_added
297
         *              u7 cc_filler_1
298
         *              u1 cc_field_is_odd
299
         *              u8 cc_data_1
300
         *              u8 cc_data_2
301
         */
302
24.6k
        if(i_src < 6)
303
0
            return;
304
24.6k
        const int b_truncate = p_src[4] & 0x01;
305
24.6k
        const int i_count_cc2 = ((p_src[4] >> 1) & 0x1f);
306
24.6k
        const uint8_t *cc = &p_src[5];
307
24.6k
        i_src -= 5;
308
24.6k
        int i;
309
310
100k
#define CC_ALIGNMENT_TEST   (0x7f)
311
312
122k
        for( i = 0; i < 2*i_count_cc2 + b_truncate && i_src >= 3; i++, cc+=3 )
313
100k
        {
314
100k
            if( (cc[0] >> 1) == CC_ALIGNMENT_TEST )
315
31.2k
            {
316
31.2k
                const bool even_field = (cc[0] & 0x01) ? 0 : 1;
317
31.2k
                if (!cc_AppendData( c, CC_PKT_BYTE0(even_field), &cc[1] ))
318
3.17k
                    break;
319
31.2k
            }
320
97.5k
            i_src -= 3;
321
97.5k
        }
322
24.6k
        c->b_reorder = false;
323
24.6k
    }
324
125k
    else if( i_payload_type == CC_PAYLOAD_REPLAYTV )
325
8.39k
    {
326
8.39k
        if(i_src < 1)
327
0
            return;
328
8.39k
        const uint8_t *cc = &p_src[0];
329
123k
        for( int i_cc_count = i_src >> 2; i_cc_count > 0;
330
115k
             i_cc_count--, cc += 4 )
331
116k
        {
332
116k
            uint8_t i_field = (cc[0] & 0x02) >> 1;
333
116k
            if (!cc_AppendData( c, CC_PKT_BYTE0(i_field), &cc[2] ))
334
1.18k
                return;
335
116k
        }
336
7.21k
        c->b_reorder = false;
337
7.21k
    }
338
117k
    else if( i_payload_type == CC_PAYLOAD_SCTE20 )
339
77.8k
    {
340
        /* user_data(2)
341
         *          (u32 stripped earlier)
342
         *          u16 p_cc_scte20
343
         *          u5 cc_count
344
         *          for cc_count
345
         *              u2 cc_priority
346
         *              u2 cc_field_num
347
         *              u5 cc_line_offset
348
         *              u8 cc_data_1[1:8]
349
         *              u8 cc_data_2[1:8]
350
         *              u1 marker bit
351
         *          un additional_realtimevideodata
352
         *          un reserved
353
         */
354
77.8k
        if(i_src < 2)
355
0
            return;
356
77.8k
        bs_t s;
357
77.8k
        bs_init( &s, &p_src[2], i_src - 2 );
358
77.8k
        const int i_cc_count = bs_read( &s, 5 );
359
1.34M
        for( int i = 0; i < i_cc_count; i++ )
360
1.26M
        {
361
1.26M
            bs_skip( &s, 2 );
362
1.26M
            const int i_field_idx = bs_read( &s, 2 );
363
1.26M
            bs_skip( &s, 5 );
364
1.26M
            uint8_t cc[2];
365
3.80M
            for( int j = 0; j < 2; j++ )
366
2.53M
            {
367
2.53M
                cc[j] = 0;
368
22.8M
                for( int k = 0; k < 8; k++ )
369
20.3M
                    cc[j] |= bs_read( &s, 1 ) << k;
370
2.53M
            }
371
1.26M
            bs_skip( &s, 1 );
372
373
1.26M
            if( i_field_idx == 0 )
374
1.04M
                continue;
375
376
            /* 1,2,3 -> 0,1,0. I.E. repeated field 3 is merged with field 1 */
377
225k
            int i_field = ((i_field_idx - 1) & 1);
378
225k
            if (!b_top_field_first)
379
204k
                i_field ^= 1;
380
381
225k
            if (!cc_AppendData( c, CC_PKT_BYTE0(i_field), &cc[0] ))
382
5.30k
                continue;
383
225k
        }
384
77.8k
        c->b_reorder = true;
385
77.8k
    }
386
39.4k
    else // CC_PAYLOAD_CDP
387
39.4k
    {
388
39.4k
#       define CDP_FLAG_TIME_CODE_PRESENT  (1<<7)
389
39.4k
#       define CDP_FLAG_CC_DATA_PRESENT    (1<<6)
390
39.4k
#       define CDP_FLAG_SVC_INFO_PRESENT   (1<<5)
391
39.4k
#       define CDP_FLAG_SVC_INFO_START     (1<<4)
392
39.4k
#       define CDP_FLAG_SVC_INFO_CHANGE    (1<<3)
393
39.4k
#       define CDP_FLAG_SVC_INFO_COMPLETE  (1<<2)
394
39.4k
#       define CDP_FLAG_CAPTION_SVC_ACTIVE (1<<1)
395
396
39.4k
        if(i_src < 7)
397
2.89k
            return;
398
399
        /* ST334-2 5.2 cdp_header() */
400
36.5k
        uint8_t cdp_length = p_src[2];
401
36.5k
        if(cdp_length < 8 || cdp_length > i_src)
402
5.32k
            return;
403
31.2k
        uint8_t cdp_flags = p_src[4];
404
405
        /* skip header */
406
31.2k
        p_src += 7; i_src -= 7;
407
408
        /* 5.3 time_code_section() */
409
31.2k
        if( cdp_flags & CDP_FLAG_TIME_CODE_PRESENT )
410
11.7k
        {
411
11.7k
            if( i_src < 5 ) // Shall be 5 bytes
412
619
                return;
413
11.1k
            p_src += 5; i_src -= 5;
414
11.1k
        }
415
        /* 5.4 ccdata_section */
416
30.6k
        if( cdp_flags & CDP_FLAG_CC_DATA_PRESENT )
417
27.8k
        {
418
            /* ccdata_section()
419
             *      u8 0x72
420
             *      u3 marker bits(111)
421
             *      u5 cc_count
422
             *      for cc_count
423
             *          u5 marker bits(1111 1)
424
             *          u1 cc_valid
425
             *          u2 cc_type
426
             *          u8 cc_data_1
427
             *          u8 cc_data_2
428
             */
429
27.8k
            if( i_src < 2 || p_src[0] != 0x72 ) // marker
430
7.83k
                return;
431
432
20.0k
            const uint8_t *cc = &p_src[1];
433
20.0k
            const int i_count_cc = cc[0]&0x1f;
434
435
20.0k
            if( i_src - 2 < i_count_cc*3 )  // broken packet
436
1.95k
                return;
437
18.0k
            cc += 1;
438
234k
            for( int i = 0; i < i_count_cc; i++, cc += 3 )
439
218k
            {
440
218k
                if (!cc_AppendData( c, cc[0], &cc[1] ))
441
2.61k
                    break;
442
218k
            }
443
18.0k
        }
444
        /* remaining data */
445
20.8k
        c->b_reorder = false;
446
20.8k
    }
447
295k
}
Unexecuted instantiation: mp4.c:cc_Extract
Unexecuted instantiation: ty.c:cc_Extract
hxxx_common.c:cc_Extract
Line
Count
Source
222
16.2k
{
223
16.2k
    if( c->i_payload_type != CC_PAYLOAD_NONE && c->i_payload_type != i_payload_type )
224
0
    {
225
0
        c->i_payload_other_count++;
226
0
        if( c->i_payload_other_count < 50 )
227
0
            return;
228
0
    }
229
16.2k
    c->i_payload_type        = i_payload_type;
230
16.2k
    c->i_payload_other_count = 0;
231
232
16.2k
    if( i_payload_type == CC_PAYLOAD_RAW )
233
0
    {
234
0
        for( int i = 0; i + 2 < i_src; i += 3 )
235
0
        {
236
0
            const uint8_t *cc = &p_src[i];
237
0
            if (!cc_AppendData( c, cc[0], &cc[1] ))
238
0
                break;
239
0
        }
240
0
        c->b_reorder = true;
241
0
    }
242
16.2k
    else if( i_payload_type == CC_PAYLOAD_GA94 )
243
16.2k
    {
244
        /* cc_data()
245
         *          u1 reserved(1)
246
         *          u1 process_cc_data_flag
247
         *          u1 additional_data_flag
248
         *          u5 cc_count
249
         *          u8 reserved(1111 1111)
250
         *          for cc_count
251
         *              u5 marker bit(1111 1)
252
         *              u1 cc_valid
253
         *              u2 cc_type
254
         *              u8 cc_data_1
255
         *              u8 cc_data_2
256
         *          u8 marker bit(1111 1111)
257
         *          if additional_data_flag
258
         *              unknown
259
         */
260
        /* cc_type:
261
         *  0x00: field 1
262
         *  0x01: field 2
263
         */
264
16.2k
        if(i_src < 1)
265
244
            return;
266
15.9k
        const uint8_t *cc = &p_src[0];
267
15.9k
        const int i_count_cc = cc[0]&0x1f;
268
15.9k
        int i;
269
270
15.9k
        if( !(cc[0]&0x40) ) // process flag
271
802
            return;
272
15.1k
        if( i_src < 1+1 + i_count_cc*3 + 1)  // broken packet
273
1.51k
            return;
274
13.6k
        if( i_count_cc <= 0 )   // no cc present
275
244
            return;
276
13.4k
        if( cc[2+i_count_cc * 3] != 0xff )  // marker absent
277
1.69k
            return;
278
11.7k
        cc += 2;
279
280
61.0k
        for( i = 0; i < i_count_cc; i++, cc += 3 )
281
49.5k
        {
282
49.5k
            if (!cc_AppendData( c, cc[0], &cc[1] ))
283
209
                break;
284
49.5k
        }
285
11.7k
        c->b_reorder = true;
286
11.7k
    }
287
0
    else if( i_payload_type == CC_PAYLOAD_DVD )
288
0
    {
289
        /* user_data
290
         *          (u32 stripped earlier)
291
         *          u32 (0x43 0x43 0x01 0xf8)
292
         *          u1 caption_odd_field_first (CC1/CC2)
293
         *          u1 caption_filler
294
         *          u5 cc_block_count  (== cc_count / 2)
295
         *          u1 caption_extra_field_added (because odd cc_count)
296
         *          for cc_block_count * 2 + caption_extra_field_added
297
         *              u7 cc_filler_1
298
         *              u1 cc_field_is_odd
299
         *              u8 cc_data_1
300
         *              u8 cc_data_2
301
         */
302
0
        if(i_src < 6)
303
0
            return;
304
0
        const int b_truncate = p_src[4] & 0x01;
305
0
        const int i_count_cc2 = ((p_src[4] >> 1) & 0x1f);
306
0
        const uint8_t *cc = &p_src[5];
307
0
        i_src -= 5;
308
0
        int i;
309
310
0
#define CC_ALIGNMENT_TEST   (0x7f)
311
312
0
        for( i = 0; i < 2*i_count_cc2 + b_truncate && i_src >= 3; i++, cc+=3 )
313
0
        {
314
0
            if( (cc[0] >> 1) == CC_ALIGNMENT_TEST )
315
0
            {
316
0
                const bool even_field = (cc[0] & 0x01) ? 0 : 1;
317
0
                if (!cc_AppendData( c, CC_PKT_BYTE0(even_field), &cc[1] ))
318
0
                    break;
319
0
            }
320
0
            i_src -= 3;
321
0
        }
322
0
        c->b_reorder = false;
323
0
    }
324
0
    else if( i_payload_type == CC_PAYLOAD_REPLAYTV )
325
0
    {
326
0
        if(i_src < 1)
327
0
            return;
328
0
        const uint8_t *cc = &p_src[0];
329
0
        for( int i_cc_count = i_src >> 2; i_cc_count > 0;
330
0
             i_cc_count--, cc += 4 )
331
0
        {
332
0
            uint8_t i_field = (cc[0] & 0x02) >> 1;
333
0
            if (!cc_AppendData( c, CC_PKT_BYTE0(i_field), &cc[2] ))
334
0
                return;
335
0
        }
336
0
        c->b_reorder = false;
337
0
    }
338
0
    else if( i_payload_type == CC_PAYLOAD_SCTE20 )
339
0
    {
340
        /* user_data(2)
341
         *          (u32 stripped earlier)
342
         *          u16 p_cc_scte20
343
         *          u5 cc_count
344
         *          for cc_count
345
         *              u2 cc_priority
346
         *              u2 cc_field_num
347
         *              u5 cc_line_offset
348
         *              u8 cc_data_1[1:8]
349
         *              u8 cc_data_2[1:8]
350
         *              u1 marker bit
351
         *          un additional_realtimevideodata
352
         *          un reserved
353
         */
354
0
        if(i_src < 2)
355
0
            return;
356
0
        bs_t s;
357
0
        bs_init( &s, &p_src[2], i_src - 2 );
358
0
        const int i_cc_count = bs_read( &s, 5 );
359
0
        for( int i = 0; i < i_cc_count; i++ )
360
0
        {
361
0
            bs_skip( &s, 2 );
362
0
            const int i_field_idx = bs_read( &s, 2 );
363
0
            bs_skip( &s, 5 );
364
0
            uint8_t cc[2];
365
0
            for( int j = 0; j < 2; j++ )
366
0
            {
367
0
                cc[j] = 0;
368
0
                for( int k = 0; k < 8; k++ )
369
0
                    cc[j] |= bs_read( &s, 1 ) << k;
370
0
            }
371
0
            bs_skip( &s, 1 );
372
373
0
            if( i_field_idx == 0 )
374
0
                continue;
375
376
            /* 1,2,3 -> 0,1,0. I.E. repeated field 3 is merged with field 1 */
377
0
            int i_field = ((i_field_idx - 1) & 1);
378
0
            if (!b_top_field_first)
379
0
                i_field ^= 1;
380
381
0
            if (!cc_AppendData( c, CC_PKT_BYTE0(i_field), &cc[0] ))
382
0
                continue;
383
0
        }
384
0
        c->b_reorder = true;
385
0
    }
386
0
    else // CC_PAYLOAD_CDP
387
0
    {
388
0
#       define CDP_FLAG_TIME_CODE_PRESENT  (1<<7)
389
0
#       define CDP_FLAG_CC_DATA_PRESENT    (1<<6)
390
0
#       define CDP_FLAG_SVC_INFO_PRESENT   (1<<5)
391
0
#       define CDP_FLAG_SVC_INFO_START     (1<<4)
392
0
#       define CDP_FLAG_SVC_INFO_CHANGE    (1<<3)
393
0
#       define CDP_FLAG_SVC_INFO_COMPLETE  (1<<2)
394
0
#       define CDP_FLAG_CAPTION_SVC_ACTIVE (1<<1)
395
396
0
        if(i_src < 7)
397
0
            return;
398
399
        /* ST334-2 5.2 cdp_header() */
400
0
        uint8_t cdp_length = p_src[2];
401
0
        if(cdp_length < 8 || cdp_length > i_src)
402
0
            return;
403
0
        uint8_t cdp_flags = p_src[4];
404
405
        /* skip header */
406
0
        p_src += 7; i_src -= 7;
407
408
        /* 5.3 time_code_section() */
409
0
        if( cdp_flags & CDP_FLAG_TIME_CODE_PRESENT )
410
0
        {
411
0
            if( i_src < 5 ) // Shall be 5 bytes
412
0
                return;
413
0
            p_src += 5; i_src -= 5;
414
0
        }
415
        /* 5.4 ccdata_section */
416
0
        if( cdp_flags & CDP_FLAG_CC_DATA_PRESENT )
417
0
        {
418
            /* ccdata_section()
419
             *      u8 0x72
420
             *      u3 marker bits(111)
421
             *      u5 cc_count
422
             *      for cc_count
423
             *          u5 marker bits(1111 1)
424
             *          u1 cc_valid
425
             *          u2 cc_type
426
             *          u8 cc_data_1
427
             *          u8 cc_data_2
428
             */
429
0
            if( i_src < 2 || p_src[0] != 0x72 ) // marker
430
0
                return;
431
432
0
            const uint8_t *cc = &p_src[1];
433
0
            const int i_count_cc = cc[0]&0x1f;
434
435
0
            if( i_src - 2 < i_count_cc*3 )  // broken packet
436
0
                return;
437
0
            cc += 1;
438
0
            for( int i = 0; i < i_count_cc; i++, cc += 3 )
439
0
            {
440
0
                if (!cc_AppendData( c, cc[0], &cc[1] ))
441
0
                    break;
442
0
            }
443
0
        }
444
        /* remaining data */
445
0
        c->b_reorder = false;
446
0
    }
447
16.2k
}
mpegvideo.c:cc_Extract
Line
Count
Source
222
311k
{
223
311k
    if( c->i_payload_type != CC_PAYLOAD_NONE && c->i_payload_type != i_payload_type )
224
59.7k
    {
225
59.7k
        c->i_payload_other_count++;
226
59.7k
        if( c->i_payload_other_count < 50 )
227
59.2k
            return;
228
59.7k
    }
229
252k
    c->i_payload_type        = i_payload_type;
230
252k
    c->i_payload_other_count = 0;
231
232
252k
    if( i_payload_type == CC_PAYLOAD_RAW )
233
0
    {
234
0
        for( int i = 0; i + 2 < i_src; i += 3 )
235
0
        {
236
0
            const uint8_t *cc = &p_src[i];
237
0
            if (!cc_AppendData( c, cc[0], &cc[1] ))
238
0
                break;
239
0
        }
240
0
        c->b_reorder = true;
241
0
    }
242
252k
    else if( i_payload_type == CC_PAYLOAD_GA94 )
243
101k
    {
244
        /* cc_data()
245
         *          u1 reserved(1)
246
         *          u1 process_cc_data_flag
247
         *          u1 additional_data_flag
248
         *          u5 cc_count
249
         *          u8 reserved(1111 1111)
250
         *          for cc_count
251
         *              u5 marker bit(1111 1)
252
         *              u1 cc_valid
253
         *              u2 cc_type
254
         *              u8 cc_data_1
255
         *              u8 cc_data_2
256
         *          u8 marker bit(1111 1111)
257
         *          if additional_data_flag
258
         *              unknown
259
         */
260
        /* cc_type:
261
         *  0x00: field 1
262
         *  0x01: field 2
263
         */
264
101k
        if(i_src < 1)
265
0
            return;
266
101k
        const uint8_t *cc = &p_src[0];
267
101k
        const int i_count_cc = cc[0]&0x1f;
268
101k
        int i;
269
270
101k
        if( !(cc[0]&0x40) ) // process flag
271
2.19k
            return;
272
99.6k
        if( i_src < 1+1 + i_count_cc*3 + 1)  // broken packet
273
80.6k
            return;
274
18.9k
        if( i_count_cc <= 0 )   // no cc present
275
1.38k
            return;
276
17.5k
        if( cc[2+i_count_cc * 3] != 0xff )  // marker absent
277
3.65k
            return;
278
13.9k
        cc += 2;
279
280
235k
        for( i = 0; i < i_count_cc; i++, cc += 3 )
281
222k
        {
282
222k
            if (!cc_AppendData( c, cc[0], &cc[1] ))
283
612
                break;
284
222k
        }
285
13.9k
        c->b_reorder = true;
286
13.9k
    }
287
150k
    else if( i_payload_type == CC_PAYLOAD_DVD )
288
24.6k
    {
289
        /* user_data
290
         *          (u32 stripped earlier)
291
         *          u32 (0x43 0x43 0x01 0xf8)
292
         *          u1 caption_odd_field_first (CC1/CC2)
293
         *          u1 caption_filler
294
         *          u5 cc_block_count  (== cc_count / 2)
295
         *          u1 caption_extra_field_added (because odd cc_count)
296
         *          for cc_block_count * 2 + caption_extra_field_added
297
         *              u7 cc_filler_1
298
         *              u1 cc_field_is_odd
299
         *              u8 cc_data_1
300
         *              u8 cc_data_2
301
         */
302
24.6k
        if(i_src < 6)
303
0
            return;
304
24.6k
        const int b_truncate = p_src[4] & 0x01;
305
24.6k
        const int i_count_cc2 = ((p_src[4] >> 1) & 0x1f);
306
24.6k
        const uint8_t *cc = &p_src[5];
307
24.6k
        i_src -= 5;
308
24.6k
        int i;
309
310
24.6k
#define CC_ALIGNMENT_TEST   (0x7f)
311
312
122k
        for( i = 0; i < 2*i_count_cc2 + b_truncate && i_src >= 3; i++, cc+=3 )
313
100k
        {
314
100k
            if( (cc[0] >> 1) == CC_ALIGNMENT_TEST )
315
31.2k
            {
316
31.2k
                const bool even_field = (cc[0] & 0x01) ? 0 : 1;
317
31.2k
                if (!cc_AppendData( c, CC_PKT_BYTE0(even_field), &cc[1] ))
318
3.17k
                    break;
319
31.2k
            }
320
97.5k
            i_src -= 3;
321
97.5k
        }
322
24.6k
        c->b_reorder = false;
323
24.6k
    }
324
125k
    else if( i_payload_type == CC_PAYLOAD_REPLAYTV )
325
8.39k
    {
326
8.39k
        if(i_src < 1)
327
0
            return;
328
8.39k
        const uint8_t *cc = &p_src[0];
329
123k
        for( int i_cc_count = i_src >> 2; i_cc_count > 0;
330
115k
             i_cc_count--, cc += 4 )
331
116k
        {
332
116k
            uint8_t i_field = (cc[0] & 0x02) >> 1;
333
116k
            if (!cc_AppendData( c, CC_PKT_BYTE0(i_field), &cc[2] ))
334
1.18k
                return;
335
116k
        }
336
7.21k
        c->b_reorder = false;
337
7.21k
    }
338
117k
    else if( i_payload_type == CC_PAYLOAD_SCTE20 )
339
77.8k
    {
340
        /* user_data(2)
341
         *          (u32 stripped earlier)
342
         *          u16 p_cc_scte20
343
         *          u5 cc_count
344
         *          for cc_count
345
         *              u2 cc_priority
346
         *              u2 cc_field_num
347
         *              u5 cc_line_offset
348
         *              u8 cc_data_1[1:8]
349
         *              u8 cc_data_2[1:8]
350
         *              u1 marker bit
351
         *          un additional_realtimevideodata
352
         *          un reserved
353
         */
354
77.8k
        if(i_src < 2)
355
0
            return;
356
77.8k
        bs_t s;
357
77.8k
        bs_init( &s, &p_src[2], i_src - 2 );
358
77.8k
        const int i_cc_count = bs_read( &s, 5 );
359
1.34M
        for( int i = 0; i < i_cc_count; i++ )
360
1.26M
        {
361
1.26M
            bs_skip( &s, 2 );
362
1.26M
            const int i_field_idx = bs_read( &s, 2 );
363
1.26M
            bs_skip( &s, 5 );
364
1.26M
            uint8_t cc[2];
365
3.80M
            for( int j = 0; j < 2; j++ )
366
2.53M
            {
367
2.53M
                cc[j] = 0;
368
22.8M
                for( int k = 0; k < 8; k++ )
369
20.3M
                    cc[j] |= bs_read( &s, 1 ) << k;
370
2.53M
            }
371
1.26M
            bs_skip( &s, 1 );
372
373
1.26M
            if( i_field_idx == 0 )
374
1.04M
                continue;
375
376
            /* 1,2,3 -> 0,1,0. I.E. repeated field 3 is merged with field 1 */
377
225k
            int i_field = ((i_field_idx - 1) & 1);
378
225k
            if (!b_top_field_first)
379
204k
                i_field ^= 1;
380
381
225k
            if (!cc_AppendData( c, CC_PKT_BYTE0(i_field), &cc[0] ))
382
5.30k
                continue;
383
225k
        }
384
77.8k
        c->b_reorder = true;
385
77.8k
    }
386
39.4k
    else // CC_PAYLOAD_CDP
387
39.4k
    {
388
39.4k
#       define CDP_FLAG_TIME_CODE_PRESENT  (1<<7)
389
39.4k
#       define CDP_FLAG_CC_DATA_PRESENT    (1<<6)
390
39.4k
#       define CDP_FLAG_SVC_INFO_PRESENT   (1<<5)
391
39.4k
#       define CDP_FLAG_SVC_INFO_START     (1<<4)
392
39.4k
#       define CDP_FLAG_SVC_INFO_CHANGE    (1<<3)
393
39.4k
#       define CDP_FLAG_SVC_INFO_COMPLETE  (1<<2)
394
39.4k
#       define CDP_FLAG_CAPTION_SVC_ACTIVE (1<<1)
395
396
39.4k
        if(i_src < 7)
397
2.89k
            return;
398
399
        /* ST334-2 5.2 cdp_header() */
400
36.5k
        uint8_t cdp_length = p_src[2];
401
36.5k
        if(cdp_length < 8 || cdp_length > i_src)
402
5.32k
            return;
403
31.2k
        uint8_t cdp_flags = p_src[4];
404
405
        /* skip header */
406
31.2k
        p_src += 7; i_src -= 7;
407
408
        /* 5.3 time_code_section() */
409
31.2k
        if( cdp_flags & CDP_FLAG_TIME_CODE_PRESENT )
410
11.7k
        {
411
11.7k
            if( i_src < 5 ) // Shall be 5 bytes
412
619
                return;
413
11.1k
            p_src += 5; i_src -= 5;
414
11.1k
        }
415
        /* 5.4 ccdata_section */
416
30.6k
        if( cdp_flags & CDP_FLAG_CC_DATA_PRESENT )
417
27.8k
        {
418
            /* ccdata_section()
419
             *      u8 0x72
420
             *      u3 marker bits(111)
421
             *      u5 cc_count
422
             *      for cc_count
423
             *          u5 marker bits(1111 1)
424
             *          u1 cc_valid
425
             *          u2 cc_type
426
             *          u8 cc_data_1
427
             *          u8 cc_data_2
428
             */
429
27.8k
            if( i_src < 2 || p_src[0] != 0x72 ) // marker
430
7.83k
                return;
431
432
20.0k
            const uint8_t *cc = &p_src[1];
433
20.0k
            const int i_count_cc = cc[0]&0x1f;
434
435
20.0k
            if( i_src - 2 < i_count_cc*3 )  // broken packet
436
1.95k
                return;
437
18.0k
            cc += 1;
438
234k
            for( int i = 0; i < i_count_cc; i++, cc += 3 )
439
218k
            {
440
218k
                if (!cc_AppendData( c, cc[0], &cc[1] ))
441
2.61k
                    break;
442
218k
            }
443
18.0k
        }
444
        /* remaining data */
445
20.8k
        c->b_reorder = false;
446
20.8k
    }
447
252k
}
vc1.c:cc_Extract
Line
Count
Source
222
21.7k
{
223
21.7k
    if( c->i_payload_type != CC_PAYLOAD_NONE && c->i_payload_type != i_payload_type )
224
0
    {
225
0
        c->i_payload_other_count++;
226
0
        if( c->i_payload_other_count < 50 )
227
0
            return;
228
0
    }
229
21.7k
    c->i_payload_type        = i_payload_type;
230
21.7k
    c->i_payload_other_count = 0;
231
232
21.7k
    if( i_payload_type == CC_PAYLOAD_RAW )
233
0
    {
234
0
        for( int i = 0; i + 2 < i_src; i += 3 )
235
0
        {
236
0
            const uint8_t *cc = &p_src[i];
237
0
            if (!cc_AppendData( c, cc[0], &cc[1] ))
238
0
                break;
239
0
        }
240
0
        c->b_reorder = true;
241
0
    }
242
21.7k
    else if( i_payload_type == CC_PAYLOAD_GA94 )
243
21.7k
    {
244
        /* cc_data()
245
         *          u1 reserved(1)
246
         *          u1 process_cc_data_flag
247
         *          u1 additional_data_flag
248
         *          u5 cc_count
249
         *          u8 reserved(1111 1111)
250
         *          for cc_count
251
         *              u5 marker bit(1111 1)
252
         *              u1 cc_valid
253
         *              u2 cc_type
254
         *              u8 cc_data_1
255
         *              u8 cc_data_2
256
         *          u8 marker bit(1111 1111)
257
         *          if additional_data_flag
258
         *              unknown
259
         */
260
        /* cc_type:
261
         *  0x00: field 1
262
         *  0x01: field 2
263
         */
264
21.7k
        if(i_src < 1)
265
0
            return;
266
21.7k
        const uint8_t *cc = &p_src[0];
267
21.7k
        const int i_count_cc = cc[0]&0x1f;
268
21.7k
        int i;
269
270
21.7k
        if( !(cc[0]&0x40) ) // process flag
271
368
            return;
272
21.3k
        if( i_src < 1+1 + i_count_cc*3 + 1)  // broken packet
273
4.20k
            return;
274
17.1k
        if( i_count_cc <= 0 )   // no cc present
275
252
            return;
276
16.8k
        if( cc[2+i_count_cc * 3] != 0xff )  // marker absent
277
4.41k
            return;
278
12.4k
        cc += 2;
279
280
188k
        for( i = 0; i < i_count_cc; i++, cc += 3 )
281
177k
        {
282
177k
            if (!cc_AppendData( c, cc[0], &cc[1] ))
283
1.43k
                break;
284
177k
        }
285
12.4k
        c->b_reorder = true;
286
12.4k
    }
287
0
    else if( i_payload_type == CC_PAYLOAD_DVD )
288
0
    {
289
        /* user_data
290
         *          (u32 stripped earlier)
291
         *          u32 (0x43 0x43 0x01 0xf8)
292
         *          u1 caption_odd_field_first (CC1/CC2)
293
         *          u1 caption_filler
294
         *          u5 cc_block_count  (== cc_count / 2)
295
         *          u1 caption_extra_field_added (because odd cc_count)
296
         *          for cc_block_count * 2 + caption_extra_field_added
297
         *              u7 cc_filler_1
298
         *              u1 cc_field_is_odd
299
         *              u8 cc_data_1
300
         *              u8 cc_data_2
301
         */
302
0
        if(i_src < 6)
303
0
            return;
304
0
        const int b_truncate = p_src[4] & 0x01;
305
0
        const int i_count_cc2 = ((p_src[4] >> 1) & 0x1f);
306
0
        const uint8_t *cc = &p_src[5];
307
0
        i_src -= 5;
308
0
        int i;
309
310
0
#define CC_ALIGNMENT_TEST   (0x7f)
311
312
0
        for( i = 0; i < 2*i_count_cc2 + b_truncate && i_src >= 3; i++, cc+=3 )
313
0
        {
314
0
            if( (cc[0] >> 1) == CC_ALIGNMENT_TEST )
315
0
            {
316
0
                const bool even_field = (cc[0] & 0x01) ? 0 : 1;
317
0
                if (!cc_AppendData( c, CC_PKT_BYTE0(even_field), &cc[1] ))
318
0
                    break;
319
0
            }
320
0
            i_src -= 3;
321
0
        }
322
0
        c->b_reorder = false;
323
0
    }
324
0
    else if( i_payload_type == CC_PAYLOAD_REPLAYTV )
325
0
    {
326
0
        if(i_src < 1)
327
0
            return;
328
0
        const uint8_t *cc = &p_src[0];
329
0
        for( int i_cc_count = i_src >> 2; i_cc_count > 0;
330
0
             i_cc_count--, cc += 4 )
331
0
        {
332
0
            uint8_t i_field = (cc[0] & 0x02) >> 1;
333
0
            if (!cc_AppendData( c, CC_PKT_BYTE0(i_field), &cc[2] ))
334
0
                return;
335
0
        }
336
0
        c->b_reorder = false;
337
0
    }
338
0
    else if( i_payload_type == CC_PAYLOAD_SCTE20 )
339
0
    {
340
        /* user_data(2)
341
         *          (u32 stripped earlier)
342
         *          u16 p_cc_scte20
343
         *          u5 cc_count
344
         *          for cc_count
345
         *              u2 cc_priority
346
         *              u2 cc_field_num
347
         *              u5 cc_line_offset
348
         *              u8 cc_data_1[1:8]
349
         *              u8 cc_data_2[1:8]
350
         *              u1 marker bit
351
         *          un additional_realtimevideodata
352
         *          un reserved
353
         */
354
0
        if(i_src < 2)
355
0
            return;
356
0
        bs_t s;
357
0
        bs_init( &s, &p_src[2], i_src - 2 );
358
0
        const int i_cc_count = bs_read( &s, 5 );
359
0
        for( int i = 0; i < i_cc_count; i++ )
360
0
        {
361
0
            bs_skip( &s, 2 );
362
0
            const int i_field_idx = bs_read( &s, 2 );
363
0
            bs_skip( &s, 5 );
364
0
            uint8_t cc[2];
365
0
            for( int j = 0; j < 2; j++ )
366
0
            {
367
0
                cc[j] = 0;
368
0
                for( int k = 0; k < 8; k++ )
369
0
                    cc[j] |= bs_read( &s, 1 ) << k;
370
0
            }
371
0
            bs_skip( &s, 1 );
372
373
0
            if( i_field_idx == 0 )
374
0
                continue;
375
376
            /* 1,2,3 -> 0,1,0. I.E. repeated field 3 is merged with field 1 */
377
0
            int i_field = ((i_field_idx - 1) & 1);
378
0
            if (!b_top_field_first)
379
0
                i_field ^= 1;
380
381
0
            if (!cc_AppendData( c, CC_PKT_BYTE0(i_field), &cc[0] ))
382
0
                continue;
383
0
        }
384
0
        c->b_reorder = true;
385
0
    }
386
0
    else // CC_PAYLOAD_CDP
387
0
    {
388
0
#       define CDP_FLAG_TIME_CODE_PRESENT  (1<<7)
389
0
#       define CDP_FLAG_CC_DATA_PRESENT    (1<<6)
390
0
#       define CDP_FLAG_SVC_INFO_PRESENT   (1<<5)
391
0
#       define CDP_FLAG_SVC_INFO_START     (1<<4)
392
0
#       define CDP_FLAG_SVC_INFO_CHANGE    (1<<3)
393
0
#       define CDP_FLAG_SVC_INFO_COMPLETE  (1<<2)
394
0
#       define CDP_FLAG_CAPTION_SVC_ACTIVE (1<<1)
395
396
0
        if(i_src < 7)
397
0
            return;
398
399
        /* ST334-2 5.2 cdp_header() */
400
0
        uint8_t cdp_length = p_src[2];
401
0
        if(cdp_length < 8 || cdp_length > i_src)
402
0
            return;
403
0
        uint8_t cdp_flags = p_src[4];
404
405
        /* skip header */
406
0
        p_src += 7; i_src -= 7;
407
408
        /* 5.3 time_code_section() */
409
0
        if( cdp_flags & CDP_FLAG_TIME_CODE_PRESENT )
410
0
        {
411
0
            if( i_src < 5 ) // Shall be 5 bytes
412
0
                return;
413
0
            p_src += 5; i_src -= 5;
414
0
        }
415
        /* 5.4 ccdata_section */
416
0
        if( cdp_flags & CDP_FLAG_CC_DATA_PRESENT )
417
0
        {
418
            /* ccdata_section()
419
             *      u8 0x72
420
             *      u3 marker bits(111)
421
             *      u5 cc_count
422
             *      for cc_count
423
             *          u5 marker bits(1111 1)
424
             *          u1 cc_valid
425
             *          u2 cc_type
426
             *          u8 cc_data_1
427
             *          u8 cc_data_2
428
             */
429
0
            if( i_src < 2 || p_src[0] != 0x72 ) // marker
430
0
                return;
431
432
0
            const uint8_t *cc = &p_src[1];
433
0
            const int i_count_cc = cc[0]&0x1f;
434
435
0
            if( i_src - 2 < i_count_cc*3 )  // broken packet
436
0
                return;
437
0
            cc += 1;
438
0
            for( int i = 0; i < i_count_cc; i++, cc += 3 )
439
0
            {
440
0
                if (!cc_AppendData( c, cc[0], &cc[1] ))
441
0
                    break;
442
0
            }
443
0
        }
444
        /* remaining data */
445
0
        c->b_reorder = false;
446
0
    }
447
21.7k
}
Unexecuted instantiation: dav1d.c:cc_Extract
video.c:cc_Extract
Line
Count
Source
222
5.78k
{
223
5.78k
    if( c->i_payload_type != CC_PAYLOAD_NONE && c->i_payload_type != i_payload_type )
224
0
    {
225
0
        c->i_payload_other_count++;
226
0
        if( c->i_payload_other_count < 50 )
227
0
            return;
228
0
    }
229
5.78k
    c->i_payload_type        = i_payload_type;
230
5.78k
    c->i_payload_other_count = 0;
231
232
5.78k
    if( i_payload_type == CC_PAYLOAD_RAW )
233
5.78k
    {
234
1.13M
        for( int i = 0; i + 2 < i_src; i += 3 )
235
1.13M
        {
236
1.13M
            const uint8_t *cc = &p_src[i];
237
1.13M
            if (!cc_AppendData( c, cc[0], &cc[1] ))
238
542
                break;
239
1.13M
        }
240
5.78k
        c->b_reorder = true;
241
5.78k
    }
242
0
    else if( i_payload_type == CC_PAYLOAD_GA94 )
243
0
    {
244
        /* cc_data()
245
         *          u1 reserved(1)
246
         *          u1 process_cc_data_flag
247
         *          u1 additional_data_flag
248
         *          u5 cc_count
249
         *          u8 reserved(1111 1111)
250
         *          for cc_count
251
         *              u5 marker bit(1111 1)
252
         *              u1 cc_valid
253
         *              u2 cc_type
254
         *              u8 cc_data_1
255
         *              u8 cc_data_2
256
         *          u8 marker bit(1111 1111)
257
         *          if additional_data_flag
258
         *              unknown
259
         */
260
        /* cc_type:
261
         *  0x00: field 1
262
         *  0x01: field 2
263
         */
264
0
        if(i_src < 1)
265
0
            return;
266
0
        const uint8_t *cc = &p_src[0];
267
0
        const int i_count_cc = cc[0]&0x1f;
268
0
        int i;
269
270
0
        if( !(cc[0]&0x40) ) // process flag
271
0
            return;
272
0
        if( i_src < 1+1 + i_count_cc*3 + 1)  // broken packet
273
0
            return;
274
0
        if( i_count_cc <= 0 )   // no cc present
275
0
            return;
276
0
        if( cc[2+i_count_cc * 3] != 0xff )  // marker absent
277
0
            return;
278
0
        cc += 2;
279
280
0
        for( i = 0; i < i_count_cc; i++, cc += 3 )
281
0
        {
282
0
            if (!cc_AppendData( c, cc[0], &cc[1] ))
283
0
                break;
284
0
        }
285
0
        c->b_reorder = true;
286
0
    }
287
0
    else if( i_payload_type == CC_PAYLOAD_DVD )
288
0
    {
289
        /* user_data
290
         *          (u32 stripped earlier)
291
         *          u32 (0x43 0x43 0x01 0xf8)
292
         *          u1 caption_odd_field_first (CC1/CC2)
293
         *          u1 caption_filler
294
         *          u5 cc_block_count  (== cc_count / 2)
295
         *          u1 caption_extra_field_added (because odd cc_count)
296
         *          for cc_block_count * 2 + caption_extra_field_added
297
         *              u7 cc_filler_1
298
         *              u1 cc_field_is_odd
299
         *              u8 cc_data_1
300
         *              u8 cc_data_2
301
         */
302
0
        if(i_src < 6)
303
0
            return;
304
0
        const int b_truncate = p_src[4] & 0x01;
305
0
        const int i_count_cc2 = ((p_src[4] >> 1) & 0x1f);
306
0
        const uint8_t *cc = &p_src[5];
307
0
        i_src -= 5;
308
0
        int i;
309
310
0
#define CC_ALIGNMENT_TEST   (0x7f)
311
312
0
        for( i = 0; i < 2*i_count_cc2 + b_truncate && i_src >= 3; i++, cc+=3 )
313
0
        {
314
0
            if( (cc[0] >> 1) == CC_ALIGNMENT_TEST )
315
0
            {
316
0
                const bool even_field = (cc[0] & 0x01) ? 0 : 1;
317
0
                if (!cc_AppendData( c, CC_PKT_BYTE0(even_field), &cc[1] ))
318
0
                    break;
319
0
            }
320
0
            i_src -= 3;
321
0
        }
322
0
        c->b_reorder = false;
323
0
    }
324
0
    else if( i_payload_type == CC_PAYLOAD_REPLAYTV )
325
0
    {
326
0
        if(i_src < 1)
327
0
            return;
328
0
        const uint8_t *cc = &p_src[0];
329
0
        for( int i_cc_count = i_src >> 2; i_cc_count > 0;
330
0
             i_cc_count--, cc += 4 )
331
0
        {
332
0
            uint8_t i_field = (cc[0] & 0x02) >> 1;
333
0
            if (!cc_AppendData( c, CC_PKT_BYTE0(i_field), &cc[2] ))
334
0
                return;
335
0
        }
336
0
        c->b_reorder = false;
337
0
    }
338
0
    else if( i_payload_type == CC_PAYLOAD_SCTE20 )
339
0
    {
340
        /* user_data(2)
341
         *          (u32 stripped earlier)
342
         *          u16 p_cc_scte20
343
         *          u5 cc_count
344
         *          for cc_count
345
         *              u2 cc_priority
346
         *              u2 cc_field_num
347
         *              u5 cc_line_offset
348
         *              u8 cc_data_1[1:8]
349
         *              u8 cc_data_2[1:8]
350
         *              u1 marker bit
351
         *          un additional_realtimevideodata
352
         *          un reserved
353
         */
354
0
        if(i_src < 2)
355
0
            return;
356
0
        bs_t s;
357
0
        bs_init( &s, &p_src[2], i_src - 2 );
358
0
        const int i_cc_count = bs_read( &s, 5 );
359
0
        for( int i = 0; i < i_cc_count; i++ )
360
0
        {
361
0
            bs_skip( &s, 2 );
362
0
            const int i_field_idx = bs_read( &s, 2 );
363
0
            bs_skip( &s, 5 );
364
0
            uint8_t cc[2];
365
0
            for( int j = 0; j < 2; j++ )
366
0
            {
367
0
                cc[j] = 0;
368
0
                for( int k = 0; k < 8; k++ )
369
0
                    cc[j] |= bs_read( &s, 1 ) << k;
370
0
            }
371
0
            bs_skip( &s, 1 );
372
373
0
            if( i_field_idx == 0 )
374
0
                continue;
375
376
            /* 1,2,3 -> 0,1,0. I.E. repeated field 3 is merged with field 1 */
377
0
            int i_field = ((i_field_idx - 1) & 1);
378
0
            if (!b_top_field_first)
379
0
                i_field ^= 1;
380
381
0
            if (!cc_AppendData( c, CC_PKT_BYTE0(i_field), &cc[0] ))
382
0
                continue;
383
0
        }
384
0
        c->b_reorder = true;
385
0
    }
386
0
    else // CC_PAYLOAD_CDP
387
0
    {
388
0
#       define CDP_FLAG_TIME_CODE_PRESENT  (1<<7)
389
0
#       define CDP_FLAG_CC_DATA_PRESENT    (1<<6)
390
0
#       define CDP_FLAG_SVC_INFO_PRESENT   (1<<5)
391
0
#       define CDP_FLAG_SVC_INFO_START     (1<<4)
392
0
#       define CDP_FLAG_SVC_INFO_CHANGE    (1<<3)
393
0
#       define CDP_FLAG_SVC_INFO_COMPLETE  (1<<2)
394
0
#       define CDP_FLAG_CAPTION_SVC_ACTIVE (1<<1)
395
396
0
        if(i_src < 7)
397
0
            return;
398
399
        /* ST334-2 5.2 cdp_header() */
400
0
        uint8_t cdp_length = p_src[2];
401
0
        if(cdp_length < 8 || cdp_length > i_src)
402
0
            return;
403
0
        uint8_t cdp_flags = p_src[4];
404
405
        /* skip header */
406
0
        p_src += 7; i_src -= 7;
407
408
        /* 5.3 time_code_section() */
409
0
        if( cdp_flags & CDP_FLAG_TIME_CODE_PRESENT )
410
0
        {
411
0
            if( i_src < 5 ) // Shall be 5 bytes
412
0
                return;
413
0
            p_src += 5; i_src -= 5;
414
0
        }
415
        /* 5.4 ccdata_section */
416
0
        if( cdp_flags & CDP_FLAG_CC_DATA_PRESENT )
417
0
        {
418
            /* ccdata_section()
419
             *      u8 0x72
420
             *      u3 marker bits(111)
421
             *      u5 cc_count
422
             *      for cc_count
423
             *          u5 marker bits(1111 1)
424
             *          u1 cc_valid
425
             *          u2 cc_type
426
             *          u8 cc_data_1
427
             *          u8 cc_data_2
428
             */
429
0
            if( i_src < 2 || p_src[0] != 0x72 ) // marker
430
0
                return;
431
432
0
            const uint8_t *cc = &p_src[1];
433
0
            const int i_count_cc = cc[0]&0x1f;
434
435
0
            if( i_src - 2 < i_count_cc*3 )  // broken packet
436
0
                return;
437
0
            cc += 1;
438
0
            for( int i = 0; i < i_count_cc; i++, cc += 3 )
439
0
            {
440
0
                if (!cc_AppendData( c, cc[0], &cc[1] ))
441
0
                    break;
442
0
            }
443
0
        }
444
        /* remaining data */
445
0
        c->b_reorder = false;
446
0
    }
447
5.78k
}
448
449
450
static inline void cc_ProbeAndExtract( cc_data_t *c, bool b_top_field_first, const uint8_t *p_src, int i_src )
451
453k
{
452
453k
    static const uint8_t p_cc_ga94[4] = { 0x47, 0x41, 0x39, 0x34 };
453
453k
    static const uint8_t p_cc_dvd[4] = { 0x43, 0x43, 0x01, 0xf8 }; /* ascii 'CC', type_code, cc_block_size */
454
453k
    static const uint8_t p_cc_replaytv4a[2] = { 0xbb, 0x02 };/* RTV4K, BB02xxxxCC02 */
455
453k
    static const uint8_t p_cc_replaytv4b[2] = { 0xcc, 0x02 };/* see DVR-ClosedCaption in samples */
456
453k
    static const uint8_t p_cc_replaytv5a[2] = { 0x99, 0x02 };/* RTV5K, 9902xxxxAA02 */
457
453k
    static const uint8_t p_cc_replaytv5b[2] = { 0xaa, 0x02 };/* see DVR-ClosedCaption in samples */
458
453k
    static const uint8_t p_cc_scte20[2] = { 0x03, 0x81 };    /* user_data_type_code, SCTE 20 */
459
453k
    static const uint8_t p_cc_scte20_old[2] = { 0x03, 0x01 };/* user_data_type_code, old, Note 1 */
460
461
453k
    if( i_src < 4 )
462
0
        return;
463
464
453k
    enum cc_payload_type_e i_payload_type;
465
453k
    if( !memcmp( p_cc_ga94, p_src, 4 ) && i_src >= 5+1+1+1 && p_src[4] == 0x03 )
466
132k
    {
467
        /* CC from DVB/ATSC TS */
468
132k
        i_payload_type = CC_PAYLOAD_GA94;
469
132k
        i_src -= 5;
470
132k
        p_src += 5;
471
132k
    }
472
321k
    else if( !memcmp( p_cc_dvd, p_src, 4 ) && i_src > 4+1 )
473
44.9k
    {
474
44.9k
        i_payload_type = CC_PAYLOAD_DVD;
475
44.9k
    }
476
276k
    else if( i_src >= 2+2 + 2+2 &&
477
238k
             ( ( !memcmp( p_cc_replaytv4a, &p_src[0], 2 ) && !memcmp( p_cc_replaytv4b, &p_src[4], 2 ) ) ||
478
231k
               ( !memcmp( p_cc_replaytv5a, &p_src[0], 2 ) && !memcmp( p_cc_replaytv5b, &p_src[4], 2 ) ) ) )
479
9.65k
    {
480
9.65k
        i_payload_type = CC_PAYLOAD_REPLAYTV;
481
9.65k
    }
482
266k
    else if( ( !memcmp( p_cc_scte20, p_src, 2 ) ||
483
244k
               !memcmp( p_cc_scte20_old, p_src, 2 ) ) && i_src > 2 )
484
95.5k
    {
485
95.5k
        i_payload_type = CC_PAYLOAD_SCTE20;
486
95.5k
    }
487
170k
    else if (p_src[0] == 0x03 && p_src[1] == i_src - 2) /* DIRECTV */
488
5.12k
    {
489
5.12k
        i_payload_type = CC_PAYLOAD_GA94;
490
5.12k
        i_src -= 2;
491
5.12k
        p_src += 2;
492
5.12k
    }
493
165k
    else if (p_src[0] == 0x96 && p_src[1] == 0x69) /* CDP */
494
45.3k
    {
495
45.3k
        i_payload_type = CC_PAYLOAD_CDP;
496
45.3k
    }
497
120k
    else
498
120k
    {
499
#if 0
500
#define V(x) ( ( x < 0x20 || x >= 0x7f ) ? '?' : x )
501
        fprintf( stderr, "-------------- unknown user data " );
502
        for( int i = 0; i < i_src; i++ )
503
            fprintf( stderr, "%2.2x ", p_src[i] );
504
        for( int i = 0; i < i_src; i++ )
505
            fprintf( stderr, "%c ", V(p_src[i]) );
506
        fprintf( stderr, "\n" );
507
#undef V
508
#endif
509
120k
        return;
510
120k
    }
511
512
333k
    cc_Extract( c, i_payload_type, b_top_field_first, p_src, i_src );
513
333k
}
Unexecuted instantiation: mp4.c:cc_ProbeAndExtract
Unexecuted instantiation: ty.c:cc_ProbeAndExtract
Unexecuted instantiation: hxxx_common.c:cc_ProbeAndExtract
mpegvideo.c:cc_ProbeAndExtract
Line
Count
Source
451
425k
{
452
425k
    static const uint8_t p_cc_ga94[4] = { 0x47, 0x41, 0x39, 0x34 };
453
425k
    static const uint8_t p_cc_dvd[4] = { 0x43, 0x43, 0x01, 0xf8 }; /* ascii 'CC', type_code, cc_block_size */
454
425k
    static const uint8_t p_cc_replaytv4a[2] = { 0xbb, 0x02 };/* RTV4K, BB02xxxxCC02 */
455
425k
    static const uint8_t p_cc_replaytv4b[2] = { 0xcc, 0x02 };/* see DVR-ClosedCaption in samples */
456
425k
    static const uint8_t p_cc_replaytv5a[2] = { 0x99, 0x02 };/* RTV5K, 9902xxxxAA02 */
457
425k
    static const uint8_t p_cc_replaytv5b[2] = { 0xaa, 0x02 };/* see DVR-ClosedCaption in samples */
458
425k
    static const uint8_t p_cc_scte20[2] = { 0x03, 0x81 };    /* user_data_type_code, SCTE 20 */
459
425k
    static const uint8_t p_cc_scte20_old[2] = { 0x03, 0x01 };/* user_data_type_code, old, Note 1 */
460
461
425k
    if( i_src < 4 )
462
0
        return;
463
464
425k
    enum cc_payload_type_e i_payload_type;
465
425k
    if( !memcmp( p_cc_ga94, p_src, 4 ) && i_src >= 5+1+1+1 && p_src[4] == 0x03 )
466
110k
    {
467
        /* CC from DVB/ATSC TS */
468
110k
        i_payload_type = CC_PAYLOAD_GA94;
469
110k
        i_src -= 5;
470
110k
        p_src += 5;
471
110k
    }
472
315k
    else if( !memcmp( p_cc_dvd, p_src, 4 ) && i_src > 4+1 )
473
44.9k
    {
474
44.9k
        i_payload_type = CC_PAYLOAD_DVD;
475
44.9k
    }
476
270k
    else if( i_src >= 2+2 + 2+2 &&
477
237k
             ( ( !memcmp( p_cc_replaytv4a, &p_src[0], 2 ) && !memcmp( p_cc_replaytv4b, &p_src[4], 2 ) ) ||
478
230k
               ( !memcmp( p_cc_replaytv5a, &p_src[0], 2 ) && !memcmp( p_cc_replaytv5b, &p_src[4], 2 ) ) ) )
479
9.65k
    {
480
9.65k
        i_payload_type = CC_PAYLOAD_REPLAYTV;
481
9.65k
    }
482
260k
    else if( ( !memcmp( p_cc_scte20, p_src, 2 ) ||
483
239k
               !memcmp( p_cc_scte20_old, p_src, 2 ) ) && i_src > 2 )
484
95.5k
    {
485
95.5k
        i_payload_type = CC_PAYLOAD_SCTE20;
486
95.5k
    }
487
164k
    else if (p_src[0] == 0x03 && p_src[1] == i_src - 2) /* DIRECTV */
488
5.12k
    {
489
5.12k
        i_payload_type = CC_PAYLOAD_GA94;
490
5.12k
        i_src -= 2;
491
5.12k
        p_src += 2;
492
5.12k
    }
493
159k
    else if (p_src[0] == 0x96 && p_src[1] == 0x69) /* CDP */
494
45.3k
    {
495
45.3k
        i_payload_type = CC_PAYLOAD_CDP;
496
45.3k
    }
497
114k
    else
498
114k
    {
499
#if 0
500
#define V(x) ( ( x < 0x20 || x >= 0x7f ) ? '?' : x )
501
        fprintf( stderr, "-------------- unknown user data " );
502
        for( int i = 0; i < i_src; i++ )
503
            fprintf( stderr, "%2.2x ", p_src[i] );
504
        for( int i = 0; i < i_src; i++ )
505
            fprintf( stderr, "%c ", V(p_src[i]) );
506
        fprintf( stderr, "\n" );
507
#undef V
508
#endif
509
114k
        return;
510
114k
    }
511
512
311k
    cc_Extract( c, i_payload_type, b_top_field_first, p_src, i_src );
513
311k
}
vc1.c:cc_ProbeAndExtract
Line
Count
Source
451
27.6k
{
452
27.6k
    static const uint8_t p_cc_ga94[4] = { 0x47, 0x41, 0x39, 0x34 };
453
27.6k
    static const uint8_t p_cc_dvd[4] = { 0x43, 0x43, 0x01, 0xf8 }; /* ascii 'CC', type_code, cc_block_size */
454
27.6k
    static const uint8_t p_cc_replaytv4a[2] = { 0xbb, 0x02 };/* RTV4K, BB02xxxxCC02 */
455
27.6k
    static const uint8_t p_cc_replaytv4b[2] = { 0xcc, 0x02 };/* see DVR-ClosedCaption in samples */
456
27.6k
    static const uint8_t p_cc_replaytv5a[2] = { 0x99, 0x02 };/* RTV5K, 9902xxxxAA02 */
457
27.6k
    static const uint8_t p_cc_replaytv5b[2] = { 0xaa, 0x02 };/* see DVR-ClosedCaption in samples */
458
27.6k
    static const uint8_t p_cc_scte20[2] = { 0x03, 0x81 };    /* user_data_type_code, SCTE 20 */
459
27.6k
    static const uint8_t p_cc_scte20_old[2] = { 0x03, 0x01 };/* user_data_type_code, old, Note 1 */
460
461
27.6k
    if( i_src < 4 )
462
0
        return;
463
464
27.6k
    enum cc_payload_type_e i_payload_type;
465
27.6k
    if( !memcmp( p_cc_ga94, p_src, 4 ) && i_src >= 5+1+1+1 && p_src[4] == 0x03 )
466
21.7k
    {
467
        /* CC from DVB/ATSC TS */
468
21.7k
        i_payload_type = CC_PAYLOAD_GA94;
469
21.7k
        i_src -= 5;
470
21.7k
        p_src += 5;
471
21.7k
    }
472
5.89k
    else if( !memcmp( p_cc_dvd, p_src, 4 ) && i_src > 4+1 )
473
0
    {
474
0
        i_payload_type = CC_PAYLOAD_DVD;
475
0
    }
476
5.89k
    else if( i_src >= 2+2 + 2+2 &&
477
1.05k
             ( ( !memcmp( p_cc_replaytv4a, &p_src[0], 2 ) && !memcmp( p_cc_replaytv4b, &p_src[4], 2 ) ) ||
478
1.05k
               ( !memcmp( p_cc_replaytv5a, &p_src[0], 2 ) && !memcmp( p_cc_replaytv5b, &p_src[4], 2 ) ) ) )
479
0
    {
480
0
        i_payload_type = CC_PAYLOAD_REPLAYTV;
481
0
    }
482
5.89k
    else if( ( !memcmp( p_cc_scte20, p_src, 2 ) ||
483
5.89k
               !memcmp( p_cc_scte20_old, p_src, 2 ) ) && i_src > 2 )
484
0
    {
485
0
        i_payload_type = CC_PAYLOAD_SCTE20;
486
0
    }
487
5.89k
    else if (p_src[0] == 0x03 && p_src[1] == i_src - 2) /* DIRECTV */
488
0
    {
489
0
        i_payload_type = CC_PAYLOAD_GA94;
490
0
        i_src -= 2;
491
0
        p_src += 2;
492
0
    }
493
5.89k
    else if (p_src[0] == 0x96 && p_src[1] == 0x69) /* CDP */
494
0
    {
495
0
        i_payload_type = CC_PAYLOAD_CDP;
496
0
    }
497
5.89k
    else
498
5.89k
    {
499
#if 0
500
#define V(x) ( ( x < 0x20 || x >= 0x7f ) ? '?' : x )
501
        fprintf( stderr, "-------------- unknown user data " );
502
        for( int i = 0; i < i_src; i++ )
503
            fprintf( stderr, "%2.2x ", p_src[i] );
504
        for( int i = 0; i < i_src; i++ )
505
            fprintf( stderr, "%c ", V(p_src[i]) );
506
        fprintf( stderr, "\n" );
507
#undef V
508
#endif
509
5.89k
        return;
510
5.89k
    }
511
512
21.7k
    cc_Extract( c, i_payload_type, b_top_field_first, p_src, i_src );
513
21.7k
}
Unexecuted instantiation: dav1d.c:cc_ProbeAndExtract
Unexecuted instantiation: video.c:cc_ProbeAndExtract
514
515
#endif /* _CC_H */
516