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
452860d7
Commit
452860d7
authored
Jun 18, 2014
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use av_packet_rescale_ts() to simplify code.
parent
874390e1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
26 deletions
+4
-26
avconv.c
avconv.c
+3
-18
output.c
doc/examples/output.c
+1
-8
No files found.
avconv.c
View file @
452860d7
...
@@ -428,13 +428,7 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost,
...
@@ -428,13 +428,7 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost,
}
}
if
(
got_packet
)
{
if
(
got_packet
)
{
if
(
pkt
.
pts
!=
AV_NOPTS_VALUE
)
av_packet_rescale_ts
(
&
pkt
,
enc
->
time_base
,
ost
->
st
->
time_base
);
pkt
.
pts
=
av_rescale_q
(
pkt
.
pts
,
enc
->
time_base
,
ost
->
st
->
time_base
);
if
(
pkt
.
dts
!=
AV_NOPTS_VALUE
)
pkt
.
dts
=
av_rescale_q
(
pkt
.
dts
,
enc
->
time_base
,
ost
->
st
->
time_base
);
if
(
pkt
.
duration
>
0
)
pkt
.
duration
=
av_rescale_q
(
pkt
.
duration
,
enc
->
time_base
,
ost
->
st
->
time_base
);
write_frame
(
s
,
&
pkt
,
ost
);
write_frame
(
s
,
&
pkt
,
ost
);
}
}
}
}
...
@@ -587,11 +581,7 @@ static void do_video_out(AVFormatContext *s,
...
@@ -587,11 +581,7 @@ static void do_video_out(AVFormatContext *s,
}
}
if
(
got_packet
)
{
if
(
got_packet
)
{
if
(
pkt
.
pts
!=
AV_NOPTS_VALUE
)
av_packet_rescale_ts
(
&
pkt
,
enc
->
time_base
,
ost
->
st
->
time_base
);
pkt
.
pts
=
av_rescale_q
(
pkt
.
pts
,
enc
->
time_base
,
ost
->
st
->
time_base
);
if
(
pkt
.
dts
!=
AV_NOPTS_VALUE
)
pkt
.
dts
=
av_rescale_q
(
pkt
.
dts
,
enc
->
time_base
,
ost
->
st
->
time_base
);
write_frame
(
s
,
&
pkt
,
ost
);
write_frame
(
s
,
&
pkt
,
ost
);
*
frame_size
=
pkt
.
size
;
*
frame_size
=
pkt
.
size
;
...
@@ -1044,12 +1034,7 @@ static void flush_encoders(void)
...
@@ -1044,12 +1034,7 @@ static void flush_encoders(void)
stop_encoding
=
1
;
stop_encoding
=
1
;
break
;
break
;
}
}
if
(
pkt
.
pts
!=
AV_NOPTS_VALUE
)
av_packet_rescale_ts
(
&
pkt
,
enc
->
time_base
,
ost
->
st
->
time_base
);
pkt
.
pts
=
av_rescale_q
(
pkt
.
pts
,
enc
->
time_base
,
ost
->
st
->
time_base
);
if
(
pkt
.
dts
!=
AV_NOPTS_VALUE
)
pkt
.
dts
=
av_rescale_q
(
pkt
.
dts
,
enc
->
time_base
,
ost
->
st
->
time_base
);
if
(
pkt
.
duration
>
0
)
pkt
.
duration
=
av_rescale_q
(
pkt
.
duration
,
enc
->
time_base
,
ost
->
st
->
time_base
);
write_frame
(
os
,
&
pkt
,
ost
);
write_frame
(
os
,
&
pkt
,
ost
);
}
}
...
...
doc/examples/output.c
View file @
452860d7
...
@@ -362,14 +362,7 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st)
...
@@ -362,14 +362,7 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st)
ret
=
avcodec_encode_video2
(
c
,
&
pkt
,
picture
,
&
got_packet
);
ret
=
avcodec_encode_video2
(
c
,
&
pkt
,
picture
,
&
got_packet
);
/* If size is zero, it means the image was buffered. */
/* If size is zero, it means the image was buffered. */
if
(
!
ret
&&
got_packet
&&
pkt
.
size
)
{
if
(
!
ret
&&
got_packet
&&
pkt
.
size
)
{
if
(
pkt
.
pts
!=
AV_NOPTS_VALUE
)
{
av_packet_rescale_ts
(
&
pkt
,
c
->
time_base
,
st
->
time_base
);
pkt
.
pts
=
av_rescale_q
(
pkt
.
pts
,
c
->
time_base
,
st
->
time_base
);
}
if
(
pkt
.
dts
!=
AV_NOPTS_VALUE
)
{
pkt
.
dts
=
av_rescale_q
(
pkt
.
dts
,
c
->
time_base
,
st
->
time_base
);
}
pkt
.
stream_index
=
st
->
index
;
pkt
.
stream_index
=
st
->
index
;
/* Write the compressed frame to the media file. */
/* Write the compressed frame to the media file. */
...
...
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