Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
b64030f2
Commit
b64030f2
authored
Mar 17, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avio: make get_checksum() internal.
parent
d09cc22d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
14 deletions
+18
-14
avio.h
libavformat/avio.h
+1
-2
avio_internal.h
libavformat/avio_internal.h
+1
-0
aviobuf.c
libavformat/aviobuf.c
+5
-1
nutdec.c
libavformat/nutdec.c
+6
-6
nutenc.c
libavformat/nutenc.c
+4
-4
oggenc.c
libavformat/oggenc.c
+1
-1
No files found.
libavformat/avio.h
View file @
b64030f2
...
...
@@ -455,6 +455,7 @@ attribute_deprecated int udp_get_local_port(URLContext *h);
attribute_deprecated
void
init_checksum
(
AVIOContext
*
s
,
unsigned
long
(
*
update_checksum
)(
unsigned
long
c
,
const
uint8_t
*
p
,
unsigned
int
len
),
unsigned
long
checksum
);
attribute_deprecated
unsigned
long
get_checksum
(
AVIOContext
*
s
);
#endif
AVIOContext
*
avio_alloc_context
(
...
...
@@ -675,8 +676,6 @@ int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
*/
int
url_close_dyn_buf
(
AVIOContext
*
s
,
uint8_t
**
pbuffer
);
unsigned
long
get_checksum
(
AVIOContext
*
s
);
#if FF_API_UDP_GET_FILE
int
udp_get_file_handle
(
URLContext
*
h
);
#endif
...
...
libavformat/avio_internal.h
View file @
b64030f2
...
...
@@ -77,6 +77,7 @@ int ff_udp_get_local_port(URLContext *h);
void
ffio_init_checksum
(
AVIOContext
*
s
,
unsigned
long
(
*
update_checksum
)(
unsigned
long
c
,
const
uint8_t
*
p
,
unsigned
int
len
),
unsigned
long
checksum
);
unsigned
long
ffio_get_checksum
(
AVIOContext
*
s
);
unsigned
long
ff_crc04C11DB7_update
(
unsigned
long
checksum
,
const
uint8_t
*
buf
,
unsigned
int
len
);
...
...
libavformat/aviobuf.c
View file @
b64030f2
...
...
@@ -412,6 +412,10 @@ void init_checksum(AVIOContext *s,
{
ffio_init_checksum
(
s
,
update_checksum
,
checksum
);
}
unsigned
long
get_checksum
(
AVIOContext
*
s
)
{
return
ffio_get_checksum
(
s
);
}
#endif
int
avio_put_str
(
AVIOContext
*
s
,
const
char
*
str
)
...
...
@@ -554,7 +558,7 @@ unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
return
av_crc
(
av_crc_get_table
(
AV_CRC_32_IEEE
),
checksum
,
buf
,
len
);
}
unsigned
long
get_checksum
(
AVIOContext
*
s
)
unsigned
long
ffio_
get_checksum
(
AVIOContext
*
s
)
{
s
->
checksum
=
s
->
update_checksum
(
s
->
checksum
,
s
->
checksum_ptr
,
s
->
buf_ptr
-
s
->
checksum_ptr
);
s
->
update_checksum
=
NULL
;
...
...
libavformat/nutdec.c
View file @
b64030f2
...
...
@@ -108,7 +108,7 @@ static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_chec
size
=
ffio_read_varlen
(
bc
);
if
(
size
>
4096
)
avio_rb32
(
bc
);
if
(
get_checksum
(
bc
)
&&
size
>
4096
)
if
(
ffio_
get_checksum
(
bc
)
&&
size
>
4096
)
return
-
1
;
ffio_init_checksum
(
bc
,
calculate_checksum
?
ff_crc04C11DB7_update
:
NULL
,
0
);
...
...
@@ -285,7 +285,7 @@ static int decode_main_header(NUTContext *nut){
assert
(
nut
->
header_len
[
0
]
==
0
);
}
if
(
skip_reserved
(
bc
,
end
)
||
get_checksum
(
bc
)){
if
(
skip_reserved
(
bc
,
end
)
||
ffio_
get_checksum
(
bc
)){
av_log
(
s
,
AV_LOG_ERROR
,
"main header checksum mismatch
\n
"
);
return
AVERROR_INVALIDDATA
;
}
...
...
@@ -374,7 +374,7 @@ static int decode_stream_header(NUTContext *nut){
ffio_read_varlen
(
bc
);
// samplerate_den
GET_V
(
st
->
codec
->
channels
,
tmp
>
0
)
}
if
(
skip_reserved
(
bc
,
end
)
||
get_checksum
(
bc
)){
if
(
skip_reserved
(
bc
,
end
)
||
ffio_
get_checksum
(
bc
)){
av_log
(
s
,
AV_LOG_ERROR
,
"stream header %d checksum mismatch
\n
"
,
stream_id
);
return
-
1
;
}
...
...
@@ -469,7 +469,7 @@ static int decode_info_header(NUTContext *nut){
}
}
if
(
skip_reserved
(
bc
,
end
)
||
get_checksum
(
bc
)){
if
(
skip_reserved
(
bc
,
end
)
||
ffio_
get_checksum
(
bc
)){
av_log
(
s
,
AV_LOG_ERROR
,
"info header checksum mismatch
\n
"
);
return
-
1
;
}
...
...
@@ -493,7 +493,7 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
ff_nut_reset_ts
(
nut
,
nut
->
time_base
[
tmp
%
nut
->
time_base_count
],
tmp
/
nut
->
time_base_count
);
if
(
skip_reserved
(
bc
,
end
)
||
get_checksum
(
bc
)){
if
(
skip_reserved
(
bc
,
end
)
||
ffio_
get_checksum
(
bc
)){
av_log
(
s
,
AV_LOG_ERROR
,
"sync point checksum mismatch
\n
"
);
return
-
1
;
}
...
...
@@ -590,7 +590,7 @@ static int find_and_decode_index(NUTContext *nut){
}
}
if
(
skip_reserved
(
bc
,
end
)
||
get_checksum
(
bc
)){
if
(
skip_reserved
(
bc
,
end
)
||
ffio_
get_checksum
(
bc
)){
av_log
(
s
,
AV_LOG_ERROR
,
"index checksum mismatch
\n
"
);
goto
fail
;
}
...
...
libavformat/nutenc.c
View file @
b64030f2
...
...
@@ -289,13 +289,13 @@ static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc, in
avio_wb64
(
bc
,
startcode
);
ff_put_v
(
bc
,
forw_ptr
);
if
(
forw_ptr
>
4096
)
avio_wl32
(
bc
,
get_checksum
(
bc
));
avio_wl32
(
bc
,
ffio_
get_checksum
(
bc
));
if
(
calculate_checksum
)
ffio_init_checksum
(
bc
,
ff_crc04C11DB7_update
,
0
);
avio_write
(
bc
,
dyn_buf
,
dyn_size
);
if
(
calculate_checksum
)
avio_wl32
(
bc
,
get_checksum
(
bc
));
avio_wl32
(
bc
,
ffio_
get_checksum
(
bc
));
av_free
(
dyn_buf
);
}
...
...
@@ -818,8 +818,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
if
(
flags
&
FLAG_SIZE_MSB
)
ff_put_v
(
bc
,
pkt
->
size
/
fc
->
size_mul
);
if
(
flags
&
FLAG_HEADER_IDX
)
ff_put_v
(
bc
,
header_idx
=
best_header_idx
);
if
(
flags
&
FLAG_CHECKSUM
)
avio_wl32
(
bc
,
get_checksum
(
bc
));
else
get_checksum
(
bc
);
if
(
flags
&
FLAG_CHECKSUM
)
avio_wl32
(
bc
,
ffio_
get_checksum
(
bc
));
else
ffio_
get_checksum
(
bc
);
avio_write
(
bc
,
pkt
->
data
+
nut
->
header_len
[
header_idx
],
pkt
->
size
-
nut
->
header_len
[
header_idx
]);
nus
->
last_flags
=
flags
;
...
...
libavformat/oggenc.c
View file @
b64030f2
...
...
@@ -68,7 +68,7 @@ typedef struct {
static
void
ogg_update_checksum
(
AVFormatContext
*
s
,
AVIOContext
*
pb
,
int64_t
crc_offset
)
{
int64_t
pos
=
avio_tell
(
pb
);
uint32_t
checksum
=
get_checksum
(
pb
);
uint32_t
checksum
=
ffio_
get_checksum
(
pb
);
avio_seek
(
pb
,
crc_offset
,
SEEK_SET
);
avio_wb32
(
pb
,
checksum
);
avio_seek
(
pb
,
pos
,
SEEK_SET
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment