十月十一日是什么星座| 旮旯是什么意思| 下巴疼是什么原因| 血糖高能吃什么主食| tct检查什么项目| 虾虎鱼吃什么| 塌腰是什么意思| 舌吻会传染什么病| 惊弓之鸟什么意思| 为什么老是做噩梦| 病例是什么| 霸王硬上弓是什么意思| 流涎是什么意思| 怀孕有积液是什么原因| 四战之地的生肖是什么| 大鱼际发青是什么原因| 什么的跳| 吃什么东西补脑| 宫颈炎用什么药物治疗比较好| 气血不足是什么意思| 三虫念什么| 大米含有什么营养成分| 放屁多吃什么药好| 一个马一个并念什么| 神经衰弱是什么病| 肚脐周围疼痛是什么原因| npn是什么意思| 什么东西不导电| 以什么| 打喷嚏流清鼻涕属于什么感冒| 喉咙一直有痰是什么原因| 老心慌是什么原因| legion什么牌子| 1.8是什么星座| 什么是姑息治疗| 红面是什么面| 但求无愧于心上句是什么| 全性向是什么意思| 品牌logo是什么意思| 妈妈的姐姐叫什么| 鹦鹉吃什么东西| 乳腺囊肿吃什么药| 糖化高是什么意思| 跳大神什么意思| 体内湿气太重吃什么药能快速除湿| 咳嗽不停是什么原因| 丰都为什么叫鬼城| 观音菩萨的坐骑是什么| 什么叫膳食纤维| 为什么不能拜女娲娘娘| 粉刺是什么样的图片| 身体冒虚汗什么原因| 甲状腺功能减退是什么意思| 猫发出咕噜咕噜的声音是什么意思| 发字五行属什么| 断肠草长什么样| 月经量多吃什么药调理| 小郡肝是什么部位| 桃花指什么生肖| 老打饱嗝是什么原因| 微针是什么| 吃猪皮有什么好处和坏处| 口角炎用什么药膏| 检察院是做什么的| 美丽的近义词是什么| 1什么意思| 脑病科是看什么病的| 茵芙莎属于什么档次| 北京户口有什么好处| 吃什么能降血糖| 蝉为什么要脱壳| 特长是什么| 倒模是什么意思| ivu是什么检查| 痛风要吃什么药好得快| 铁观音属于什么茶| 小燕子吃什么| 赵丽颖的真名叫什么| 什么是事实婚姻| psa检查是什么意思| 马蜂蛰了用什么药| 蚝油是干什么用的| 中国中铁是做什么的| 梦见把蛇打死了是什么意思| 转诊是什么意思| 反胃是什么原因引起的| 吃什么补身体| 金银花和什么搭配喝好| 额头长痘是因为什么| 龙筋是什么| 普拉提是什么运动| 腰椎退行性变什么意思| 88.88红包代表什么意思| 眼睛有血丝是什么原因| 喉咙痛吃什么药好| 穿刺手术是什么意思| 胃轻度肠化是什么意思| 湘女多情是什么意思| 哼哈二将是什么意思| 身上长湿疹是什么原因导致| 蜘蛛痣长什么样| 肠道门诊看什么病| 人格魅力是什么意思| 高粱是什么| 羊水偏多是什么原因| 父母是什么意思| 坐飞机需要带什么证件| 汉武帝属什么生肖| 为什么洗头发时会掉很多头发| 散光是什么| 梦见理发是什么意思| 喝什么茶降血脂| nk是什么| 渡劫是什么意思| 路人皆知的上一句歇后语是什么| 贤妻良母是什么意思| 青岛有什么山| 老年人脚肿是什么原因引起的| 炖牛肉放什么调料好吃| 蹲久了站起来头晕是什么原因| 桑葚是什么季节的| 14k金是什么意思| 接档是什么意思| pic什么意思| 浮白是什么意思| 什么是低碳生活| 什么杯子不能装水| 停车坐爱枫林晚的坐是什么意思| 幽闭恐惧症是什么| 豌豆荚是什么| ella是什么意思| 13颗珠子的手串什么意思| 鼻饲是什么意思| tm是什么意思| yq是什么意思| vjc是什么品牌| 窘迫什么意思| 冰火两重天是什么意思| 头发麻是什么病的前兆| 小丑代表什么生肖| 118什么意思| 辟谷是什么意思| fierce是什么意思| 豆浆喝多了有什么副作用| 72年鼠是什么命| 吃什么预防脑梗| 舌头上有红点点是什么原因| 哦多桑是什么意思| 胃烧心是怎么回事吃什么药| 丝瓜有什么好处| 梦见和死去的亲人说话是什么意思| 升血小板吃什么药| 曹操的脸谱是什么颜色| 双侧甲状腺弥漫病变是什么意思| 风雨交加是什么生肖| 男人硬不起来是什么原因| peek是什么材质| 朱代表什么生肖| 祖籍是什么意思| 聚字五行属什么| 除了胃镜还有什么检查胃的方法吗| 大腿根部痒用什么药膏| 成字五行属什么| 宝宝睡觉摇头是什么原因| blingbling什么意思| 四时是什么时辰| 白细胞偏高说明什么| 南五行属什么| 自字五行属什么| 蓝莓有什么好处| 紫菜是什么颜色| 离退休是什么意思| 便秘喝什么茶好| 腰麻是什么麻醉| 虎都男装属于什么档次| 杜比全景声是什么意思| 感叹号像什么| 湿气重的人适合吃什么| neighborhood什么意思| 盘是什么意思| 猪咳嗽用什么药好得快| 胸腺癌早期有什么症状| 情系是什么意思| 1984年属什么| 骨骺是什么意思| 处是什么结构| 甲亢甲减有什么症状| 乔治阿玛尼和阿玛尼有什么区别| venes保温杯是什么品牌| 葡萄什么时候种植| 石家庄为什么叫国际庄| 眉飞色舞是什么意思| 军士长是什么军衔| 颈椎挂什么科| 蛇是什么类动物| 养老院护工都做些什么| 十字架代表什么| 英语6级是什么水平| 985是什么| 马的贵人是什么生肖| 什么手机信号最好最强| 脚痛是什么原因| 鼠女和什么生肖最配| 猪头三是什么意思| igg是什么| 双子是什么星座| 为什么医院都让喝雀巢奶粉| 化疗期间吃什么食物好| 慢性胃炎伴胆汁反流是什么意思| 小孩说话晚是什么原因| 生殖器疱疹吃什么药| 马骝是什么意思| 吃饭咬舌头是什么原因| 冷藏是什么意思| 菡什么意思| 三颗星是什么军衔| 神经过敏是什么意思| 细菌性阴道病用什么药| 实时更新是什么意思| 兔子的耳朵有什么作用| 躺尸是什么意思| 月经期间吃西瓜有什么影响| 梦到老公出轨是什么意思| 今年什么时候进入伏天| 心什么神什么| 1951年属什么| 商标r是什么意思| 瓜子脸适合什么刘海| 太岁是什么| 鼓刹和碟刹有什么区别| 骨髓移植是什么意思| 90年什么命| 王安石是什么朝代的| 上升星座是什么意思| 女孩为什么难得午时贵| dtc什么意思| 立春之后是什么节气| 细菌性阴道炎用什么药效果好| 知音是什么意思| 演唱会安可是什么意思| 男人精液少是什么原因| 儿童流鼻涕吃什么药| 颜控什么意思| 孕妇贫血吃什么补血最快| 250为什么是骂人的话| 蜻蜓点水的目的是什么| 肾结石检查什么项目| 985211是什么意思| 囊性病变是什么意思| 神话故事有什么| 狗可以吃什么水果| 肚脐眼上方是什么器官| 金榜题名是什么生肖| 占卜是什么意思| 你的美丽让你带走是什么歌| 为什么一热脸就特别红| 细菌性肠炎是什么原因引起的| 嗳气是什么原因引起的| 柯字五行属什么| 三十六计最后一计是什么| 梦中的梦中是什么歌| 咳嗽吃什么好得快| 中考报名号是什么| 孕妇吃什么胎儿智商高| 百度

