猪心炖什么补气补血| 乌鸡汤放什么材料| 马尿是什么意思| perry是什么意思| 6月6号是什么星座| 腰间盘膨出和突出有什么区别| 宫内感染有什么症状| 砥砺什么意思| 圣罗兰为什么叫杨树林| 猴子下山的故事告诉我们什么| 意象是什么意思| 11号来月经什么时候是排卵期| 腿为什么会抽筋| 量贩式ktv什么意思| 拔牙后吃什么消炎药最好| 1658是什么意思| 风团是什么| 满五唯一的房子要交什么税| 甲状腺病变是什么意思| 肌酐高不能吃什么| 吃什么可以让子宫内膜变薄| 04年属什么生肖| 肺部炎症用什么药最好| 调和营卫是什么意思| quilt什么意思| 总ige高是什么意思| 什么颜色最吸热| 梦见种玉米是什么意思| 喝什么去湿气最好最快| 口炎读什么| 脚上长鸡眼去医院挂什么科| 什么是双| 延字五行属什么| 天铁是什么| 垂问是什么意思| 火龙果有什么好处| 眼睛经常充血是什么原因引起的| 梦见拉麦子是什么预兆| 十月30号是什么星座| 一个既一个旦念什么| 磋磨什么意思| 夏枯草是什么样子| 怡字属于五行属什么| 行政许可是什么意思| 做胃镜有什么好处| 梦见不干净的东西代表什么| bp是什么意思| 女人带貔貅有什么讲究| 蛆长什么样子| 什么是扁桃体| amy是什么意思| 农历六月六是什么节日| 脂肪燃烧是什么感觉| 羊膜囊是什么| 想留不能留才最寂寞是什么歌| 失眠吃什么好睡觉| 梦见剃光头是什么预兆| 成功的反义词是什么| 玉势是什么| 牛肉和什么菜炒好吃| 手机越狱什么意思| 梦见搞卫生什么意思| 百白破是预防什么的| 单男是什么意思| 安然无恙是什么意思| 开山鼻祖是什么意思| 倒反天罡是什么意思| 什么照片看不出照的是谁| 大便次数少是什么原因| 李荣浩什么学历| 胆囊息肉是什么原因造成的| 兰若是什么意思| 柠檬茶喝了有什么好处| 抗心磷脂抗体阳性是什么意思| 副局级是什么级别| 低蛋白血症吃什么最快| 经常肚子疼拉肚子是什么原因| 老人嘴唇发紫是什么原因| 阴唇内侧长疙瘩是什么原因| 葳蕤是什么中药| 大学是什么学历| 7月30日是什么日子| 皮卡丘什么意思| 马蹄南去人北望是什么歌| 甲醛超标有什么反应| 鼻窦粘膜增厚什么意思| 妹汁是什么| 幽门螺杆菌什么症状| 手指甲软薄是缺什么| 瞽叟是什么意思| 来月经同房会有什么后果| 李世民的字是什么| 血脂高吃什么药最好| 济公属什么生肖| 沐字五行属什么| 爱上一个人是什么感觉| 记吃不记打的下一句是什么| 为什么男怕属鸡| 荼蘼是什么意思| pet-ct主要检查什么| 肺部阴影意味着什么| 卸妆用什么最好| k9是什么意思| 胃糜烂吃什么药| 羊入虎口是什么生肖| 梦见什么是怀孕的征兆| 什么是周期| 槿字五行属什么| 点茶是什么意思| 天麻是什么样子| 乔治白属于什么档次| 如虎添翼是什么生肖| 儒字五行属什么| 为什么小便会带血| 四月初七是什么星座| 糖尿病吃什么好| 阴道镜活检是什么意思| 心神不定是什么生肖| 为什么最近一直下雨| 舌苔发白是什么原因引起的| 猪胰是什么东西| 绿心黑豆有什么功效| 最近老坏东西暗示什么| 67什么意思| 节制的意思是什么| 小麦什么时候播种| 脚气是什么样的| 劳您费心了什么意思| 大熊猫生活在什么地方| 女人喝甘草水有什么好处| 渗湿是什么意思| 小便不利什么意思| 脚肿是什么原因| 是什么词性| 红虾是什么虾| 高密度脂蛋白高是什么原因| 什么什么相接| 什么叫玄学| 脸色苍白没有血色是什么原因| 便秘看什么科| 兰花代表什么象征意义| 喝白醋有什么好处| 安坦又叫什么药| 不可名状的名是什么意思| 咳嗽吐白痰吃什么药| 5月24日是什么星座| 饮食男女是什么意思| 看脑袋挂什么科| 牙龈充血是什么原因| 头出虚汗是什么原因引起的| mg是什么元素| 哮喘吃什么药管用| 泡脚有什么好处和坏处| 订盟是什么意思| 良字少一点是什么字| 六块钱的麻辣烫是什么意思| 拿什么证明分居两年| 吐气如兰是什么意思| 脾虚喝什么泡水比较好| 大便出血是什么原因引起的| 淡定从容是什么意思| 灵芝孢子粉什么时候吃最好| 吸渣体质是什么意思| 甲沟炎挂什么科| 独一无二指什么生肖| 癃闭什么意思| 电疗有什么作用和功效| 什么是ct检查| 一进门见到什么植物好| 间作套种是什么意思| 梦见自己大出血是什么征兆| 电饭锅内胆什么材质好| 正装是什么样的衣服| 肾病有什么症状男性| 内衣34是什么码| 去取环前需做什么准备| 什么方法| 腰椎生理曲度变直是什么意思| 什么的蔷薇| 为什么会梦见前男友| 微喇裤配什么鞋子好看| 衙内是什么意思| 血小板低什么原因| 手抽筋是什么原因| 四月份是什么季节| 洗衣机启动不了是什么原因| 什么官许愿| 血凝是什么意思| 飞蛾吃什么东西| 打嗝医学术语是什么| 左下腹痛挂什么科| 土霉素主要是治疗什么病| 增强免疫力吃什么药| 什么其谈| tcl什么牌子| lsp什么意思| 第二天叫什么日| 内分泌失调什么意思| 何许人也是什么意思| 月经血块是什么原因| 中国的母亲河是什么河| 驳是什么意思| 天秤座什么象星座| 猿是什么动物| 乳头痛是什么征兆| 容易上火是什么原因| 面瘫吃什么药好得快| poscer是什么牌子| 白斩鸡是什么意思| 牛油果核有什么用| 什么然而止| 热闹非凡是什么意思| 小分子肽能治什么病| 怀孕10天有什么症状| 震楼神器楼上什么感觉| 12月10号是什么星座| 小棉袄是什么意思| 今年17岁属什么| 小孩咳嗽不能吃什么食物| 多出汗是什么原因| 曹操叫什么| 心律不齐是什么原因引起的| eligible是什么意思| 房速与房颤有什么区别| 菊花茶为什么会变绿色| 栀子泡水喝有什么功效| 岔气吃什么药最管用| 浮肿是什么原因造成的| 活血化瘀吃什么药| 考试吃什么| 胎位 头位是什么意思| 泄泻什么意思| 蛋白尿是什么意思| 奥利奥是什么意思| 封神榜是什么| 明月几时有的下一句是什么| 过度纵欲的后果是什么| 同房干涩什么原因导致的| 明天什么考试| 什么样的人不适合吃人参| 今年28岁属什么生肖| 什么人容易得阿尔兹海默症| 拉肚子拉稀是什么原因| 食是什么生肖| 梦见好多水果是什么预兆| 为什么不建议打水光针| 手指有痣代表什么意思| 切除脾脏对身体有什么影响| 性是什么意思| 肝硬化有什么症状表现| yonex是什么品牌| 头皮很痒是什么原因| 头疼恶心是什么症状| 谷丙转氨酶偏高吃什么药| 糖类抗原125偏高说明什么| 肌肉跳动是什么原因| 天煞孤星是什么意思| 尿蛋白2加是什么意思| 水是由什么构成的| 鼻血止不住是什么原因| 遗精是什么原因引起的| 猪肝吃多了有什么坏处| 鲱鱼在中国叫什么鱼| 宝格丽表属于什么档次| 百度

