@@ -578,6 +578,63 @@ ngx_rtmp_cmd_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
578
578
}
579
579
580
580
581
+ static ngx_int_t
582
+ ngx_rtmp_cmd_play2_init (ngx_rtmp_session_t * s , ngx_rtmp_header_t * h ,
583
+ ngx_chain_t * in )
584
+ {
585
+ static ngx_rtmp_play_t v ;
586
+ static ngx_rtmp_close_stream_t vc ;
587
+
588
+ static ngx_rtmp_amf_elt_t in_obj [] = {
589
+
590
+ { NGX_RTMP_AMF_NUMBER ,
591
+ ngx_string ("start" ),
592
+ & v .start , 0 },
593
+
594
+ { NGX_RTMP_AMF_STRING ,
595
+ ngx_string ("streamName" ),
596
+ & v .name , sizeof (v .name ) },
597
+ };
598
+
599
+ static ngx_rtmp_amf_elt_t in_elts [] = {
600
+
601
+ /* transaction is always 0 */
602
+ { NGX_RTMP_AMF_NUMBER ,
603
+ ngx_null_string ,
604
+ NULL , 0 },
605
+
606
+ { NGX_RTMP_AMF_NULL ,
607
+ ngx_null_string ,
608
+ NULL , 0 },
609
+
610
+ { NGX_RTMP_AMF_OBJECT ,
611
+ ngx_null_string ,
612
+ & in_obj , sizeof (in_obj ) }
613
+ };
614
+
615
+ ngx_memzero (& v , sizeof (v ));
616
+
617
+ if (ngx_rtmp_receive_amf (s , in , in_elts ,
618
+ sizeof (in_elts ) / sizeof (in_elts [0 ])))
619
+ {
620
+ return NGX_ERROR ;
621
+ }
622
+
623
+ ngx_rtmp_cmd_fill_args (v .name , v .args );
624
+
625
+ ngx_log_error (NGX_LOG_INFO , s -> connection -> log , 0 ,
626
+ "play2: name='%s' args='%s' start=%i" ,
627
+ v .name , v .args , (ngx_int_t ) v .start );
628
+
629
+ ngx_memzero (& vc , sizeof (vc ));
630
+
631
+ /* close_stream should be synchronous */
632
+ ngx_rtmp_close_stream (s , & vc );
633
+
634
+ return ngx_rtmp_play (s , & v );
635
+ }
636
+
637
+
581
638
static ngx_int_t
582
639
ngx_rtmp_cmd_pause_init (ngx_rtmp_session_t * s , ngx_rtmp_header_t * h ,
583
640
ngx_chain_t * in )
@@ -730,6 +787,7 @@ static ngx_rtmp_amf_handler_t ngx_rtmp_cmd_map[] = {
730
787
{ ngx_string ("deleteStream" ), ngx_rtmp_cmd_delete_stream_init },
731
788
{ ngx_string ("publish" ), ngx_rtmp_cmd_publish_init },
732
789
{ ngx_string ("play" ), ngx_rtmp_cmd_play_init },
790
+ { ngx_string ("play2" ), ngx_rtmp_cmd_play2_init },
733
791
{ ngx_string ("seek" ), ngx_rtmp_cmd_seek_init },
734
792
{ ngx_string ("pause" ), ngx_rtmp_cmd_pause_init },
735
793
{ ngx_string ("pauseraw" ), ngx_rtmp_cmd_pause_init },
0 commit comments