Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
b912ef3f
Commit
b912ef3f
authored
18 years ago
by
Baptiste Coudurier
Browse files
Options
Downloads
Patches
Plain Diff
fix pts handling
Originally committed as revision 8299 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
d0429b4f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavformat/swf.c
+7
-16
7 additions, 16 deletions
libavformat/swf.c
with
7 additions
and
16 deletions
libavformat/swf.c
+
7
−
16
View file @
b912ef3f
...
@@ -67,7 +67,7 @@ typedef struct {
...
@@ -67,7 +67,7 @@ typedef struct {
int
sound_samples
;
int
sound_samples
;
int
swf_frame_number
;
int
swf_frame_number
;
int
video_frame_number
;
int
video_frame_number
;
int
ms_per_f
ra
m
e
;
int
frame_
ra
t
e
;
int
tag
;
int
tag
;
uint8_t
audio_fifo
[
AUDIO_FIFO_SIZE
];
uint8_t
audio_fifo
[
AUDIO_FIFO_SIZE
];
...
@@ -631,7 +631,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
...
@@ -631,7 +631,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
{
SWFContext
*
swf
=
s
->
priv_data
;
SWFContext
*
swf
=
s
->
priv_data
;
ByteIOContext
*
pb
=
&
s
->
pb
;
ByteIOContext
*
pb
=
&
s
->
pb
;
int
nbits
,
len
,
frame_rate
,
tag
,
v
;
int
nbits
,
len
,
tag
,
v
;
offset_t
frame_offset
=
-
1
;
offset_t
frame_offset
=
-
1
;
AVStream
*
ast
=
0
;
AVStream
*
ast
=
0
;
AVStream
*
vst
=
0
;
AVStream
*
vst
=
0
;
...
@@ -650,13 +650,9 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
...
@@ -650,13 +650,9 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
nbits
=
get_byte
(
pb
)
>>
3
;
nbits
=
get_byte
(
pb
)
>>
3
;
len
=
(
4
*
nbits
-
3
+
7
)
/
8
;
len
=
(
4
*
nbits
-
3
+
7
)
/
8
;
url_fskip
(
pb
,
len
);
url_fskip
(
pb
,
len
);
frame_rate
=
get_le16
(
pb
);
swf
->
frame_rate
=
get_le16
(
pb
);
/* 8.8 fixed */
get_le16
(
pb
);
/* frame count */
get_le16
(
pb
);
/* frame count */
/* The Flash Player converts 8.8 frame rates
to milliseconds internally. Do the same to get
a correct framerate */
swf
->
ms_per_frame
=
(
1000
*
256
)
/
frame_rate
;
swf
->
samples_per_frame
=
0
;
swf
->
samples_per_frame
=
0
;
for
(;;)
{
for
(;;)
{
...
@@ -683,7 +679,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
...
@@ -683,7 +679,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
v
=
get_byte
(
pb
);
v
=
get_byte
(
pb
);
swf
->
samples_per_frame
=
get_le16
(
pb
);
swf
->
samples_per_frame
=
get_le16
(
pb
);
ast
=
av_new_stream
(
s
,
-
1
);
/* -1 to avoid clash with video stream ch_id */
ast
=
av_new_stream
(
s
,
-
1
);
/* -1 to avoid clash with video stream ch_id */
av_set_pts_info
(
ast
,
2
4
,
1
,
1000
);
/* 24 bit pts in ms
*/
av_set_pts_info
(
ast
,
6
4
,
256
,
swf
->
frame_rate
);
/* XXX same as video stream
*/
swf
->
audio_stream_index
=
ast
->
index
;
swf
->
audio_stream_index
=
ast
->
index
;
ast
->
codec
->
channels
=
1
+
(
v
&
1
);
ast
->
codec
->
channels
=
1
+
(
v
&
1
);
ast
->
codec
->
codec_type
=
CODEC_TYPE_AUDIO
;
ast
->
codec
->
codec_type
=
CODEC_TYPE_AUDIO
;
...
@@ -706,13 +702,8 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
...
@@ -706,13 +702,8 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
url_fskip
(
pb
,
len
);
url_fskip
(
pb
,
len
);
}
}
}
}
if
(
vst
)
{
if
(
vst
)
av_set_pts_info
(
vst
,
24
,
1
,
1000
);
/* 24 bit pts in ms */
av_set_pts_info
(
vst
,
64
,
256
,
swf
->
frame_rate
);
if
(
swf
->
ms_per_frame
)
{
vst
->
codec
->
time_base
.
den
=
1000
.
/
swf
->
ms_per_frame
;
vst
->
codec
->
time_base
.
num
=
1
;
}
}
return
0
;
return
0
;
}
}
...
@@ -735,7 +726,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -735,7 +726,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
if
(
st
->
codec
->
codec_type
==
CODEC_TYPE_VIDEO
&&
st
->
id
==
ch_id
)
{
if
(
st
->
codec
->
codec_type
==
CODEC_TYPE_VIDEO
&&
st
->
id
==
ch_id
)
{
frame
=
get_le16
(
pb
);
frame
=
get_le16
(
pb
);
av_get_packet
(
pb
,
pkt
,
len
-
2
);
av_get_packet
(
pb
,
pkt
,
len
-
2
);
pkt
->
pts
=
frame
*
swf
->
ms_per_frame
;
pkt
->
pts
=
frame
;
pkt
->
stream_index
=
st
->
index
;
pkt
->
stream_index
=
st
->
index
;
return
pkt
->
size
;
return
pkt
->
size
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment