Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
3101bb66
Commit
3101bb66
authored
Feb 03, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avconv: rename InputStream.next_pts to next_dts.
It's used to predict dts, not pts.
parent
1270e12e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
avconv.c
avconv.c
+20
-19
No files found.
avconv.c
View file @
3101bb66
...
...
@@ -168,8 +168,9 @@ typedef struct InputStream {
AVFrame
*
filtered_frame
;
int64_t
start
;
/* time when read started */
int64_t
next_pts
;
/* synthetic pts for cases where pkt.pts
is not defined */
/* predicted dts of the next packet read for this stream or (when there are
* several frames in a packet) of the next frame in current packet */
int64_t
next_dts
;
int64_t
pts
;
/* current pts */
PtsCorrectionContext
pts_ctx
;
double
ts_scale
;
...
...
@@ -1847,11 +1848,11 @@ static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
/* if the decoder provides a pts, use it instead of the last packet pts.
the decoder could be delaying output by a packet or more. */
if
(
decoded_frame
->
pts
!=
AV_NOPTS_VALUE
)
ist
->
next_
p
ts
=
decoded_frame
->
pts
;
ist
->
next_
d
ts
=
decoded_frame
->
pts
;
/* increment next_
p
ts to use for the case where the input stream does not
/* increment next_
d
ts to use for the case where the input stream does not
have timestamps or there are multiple frames in the packet */
ist
->
next_
p
ts
+=
((
int64_t
)
AV_TIME_BASE
*
decoded_frame
->
nb_samples
)
/
ist
->
next_
d
ts
+=
((
int64_t
)
AV_TIME_BASE
*
decoded_frame
->
nb_samples
)
/
avctx
->
sample_rate
;
// preprocess audio (volume)
...
...
@@ -1954,14 +1955,14 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
/* no picture yet */
return
ret
;
}
ist
->
next_
p
ts
=
ist
->
pts
=
guess_correct_pts
(
&
ist
->
pts_ctx
,
decoded_frame
->
pkt_pts
,
ist
->
next_
d
ts
=
ist
->
pts
=
guess_correct_pts
(
&
ist
->
pts_ctx
,
decoded_frame
->
pkt_pts
,
decoded_frame
->
pkt_dts
);
if
(
pkt
->
duration
)
ist
->
next_
p
ts
+=
av_rescale_q
(
pkt
->
duration
,
ist
->
st
->
time_base
,
AV_TIME_BASE_Q
);
ist
->
next_
d
ts
+=
av_rescale_q
(
pkt
->
duration
,
ist
->
st
->
time_base
,
AV_TIME_BASE_Q
);
else
if
(
ist
->
st
->
codec
->
time_base
.
num
!=
0
)
{
int
ticks
=
ist
->
st
->
parser
?
ist
->
st
->
parser
->
repeat_pict
+
1
:
ist
->
st
->
codec
->
ticks_per_frame
;
ist
->
next_
p
ts
+=
((
int64_t
)
AV_TIME_BASE
*
ist
->
next_
d
ts
+=
((
int64_t
)
AV_TIME_BASE
*
ist
->
st
->
codec
->
time_base
.
num
*
ticks
)
/
ist
->
st
->
codec
->
time_base
.
den
;
}
...
...
@@ -2091,8 +2092,8 @@ static int output_packet(InputStream *ist,
int64_t
pkt_pts
=
AV_NOPTS_VALUE
;
AVPacket
avpkt
;
if
(
ist
->
next_
p
ts
==
AV_NOPTS_VALUE
)
ist
->
next_
p
ts
=
ist
->
pts
;
if
(
ist
->
next_
d
ts
==
AV_NOPTS_VALUE
)
ist
->
next_
d
ts
=
ist
->
pts
;
if
(
pkt
==
NULL
)
{
/* EOF handling */
...
...
@@ -2105,7 +2106,7 @@ static int output_packet(InputStream *ist,
}
if
(
pkt
->
dts
!=
AV_NOPTS_VALUE
)
ist
->
next_
p
ts
=
ist
->
pts
=
av_rescale_q
(
pkt
->
dts
,
ist
->
st
->
time_base
,
AV_TIME_BASE_Q
);
ist
->
next_
d
ts
=
ist
->
pts
=
av_rescale_q
(
pkt
->
dts
,
ist
->
st
->
time_base
,
AV_TIME_BASE_Q
);
if
(
pkt
->
pts
!=
AV_NOPTS_VALUE
)
pkt_pts
=
av_rescale_q
(
pkt
->
pts
,
ist
->
st
->
time_base
,
AV_TIME_BASE_Q
);
...
...
@@ -2114,7 +2115,7 @@ static int output_packet(InputStream *ist,
int
ret
=
0
;
handle_eof:
ist
->
pts
=
ist
->
next_
p
ts
;
ist
->
pts
=
ist
->
next_
d
ts
;
if
(
avpkt
.
size
&&
avpkt
.
size
!=
pkt
->
size
)
{
av_log
(
NULL
,
ist
->
showed_multi_packet_warning
?
AV_LOG_VERBOSE
:
AV_LOG_WARNING
,
...
...
@@ -2151,16 +2152,16 @@ static int output_packet(InputStream *ist,
/* handle stream copy */
if
(
!
ist
->
decoding_needed
)
{
rate_emu_sleep
(
ist
);
ist
->
pts
=
ist
->
next_
p
ts
;
ist
->
pts
=
ist
->
next_
d
ts
;
switch
(
ist
->
st
->
codec
->
codec_type
)
{
case
AVMEDIA_TYPE_AUDIO
:
ist
->
next_
p
ts
+=
((
int64_t
)
AV_TIME_BASE
*
ist
->
st
->
codec
->
frame_size
)
/
ist
->
next_
d
ts
+=
((
int64_t
)
AV_TIME_BASE
*
ist
->
st
->
codec
->
frame_size
)
/
ist
->
st
->
codec
->
sample_rate
;
break
;
case
AVMEDIA_TYPE_VIDEO
:
if
(
ist
->
st
->
codec
->
time_base
.
num
!=
0
)
{
int
ticks
=
ist
->
st
->
parser
?
ist
->
st
->
parser
->
repeat_pict
+
1
:
ist
->
st
->
codec
->
ticks_per_frame
;
ist
->
next_
p
ts
+=
((
int64_t
)
AV_TIME_BASE
*
ist
->
next_
d
ts
+=
((
int64_t
)
AV_TIME_BASE
*
ist
->
st
->
codec
->
time_base
.
num
*
ticks
)
/
ist
->
st
->
codec
->
time_base
.
den
;
}
...
...
@@ -2237,7 +2238,7 @@ static int init_input_stream(int ist_index, OutputStream *output_streams, int nb
}
ist
->
pts
=
ist
->
st
->
avg_frame_rate
.
num
?
-
ist
->
st
->
codec
->
has_b_frames
*
AV_TIME_BASE
/
av_q2d
(
ist
->
st
->
avg_frame_rate
)
:
0
;
ist
->
next_
p
ts
=
AV_NOPTS_VALUE
;
ist
->
next_
d
ts
=
AV_NOPTS_VALUE
;
init_pts_correction
(
&
ist
->
pts_ctx
);
ist
->
is_start
=
1
;
...
...
@@ -2759,13 +2760,13 @@ static int transcode(OutputFile *output_files,
pkt
.
dts
*=
ist
->
ts_scale
;
//fprintf(stderr, "next:%"PRId64" dts:%"PRId64" off:%"PRId64" %d\n",
// ist->next_
p
ts,
// ist->next_
d
ts,
// pkt.dts, input_files[ist->file_index].ts_offset,
// ist->st->codec->codec_type);
if
(
pkt
.
dts
!=
AV_NOPTS_VALUE
&&
ist
->
next_
p
ts
!=
AV_NOPTS_VALUE
if
(
pkt
.
dts
!=
AV_NOPTS_VALUE
&&
ist
->
next_
d
ts
!=
AV_NOPTS_VALUE
&&
(
is
->
iformat
->
flags
&
AVFMT_TS_DISCONT
))
{
int64_t
pkt_dts
=
av_rescale_q
(
pkt
.
dts
,
ist
->
st
->
time_base
,
AV_TIME_BASE_Q
);
int64_t
delta
=
pkt_dts
-
ist
->
next_
p
ts
;
int64_t
delta
=
pkt_dts
-
ist
->
next_
d
ts
;
if
((
FFABS
(
delta
)
>
1LL
*
dts_delta_threshold
*
AV_TIME_BASE
||
pkt_dts
+
1
<
ist
->
pts
)
&&
!
copy_ts
)
{
input_files
[
ist
->
file_index
].
ts_offset
-=
delta
;
av_log
(
NULL
,
AV_LOG_DEBUG
,
...
...
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