aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2014-08-12 08:48:20 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2014-08-12 08:48:20 +0200
commitfddea3f074d920752a3a1d47f4858a710d65a3ef (patch)
treeabd4c7bd532f8daf6c3b0d14fb8bc729416c099f
parentd6711ee648f840c446e729a4f07d67ea229192a5 (diff)
downloadffmpeg-fddea3f074d920752a3a1d47f4858a710d65a3ef.tar.gz
Check for hevc startcode when muxing into mpeg-ts.
-rw-r--r--libavformat/mpegtsenc.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 1a54c1ad02..e37f6d4d9b 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1184,6 +1184,18 @@ int ff_check_h264_startcode(AVFormatContext *s, const AVStream *st, const AVPack
return 0;
}
+static int check_hevc_startcode(AVFormatContext *s, const AVStream *st, const AVPacket *pkt)
+{
+ if (pkt->size < 5 || AV_RB32(pkt->data) != 0x0000001) {
+ if (!st->nb_frames) {
+ av_log(s, AV_LOG_ERROR, "HEVC bitstream malformed, no startcode found\n");
+ return AVERROR_PATCHWELCOME;
+ }
+ av_log(s, AV_LOG_WARNING, "HEVC bitstream error, startcode missing\n");
+ }
+ return 0;
+}
+
static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
{
AVStream *st = s->streams[pkt->stream_index];
@@ -1281,6 +1293,10 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
ts_st->amux->pb = NULL;
buf = data;
}
+ } else if (st->codec->codec_id == AV_CODEC_ID_HEVC) {
+ int ret = check_hevc_startcode(s, st, pkt);
+ if (ret < 0)
+ return ret;
}
if (pkt->dts != AV_NOPTS_VALUE) {