李佳当选内蒙古自治区政协主席


Directory: ../../../ffmpeg/
File: src/libavformat/mpsubdec.c
Date: 2025-08-04 00:43:16
Exec Total Coverage
Lines: 74 86 86.0%
Functions: 3 3 100.0%
Branches: 43 62 69.4%

Line Branch Exec Source
1 /*
2 * Copyright (c) 2012 Clément B?sch
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 /**
22 * @file
23 * MPlayer subtitles format demuxer
24 */
25
26 #include "avformat.h"
27 #include "demux.h"
28 #include "internal.h"
29 #include "subtitles.h"
30
31 #define TSBASE 10000000
32
33 typedef struct {
34 FFDemuxSubtitlesQueue q;
35 } MPSubContext;
36
37 7241 static int mpsub_probe(const AVProbeData *p)
38 {
39 7241 const char *ptr = p->buf;
40 7241 const char *ptr_end = p->buf + p->buf_size;
41
42
2/2
✓ Branch 0 taken 17843 times.
✓ Branch 1 taken 88 times.
17931 while (ptr < ptr_end) {
43 int inc;
44
45
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 17842 times.
17843 if (!memcmp(ptr, "FORMAT=TIME", 11))
46 1 return AVPROBE_SCORE_EXTENSION;
47
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 17840 times.
17842 if (!memcmp(ptr, "FORMAT=", 7))
48 2 return AVPROBE_SCORE_EXTENSION / 3;
49 17840 inc = ff_subtitles_next_line(ptr);
50
2/2
✓ Branch 0 taken 7150 times.
✓ Branch 1 taken 10690 times.
17840 if (!inc)
51 7150 break;
52 10690 ptr += inc;
53 }
54 7238 return 0;
55 }
56
57 42 static int parse_line(const char *line, int64_t *value, int64_t *value2)
58 {
59 int vi, p1, p2;
60
61
2/2
✓ Branch 0 taken 65 times.
✓ Branch 1 taken 23 times.
88 for (vi = 0; vi < 2; vi++) {
62 long long intval, fracval;
63 65 int n = av_sscanf(line, "%lld%n.%lld%n", &intval, &p1, &fracval, &p2);
64
4/6
✓ Branch 0 taken 46 times.
✓ Branch 1 taken 19 times.
✓ Branch 2 taken 46 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 46 times.
65 if (n <= 0 || intval < INT64_MIN / TSBASE || intval > INT64_MAX / TSBASE)
65 19 return AVERROR_INVALIDDATA;
66
67 46 intval *= TSBASE;
68
69
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 41 times.
46 if (n == 2) {
70
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (fracval < 0)
71 return AVERROR_INVALIDDATA;
72
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 5 times.
35 for (;p2 - p1 < 7 + 1; p1--)
73 30 fracval *= 10;
74
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 for (;p2 - p1 > 7 + 1; p1++)
75 fracval /= 10;
76
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 if (intval > 0) intval = av_sat_add64(intval, fracval);
77 else intval = av_sat_sub64(intval, fracval);
78 5 line += p2;
79 } else
80 41 line += p1;
81
82 46 *value = intval;
83
84 46 value = value2;
85 }
86
87 23 return 0;
88 }
89
90 2 static int mpsub_read_header(AVFormatContext *s)
91 {
92 2 MPSubContext *mpsub = s->priv_data;
93 AVStream *st;
94 AVBPrint buf;
95 2 AVRational pts_info = (AVRational){ TSBASE, 1 }; // ts based by default
96 2 int res = 0;
97 2 int64_t current_pts = 0;
98 int i;
99 2 int common_factor = 0;
100
101 2 av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
102
103
2/2
✓ Branch 1 taken 43 times.
✓ Branch 2 taken 2 times.
45 while (!avio_feof(s->pb)) {
104 char line[1024];
105 int64_t start, duration;
106 43 int fps, len = ff_get_line(s->pb, line, sizeof(line));
107
108
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 43 times.
43 if (!len)
109 break;
110
111 43 line[strcspn(line, "\r\n")] = 0;
112
113
4/6
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 42 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
43 if (sscanf(line, "FORMAT=%d", &fps) == 1 && fps > 3 && fps < 100) {
114 /* frame based timing */
115 1 pts_info = (AVRational){ TSBASE * fps, 1 };
116
2/2
✓ Branch 1 taken 23 times.
✓ Branch 2 taken 19 times.
42 } else if (parse_line(line, &start, &duration) >= 0) {
117 AVPacket *sub;
118 23 const int64_t pos = avio_tell(s->pb);
119
120 23 res = ff_subtitles_read_chunk(s->pb, &buf);
121
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 23 times.
23 if (res < 0) goto end;
122
1/2
✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
23 if (buf.len) {
123 23 sub = ff_subtitles_queue_insert_bprint(&mpsub->q, &buf, 0);
124
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 23 times.
23 if (!sub) {
125 res = AVERROR(ENOMEM);
126 goto end;
127 }
128
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
23 if ( current_pts < 0 && start < INT64_MIN - current_pts
129
3/4
✓ Branch 0 taken 21 times.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
23 || current_pts > 0 && start > INT64_MAX - current_pts) {
130 res = AVERROR_INVALIDDATA;
131 goto end;
132 }
133 23 sub->pts = current_pts + start;
134
2/4
✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 23 times.
23 if (duration < 0 || sub->pts > INT64_MAX - duration) {
135 res = AVERROR_INVALIDDATA;
136 goto end;
137 }
138 23 sub->duration = duration;
139
140 23 common_factor = av_gcd(duration, common_factor);
141 23 common_factor = av_gcd(sub->pts, common_factor);
142
143 23 current_pts = sub->pts + duration;
144 23 sub->pos = pos;
145 }
146 }
147 }
148
149
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (common_factor > 1) {
150 2 common_factor = av_gcd(pts_info.num, common_factor);
151
2/2
✓ Branch 0 taken 23 times.
✓ Branch 1 taken 2 times.
25 for (i = 0; i < mpsub->q.nb_subs; i++) {
152 23 mpsub->q.subs[i]->pts /= common_factor;
153 23 mpsub->q.subs[i]->duration /= common_factor;
154 }
155 2 pts_info.num /= common_factor;
156 }
157
158 2 st = avformat_new_stream(s, NULL);
159
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (!st) {
160 res = AVERROR(ENOMEM);
161 goto end;
162 }
163 2 avpriv_set_pts_info(st, 64, pts_info.den, pts_info.num);
164 2 st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
165 2 st->codecpar->codec_id = AV_CODEC_ID_TEXT;
166
167 2 ff_subtitles_queue_finalize(s, &mpsub->q);
168
169 2 end:
170 2 av_bprint_finalize(&buf, NULL);
171 2 return res;
172 }
173
174 const FFInputFormat ff_mpsub_demuxer = {
175 .p.name = "mpsub",
176 .p.long_name = NULL_IF_CONFIG_SMALL("MPlayer subtitles"),
177 .p.extensions = "sub",
178 .priv_data_size = sizeof(MPSubContext),
179 .flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
180 .read_probe = mpsub_probe,
181 .read_header = mpsub_read_header,
182 .read_packet = ff_subtitles_read_packet,
183 .read_seek2 = ff_subtitles_read_seek,
184 .read_close = ff_subtitles_read_close,
185 };
186

