@@ -7,11 +7,26 @@ defmodule Membrane.Transcoder.Video do
77
88 @ type video_stream_format :: VP8 . t ( ) | VP9 . t ( ) | H264 . t ( ) | H265 . t ( ) | RawVideo . t ( )
99
10+ defguardp is_raw_video_format ( format )
11+ when is_struct ( format ) and format . __struct__ == RawVideo
12+
13+ defguardp is_h26x_format ( format )
14+ when is_struct ( format ) and
15+ ( format . __struct__ in [ H264 , H265 ] or
16+ ( format . __struct__ == RemoteStream and
17+ format . content_format in [ H264 , H265 ] ) )
18+
19+ defguardp is_vpx_format ( format )
20+ when is_struct ( format ) and
21+ ( format . __struct__ in [ VP8 , VP9 ] or
22+ ( format . __struct__ == RemoteStream and
23+ format . content_format in [ VP8 , VP9 ] and
24+ format . type == :packetized ) )
25+
1026 defguard is_video_format ( format )
11- when is_struct ( format ) and
12- ( format . __struct__ in [ VP8 , VP9 , H264 , H265 , RawVideo ] or
13- ( format . __struct__ == RemoteStream and format . content_format in [ VP8 , VP9 ] and
14- format . type == :packetized ) )
27+ when is_h26x_format ( format ) or
28+ is_vpx_format ( format ) or
29+ is_raw_video_format ( format )
1530
1631 @ spec plug_video_transcoding (
1732 ChildrenSpec . builder ( ) ,
@@ -24,6 +39,21 @@ defmodule Membrane.Transcoder.Video do
2439 do_plug_video_transcoding ( builder , input_format , output_format , transcoding_policy )
2540 end
2641
42+ defp do_plug_video_transcoding (
43+ builder ,
44+ % RemoteStream { content_format: h26x } ,
45+ output_format ,
46+ transcoding_policy
47+ )
48+ when h26x in [ H264 , H265 ] do
49+ do_plug_video_transcoding (
50+ builder ,
51+ struct! ( h26x ) ,
52+ output_format ,
53+ transcoding_policy
54+ )
55+ end
56+
2757 defp do_plug_video_transcoding ( builder , % H264 { } , % H264 { } = output_format , transcoding_policy )
2858 when transcoding_policy in [ :if_needed , :never ] do
2959 builder
0 commit comments