[MPlayer-dev-eng] [PATCH] shared memory stream - part 1

Nico Sabbi nsabbi at email.it
Wed Aug 8 10:34:01 CEST 2007


Ötvös Attila wrote:

>Hi all!
>
>part-1: configure, shared memory stream and implement -ors options.
>part-2: shared memory export, import filter
>part-3: documents
>
>This patch implement shared video frames between more programs (mplayer or 
>mencoder) with shared memory special stream (similar TV stream).
>Mplayer or mencoder can export read TV or raw video with -ors (out raw stream) 
>option:
>
>mplayer tv:// -ors smem://1000 [options]
>mencoder tv:// -ors smem://1001 [options]
>
>Mplayer or mencoder can read 1 shared memory stream:
>
>mplayer smem://1000
>mencoder smem://1000
>
>or more shared memory stream. Example shared screen to CCTV:
>
>mencoder tv:// -tv device=/dev/video0 -ors smem://1000 [options]
>mencoder tv:// -tv device=/dev/video1 -ors smem://1001 [options]
>mencoder tv:// -tv device=/dev/video2 -ors smem://1002 [options]
>mencoder tv:// -tv device=/dev/video3 -ors smem://1003 [options]
>mplayer smem://1000,1001,1002,1003 -vf tile=2:2
>
>Some old screen shot:
>http://onebithq.com/root/mplayer/cctv
>
>Best regards.
>Attila
>  
>
>  
>

the idea is good, but there some hacks that I don't like:
- the introduction of -ors shouldn't be needed, because
the out-stream that you rightfully used should recognize
the smsm:// stream prefix automatically
- I would send to the output stream a full multiplex
of audio+video or video alone, thus there would not
be any need to force output  demuxer_type, width, height
- once done this the only thing you need to do is to  implementing
a stream reader and writer leaving alone all the rest

In summary you would use something like:

mencoder tv:// -tv device=/dev/video0 -ovc raw smem://1000 [options]
mencoder tv:// -tv device=/dev/video1 -ovc raw smem://1001 [options]
mplayer smem://1000,1001,1002,1003 -vf tile=2:2


It seems that you have finally learned to indent your code :)

> }
>Index: mencoder.c
>===================================================================
>--- mencoder.c	(revision 24014)
>+++ mencoder.c	(working copy)
>@@ -111,7 +111,14 @@
> char* audio_lang=NULL;
> char* dvdsub_lang=NULL;
> static char* spudec_ifo=NULL;
>+#ifdef HAVE_SHAREDMEM
>+#include "stream/stream_sharedmem.h"
> 
>+stream_t* out_raw_stream=NULL;
>+int out_raw_stream_opened = 0;
>+char* out_raw_stream_name = NULL;
>+#endif
>+
> static char** audio_codec_list=NULL;  // override audio codec
> static char** video_codec_list=NULL;  // override video codec
> static char** audio_fm_list=NULL;     // override audio codec family 
>@@ -305,6 +312,10 @@
>     else
> 	mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_Exiting);
> 
>+#ifdef HAVE_SHAREDMEM
>+    if (out_raw_stream) free_stream(out_raw_stream);
>+    out_raw_stream_name=NULL;
>+#endif	
>     exit(level);
> }
> 
>@@ -1350,6 +1361,20 @@
>     }
> }
> 
>+#ifdef HAVE_SHAREDMEM
>+if (out_raw_stream_name && !out_raw_stream_opened) {
>+    out_raw_stream_opened=1;
>+    set_smem_opts(0, frame_data.in_size, file_format,
>+            sh_video->format, sh_video->disp_w, sh_video->disp_h);
>+    out_raw_stream = open_output_stream(out_raw_stream_name, NULL);
>+    if (!out_raw_stream) {
>+        mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_CannotOpenOutputFile, out_raw_stream_name);
>+    }
>+}
>+if (out_raw_stream)
>+    stream_write_buffer(out_raw_stream, frame_data.start, frame_data.in_size);
>+#endif
>+
> videosamples++;
> videorate+=(GetTimerMS() - ptimer_start);
> 
>  
>
>------------------------------------------------------------------------
>

unneeded: only the stream module needs to care of multiple shared segments




More information about the MPlayer-dev-eng mailing list