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
2940b38e
Commit
2940b38e
authored
Jun 07, 2008
by
Baptiste Coudurier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix pts handling in ffm
Originally committed as revision 13683 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
c07d64c8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
30 deletions
+10
-30
ffm.h
libavformat/ffm.h
+1
-4
ffmdec.c
libavformat/ffmdec.c
+0
-6
ffmenc.c
libavformat/ffmenc.c
+8
-19
libav.regression.ref
tests/libav.regression.ref
+1
-1
No files found.
libavformat/ffm.h
View file @
2940b38e
...
...
@@ -32,10 +32,6 @@
#define FRAME_HEADER_SIZE 8
#define FLAG_KEY_FRAME 0x01
typedef
struct
FFMStream
{
int64_t
pts
;
}
FFMStream
;
enum
{
READ_HEADER
,
READ_DATA
,
...
...
@@ -55,6 +51,7 @@ typedef struct FFMContext {
int64_t
pts
;
uint8_t
*
packet_ptr
,
*
packet_end
;
uint8_t
packet
[
FFM_PACKET_SIZE
];
int64_t
start_time
;
}
FFMContext
;
#endif
/* FFMPEG_FFM_H */
libavformat/ffmdec.c
View file @
2940b38e
...
...
@@ -232,7 +232,6 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
FFMContext
*
ffm
=
s
->
priv_data
;
AVStream
*
st
;
FFMStream
*
fst
;
ByteIOContext
*
pb
=
s
->
pb
;
AVCodecContext
*
codec
;
int
i
,
nb_streams
;
...
...
@@ -263,15 +262,10 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
st
=
av_new_stream
(
s
,
0
);
if
(
!
st
)
goto
fail
;
fst
=
av_mallocz
(
sizeof
(
FFMStream
));
if
(
!
fst
)
goto
fail
;
s
->
streams
[
i
]
=
st
;
av_set_pts_info
(
st
,
64
,
1
,
1000000
);
st
->
priv_data
=
fst
;
codec
=
st
->
codec
;
/* generic info */
codec
->
codec_id
=
get_be32
(
pb
);
...
...
libavformat/ffmenc.c
View file @
2940b38e
...
...
@@ -92,7 +92,6 @@ static int ffm_write_header(AVFormatContext *s)
{
FFMContext
*
ffm
=
s
->
priv_data
;
AVStream
*
st
;
FFMStream
*
fst
;
ByteIOContext
*
pb
=
s
->
pb
;
AVCodecContext
*
codec
;
int
bit_rate
,
i
;
...
...
@@ -116,11 +115,7 @@ static int ffm_write_header(AVFormatContext *s)
/* list of streams */
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
st
=
s
->
streams
[
i
];
fst
=
av_mallocz
(
sizeof
(
FFMStream
));
if
(
!
fst
)
goto
fail
;
av_set_pts_info
(
st
,
64
,
1
,
1000000
);
st
->
priv_data
=
fst
;
codec
=
st
->
codec
;
/* generic info */
...
...
@@ -176,12 +171,13 @@ static int ffm_write_header(AVFormatContext *s)
default:
return
-
1
;
}
}
/* hack to have real time */
if
(
ffm_nopts
)
fst
->
pts
=
0
;
ffm
->
start_time
=
0
;
else
fst
->
pts
=
av_gettime
();
}
ffm
->
start_time
=
av_gettime
();
/* flush until end of block reached */
while
((
url_ftell
(
pb
)
%
ffm
->
packet_size
)
!=
0
)
...
...
@@ -198,22 +194,16 @@ static int ffm_write_header(AVFormatContext *s)
ffm
->
first_packet
=
1
;
return
0
;
fail:
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
st
=
s
->
streams
[
i
];
av_freep
(
&
st
->
priv_data
);
}
return
-
1
;
}
static
int
ffm_write_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
FFMContext
*
ffm
=
s
->
priv_data
;
AVStream
*
st
=
s
->
streams
[
pkt
->
stream_index
];
FFMStream
*
fst
=
st
->
priv_data
;
int64_t
pts
;
uint8_t
header
[
FRAME_HEADER_SIZE
];
pts
=
f
s
t
->
pts
;
pts
=
f
fm
->
start_time
+
pk
t
->
pts
;
/* packet size & key_frame */
header
[
0
]
=
pkt
->
stream_index
;
header
[
1
]
=
0
;
...
...
@@ -224,7 +214,6 @@ static int ffm_write_packet(AVFormatContext *s, AVPacket *pkt)
ffm_write_data
(
s
,
header
,
FRAME_HEADER_SIZE
,
pts
,
1
);
ffm_write_data
(
s
,
pkt
->
data
,
pkt
->
size
,
pts
,
0
);
fst
->
pts
+=
pkt
->
duration
;
return
0
;
}
...
...
tests/libav.regression.ref
View file @
2940b38e
...
...
@@ -15,7 +15,7 @@ bdb7484c68db722f66ba1630cf79844c *./tests/data/b-libav.mpg
d6fdeb9f7083cc827f9510c6c4517dc0 *./tests/data/b-libav.swf
335771 ./tests/data/b-libav.swf
./tests/data/b-libav.swf CRC=0xe14e8847
745e811e246f3727dc80a7504a18b129
*./tests/data/b-libav.ffm
bf28235fdc3bdd77faf251a239b6bc58
*./tests/data/b-libav.ffm
380928 ./tests/data/b-libav.ffm
./tests/data/b-libav.ffm CRC=0xca8f6870
f8ad5bd78f4d012a8ce9570aa395ac54 *./tests/data/b-libav.flv
...
...
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