Finally getting some fingers moving. I am pushing code at here. Worked out an initial class structure for getting the things working. I am trying to put in little bit of documentation in the function itself.
Currently there are three main classes: Server, UI and Controller.
The Server
The Server is the interaction module with gst-switch-srv. It is capable of controlling the server. The Server class has a contructor where the user can specify the video port, audio port, control port and the output record file. The server can be started off forking a new process and can safely be killed. Connection to the controller can be made by invoking the Controller class. If a connection does not exist a new connection should be made to the Controller. Now that the server is running, there should be some input to the server! These are the videotestsrc elements of gstreamer. I have added options where the user can select what pattern, height, width etc can be specified. The width of the input stream should be 300 and height should be 200 always, else it might result in some strange unclear patterns coming up. If no pattern is specified a random one gets selected. The Server and the test sources can be easily killed off by invoking like this. I was earlier facing a problem where the subprocess.Popen() command was making two processes. Now, while killing only one gets killed, whereas the other one was still remaining. I was using an option shell=True as an argument to the Popen command. Changing this option to shell=False allowed me to control the server class more easily as in this case only one process gets created! Currently the video sources are being fed by creating new processes. I will modify these using the Gstreamer 1.0 Python Bindings defined under gi.repository.Gst
The UI
Now the server is running and the input sources have been specified, we need to view the output that is getting generated. For this the gst-switch-ui can be invoked. Simply the UI is run using: The UI process is ended simply using ui.end() method. Once the controller is ready, the compose port can be used to view the output of the gst-switch server directly eliminating the need of the UI.
Comments Section
Feel free to comment on the post but keep it clean and on topic.
blog comments powered by Disqus