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
0bef08e5
Commit
0bef08e5
authored
Jul 12, 2008
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New codec probing system try #1.
Originally committed as revision 14184 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
3e86dba2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
2 deletions
+46
-2
avcodec.h
libavcodec/avcodec.h
+2
-0
asf.c
libavformat/asf.c
+1
-1
avformat.h
libavformat/avformat.h
+10
-0
utils.c
libavformat/utils.c
+33
-1
No files found.
libavcodec/avcodec.h
View file @
0bef08e5
...
...
@@ -313,6 +313,8 @@ enum CodecID {
/* other specific kind of codecs (generally used for attachments) */
CODEC_ID_TTF
=
0x18000
,
CODEC_ID_PROBE
=
0x19000
,
///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it
CODEC_ID_MPEG2TS
=
0x20000
,
/**< _FAKE_ codec to indicate a raw MPEG-2 TS
* stream (only used by libavformat) */
};
...
...
libavformat/asf.c
View file @
0bef08e5
...
...
@@ -264,7 +264,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
if
(
is_dvr_ms_audio
)
{
// codec_id and codec_tag are unreliable in dvr_ms
// files. Set them later by probing stream.
st
->
codec
->
codec_id
=
CODEC_ID_
NON
E
;
st
->
codec
->
codec_id
=
CODEC_ID_
PROB
E
;
st
->
codec
->
codec_tag
=
0
;
}
st
->
need_parsing
=
AVSTREAM_PARSE_FULL
;
...
...
libavformat/avformat.h
View file @
0bef08e5
...
...
@@ -391,6 +391,8 @@ typedef struct AVStream {
char
*
filename
;
/**< source filename of the stream */
int
disposition
;
/**< AV_DISPOSITION_* bitfield */
AVProbeData
probe_data
;
}
AVStream
;
#define AV_PROGRAM_RUNNING 1
...
...
@@ -555,6 +557,14 @@ typedef struct AVFormatContext {
*/
int
debug
;
#define FF_FDEBUG_TS 0x0001
/**
* raw packets from the demuxer, prior to parsing and decoding.
* This buffer is used for buffering packets until the codec can
* be identified, as parsing cannot be done without knowing the
* codec.
*/
struct
AVPacketList
*
raw_packet_buffer
;
}
AVFormatContext
;
typedef
struct
AVPacketList
{
...
...
libavformat/utils.c
View file @
0bef08e5
...
...
@@ -540,12 +540,30 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int
ret
;
AVStream
*
st
;
for
(;;){
AVPacketList
*
pktl
=
s
->
raw_packet_buffer
;
if
(
pktl
)
{
*
pkt
=
pktl
->
pkt
;
if
(
s
->
streams
[
pkt
->
stream_index
]
->
codec
->
codec_id
!=
CODEC_ID_PROBE
){
s
->
raw_packet_buffer
=
pktl
->
next
;
av_free
(
pktl
);
return
0
;
}
}
av_init_packet
(
pkt
);
ret
=
s
->
iformat
->
read_packet
(
s
,
pkt
);
if
(
ret
<
0
)
return
ret
;
st
=
s
->
streams
[
pkt
->
stream_index
];
if
(
!
pktl
&&
st
->
codec
->
codec_id
!=
CODEC_ID_PROBE
)
return
ret
;
add_to_pktbuf
(
&
s
->
raw_packet_buffer
,
pkt
);
switch
(
st
->
codec
->
codec_type
){
case
CODEC_TYPE_VIDEO
:
if
(
s
->
video_codec_id
)
st
->
codec
->
codec_id
=
s
->
video_codec_id
;
...
...
@@ -558,7 +576,21 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt)
break
;
}
return
ret
;
if
(
st
->
codec
->
codec_id
==
CODEC_ID_PROBE
){
AVProbeData
*
pd
=
&
st
->
probe_data
;
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
);
set_codec_from_probe_data
(
st
,
pd
,
1
);
if
(
st
->
codec
->
codec_id
!=
CODEC_ID_PROBE
){
pd
->
buf_size
=
0
;
av_freep
(
&
pd
->
buf
);
}
}
}
}
/**********************************************************/
...
...
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