mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
hls: detect SAMPLE-AES encryption
SAMPLE-AES encryption is not commonly used yet, but without this patch ffmpeg is thinking that the hls segments are not encrypted which produces broken files. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
d75a73b5fc
commit
6c8a158989
@ -62,6 +62,7 @@
|
|||||||
enum KeyType {
|
enum KeyType {
|
||||||
KEY_NONE,
|
KEY_NONE,
|
||||||
KEY_AES_128,
|
KEY_AES_128,
|
||||||
|
KEY_SAMPLE_AES
|
||||||
};
|
};
|
||||||
|
|
||||||
struct segment {
|
struct segment {
|
||||||
@ -329,7 +330,7 @@ static void handle_variant_args(struct variant_info *info, const char *key,
|
|||||||
|
|
||||||
struct key_info {
|
struct key_info {
|
||||||
char uri[MAX_URL_SIZE];
|
char uri[MAX_URL_SIZE];
|
||||||
char method[10];
|
char method[11];
|
||||||
char iv[35];
|
char iv[35];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -556,6 +557,8 @@ static int parse_playlist(HLSContext *c, const char *url,
|
|||||||
has_iv = 0;
|
has_iv = 0;
|
||||||
if (!strcmp(info.method, "AES-128"))
|
if (!strcmp(info.method, "AES-128"))
|
||||||
key_type = KEY_AES_128;
|
key_type = KEY_AES_128;
|
||||||
|
if (!strcmp(info.method, "SAMPLE-AES"))
|
||||||
|
key_type = KEY_SAMPLE_AES;
|
||||||
if (!strncmp(info.iv, "0x", 2) || !strncmp(info.iv, "0X", 2)) {
|
if (!strncmp(info.iv, "0x", 2) || !strncmp(info.iv, "0X", 2)) {
|
||||||
ff_hex_to_data(iv, info.iv + 2);
|
ff_hex_to_data(iv, info.iv + 2);
|
||||||
has_iv = 1;
|
has_iv = 1;
|
||||||
@ -967,6 +970,10 @@ static int open_input(HLSContext *c, struct playlist *pls)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
} else if (seg->key_type == KEY_SAMPLE_AES) {
|
||||||
|
av_log(pls->parent, AV_LOG_ERROR,
|
||||||
|
"SAMPLE-AES encryption is not supported yet\n");
|
||||||
|
ret = AVERROR_PATCHWELCOME;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ret = AVERROR(ENOSYS);
|
ret = AVERROR(ENOSYS);
|
||||||
|
Loading…
Reference in New Issue
Block a user