@@ -104,7 +104,33 @@ int ffmpeg_append_st2110_transport(std::string &transport, std::string &pipeline
104104 return 0 ;
105105}
106106
107- int ffmpeg_append_stream_type (StreamType &s, bool is_rx, int idx, std::string &pipeline_string) {
107+ int ffmpeg_append_mcm_transport (Payload &p, std::string &pipeline_string) {
108+ switch (p.type ) {
109+ case video:
110+ pipeline_string += " -f mcm" ;
111+ break ;
112+ case audio:
113+ if (p.audio .format == " s16be" || p.audio .format == " s16le" || p.audio .format == " u16be" || p.audio .format == " u16le" ){
114+ pipeline_string += " -f mcm_audio_pcm16" ;
115+ break ;
116+ }
117+ else if (p.audio .format == " s24be" || p.audio .format == " s24le" || p.audio .format == " u24be" || p.audio .format == " u24le" ){
118+ pipeline_string += " -f mcm_audio_pcm24" ;
119+ break ;
120+ }
121+ else {
122+ std::cout << " Error: audio format " << p.audio .format << " not supported yet" << std::endl;
123+ return 1 ;
124+ }
125+ default :
126+ std::cout << " Error: unknown mcm payload type" << std::endl;
127+ return 1 ;
128+ }
129+ return 0 ;
130+ }
131+
132+ int ffmpeg_append_stream_type (Stream &st, bool is_rx, int idx, std::string &pipeline_string) {
133+ auto s = st.stream_type ;
108134 switch (s.type ) {
109135 case file:
110136 {
@@ -144,12 +170,27 @@ int ffmpeg_append_stream_type(StreamType &s, bool is_rx, int idx, std::string &p
144170 else {
145171 pipeline_string += " -" ;
146172 }
147-
148-
149173 break ;
150174 case mcm:
151- std::cout << " Error: mcm not supported yet" << std::endl;
152- return 1 ;
175+ if (ffmpeg_append_mcm_transport (st.payload , pipeline_string) != 0 ) {
176+ pipeline_string.clear ();
177+ std::cout << " Error appending mcm transport" << std::endl;
178+ return 1 ;
179+ }
180+ pipeline_string += " -conn_type " + s.mcm .conn_type ;
181+ pipeline_string += " -transport " + s.mcm .transport ;
182+ if (s.mcm .transport == " st2110-20" ) {
183+ pipeline_string += " -transport_pixel_format " + s.mcm .transport_pixel_format ;
184+ }
185+ pipeline_string += " -ip_addr " + s.mcm .ip ;
186+ pipeline_string += " -port " + std::to_string (s.mcm .port );
187+ if (is_rx) {
188+ pipeline_string += " -i \" " + std::to_string (idx) + " \" " ;
189+ }
190+ else {
191+ pipeline_string += " -" ;
192+ }
193+ break ;
153194 default :
154195 break ;
155196 }
@@ -164,7 +205,7 @@ int ffmpeg_combine_rx_tx(Stream &rx, Stream &tx, int idx, std::string &pipeline_
164205 return 1 ;
165206 }
166207
167- if (ffmpeg_append_stream_type (rx. stream_type , true /* is_rx*/ , idx, pipeline_string) != 0 ) {
208+ if (ffmpeg_append_stream_type (rx, true /* is_rx*/ , idx, pipeline_string) != 0 ) {
168209 pipeline_string.clear ();
169210 std::cout << " Error appending rx stream type" << std::endl;
170211 return 1 ;
@@ -178,7 +219,7 @@ int ffmpeg_combine_rx_tx(Stream &rx, Stream &tx, int idx, std::string &pipeline_
178219 }
179220 }
180221
181- if (ffmpeg_append_stream_type (tx. stream_type , false /* is_rx*/ , idx, pipeline_string) != 0 ) {
222+ if (ffmpeg_append_stream_type (tx, false /* is_rx*/ , idx, pipeline_string) != 0 ) {
182223 pipeline_string.clear ();
183224 std::cout << " Error appending tx stream type" << std::endl;
184225 return 1 ;
@@ -199,7 +240,7 @@ int ffmpeg_append_multiviewer_input(Stream &s, int idx, std::string &pipeline_st
199240 return 1 ;
200241 }
201242
202- if (ffmpeg_append_stream_type (s. stream_type , true /* is_rx*/ , idx, pipeline_string) != 0 ){
243+ if (ffmpeg_append_stream_type (s, true /* is_rx*/ , idx, pipeline_string) != 0 ){
203244 pipeline_string.clear ();
204245 std::cout << " Error appending rx stream type" << std::endl;
205246 return 1 ;
@@ -272,7 +313,7 @@ int ffmpeg_append_split_process(std::vector<Stream> &senders, uint32_t intel_gpu
272313 if (senders[i].payload .video .video_type != " rawvideo" ) {
273314 pipeline_string += " -c:v " + senders[i].payload .video .video_type ;
274315 }
275- ffmpeg_append_stream_type (senders[i]. stream_type , false /* is_rx*/ , i, pipeline_string);
316+ ffmpeg_append_stream_type (senders[i], false /* is_rx*/ , i, pipeline_string);
276317 }
277318 return 0 ;
278319}
@@ -324,7 +365,7 @@ int ffmpeg_append_multiviewer(Config &config, std::string &pipeline_string) {
324365 std::cout << " Error appending multiviewer process" << std::endl;
325366 return 1 ;
326367 }
327- if (ffmpeg_append_stream_type (config.senders [0 ]. stream_type , false /* is_rx*/ , 0 , pipeline_string) != 0 ) {
368+ if (ffmpeg_append_stream_type (config.senders [0 ], false /* is_rx*/ , 0 , pipeline_string) != 0 ) {
328369 pipeline_string.clear ();
329370 std::cout << " Error appending multiviewer tx stream" << std::endl;
330371 return 1 ;
@@ -350,7 +391,7 @@ int ffmpeg_append_recorder(Config &config, std::string &pipeline_string) {
350391 std::cout << " Error appending recorder rx payload" << std::endl;
351392 return 1 ;
352393 }
353- if (ffmpeg_append_stream_type (config.receivers [0 ]. stream_type , true /* is_rx*/ , 0 , pipeline_string) != 0 ) {
394+ if (ffmpeg_append_stream_type (config.receivers [0 ], true /* is_rx*/ , 0 , pipeline_string) != 0 ) {
354395 pipeline_string.clear ();
355396 std::cout << " Error appending recorder rx stream" << std::endl;
356397 return 1 ;
@@ -384,13 +425,13 @@ int ffmpeg_append_upscale(Config &config, std::string &pipeline_string) {
384425 std::cout << " Error appending upscale rx payload" << std::endl;
385426 return 1 ;
386427 }
387- if (ffmpeg_append_stream_type (config.receivers [0 ]. stream_type , true /* is_rx*/ , 0 , pipeline_string) != 0 ){
428+ if (ffmpeg_append_stream_type (config.receivers [0 ], true /* is_rx*/ , 0 , pipeline_string) != 0 ){
388429 pipeline_string.clear ();
389430 std::cout << " Error appending upscale rx stream" << std::endl;
390431 return 1 ;
391432 }
392433 pipeline_string += " -vf \" format=yuv420p,hwupload,raisr_opencl,hwdownload,format=yuv420p,format=yuv422p10le\" " ;
393- if (ffmpeg_append_stream_type (config.senders [0 ]. stream_type , false /* is_rx*/ , 0 , pipeline_string) != 0 ){
434+ if (ffmpeg_append_stream_type (config.senders [0 ], false /* is_rx*/ , 0 , pipeline_string) != 0 ){
394435 pipeline_string.clear ();
395436 std::cout << " Error appending upscale tx stream" << std::endl;
396437 return 1 ;
0 commit comments