summaryrefslogtreecommitdiff
path: root/libavformat/mpegts.c
diff options
context:
space:
mode:
authorNachiket Tarate <nachiket.programmer@gmail.com>2021-09-22 00:12:00 +0530
committerSteven Liu <lq@chinaffmpeg.org>2021-10-13 11:23:53 +0800
commitff958b38463f6ebd17471c40001287c71698f639 (patch)
tree2b5e5bdf288d0308245fb9c63c167835d1b8220d /libavformat/mpegts.c
parentef0f5d1be67a97bf8a5c3da07e12f55b34a24ec3 (diff)
libavformat/hls: add support for decryption of HLS media segments encrypted using SAMPLE-AES encryption method
Apple HTTP Live Streaming Sample Encryption: https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption Signed-off-by: Nachiket Tarate <nachiket.programmer@gmail.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Diffstat (limited to 'libavformat/mpegts.c')
-rw-r--r--libavformat/mpegts.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 9a6bbb1c93..44d9298b12 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -839,6 +839,15 @@ static const StreamType MISC_types[] = {
{ 0 },
};
+/* HLS Sample Encryption Types */
+static const StreamType HLS_SAMPLE_ENC_types[] = {
+ { 0xdb, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264},
+ { 0xcf, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC },
+ { 0xc1, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AC3 },
+ { 0xc2, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_EAC3},
+ { 0 },
+};
+
static const StreamType REGD_types[] = {
{ MKTAG('d', 'r', 'a', 'c'), AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_DIRAC },
{ MKTAG('A', 'C', '-', '3'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AC3 },
@@ -950,6 +959,8 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
}
if (st->codecpar->codec_id == AV_CODEC_ID_NONE)
mpegts_find_stream_type(st, pes->stream_type, MISC_types);
+ if (st->codecpar->codec_id == AV_CODEC_ID_NONE)
+ mpegts_find_stream_type(st, pes->stream_type, HLS_SAMPLE_ENC_types);
if (st->codecpar->codec_id == AV_CODEC_ID_NONE) {
st->codecpar->codec_id = old_codec_id;
st->codecpar->codec_type = old_codec_type;