Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
80485a4f
Commit
80485a4f
authored
Jun 08, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpegtsenc: make pts/dts offseting optional
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
6668ef75
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
mpegtsenc.c
libavformat/mpegtsenc.c
+12
-6
No files found.
libavformat/mpegtsenc.c
View file @
80485a4f
...
@@ -83,6 +83,7 @@ typedef struct MpegTSWrite {
...
@@ -83,6 +83,7 @@ typedef struct MpegTSWrite {
#define MPEGTS_FLAG_REEMIT_PAT_PMT 0x01
#define MPEGTS_FLAG_REEMIT_PAT_PMT 0x01
#define MPEGTS_FLAG_AAC_LATM 0x02
#define MPEGTS_FLAG_AAC_LATM 0x02
int
flags
;
int
flags
;
int
copyts
;
}
MpegTSWrite
;
}
MpegTSWrite
;
/* a PES packet header is generated every DEFAULT_PES_HEADER_FREQ packets */
/* a PES packet header is generated every DEFAULT_PES_HEADER_FREQ packets */
...
@@ -117,6 +118,8 @@ static const AVOption options[] = {
...
@@ -117,6 +118,8 @@ static const AVOption options[] = {
// backward compatibility
// backward compatibility
{
"resend_headers"
,
"Reemit PAT/PMT before writing the next packet"
,
{
"resend_headers"
,
"Reemit PAT/PMT before writing the next packet"
,
offsetof
(
MpegTSWrite
,
reemit_pat_pmt
),
AV_OPT_TYPE_INT
,
{
0
},
0
,
INT_MAX
,
AV_OPT_FLAG_ENCODING_PARAM
},
offsetof
(
MpegTSWrite
,
reemit_pat_pmt
),
AV_OPT_TYPE_INT
,
{
0
},
0
,
INT_MAX
,
AV_OPT_FLAG_ENCODING_PARAM
},
{
"mpegts_copyts"
,
"dont offset dts/pts"
,
offsetof
(
MpegTSWrite
,
copyts
),
AV_OPT_TYPE_INT
,
{.
dbl
=-
1
},
-
1
,
1
,
AV_OPT_FLAG_ENCODING_PARAM
},
{
NULL
},
{
NULL
},
};
};
...
@@ -636,7 +639,8 @@ static int mpegts_write_header(AVFormatContext *s)
...
@@ -636,7 +639,8 @@ static int mpegts_write_header(AVFormatContext *s)
ts
->
pat_packet_period
=
(
ts
->
mux_rate
*
PAT_RETRANS_TIME
)
/
ts
->
pat_packet_period
=
(
ts
->
mux_rate
*
PAT_RETRANS_TIME
)
/
(
TS_PACKET_SIZE
*
8
*
1000
);
(
TS_PACKET_SIZE
*
8
*
1000
);
ts
->
first_pcr
=
av_rescale
(
s
->
max_delay
,
PCR_TIME_BASE
,
AV_TIME_BASE
);
if
(
ts
->
copyts
<
1
)
ts
->
first_pcr
=
av_rescale
(
s
->
max_delay
,
PCR_TIME_BASE
,
AV_TIME_BASE
);
}
else
{
}
else
{
/* Arbitrary values, PAT/PMT will also be written on video key frames */
/* Arbitrary values, PAT/PMT will also be written on video key frames */
ts
->
sdt_packet_period
=
200
;
ts
->
sdt_packet_period
=
200
;
...
@@ -1027,7 +1031,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
...
@@ -1027,7 +1031,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
MpegTSWrite
*
ts
=
s
->
priv_data
;
MpegTSWrite
*
ts
=
s
->
priv_data
;
MpegTSWriteStream
*
ts_st
=
st
->
priv_data
;
MpegTSWriteStream
*
ts_st
=
st
->
priv_data
;
const
int64_t
delay
=
av_rescale
(
s
->
max_delay
,
90000
,
AV_TIME_BASE
)
*
2
;
const
int64_t
delay
=
av_rescale
(
s
->
max_delay
,
90000
,
AV_TIME_BASE
)
*
2
;
int64_t
dts
=
AV_NOPTS_VALUE
,
pts
=
AV_NOPTS_VALUE
;
int64_t
dts
=
pkt
->
dts
,
pts
=
pkt
->
pts
;
if
(
ts
->
reemit_pat_pmt
)
{
if
(
ts
->
reemit_pat_pmt
)
{
av_log
(
s
,
AV_LOG_WARNING
,
"resend_headers option is deprecated, use -mpegts_flags resend_headers
\n
"
);
av_log
(
s
,
AV_LOG_WARNING
,
"resend_headers option is deprecated, use -mpegts_flags resend_headers
\n
"
);
...
@@ -1041,10 +1045,12 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
...
@@ -1041,10 +1045,12 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
ts
->
flags
&=
~
MPEGTS_FLAG_REEMIT_PAT_PMT
;
ts
->
flags
&=
~
MPEGTS_FLAG_REEMIT_PAT_PMT
;
}
}
if
(
pkt
->
pts
!=
AV_NOPTS_VALUE
)
if
(
ts
->
copyts
<
1
){
pts
=
pkt
->
pts
+
delay
;
if
(
pts
!=
AV_NOPTS_VALUE
)
if
(
pkt
->
dts
!=
AV_NOPTS_VALUE
)
pts
+=
delay
;
dts
=
pkt
->
dts
+
delay
;
if
(
dts
!=
AV_NOPTS_VALUE
)
dts
+=
delay
;
}
if
(
ts_st
->
first_pts_check
&&
pts
==
AV_NOPTS_VALUE
)
{
if
(
ts_st
->
first_pts_check
&&
pts
==
AV_NOPTS_VALUE
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"first pts value must set
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"first pts value must set
\n
"
);
...
...
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