@@ -16,7 +16,7 @@ static ngx_rtmp_stream_eof_pt next_stream_eof;
16
16
17
17
static ngx_int_t ngx_rtmp_dash_postconfiguration (ngx_conf_t * cf );
18
18
static void * ngx_rtmp_dash_create_app_conf (ngx_conf_t * cf );
19
- static char * ngx_rtmp_dash_merge_app_conf (ngx_conf_t * cf ,
19
+ static char * ngx_rtmp_dash_merge_app_conf (ngx_conf_t * cf ,
20
20
void * parent , void * child );
21
21
static ngx_int_t ngx_rtmp_dash_write_init_segments (ngx_rtmp_session_t * s );
22
22
@@ -230,7 +230,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
230
230
static u_char buffer [NGX_RTMP_DASH_BUFSIZE ];
231
231
static u_char start_time [sizeof ("1970-09-28T12:00:00+06:00" )];
232
232
static u_char end_time [sizeof ("1970-09-28T12:00:00+06:00" )];
233
-
233
+
234
234
dacf = ngx_rtmp_get_module_app_conf (s , ngx_rtmp_dash_module );
235
235
ctx = ngx_rtmp_get_module_ctx (s , ngx_rtmp_dash_module );
236
236
codec_ctx = ngx_rtmp_get_module_ctx (s , ngx_rtmp_codec_module );
@@ -243,7 +243,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
243
243
ngx_rtmp_dash_write_init_segments (s );
244
244
}
245
245
246
- fd = ngx_open_file (ctx -> playlist_bak .data , NGX_FILE_WRONLY ,
246
+ fd = ngx_open_file (ctx -> playlist_bak .data , NGX_FILE_WRONLY ,
247
247
NGX_FILE_TRUNCATE , NGX_FILE_DEFAULT_ACCESS );
248
248
249
249
if (fd == NGX_INVALID_FILE ) {
@@ -343,7 +343,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
343
343
344
344
ngx_libc_localtime (ctx -> start_time .sec +
345
345
ngx_rtmp_dash_get_frag (s , 0 )-> timestamp / 1000 , & tm );
346
-
346
+
347
347
* ngx_sprintf (start_time , "%4d-%02d-%02dT%02d:%02d:%02d%c%02d:%02d" ,
348
348
tm .tm_year + 1900 , tm .tm_mon + 1 ,
349
349
tm .tm_mday , tm .tm_hour ,
@@ -354,9 +354,9 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
354
354
355
355
ngx_libc_localtime (ctx -> start_time .sec +
356
356
(ngx_rtmp_dash_get_frag (s , ctx -> nfrags - 1 )-> timestamp +
357
- ngx_rtmp_dash_get_frag (s , ctx -> nfrags - 1 )-> duration ) /
357
+ ngx_rtmp_dash_get_frag (s , ctx -> nfrags - 1 )-> duration ) /
358
358
1000 , & tm );
359
-
359
+
360
360
* ngx_sprintf (end_time , "%4d-%02d-%02dT%02d:%02d:%02d%c%02d:%02d" ,
361
361
tm .tm_year + 1900 , tm .tm_mon + 1 ,
362
362
tm .tm_mday , tm .tm_hour ,
@@ -383,14 +383,14 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
383
383
384
384
if (ctx -> has_video ) {
385
385
p = ngx_slprintf (buffer , last , NGX_RTMP_DASH_MANIFEST_VIDEO ,
386
- codec_ctx -> width ,
386
+ codec_ctx -> width ,
387
387
codec_ctx -> height ,
388
388
codec_ctx -> frame_rate ,
389
389
& ctx -> name ,
390
390
codec_ctx -> avc_profile ,
391
391
codec_ctx -> avc_compat ,
392
392
codec_ctx -> avc_level ,
393
- codec_ctx -> width ,
393
+ codec_ctx -> width ,
394
394
codec_ctx -> height ,
395
395
codec_ctx -> frame_rate ,
396
396
(ngx_uint_t ) (codec_ctx -> video_data_rate * 1000 ),
@@ -402,10 +402,10 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
402
402
p = ngx_slprintf (p , last , NGX_RTMP_DASH_MANIFEST_TIME ,
403
403
f -> timestamp , f -> duration );
404
404
}
405
-
405
+
406
406
p = ngx_slprintf (p , last , NGX_RTMP_DASH_MANIFEST_VIDEO_FOOTER );
407
407
408
- n = ngx_write_fd (fd , buffer , p - buffer );
408
+ n = ngx_write_fd (fd , buffer , p - buffer );
409
409
}
410
410
411
411
if (ctx -> has_audio ) {
@@ -425,13 +425,13 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
425
425
}
426
426
427
427
p = ngx_slprintf (p , last , NGX_RTMP_DASH_MANIFEST_AUDIO_FOOTER );
428
-
428
+
429
429
n = ngx_write_fd (fd , buffer , p - buffer );
430
430
}
431
431
432
432
p = ngx_slprintf (buffer , last , NGX_RTMP_DASH_MANIFEST_FOOTER );
433
433
n = ngx_write_fd (fd , buffer , p - buffer );
434
-
434
+
435
435
if (n < 0 ) {
436
436
ngx_log_error (NGX_LOG_ERR , s -> connection -> log , ngx_errno ,
437
437
"dash: write failed: '%V'" , & ctx -> playlist_bak );
@@ -445,7 +445,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
445
445
== NGX_FILE_ERROR )
446
446
{
447
447
ngx_log_error (NGX_LOG_ERR , s -> connection -> log , ngx_errno ,
448
- "dash: rename failed: '%V'->'%V'" ,
448
+ "dash: rename failed: '%V'->'%V'" ,
449
449
& ctx -> playlist_bak , & ctx -> playlist );
450
450
return NGX_ERROR ;
451
451
}
@@ -493,7 +493,7 @@ ngx_rtmp_dash_write_init_segments(ngx_rtmp_session_t *s)
493
493
NGX_RTMP_MP4_VIDEO_TRACK );
494
494
ngx_rtmp_mp4_write_moov (s , & b , NGX_RTMP_MP4_VIDEO_TRACK );
495
495
496
- rc = ngx_write_fd (fd , b .start , (size_t ) (b .last - b .start ));
496
+ rc = ngx_write_fd (fd , b .start , (size_t ) (b .last - b .start ));
497
497
if (rc == NGX_ERROR ) {
498
498
ngx_log_error (NGX_LOG_ERR , s -> connection -> log , ngx_errno ,
499
499
"dash: writing video init failed" );
@@ -528,7 +528,7 @@ ngx_rtmp_dash_write_init_segments(ngx_rtmp_session_t *s)
528
528
529
529
ngx_close_file (fd );
530
530
531
- return NGX_OK ;
531
+ return NGX_OK ;
532
532
}
533
533
534
534
@@ -640,7 +640,7 @@ ngx_rtmp_dash_close_fragment(ngx_rtmp_session_t *s, ngx_rtmp_dash_track_t *t)
640
640
}
641
641
642
642
643
- static ngx_int_t
643
+ static ngx_int_t
644
644
ngx_rtmp_dash_close_fragments (ngx_rtmp_session_t * s )
645
645
{
646
646
ngx_rtmp_dash_ctx_t * ctx ;
@@ -698,7 +698,7 @@ ngx_rtmp_dash_open_fragment(ngx_rtmp_session_t *s, ngx_rtmp_dash_track_t *t,
698
698
t -> sample_count = 0 ;
699
699
t -> earliest_pres_time = 0 ;
700
700
t -> latest_pres_time = 0 ;
701
- t -> mdat_size = 0 ;
701
+ t -> mdat_size = 0 ;
702
702
t -> opened = 1 ;
703
703
704
704
if (type == 'v' ) {
@@ -895,7 +895,7 @@ ngx_rtmp_dash_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
895
895
896
896
ctx -> name .len = ngx_strlen (v -> name );
897
897
ctx -> name .data = ngx_palloc (s -> connection -> pool , ctx -> name .len + 1 );
898
-
898
+
899
899
if (ctx -> name .data == NULL ) {
900
900
return NGX_ERROR ;
901
901
}
@@ -916,8 +916,8 @@ ngx_rtmp_dash_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
916
916
917
917
p = ngx_cpymem (p , ctx -> name .data , ctx -> name .len );
918
918
919
- /*
920
- * ctx->stream holds initial part of stream file path
919
+ /*
920
+ * ctx->stream holds initial part of stream file path
921
921
* however the space for the whole stream path
922
922
* is allocated
923
923
*/
@@ -942,9 +942,9 @@ ngx_rtmp_dash_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
942
942
943
943
/* playlist bak (new playlist) path */
944
944
945
- ctx -> playlist_bak .data = ngx_palloc (s -> connection -> pool ,
945
+ ctx -> playlist_bak .data = ngx_palloc (s -> connection -> pool ,
946
946
ctx -> playlist .len + sizeof (".bak" ));
947
- p = ngx_cpymem (ctx -> playlist_bak .data , ctx -> playlist .data ,
947
+ p = ngx_cpymem (ctx -> playlist_bak .data , ctx -> playlist .data ,
948
948
ctx -> playlist .len );
949
949
p = ngx_cpymem (p , ".bak" , sizeof (".bak" ) - 1 );
950
950
@@ -992,7 +992,7 @@ ngx_rtmp_dash_close_stream(ngx_rtmp_session_t *s, ngx_rtmp_close_stream_t *v)
992
992
993
993
994
994
static void
995
- ngx_rtmp_dash_update_fragments (ngx_rtmp_session_t * s , ngx_int_t boundary ,
995
+ ngx_rtmp_dash_update_fragments (ngx_rtmp_session_t * s , ngx_int_t boundary ,
996
996
uint32_t timestamp )
997
997
{
998
998
ngx_int_t hit ;
@@ -1028,7 +1028,7 @@ ngx_rtmp_dash_update_fragments(ngx_rtmp_session_t *s, ngx_int_t boundary,
1028
1028
1029
1029
f -> duration = (timestamp - f -> timestamp );
1030
1030
1031
- if (boundary ) {
1031
+ if (boundary ) {
1032
1032
ngx_rtmp_dash_close_fragments (s );
1033
1033
ngx_rtmp_dash_open_fragments (s );
1034
1034
@@ -1100,7 +1100,7 @@ ngx_rtmp_dash_append(ngx_rtmp_session_t *s, ngx_chain_t *in,
1100
1100
1101
1101
1102
1102
static ngx_int_t
1103
- ngx_rtmp_dash_audio (ngx_rtmp_session_t * s , ngx_rtmp_header_t * h ,
1103
+ ngx_rtmp_dash_audio (ngx_rtmp_session_t * s , ngx_rtmp_header_t * h ,
1104
1104
ngx_chain_t * in )
1105
1105
{
1106
1106
u_char htype ;
@@ -1111,9 +1111,9 @@ ngx_rtmp_dash_audio(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
1111
1111
dacf = ngx_rtmp_get_module_app_conf (s , ngx_rtmp_dash_module );
1112
1112
ctx = ngx_rtmp_get_module_ctx (s , ngx_rtmp_dash_module );
1113
1113
codec_ctx = ngx_rtmp_get_module_ctx (s , ngx_rtmp_codec_module );
1114
-
1114
+
1115
1115
if (dacf == NULL || !dacf -> dash || ctx == NULL ||
1116
- codec_ctx == NULL || h -> mlen < 2 )
1116
+ codec_ctx == NULL || h -> mlen < 2 )
1117
1117
{
1118
1118
return NGX_OK ;
1119
1119
}
@@ -1148,7 +1148,7 @@ ngx_rtmp_dash_audio(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
1148
1148
1149
1149
1150
1150
static ngx_int_t
1151
- ngx_rtmp_dash_video (ngx_rtmp_session_t * s , ngx_rtmp_header_t * h ,
1151
+ ngx_rtmp_dash_video (ngx_rtmp_session_t * s , ngx_rtmp_header_t * h ,
1152
1152
ngx_chain_t * in )
1153
1153
{
1154
1154
u_char * p ;
@@ -1296,7 +1296,7 @@ ngx_rtmp_dash_cleanup_dir(ngx_str_t *ppath, ngx_msec_t playlen)
1296
1296
ngx_log_debug1 (NGX_LOG_DEBUG_RTMP , ngx_cycle -> log , 0 ,
1297
1297
"dash: cleanup dir '%V'" , & name );
1298
1298
1299
- /*
1299
+ /*
1300
1300
* null-termination gets spoiled in win32
1301
1301
* version of ngx_open_dir
1302
1302
*/
0 commit comments