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
62bebf6e
Commit
62bebf6e
authored
Jun 04, 2012
by
Alex Converse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat: Factorize codec probing.
parent
c6061443
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
20 deletions
+25
-20
utils.c
libavformat/utils.c
+25
-20
No files found.
libavformat/utils.c
View file @
62bebf6e
...
...
@@ -612,6 +612,30 @@ fail:
/*******************************************************/
static
void
probe_codec
(
AVFormatContext
*
s
,
AVStream
*
st
,
const
AVPacket
*
pkt
)
{
if
(
st
->
codec
->
codec_id
==
CODEC_ID_PROBE
){
AVProbeData
*
pd
=
&
st
->
probe_data
;
av_log
(
s
,
AV_LOG_DEBUG
,
"probing stream %d
\n
"
,
st
->
index
);
--
st
->
probe_packets
;
pd
->
buf
=
av_realloc
(
pd
->
buf
,
pd
->
buf_size
+
pkt
->
size
+
AVPROBE_PADDING_SIZE
);
memcpy
(
pd
->
buf
+
pd
->
buf_size
,
pkt
->
data
,
pkt
->
size
);
pd
->
buf_size
+=
pkt
->
size
;
memset
(
pd
->
buf
+
pd
->
buf_size
,
0
,
AVPROBE_PADDING_SIZE
);
if
(
av_log2
(
pd
->
buf_size
)
!=
av_log2
(
pd
->
buf_size
-
pkt
->
size
)){
//FIXME we do not reduce score to 0 for the case of running out of buffer space in bytes
set_codec_from_probe_data
(
s
,
st
,
pd
,
st
->
probe_packets
>
0
?
AVPROBE_SCORE_MAX
/
4
:
0
);
if
(
st
->
codec
->
codec_id
!=
CODEC_ID_PROBE
){
pd
->
buf_size
=
0
;
av_freep
(
&
pd
->
buf
);
av_log
(
s
,
AV_LOG_DEBUG
,
"probed stream %d
\n
"
,
st
->
index
);
}
}
}
}
int
ff_read_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
int
ret
,
i
;
...
...
@@ -675,26 +699,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
add_to_pktbuf
(
&
s
->
raw_packet_buffer
,
pkt
,
&
s
->
raw_packet_buffer_end
);
s
->
raw_packet_buffer_remaining_size
-=
pkt
->
size
;
if
(
st
->
codec
->
codec_id
==
CODEC_ID_PROBE
){
AVProbeData
*
pd
=
&
st
->
probe_data
;
av_log
(
s
,
AV_LOG_DEBUG
,
"probing stream %d
\n
"
,
st
->
index
);
--
st
->
probe_packets
;
pd
->
buf
=
av_realloc
(
pd
->
buf
,
pd
->
buf_size
+
pkt
->
size
+
AVPROBE_PADDING_SIZE
);
memcpy
(
pd
->
buf
+
pd
->
buf_size
,
pkt
->
data
,
pkt
->
size
);
pd
->
buf_size
+=
pkt
->
size
;
memset
(
pd
->
buf
+
pd
->
buf_size
,
0
,
AVPROBE_PADDING_SIZE
);
if
(
av_log2
(
pd
->
buf_size
)
!=
av_log2
(
pd
->
buf_size
-
pkt
->
size
)){
//FIXME we do not reduce score to 0 for the case of running out of buffer space in bytes
set_codec_from_probe_data
(
s
,
st
,
pd
,
st
->
probe_packets
>
0
?
AVPROBE_SCORE_MAX
/
4
:
0
);
if
(
st
->
codec
->
codec_id
!=
CODEC_ID_PROBE
){
pd
->
buf_size
=
0
;
av_freep
(
&
pd
->
buf
);
av_log
(
s
,
AV_LOG_DEBUG
,
"probed stream %d
\n
"
,
st
->
index
);
}
}
}
probe_codec
(
s
,
st
,
pkt
);
}
}
...
...
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