summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheAMM <the.actual.amm@gmail.com>2021-05-25 00:48:40 +0300
committersfan5 <sfan5@live.de>2021-05-26 17:36:22 +0200
commit643c699f2684987db6073ebe8a6ea76e56c87055 (patch)
tree8ba38ea2e8cbf0a50e3520a88c4a5ffd55514af9
parentec0006bfa1aaf608a7141929f2871c89ac7a15d6 (diff)
downloadmpv-643c699f2684987db6073ebe8a6ea76e56c87055.tar.bz2
mpv-643c699f2684987db6073ebe8a6ea76e56c87055.tar.xz
recorder: clear codec_tag if no target format support
Avoiding blindly copying the codec_tag between different formats allows us to mux packets from, say, mpegts streams to matroska, making the recorder (dump-cache) much more usable as unsupported codec_tags can make the muxer reject the streams.
-rw-r--r--common/recorder.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/recorder.c b/common/recorder.c
index 58bf257883..63e4163303 100644
--- a/common/recorder.c
+++ b/common/recorder.c
@@ -91,6 +91,12 @@ static int add_stream(struct mp_recorder *priv, struct sh_stream *sh)
if (!avp)
return -1;
+ // Check if we get the same codec_tag for the output format;
+ // otherwise clear it to have a chance at muxing
+ if (av_codec_get_id(priv->mux->oformat->codec_tag,
+ avp->codec_tag) != avp->codec_tag)
+ avp->codec_tag = 0;
+
// We don't know the delay, so make something up. If the format requires
// DTS, the result will probably be broken. FFmpeg provides nothing better
// yet (unless you demux with libavformat, which contains tons of hacks