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
27e91f37
Commit
27e91f37
authored
Jun 23, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffmpeg: merge input_files_ts_offset into input_files.
parent
9e253c13
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
ffmpeg.c
ffmpeg.c
+10
-9
No files found.
ffmpeg.c
View file @
27e91f37
...
...
@@ -107,7 +107,6 @@ static const OptionDef options[];
#define FFM_PACKET_SIZE 4096 //XXX a duplicate of the line in ffm.h
static
const
char
*
last_asked_format
=
NULL
;
static
int64_t
input_files_ts_offset
[
MAX_FILES
];
static
double
*
input_files_ts_scale
[
MAX_FILES
]
=
{
NULL
};
static
int
nb_input_files_ts_scale
[
MAX_FILES
]
=
{
0
};
...
...
@@ -329,6 +328,7 @@ typedef struct InputFile {
int
eof_reached
;
/* true if eof reached */
int
ist_index
;
/* index of first stream in ist_table */
int
buffer_size
;
/* current total buffer size */
int64_t
ts_offset
;
}
InputFile
;
static
InputStream
*
input_streams
=
NULL
;
...
...
@@ -1671,7 +1671,7 @@ static int output_packet(InputStream *ist, int ist_index,
os
=
output_files
[
ost
->
file_index
];
/* set the input output pts pairs */
//ost->sync_ipts = (double)(ist->pts + input_files
_ts_offset[ist->file_index]
- start_time)/ AV_TIME_BASE;
//ost->sync_ipts = (double)(ist->pts + input_files
[ist->file_index].ts_offset
- start_time)/ AV_TIME_BASE;
if
(
ost
->
encoding_needed
)
{
av_assert0
(
ist
->
decoding_needed
);
...
...
@@ -1882,7 +1882,7 @@ static int copy_chapters(int infile, int outfile)
for
(
i
=
0
;
i
<
is
->
nb_chapters
;
i
++
)
{
AVChapter
*
in_ch
=
is
->
chapters
[
i
],
*
out_ch
;
int64_t
ts_off
=
av_rescale_q
(
start_time
-
input_files
_ts_offset
[
infile
]
,
int64_t
ts_off
=
av_rescale_q
(
start_time
-
input_files
[
infile
].
ts_offset
,
AV_TIME_BASE_Q
,
in_ch
->
time_base
);
int64_t
rt
=
(
recording_time
==
INT64_MAX
)
?
INT64_MAX
:
av_rescale_q
(
recording_time
,
AV_TIME_BASE_Q
,
in_ch
->
time_base
);
...
...
@@ -2613,9 +2613,9 @@ static int transcode(AVFormatContext **output_files,
goto
discard_packet
;
if
(
pkt
.
dts
!=
AV_NOPTS_VALUE
)
pkt
.
dts
+=
av_rescale_q
(
input_files
_ts_offset
[
ist
->
file_index
]
,
AV_TIME_BASE_Q
,
ist
->
st
->
time_base
);
pkt
.
dts
+=
av_rescale_q
(
input_files
[
ist
->
file_index
].
ts_offset
,
AV_TIME_BASE_Q
,
ist
->
st
->
time_base
);
if
(
pkt
.
pts
!=
AV_NOPTS_VALUE
)
pkt
.
pts
+=
av_rescale_q
(
input_files
_ts_offset
[
ist
->
file_index
]
,
AV_TIME_BASE_Q
,
ist
->
st
->
time_base
);
pkt
.
pts
+=
av_rescale_q
(
input_files
[
ist
->
file_index
].
ts_offset
,
AV_TIME_BASE_Q
,
ist
->
st
->
time_base
);
if
(
pkt
.
stream_index
<
nb_input_files_ts_scale
[
file_index
]
&&
input_files_ts_scale
[
file_index
][
pkt
.
stream_index
]){
...
...
@@ -2625,15 +2625,16 @@ static int transcode(AVFormatContext **output_files,
pkt
.
dts
*=
input_files_ts_scale
[
file_index
][
pkt
.
stream_index
];
}
// fprintf(stderr, "next:%"PRId64" dts:%"PRId64" off:%"PRId64" %d\n", ist->next_pts, pkt.dts, input_files
_ts_offset[ist->file_index]
, ist->st->codec->codec_type);
// fprintf(stderr, "next:%"PRId64" dts:%"PRId64" off:%"PRId64" %d\n", ist->next_pts, pkt.dts, input_files
[ist->file_index].ts_offset
, ist->st->codec->codec_type);
if
(
pkt
.
dts
!=
AV_NOPTS_VALUE
&&
ist
->
next_pts
!=
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_pts
;
if
((
FFABS
(
delta
)
>
1LL
*
dts_delta_threshold
*
AV_TIME_BASE
||
pkt_dts
+
1
<
ist
->
pts
)
&&
!
copy_ts
){
input_files
_ts_offset
[
ist
->
file_index
]
-=
delta
;
input_files
[
ist
->
file_index
].
ts_offset
-=
delta
;
if
(
verbose
>
2
)
fprintf
(
stderr
,
"timestamp discontinuity %"
PRId64
", new offset= %"
PRId64
"
\n
"
,
delta
,
input_files_ts_offset
[
ist
->
file_index
]);
fprintf
(
stderr
,
"timestamp discontinuity %"
PRId64
", new offset= %"
PRId64
"
\n
"
,
delta
,
input_files
[
ist
->
file_index
].
ts_offset
);
pkt
.
dts
-=
av_rescale_q
(
delta
,
AV_TIME_BASE_Q
,
ist
->
st
->
time_base
);
if
(
pkt
.
pts
!=
AV_NOPTS_VALUE
)
pkt
.
pts
-=
av_rescale_q
(
delta
,
AV_TIME_BASE_Q
,
ist
->
st
->
time_base
);
...
...
@@ -3357,7 +3358,6 @@ static int opt_input_file(const char *opt, const char *filename)
}
}
input_files_ts_offset
[
nb_input_files
]
=
input_ts_offset
-
(
copy_ts
?
0
:
timestamp
);
/* dump the file content */
if
(
verbose
>=
0
)
av_dump_format
(
ic
,
nb_input_files
,
filename
,
0
);
...
...
@@ -3365,6 +3365,7 @@ static int opt_input_file(const char *opt, const char *filename)
input_files
=
grow_array
(
input_files
,
sizeof
(
*
input_files
),
&
nb_input_files
,
nb_input_files
+
1
);
input_files
[
nb_input_files
-
1
].
ctx
=
ic
;
input_files
[
nb_input_files
-
1
].
ist_index
=
nb_input_streams
-
ic
->
nb_streams
;
input_files
[
nb_input_files
-
1
].
ts_offset
=
input_ts_offset
-
(
copy_ts
?
0
:
timestamp
);
frame_rate
=
(
AVRational
){
0
,
0
};
frame_pix_fmt
=
PIX_FMT_NONE
;
...
...
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