生物碱是什么 体重除以身高的平方是什么指数 脱肛是什么意思 呼吸道感染一般用什么消炎药 什么花适合室内养
手掌心经常出汗是什么原因 痛风挂什么科就医 天蝎是什么象星座 包皮是什么样子图片 我用什么留住你
黄芪精适合什么人喝 ccu是什么 多五行属什么 拉拉什么意思 高山茶属于什么茶
玉米须加什么治痛风 风肖是什么生肖 燃气灶什么品牌好 骨挫伤是什么意思 什么米好吃又香又软
腰酸背痛挂什么科hcv8jop1ns2r.cn 什么叫智齿hcv7jop4ns7r.cn 十指纤纤尽夸巧是什么生肖hcv8jop5ns3r.cn 谭咏麟属什么生肖sanhestory.com 伏地魔是什么意思hcv8jop1ns6r.cn
吃避孕药为什么要吃维生素chcv9jop8ns0r.cn 好好的什么意思beikeqingting.com 惆怅是什么意思hcv8jop1ns0r.cn 什么零食热量低有利于减肥hcv8jop2ns1r.cn 内热吃什么药hcv9jop1ns2r.cn
肠息肉是什么原因引起的hcv8jop7ns4r.cn 为什么要抽烟hcv9jop1ns3r.cn 12583是什么电话hcv8jop9ns2r.cn 维生素b族什么时候吃最好hcv9jop4ns5r.cn 胃疼喝什么能缓解疼痛hcv7jop5ns2r.cn
区块链是什么hcv9jop4ns3r.cn 广州有什么好吃的mmeoe.com 财大气粗是什么意思xinjiangjialails.com 什么家hcv9jop4ns4r.cn 日加西念什么onlinewuye.com
百度