北京朝阳法院:一年立案13万余件 微信快速立案让诉讼更便捷


Directory: ../../../ffmpeg/
File: src/libavformat/paf.c
Date: 2025-08-04 00:43:16
Exec Total Coverage
Lines: 131 148 88.5%
Functions: 5 5 100.0%
Branches: 52 84 61.9%

Line Branch Exec Source
1 /*
2 * Packed Animation File demuxer
3 * Copyright (c) 2012 Paul B Mahol
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include "libavutil/channel_layout.h"
23 #include "libavutil/mem.h"
24 #include "libavcodec/paf.h"
25 #include "avformat.h"
26 #include "demux.h"
27 #include "internal.h"
28
29 #define MAGIC "Packed Animation File V1.0\n(c) 1992-96 Amazing Studio\x0a\x1a"
30
31 typedef struct PAFDemuxContext {
32 uint32_t buffer_size;
33 uint32_t frame_blks;
34 uint32_t nb_frames;
35 uint32_t start_offset;
36 uint32_t preload_count;
37 uint32_t max_video_blks;
38 uint32_t max_audio_blks;
39
40 uint32_t current_frame;
41 uint32_t current_frame_count;
42 uint32_t current_frame_block;
43
44 uint32_t *blocks_count_table;
45 uint32_t *frames_offset_table;
46 uint32_t *blocks_offset_table;
47
48 uint8_t *video_frame;
49 int video_size;
50
51 uint8_t *audio_frame;
52 uint8_t *temp_audio_frame;
53 int audio_size;
54
55 int got_audio;
56 } PAFDemuxContext;
57
58 7241 static int read_probe(const AVProbeData *p)
59 {
60
2/2
✓ Branch 0 taken 7239 times.
✓ Branch 1 taken 2 times.
7241 if ((p->buf_size >= strlen(MAGIC)) &&
61
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 7236 times.
7239 !memcmp(p->buf, MAGIC, strlen(MAGIC)))
62 3 return AVPROBE_SCORE_MAX;
63 7238 return 0;
64 }
65
66 3 static int read_close(AVFormatContext *s)
67 {
68 3 PAFDemuxContext *p = s->priv_data;
69
70 3 av_freep(&p->blocks_count_table);
71 3 av_freep(&p->frames_offset_table);
72 3 av_freep(&p->blocks_offset_table);
73 3 av_freep(&p->video_frame);
74 3 av_freep(&p->audio_frame);
75 3 av_freep(&p->temp_audio_frame);
76
77 3 return 0;
78 }
79
80 9 static int read_table(AVFormatContext *s, uint32_t *table, uint32_t count)
81 {
82 int i;
83
84
2/2
✓ Branch 0 taken 152565 times.
✓ Branch 1 taken 9 times.
152574 for (i = 0; i < count; i++) {
85
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 152565 times.
152565 if (avio_feof(s->pb))
86 return AVERROR_INVALIDDATA;
87 152565 table[i] = avio_rl32(s->pb);
88 }
89
90 9 avio_skip(s->pb, 4 * (FFALIGN(count, 512) - count));
91 9 return 0;
92 }
93
94 3 static int read_header(AVFormatContext *s)
95 {
96 3 PAFDemuxContext *p = s->priv_data;
97 3 AVIOContext *pb = s->pb;
98 AVStream *ast, *vst;
99 3 int frame_ms, ret = 0;
100
101 3 avio_skip(pb, 132);
102
103 3 vst = avformat_new_stream(s, 0);
104
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 if (!vst)
105 return AVERROR(ENOMEM);
106
107 3 vst->start_time = 0;
108 3 vst->nb_frames =
109 3 vst->duration =
110 3 p->nb_frames = avio_rl32(pb);
111 3 frame_ms = avio_rl32(pb);
112
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 if (frame_ms < 1)
113 return AVERROR_INVALIDDATA;
114
115 3 vst->codecpar->width = avio_rl32(pb);
116 3 vst->codecpar->height = avio_rl32(pb);
117 3 avio_skip(pb, 4);
118
119 3 vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
120 3 vst->codecpar->codec_tag = 0;
121 3 vst->codecpar->codec_id = AV_CODEC_ID_PAF_VIDEO;
122 3 avpriv_set_pts_info(vst, 64, frame_ms, 1000);
123
124 3 ast = avformat_new_stream(s, 0);
125
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 if (!ast)
126 return AVERROR(ENOMEM);
127
128 3 ast->start_time = 0;
129 3 ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
130 3 ast->codecpar->codec_tag = 0;
131 3 ast->codecpar->codec_id = AV_CODEC_ID_PAF_AUDIO;
132 3 ast->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
133 3 ast->codecpar->sample_rate = 22050;
134 3 avpriv_set_pts_info(ast, 64, 1, 22050);
135
136 3 p->buffer_size = avio_rl32(pb);
137 3 p->preload_count = avio_rl32(pb);
138 3 p->frame_blks = avio_rl32(pb);
139 3 p->start_offset = avio_rl32(pb);
140 3 p->max_video_blks = avio_rl32(pb);
141 3 p->max_audio_blks = avio_rl32(pb);
142
143
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
3 if (avio_feof(pb))
144 return AVERROR_INVALIDDATA;
145
146
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (p->buffer_size < 175 ||
147
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 p->max_audio_blks < 2 ||
148
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 p->max_video_blks < 1 ||
149
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 p->frame_blks < 1 ||
150
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 p->nb_frames < 1 ||
151
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 p->preload_count < 1 ||
152
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 p->buffer_size > 2048 ||
153
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 p->max_video_blks > 2048 ||
154
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 p->max_audio_blks > 2048 ||
155
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 p->nb_frames > INT_MAX / sizeof(uint32_t) ||
156
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 p->frame_blks > INT_MAX / sizeof(uint32_t))
157 return AVERROR_INVALIDDATA;
158
159 3 p->blocks_count_table = av_malloc_array(p->nb_frames,
160 sizeof(*p->blocks_count_table));
161 3 p->frames_offset_table = av_malloc_array(p->nb_frames,
162 sizeof(*p->frames_offset_table));
163 3 p->blocks_offset_table = av_malloc_array(p->frame_blks,
164 sizeof(*p->blocks_offset_table));
165
166 3 p->video_size = p->max_video_blks * p->buffer_size;
167 3 p->video_frame = av_mallocz(p->video_size);
168
169 3 p->audio_size = p->max_audio_blks * p->buffer_size;
170 3 p->audio_frame = av_mallocz(p->audio_size);
171 3 p->temp_audio_frame = av_mallocz(p->audio_size);
172
173
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (!p->blocks_count_table ||
174
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 !p->frames_offset_table ||
175
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 !p->blocks_offset_table ||
176
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 !p->video_frame ||
177
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 !p->audio_frame ||
178
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 !p->temp_audio_frame)
179 return AVERROR(ENOMEM);
180
181 3 avio_seek(pb, p->buffer_size, SEEK_SET);
182
183 3 ret = read_table(s, p->blocks_count_table, p->nb_frames);
184
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 if (ret < 0)
185 return ret;
186 3 ret = read_table(s, p->frames_offset_table, p->nb_frames);
187
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 if (ret < 0)
188 return ret;
189 3 ret = read_table(s, p->blocks_offset_table, p->frame_blks);
190
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 if (ret < 0)
191 return ret;
192
193 3 p->got_audio = 0;
194 3 p->current_frame = 0;
195 3 p->current_frame_block = 0;
196
197 3 avio_seek(pb, p->start_offset, SEEK_SET);
198
199 3 return 0;
200 }
201
202 477 static int read_packet(AVFormatContext *s, AVPacket *pkt)
203 {
204 477 PAFDemuxContext *p = s->priv_data;
205 477 AVIOContext *pb = s->pb;
206 uint32_t count, offset;
207 int size, i, ret;
208
209
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 477 times.
477 if (p->current_frame >= p->nb_frames)
210 return AVERROR_EOF;
211
212
2/2
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 474 times.
477 if (avio_feof(pb))
213 3 return AVERROR_EOF;
214
215
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 456 times.
474 if (p->got_audio) {
216
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
18 if ((ret = av_new_packet(pkt, p->audio_size)) < 0)
217 return ret;
218
219 18 memcpy(pkt->data, p->temp_audio_frame, p->audio_size);
220 18 pkt->duration = PAF_SOUND_SAMPLES * (p->audio_size / PAF_SOUND_FRAME_SIZE);
221 18 pkt->flags |= AV_PKT_FLAG_KEY;
222 18 pkt->stream_index = 1;
223 18 p->got_audio = 0;
224 18 return pkt->size;
225 }
226
227 912 count = (p->current_frame == 0) ? p->preload_count
228
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 453 times.
456 : p->blocks_count_table[p->current_frame - 1];
229
2/2
✓ Branch 0 taken 2772 times.
✓ Branch 1 taken 456 times.
3228 for (i = 0; i < count; i++) {
230
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2772 times.
2772 if (p->current_frame_block >= p->frame_blks)
231 return AVERROR_INVALIDDATA;
232
233 2772 offset = p->blocks_offset_table[p->current_frame_block] & ~(1U << 31);
234
2/2
✓ Branch 0 taken 1245 times.
✓ Branch 1 taken 1527 times.
2772 if (p->blocks_offset_table[p->current_frame_block] & (1U << 31)) {
235
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1245 times.
1245 if (offset > p->audio_size - p->buffer_size)
236 return AVERROR_INVALIDDATA;
237
238 1245 avio_read(pb, p->audio_frame + offset, p->buffer_size);
239
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 1227 times.
1245 if (offset == (p->max_audio_blks - 2) * p->buffer_size) {
240 18 memcpy(p->temp_audio_frame, p->audio_frame, p->audio_size);
241 18 p->got_audio = 1;
242 }
243 } else {
244
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1527 times.
1527 if (offset > p->video_size - p->buffer_size)
245 return AVERROR_INVALIDDATA;
246
247 1527 avio_read(pb, p->video_frame + offset, p->buffer_size);
248 }
249 2772 p->current_frame_block++;
250 }
251
252
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 456 times.
456 if (p->frames_offset_table[p->current_frame] >= p->video_size)
253 return AVERROR_INVALIDDATA;
254
255 456 size = p->video_size - p->frames_offset_table[p->current_frame];
256
257
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 456 times.
456 if ((ret = av_new_packet(pkt, size)) < 0)
258 return ret;
259
260 456 pkt->stream_index = 0;
261 456 pkt->duration = 1;
262 456 memcpy(pkt->data, p->video_frame + p->frames_offset_table[p->current_frame], size);
263
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 450 times.
456 if (pkt->data[0] & 0x20)
264 6 pkt->flags |= AV_PKT_FLAG_KEY;
265 456 p->current_frame++;
266
267 456 return pkt->size;
268 }
269
270 const FFInputFormat ff_paf_demuxer = {
271 .p.name = "paf",
272 .p.long_name = NULL_IF_CONFIG_SMALL("Amazing Studio Packed Animation File"),
273 .priv_data_size = sizeof(PAFDemuxContext),
274 .flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
275 .read_probe = read_probe,
276 .read_header = read_header,
277 .read_packet = read_packet,
278 .read_close = read_close,
279 };
280

看近视眼挂什么科 四维彩超和大排畸有什么区别 胸痹是什么意思 pn是什么意思 人设崩塌是什么意思
脾胃虚弱吃什么蔬菜 5月20日是什么日子 茄子和什么不能一起吃 春天的雨是什么 外伤用什么消炎药
纠结是什么意思 虾吃什么食物 干净的反义词是什么 二级b超是检查什么 睡觉后腰疼是什么原因引起的
低俗是什么意思 大面积杀跳蚤用什么药 蝴蝶喜欢吃什么 举足轻重是什么生肖 balance什么意思
府尹相当于现在什么官hcv8jop2ns2r.cn 什么是包茎hcv8jop6ns1r.cn 什么叫家hcv9jop2ns8r.cn 子宫b超能查出什么来hcv8jop4ns4r.cn 2022年属虎的是什么命hcv9jop3ns4r.cn
筋道是什么意思adwl56.com 五月七号是什么星座cl108k.com 80年属猴的是什么命hcv7jop7ns0r.cn 5个月宝宝吃什么辅食hcv8jop3ns3r.cn 什么提示你怀了女宝宝weuuu.com
学位证是什么hcv8jop8ns1r.cn 殊胜是什么意思hcv9jop4ns8r.cn 不知所云是什么意思hcv8jop9ns0r.cn 排场是什么意思hcv9jop4ns4r.cn 红斑是什么病hcv9jop6ns7r.cn
5月8日什么星座hcv8jop4ns2r.cn 气胸病是什么原因引起的hcv9jop5ns1r.cn 胃火旺盛吃什么药hcv9jop0ns1r.cn 肠道炎有什么症状zsyouku.com 私房菜是什么意思hcv7jop9ns6r.cn
百度