mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge commit 'a1aa37dd0b96710d4a17718198a3f56aea2040c1'
* commit 'a1aa37dd0b96710d4a17718198a3f56aea2040c1': matroskaenc: write CodecDelay Conflicts: libavformat/matroskaenc.c tests/ref/lavf/mkv tests/ref/seek/lavf-mkv This is largely not merged as it causes assertion failures and av sync errors Further investigation of this is warranted if the changes are found to fix/improve something in relation tod92b1b1bab
See:d92b1b1bab
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
82e4f39883
@ -85,6 +85,7 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
int write_dts;
|
int write_dts;
|
||||||
int has_cue;
|
int has_cue;
|
||||||
|
int64_t ts_offset;
|
||||||
} mkv_track;
|
} mkv_track;
|
||||||
|
|
||||||
#define MODE_MATROSKAv2 0x01
|
#define MODE_MATROSKAv2 0x01
|
||||||
@ -694,13 +695,17 @@ static int mkv_write_tracks(AVFormatContext *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (codec->codec_id == AV_CODEC_ID_OPUS) {
|
if (codec->codec_type == AVMEDIA_TYPE_AUDIO && codec->delay && codec->codec_id == AV_CODEC_ID_OPUS) {
|
||||||
uint64_t codec_delay =av_rescale_q(codec->delay,
|
// mkv->tracks[i].ts_offset = av_rescale_q(codec->delay,
|
||||||
(AVRational){1, codec->sample_rate},
|
// (AVRational){ 1, codec->sample_rate },
|
||||||
(AVRational){1, 1000000000});
|
// st->time_base);
|
||||||
put_ebml_uint(pb, MATROSKA_ID_CODECDELAY, codec_delay);
|
|
||||||
put_ebml_uint(pb, MATROSKA_ID_SEEKPREROLL, OPUS_SEEK_PREROLL);
|
|
||||||
|
|
||||||
|
put_ebml_uint(pb, MATROSKA_ID_CODECDELAY,
|
||||||
|
av_rescale_q(codec->delay, (AVRational){ 1, codec->sample_rate },
|
||||||
|
(AVRational){ 1, 1000000000 }));
|
||||||
|
}
|
||||||
|
if (codec->codec_id == AV_CODEC_ID_OPUS) {
|
||||||
|
put_ebml_uint(pb, MATROSKA_ID_SEEKPREROLL, OPUS_SEEK_PREROLL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mkv->mode == MODE_WEBM && !(codec->codec_id == AV_CODEC_ID_VP8 ||
|
if (mkv->mode == MODE_WEBM && !(codec->codec_id == AV_CODEC_ID_VP8 ||
|
||||||
@ -1549,6 +1554,7 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
|
|||||||
av_log(s, AV_LOG_ERROR, "Can't write packet with unknown timestamp\n");
|
av_log(s, AV_LOG_ERROR, "Can't write packet with unknown timestamp\n");
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
ts += mkv->tracks[pkt->stream_index].ts_offset;
|
||||||
|
|
||||||
if (!s->pb->seekable) {
|
if (!s->pb->seekable) {
|
||||||
if (!mkv->dyn_bc) {
|
if (!mkv->dyn_bc) {
|
||||||
@ -1614,6 +1620,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
cluster_time = pkt->dts - mkv->cluster_pts;
|
cluster_time = pkt->dts - mkv->cluster_pts;
|
||||||
else
|
else
|
||||||
cluster_time = pkt->pts - mkv->cluster_pts;
|
cluster_time = pkt->pts - mkv->cluster_pts;
|
||||||
|
cluster_time += mkv->tracks[pkt->stream_index].ts_offset;
|
||||||
|
|
||||||
// start a new cluster every 5 MB or 5 sec, or 32k / 1 sec for streaming or
|
// start a new cluster every 5 MB or 5 sec, or 32k / 1 sec for streaming or
|
||||||
// after 4k and on a keyframe
|
// after 4k and on a keyframe
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#define LIBAVFORMAT_VERSION_MAJOR 55
|
#define LIBAVFORMAT_VERSION_MAJOR 55
|
||||||
#define LIBAVFORMAT_VERSION_MINOR 37
|
#define LIBAVFORMAT_VERSION_MINOR 37
|
||||||
#define LIBAVFORMAT_VERSION_MICRO 101
|
#define LIBAVFORMAT_VERSION_MICRO 102
|
||||||
|
|
||||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||||
LIBAVFORMAT_VERSION_MINOR, \
|
LIBAVFORMAT_VERSION_MINOR, \
|
||||||
|
Loading…
Reference in New Issue
Block a user