@@ -111,8 +111,8 @@ typedef struct {
111
111
ngx_str_t base_url ;
112
112
ngx_int_t granularity ;
113
113
ngx_flag_t keys ;
114
- ngx_str_t keys_path ;
115
- ngx_str_t keys_url ;
114
+ ngx_str_t key_path ;
115
+ ngx_str_t key_url ;
116
116
ngx_int_t frags_per_key ;
117
117
} ngx_rtmp_hls_app_conf_t ;
118
118
@@ -287,18 +287,18 @@ static ngx_command_t ngx_rtmp_hls_commands[] = {
287
287
offsetof(ngx_rtmp_hls_app_conf_t , keys ),
288
288
NULL },
289
289
290
- { ngx_string ("hls_keys_path " ),
290
+ { ngx_string ("hls_key_path " ),
291
291
NGX_RTMP_MAIN_CONF |NGX_RTMP_SRV_CONF |NGX_RTMP_APP_CONF |NGX_CONF_TAKE1 ,
292
292
ngx_conf_set_str_slot ,
293
293
NGX_RTMP_APP_CONF_OFFSET ,
294
- offsetof(ngx_rtmp_hls_app_conf_t , keys_path ),
294
+ offsetof(ngx_rtmp_hls_app_conf_t , key_path ),
295
295
NULL },
296
296
297
- { ngx_string ("hls_keys_url " ),
297
+ { ngx_string ("hls_key_url " ),
298
298
NGX_RTMP_MAIN_CONF |NGX_RTMP_SRV_CONF |NGX_RTMP_APP_CONF |NGX_CONF_TAKE1 ,
299
299
ngx_conf_set_str_slot ,
300
300
NGX_RTMP_APP_CONF_OFFSET ,
301
- offsetof(ngx_rtmp_hls_app_conf_t , keys_url ),
301
+ offsetof(ngx_rtmp_hls_app_conf_t , key_url ),
302
302
NULL },
303
303
304
304
{ ngx_string ("hls_fragments_per_key" ),
@@ -541,15 +541,15 @@ ngx_rtmp_hls_write_playlist(ngx_rtmp_session_t *s)
541
541
}
542
542
543
543
sep = hacf -> nested ? (hacf -> base_url .len ? "/" : "" ) : "-" ;
544
- key_sep = hacf -> nested ? (hacf -> keys_url .len ? "/" : "" ) : "-" ;
544
+ key_sep = hacf -> nested ? (hacf -> key_url .len ? "/" : "" ) : "-" ;
545
545
546
546
name_part .len = 0 ;
547
547
if (!hacf -> nested || hacf -> base_url .len ) {
548
548
name_part = ctx -> name ;
549
549
}
550
550
551
551
key_name_part .len = 0 ;
552
- if (!hacf -> nested || hacf -> keys_url .len ) {
552
+ if (!hacf -> nested || hacf -> key_url .len ) {
553
553
key_name_part = ctx -> name ;
554
554
}
555
555
@@ -568,7 +568,7 @@ ngx_rtmp_hls_write_playlist(ngx_rtmp_session_t *s)
568
568
if (hacf -> keys && (i == 0 || f -> key_id != prev_key_id )) {
569
569
p = ngx_slprintf (p , end , "#EXT-X-KEY:METHOD=AES-128,"
570
570
"URI=\"%V%V%s%uL.key\",IV=0x%032XL\n" ,
571
- & hacf -> keys_url , & key_name_part ,
571
+ & hacf -> key_url , & key_name_part ,
572
572
key_sep , f -> key_id , f -> key_id );
573
573
}
574
574
@@ -864,7 +864,7 @@ ngx_rtmp_hls_open_fragment(ngx_rtmp_session_t *s, uint64_t ts,
864
864
}
865
865
866
866
if (hacf -> keys &&
867
- ngx_rtmp_hls_ensure_directory (s , & hacf -> keys_path ) != NGX_OK )
867
+ ngx_rtmp_hls_ensure_directory (s , & hacf -> key_path ) != NGX_OK )
868
868
{
869
869
return NGX_ERROR ;
870
870
}
@@ -1397,16 +1397,16 @@ ngx_rtmp_hls_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
1397
1397
/* key path */
1398
1398
1399
1399
if (hacf -> keys ) {
1400
- len = hacf -> keys_path .len + 1 + ctx -> name .len + NGX_INT64_LEN
1400
+ len = hacf -> key_path .len + 1 + ctx -> name .len + NGX_INT64_LEN
1401
1401
+ sizeof (".key" );
1402
1402
1403
1403
ctx -> keyfile .data = ngx_palloc (s -> connection -> pool , len );
1404
1404
if (ctx -> keyfile .data == NULL ) {
1405
1405
return NGX_ERROR ;
1406
1406
}
1407
1407
1408
- p = ngx_cpymem (ctx -> keyfile .data , hacf -> keys_path .data ,
1409
- hacf -> keys_path .len );
1408
+ p = ngx_cpymem (ctx -> keyfile .data , hacf -> key_path .data ,
1409
+ hacf -> key_path .len );
1410
1410
1411
1411
if (p [-1 ] != '/' ) {
1412
1412
* p ++ = '/' ;
@@ -2294,8 +2294,8 @@ ngx_rtmp_hls_merge_app_conf(ngx_conf_t *cf, void *parent, void *child)
2294
2294
ngx_conf_merge_str_value (conf -> base_url , prev -> base_url , "" );
2295
2295
ngx_conf_merge_value (conf -> granularity , prev -> granularity , 0 );
2296
2296
ngx_conf_merge_value (conf -> keys , prev -> keys , 0 );
2297
- ngx_conf_merge_str_value (conf -> keys_path , prev -> keys_path , "" );
2298
- ngx_conf_merge_str_value (conf -> keys_url , prev -> keys_url , "" );
2297
+ ngx_conf_merge_str_value (conf -> key_path , prev -> key_path , "" );
2298
+ ngx_conf_merge_str_value (conf -> key_url , prev -> key_url , "" );
2299
2299
ngx_conf_merge_value (conf -> frags_per_key , prev -> frags_per_key , 0 );
2300
2300
2301
2301
if (conf -> fraglen ) {
@@ -2337,20 +2337,20 @@ ngx_rtmp_hls_merge_app_conf(ngx_conf_t *cf, void *parent, void *child)
2337
2337
2338
2338
ngx_conf_merge_str_value (conf -> path , prev -> path , "" );
2339
2339
2340
- if (conf -> keys && conf -> cleanup && conf -> keys_path .len &&
2341
- ngx_strcmp (conf -> keys_path .data , conf -> path .data ) != 0 &&
2340
+ if (conf -> keys && conf -> cleanup && conf -> key_path .len &&
2341
+ ngx_strcmp (conf -> key_path .data , conf -> path .data ) != 0 &&
2342
2342
conf -> type != NGX_RTMP_HLS_TYPE_EVENT )
2343
2343
{
2344
- if (conf -> keys_path .data [conf -> keys_path .len - 1 ] == '/' ) {
2345
- conf -> keys_path .len -- ;
2344
+ if (conf -> key_path .data [conf -> key_path .len - 1 ] == '/' ) {
2345
+ conf -> key_path .len -- ;
2346
2346
}
2347
2347
2348
2348
cleanup = ngx_pcalloc (cf -> pool , sizeof (* cleanup ));
2349
2349
if (cleanup == NULL ) {
2350
2350
return NGX_CONF_ERROR ;
2351
2351
}
2352
2352
2353
- cleanup -> path = conf -> keys_path ;
2353
+ cleanup -> path = conf -> key_path ;
2354
2354
cleanup -> playlen = conf -> playlen ;
2355
2355
2356
2356
conf -> slot = ngx_pcalloc (cf -> pool , sizeof (* conf -> slot ));
@@ -2359,7 +2359,7 @@ ngx_rtmp_hls_merge_app_conf(ngx_conf_t *cf, void *parent, void *child)
2359
2359
}
2360
2360
2361
2361
conf -> slot -> manager = ngx_rtmp_hls_cleanup ;
2362
- conf -> slot -> name = conf -> keys_path ;
2362
+ conf -> slot -> name = conf -> key_path ;
2363
2363
conf -> slot -> data = cleanup ;
2364
2364
conf -> slot -> conf_file = cf -> conf_file -> file .name .data ;
2365
2365
conf -> slot -> line = cf -> conf_file -> line ;
@@ -2369,10 +2369,10 @@ ngx_rtmp_hls_merge_app_conf(ngx_conf_t *cf, void *parent, void *child)
2369
2369
}
2370
2370
}
2371
2371
2372
- ngx_conf_merge_str_value (conf -> keys_path , prev -> keys_path , "" );
2372
+ ngx_conf_merge_str_value (conf -> key_path , prev -> key_path , "" );
2373
2373
2374
- if (conf -> keys_path .len == 0 ) {
2375
- conf -> keys_path = conf -> path ;
2374
+ if (conf -> key_path .len == 0 ) {
2375
+ conf -> key_path = conf -> path ;
2376
2376
}
2377
2377
2378
2378
return NGX_CONF_OK ;
0 commit comments