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
3a0c70f1
Commit
3a0c70f1
authored
Sep 10, 2014
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc/examples/transcoding: use av_packet_rescale_ts()
Simplify.
parent
5ddfac81
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
27 deletions
+9
-27
transcoding.c
doc/examples/transcoding.c
+9
-27
No files found.
doc/examples/transcoding.c
View file @
3a0c70f1
...
...
@@ -385,15 +385,7 @@ static int encode_write_frame(AVFrame *filt_frame, unsigned int stream_index, in
/* prepare packet for muxing */
enc_pkt
.
stream_index
=
stream_index
;
enc_pkt
.
dts
=
av_rescale_q_rnd
(
enc_pkt
.
dts
,
ofmt_ctx
->
streams
[
stream_index
]
->
codec
->
time_base
,
ofmt_ctx
->
streams
[
stream_index
]
->
time_base
,
AV_ROUND_NEAR_INF
|
AV_ROUND_PASS_MINMAX
);
enc_pkt
.
pts
=
av_rescale_q_rnd
(
enc_pkt
.
pts
,
ofmt_ctx
->
streams
[
stream_index
]
->
codec
->
time_base
,
ofmt_ctx
->
streams
[
stream_index
]
->
time_base
,
AV_ROUND_NEAR_INF
|
AV_ROUND_PASS_MINMAX
);
enc_pkt
.
duration
=
av_rescale_q
(
enc_pkt
.
duration
,
av_packet_rescale_ts
(
&
enc_pkt
,
ofmt_ctx
->
streams
[
stream_index
]
->
codec
->
time_base
,
ofmt_ctx
->
streams
[
stream_index
]
->
time_base
);
...
...
@@ -509,14 +501,9 @@ int main(int argc, char **argv)
ret
=
AVERROR
(
ENOMEM
);
break
;
}
packet
.
dts
=
av_rescale_q_rnd
(
packet
.
dts
,
ifmt_ctx
->
streams
[
stream_index
]
->
time_base
,
ifmt_ctx
->
streams
[
stream_index
]
->
codec
->
time_base
,
AV_ROUND_NEAR_INF
|
AV_ROUND_PASS_MINMAX
);
packet
.
pts
=
av_rescale_q_rnd
(
packet
.
pts
,
av_packet_rescale_ts
(
&
packet
,
ifmt_ctx
->
streams
[
stream_index
]
->
time_base
,
ifmt_ctx
->
streams
[
stream_index
]
->
codec
->
time_base
,
AV_ROUND_NEAR_INF
|
AV_ROUND_PASS_MINMAX
);
ifmt_ctx
->
streams
[
stream_index
]
->
codec
->
time_base
);
dec_func
=
(
type
==
AVMEDIA_TYPE_VIDEO
)
?
avcodec_decode_video2
:
avcodec_decode_audio4
;
ret
=
dec_func
(
ifmt_ctx
->
streams
[
stream_index
]
->
codec
,
frame
,
...
...
@@ -538,14 +525,9 @@ int main(int argc, char **argv)
}
}
else
{
/* remux this frame without reencoding */
packet
.
dts
=
av_rescale_q_rnd
(
packet
.
dts
,
av_packet_rescale_ts
(
&
packet
,
ifmt_ctx
->
streams
[
stream_index
]
->
time_base
,
ofmt_ctx
->
streams
[
stream_index
]
->
time_base
,
AV_ROUND_NEAR_INF
|
AV_ROUND_PASS_MINMAX
);
packet
.
pts
=
av_rescale_q_rnd
(
packet
.
pts
,
ifmt_ctx
->
streams
[
stream_index
]
->
time_base
,
ofmt_ctx
->
streams
[
stream_index
]
->
time_base
,
AV_ROUND_NEAR_INF
|
AV_ROUND_PASS_MINMAX
);
ofmt_ctx
->
streams
[
stream_index
]
->
time_base
);
ret
=
av_interleaved_write_frame
(
ofmt_ctx
,
&
packet
);
if
(
ret
<
0
)
...
...
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