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
bb01a3f0
Commit
bb01a3f0
authored
Mar 10, 2004
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
guess framerate
Originally committed as revision 2866 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
c276af04
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
flvdec.c
libavformat/flvdec.c
+14
-3
No files found.
libavformat/flvdec.c
View file @
bb01a3f0
...
...
@@ -40,12 +40,16 @@ static int flv_probe(AVProbeData *p)
return
0
;
}
#define FRAME_RATE_UNKNOWN 31415 //yes i know its beatifull
static
int
flv_read_header
(
AVFormatContext
*
s
,
AVFormatParameters
*
ap
)
{
int
offset
,
flags
;
AVStream
*
st
;
s
->
ctx_flags
|=
AVFMTCTX_NOHEADER
;
//ok we have a header but theres no fps, codec type, sample_rate, ...
av_set_pts_info
(
s
,
24
,
1
,
1000
);
/* 24 bit pts in ms */
url_fskip
(
&
s
->
pb
,
4
);
...
...
@@ -57,8 +61,9 @@ static int flv_read_header(AVFormatContext *s,
return
AVERROR_NOMEM
;
st
->
codec
.
codec_type
=
CODEC_TYPE_VIDEO
;
st
->
codec
.
codec_id
=
CODEC_ID_FLV1
;
st
->
codec
.
frame_rate
=
ap
->
frame_rate
;
st
->
codec
.
frame_rate_base
=
ap
->
frame_rate_base
;
st
->
codec
.
frame_rate
=
FRAME_RATE_UNKNOWN
;
// st->codec.frame_rate= ap->frame_rate;
// st->codec.frame_rate_base= ap->frame_rate_base;
}
if
((
flags
&
4
))
{
...
...
@@ -118,11 +123,17 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
}
goto
skip
;
found:
if
(
type
==
8
){
if
(
type
==
8
&&
st
->
codec
.
sample_rate
==
0
){
st
->
codec
.
channels
=
(
flags
&
1
)
+
1
;
st
->
codec
.
sample_rate
=
(
44100
<<
((
flags
>>
2
)
&
3
))
>>
3
;
}
//guess the frame rate
if
(
type
==
9
&&
st
->
codec
.
frame_rate
==
FRAME_RATE_UNKNOWN
&&
pts
){
st
->
codec
.
frame_rate_base
=
1
;
st
->
codec
.
frame_rate
=
(
1000
+
pts
/
2
)
/
pts
;
}
if
(
av_new_packet
(
pkt
,
size
)
<
0
)
return
-
EIO
;
...
...
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