Commit 3e0daf07 authored by Derek Buitenhuis's avatar Derek Buitenhuis

Merge commit 'bef3b1f5'

* commit 'bef3b1f5':
  movenc: Allow setting start_dts/start_cts before writing actual packets
Merged-by: 's avatarDerek Buitenhuis <derek.buitenhuis@gmail.com>
parents e73a4d84 bef3b1f5
...@@ -4564,9 +4564,6 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -4564,9 +4564,6 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt)
int64_t frag_duration = 0; int64_t frag_duration = 0;
int size = pkt->size; int size = pkt->size;
if (!pkt->size)
return 0; /* Discard 0 sized packets */
if (mov->flags & FF_MOV_FLAG_FRAG_DISCONT) { if (mov->flags & FF_MOV_FLAG_FRAG_DISCONT) {
int i; int i;
for (i = 0; i < s->nb_streams; i++) for (i = 0; i < s->nb_streams; i++)
...@@ -4574,6 +4571,18 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -4574,6 +4571,18 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt)
mov->flags &= ~FF_MOV_FLAG_FRAG_DISCONT; mov->flags &= ~FF_MOV_FLAG_FRAG_DISCONT;
} }
if (!pkt->size) {
if (trk->start_dts == AV_NOPTS_VALUE && trk->frag_discont) {
trk->start_dts = pkt->dts;
if (pkt->pts != AV_NOPTS_VALUE)
trk->start_cts = pkt->pts - pkt->dts;
else
trk->start_cts = 0;
}
return 0; /* Discard 0 sized packets */
}
if (trk->entry && pkt->stream_index < s->nb_streams) if (trk->entry && pkt->stream_index < s->nb_streams)
frag_duration = av_rescale_q(pkt->dts - trk->cluster[0].dts, frag_duration = av_rescale_q(pkt->dts - trk->cluster[0].dts,
s->streams[pkt->stream_index]->time_base, s->streams[pkt->stream_index]->time_base,
...@@ -4628,7 +4637,8 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -4628,7 +4637,8 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
int i; int i;
MOVMuxContext *mov = s->priv_data; MOVMuxContext *mov = s->priv_data;
if (!pkt->size) return 0; /* Discard 0 sized packets */ if (!pkt->size)
return mov_write_single_packet(s, pkt); /* Passthrough. */
/* /*
* Subtitles require special handling. * Subtitles require special handling.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment