Skip to content

Commit 26f0687

Browse files
authored
hls: add vod_hls_encryption_output_iv directive (#1514)
* hls: add vod_hls_encryption_output_iv variable * remove complexity just return IV when vod_hls_encryption_output_iv is enabled
1 parent 5b96c97 commit 26f0687

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,6 +1714,13 @@ The parameter value can contain variables.
17141714
When enabled, the module will shift back the dts timestamps by the pts delay of the initial frame.
17151715
This can help keep the pts timestamps aligned across multiple renditions.
17161716

1717+
#### vod_hls_encryption_output_iv
1718+
* **syntax**: `vod_hls_encryption_output_iv on/off`
1719+
* **default**: `off`
1720+
* **context**: `http`, `server`, `location`
1721+
1722+
When enabled, the module outputs the `IV` attribute in returned `#EXT-X-KEY` tags.
1723+
17171724
### Configuration directives - MSS
17181725

17191726
#### vod_mss_manifest_file_name_prefix

ngx_http_vod_hls.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ ngx_http_vod_hls_init_encryption_params(
171171
}
172172

173173
encryption_params->iv = encryption_params->iv_buf;
174-
encryption_params->return_iv = FALSE;
174+
encryption_params->return_iv = conf->hls.output_iv;
175175

176176
sequence = &submodule_context->media_set.sequences[0];
177177

@@ -1116,6 +1116,7 @@ ngx_http_vod_hls_create_loc_conf(
11161116
conf->align_pts = NGX_CONF_UNSET;
11171117
conf->output_id3_timestamps = NGX_CONF_UNSET;
11181118
conf->encryption_method = NGX_CONF_UNSET_UINT;
1119+
conf->output_iv = NGX_CONF_UNSET;
11191120
conf->m3u8_config.output_iframes_playlist = NGX_CONF_UNSET;
11201121
conf->m3u8_config.force_unmuxed_segments = NGX_CONF_UNSET;
11211122
conf->m3u8_config.container_format = NGX_CONF_UNSET_UINT;
@@ -1131,6 +1132,7 @@ ngx_http_vod_hls_merge_loc_conf(
11311132
ngx_conf_merge_value(conf->absolute_master_urls, prev->absolute_master_urls, 1);
11321133
ngx_conf_merge_value(conf->absolute_index_urls, prev->absolute_index_urls, 1);
11331134
ngx_conf_merge_value(conf->absolute_iframe_urls, prev->absolute_iframe_urls, 0);
1135+
ngx_conf_merge_value(conf->output_iv, prev->output_iv, 0);
11341136
ngx_conf_merge_value(conf->m3u8_config.output_iframes_playlist, prev->m3u8_config.output_iframes_playlist, 1);
11351137

11361138
ngx_conf_merge_str_value(conf->master_file_name_prefix, prev->master_file_name_prefix, "master");

ngx_http_vod_hls_commands.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@
3535
NGX_HTTP_LOC_CONF_OFFSET,
3636
BASE_OFFSET + offsetof(ngx_http_vod_hls_loc_conf_t, m3u8_config.encryption_key_format_versions),
3737
NULL },
38+
39+
{ ngx_string("vod_hls_encryption_output_iv"),
40+
NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_CONF_TAKE1,
41+
ngx_conf_set_flag_slot,
42+
NGX_HTTP_LOC_CONF_OFFSET,
43+
BASE_OFFSET + offsetof(ngx_http_vod_hls_loc_conf_t, output_iv),
44+
NULL },
3845
#endif // NGX_HAVE_OPENSSL_EVP
3946

4047
{ ngx_string("vod_hls_container_format"),

ngx_http_vod_hls_conf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ typedef struct
1919
ngx_http_complex_value_t* id3_data;
2020
vod_uint_t encryption_method;
2121
ngx_http_complex_value_t* encryption_key_uri;
22+
bool_t output_iv;
2223

2324
// derived fields
2425
m3u8_config_t m3u8_config;

0 commit comments

Comments
 (0)