def testAudioOnlyStream(self): save = AssistantSaver() porter = self._createPorter() save.addPorter(porter, 'audio-video') save.setFlowName('flow') audioProducer = TestAudioProducer() audioProducer.worker = 'worker' save.setAudioProducer(audioProducer) audioEncoder = VorbisAudioEncoder() audioEncoder.worker = 'worker' save.setAudioEncoder(audioEncoder) videoProducer = self._createVideoEncoder() self.assertRaises(ValueError, save.setVideoOverlay, self._createVideoOverlay(videoProducer)) save.setMuxer('ogg-muxer', 'muxer') streamer = self._createHTTPStreamer() streamer.setPorter(porter) save.addConsumer(streamer, 'audio') configuration = save.getXML() testsuite.diffStrings( ('<planet>\n' ' <atmosphere>\n' ' <component name="porter-audio-video"\n' ' type="porter"\n' ' project="flumotion"\n' ' worker="porter-worker"\n' ' version="%(version)s">\n' ' \n' ' <property name="password">password</property>\n' ' <property name="port">8080</property>\n' ' <property name="socket-path">flu-XXXX.socket</property>\n' ' <property name="username">username</property>\n' ' </component>\n' ' </atmosphere>\n' ' <flow name="flow">\n' ' <component name="producer-audio"\n' ' type="audiotest-producer"\n' ' project="flumotion"\n' ' worker="worker"\n' ' version="%(version)s">\n' ' \n' ' <property name="samplerate">44100</property>\n' ' </component>\n' ' <component name="encoder-audio"\n' ' type="vorbis-encoder"\n' ' project="flumotion"\n' ' worker="worker"\n' ' version="%(version)s">\n' ' <eater name="default">\n' ' <feed>producer-audio</feed>\n' ' </eater>\n' ' \n' ' <property name="bitrate">64000</property>\n' ' </component>\n' ' <component name="muxer-audio"\n' ' type="ogg-muxer"\n' ' project="flumotion"\n' ' worker="muxer"\n' ' version="%(version)s">\n' ' <eater name="default">\n' ' <feed>encoder-audio</feed>\n' ' </eater>\n' ' </component>\n' ' <component name="http-audio"\n' ' type="http-streamer"\n' ' project="flumotion"\n' ' worker="streamer-worker"\n' ' version="%(version)s">\n' ' <eater name="default">\n' ' <feed>muxer-audio</feed>\n' ' </eater>\n' ' \n' ' <property name="burst-on-connect">False</property>\n' ' <property name="port">8080</property>\n' ' <property name="porter-password">password</property>\n' ' <property name="porter-socket-path">flu-XXXX.socket' '</property>\n' ' <property name="porter-username">username</property>\n' ' <property name="type">slave</property>\n' ' </component>\n' ' </flow>\n' '</planet>\n' % dict(version=configure.version)), configuration)
def testAudioOnlyStream(self): save = AssistantSaver() porter = self._createPorter() save.addPorter(porter, 'audio-video') save.setFlowName('flow') audioProducer = TestAudioProducer() audioProducer.worker = 'worker' save.setAudioProducer(audioProducer) audioEncoder = VorbisAudioEncoder() audioEncoder.worker = 'worker' save.setAudioEncoder(audioEncoder) videoProducer = self._createVideoEncoder() self.assertRaises(ValueError, save.setVideoOverlay, self._createVideoOverlay(videoProducer)) save.setMuxer('ogg-muxer', 'muxer') streamer = self._createHTTPStreamer() streamer.setPorter(porter) save.addConsumer(streamer, 'audio') configuration = save.getXML() testsuite.diffStrings( XMLWriter.encoding + \ ('<planet>\n' ' <atmosphere>\n' ' <component name="porter-audio-video"\n' ' type="porter"\n' ' project="flumotion"\n' ' worker="porter-worker"\n' ' version="%(version)s">\n' ' \n' ' <property name="password">password</property>\n' ' <property name="port">8080</property>\n' ' <property name="socket-path">flu-XXXX.socket</property>\n' ' <property name="username">username</property>\n' ' </component>\n' ' </atmosphere>\n' ' <flow name="flow">\n' ' <component name="producer-audio"\n' ' type="audiotest-producer"\n' ' project="flumotion"\n' ' worker="worker"\n' ' version="%(version)s">\n' ' \n' ' <property name="samplerate">44100</property>\n' ' </component>\n' ' <component name="encoder-audio"\n' ' type="vorbis-encoder"\n' ' project="flumotion"\n' ' worker="worker"\n' ' version="%(version)s">\n' ' <eater name="default">\n' ' <feed>producer-audio</feed>\n' ' </eater>\n' ' \n' ' <property name="bitrate">64000</property>\n' ' </component>\n' ' <component name="muxer-audio"\n' ' type="ogg-muxer"\n' ' project="flumotion"\n' ' worker="muxer"\n' ' version="%(version)s">\n' ' <eater name="default">\n' ' <feed>encoder-audio</feed>\n' ' </eater>\n' ' </component>\n' ' <component name="http-audio"\n' ' type="http-streamer"\n' ' project="flumotion"\n' ' worker="streamer-worker"\n' ' version="%(version)s">\n' ' <eater name="default">\n' ' <feed>muxer-audio</feed>\n' ' </eater>\n' ' \n' ' <property name="burst-on-connect">False</property>\n' ' <property name="port">8080</property>\n' ' <property name="porter-password">password</property>\n' ' <property name="porter-socket-path">flu-XXXX.socket' '</property>\n' ' <property name="porter-username">username</property>\n' ' <property name="type">slave</property>\n' ' </component>\n' ' </flow>\n' '</planet>\n' % dict(version=configure.version)), configuration)
def testOggStream(self): save = AssistantSaver() save.setFlowName('flow') audioProducer = TestAudioProducer() audioProducer.worker = 'worker' save.setAudioProducer(audioProducer) videoProducer = TestVideoProducer() videoProducer.worker = 'worker' videoProducer.properties.width = 320 videoProducer.properties.height = 240 save.setVideoProducer(videoProducer) save.setVideoOverlay(self._createVideoOverlay(videoProducer)) audioEncoder = VorbisAudioEncoder() audioEncoder.worker = 'worker' save.setAudioEncoder(audioEncoder) videoEncoder = TheoraVideoEncoder() videoEncoder.worker = 'worker' save.setVideoEncoder(videoEncoder) save.setMuxer('ogg-muxer', 'muxer-worker') porter = self._createPorter() save.addPorter(porter, 'audio-video') streamer = self._createHTTPStreamer() streamer.setPorter(porter) save.addConsumer(streamer, 'audio-video') configuration = save.getXML() testsuite.diffStrings( ('<planet>\n' ' <atmosphere>\n' ' <component name="porter-audio-video"\n' ' type="porter"\n' ' project="flumotion"\n' ' worker="porter-worker"\n' ' version="%(version)s">\n' ' \n' ' <property name="password">password</property>\n' ' <property name="port">8080</property>\n' ' <property name="socket-path">flu-XXXX.socket</property>\n' ' <property name="username">username</property>\n' ' </component>\n' ' </atmosphere>\n' ' <flow name="flow">\n' ' <component name="producer-audio"\n' ' type="audiotest-producer"\n' ' project="flumotion"\n' ' worker="worker"\n' ' version="%(version)s">\n' ' \n' ' <property name="samplerate">44100</property>\n' ' </component>\n' ' <component name="producer-video"\n' ' type="videotest-producer"\n' ' project="flumotion"\n' ' worker="worker"\n' ' version="%(version)s">\n' ' \n' ' <property name="height">240</property>\n' ' <property name="pattern">0</property>\n' ' <property name="width">320</property>\n' ' </component>\n' ' <component name="overlay-video"\n' ' type="overlay-converter"\n' ' project="flumotion"\n' ' worker="overlay-worker"\n' ' version="%(version)s">\n' ' <eater name="default">\n' ' <feed>producer-video</feed>\n' ' </eater>\n' ' \n' ' <property name="fluendo-logo">True</property>\n' ' <property name="height">240</property>\n' ' <property name="show-text">True</property>\n' ' <property name="text">Flumotion</property>\n' ' <property name="width">320</property>\n' ' <property name="xiph-logo">True</property>\n' ' </component>\n' ' <component name="encoder-video"\n' ' type="theora-encoder"\n' ' project="flumotion"\n' ' worker="worker"\n' ' version="%(version)s">\n' ' <eater name="default">\n' ' <feed>overlay-video</feed>\n' ' </eater>\n' ' \n' ' <property name="bitrate">400000</property>\n' ' <property name="keyframe-maxdistance">50</property>\n' ' <property name="noise-sensitivity">1</property>\n' ' <property name="sharpness">0</property>\n' ' </component>\n' ' <component name="encoder-audio"\n' ' type="vorbis-encoder"\n' ' project="flumotion"\n' ' worker="worker"\n' ' version="%(version)s">\n' ' <eater name="default">\n' ' <feed>producer-audio</feed>\n' ' </eater>\n' ' \n' ' <property name="bitrate">64000</property>\n' ' </component>\n' ' <component name="muxer-audio-video"\n' ' type="ogg-muxer"\n' ' project="flumotion"\n' ' worker="muxer-worker"\n' ' version="%(version)s">\n' ' <eater name="default">\n' ' <feed>encoder-audio</feed>\n' ' <feed>encoder-video</feed>\n' ' </eater>\n' ' </component>\n' ' <component name="http-audio-video"\n' ' type="http-streamer"\n' ' project="flumotion"\n' ' worker="streamer-worker"\n' ' version="%(version)s">\n' ' <eater name="default">\n' ' <feed>muxer-audio-video</feed>\n' ' </eater>\n' ' \n' ' <property name="burst-on-connect">False</property>\n' ' <property name="port">8080</property>\n' ' <property name="porter-password">password</property>\n' ' <property name="porter-socket-path">flu-XXXX.socket' '</property>\n' ' <property name="porter-username">username</property>\n' ' <property name="type">slave</property>\n' ' </component>\n' ' </flow>\n' '</planet>\n' % dict(version=configure.version)), configuration)
def testOggStream(self): save = AssistantSaver() save.setFlowName('flow') audioProducer = TestAudioProducer() audioProducer.worker = 'worker' save.setAudioProducer(audioProducer) videoProducer = TestVideoProducer() videoProducer.worker = 'worker' videoProducer.properties.width = 320 videoProducer.properties.height = 240 save.setVideoProducer(videoProducer) save.setVideoOverlay(self._createVideoOverlay(videoProducer)) audioEncoder = VorbisAudioEncoder() audioEncoder.worker = 'worker' save.setAudioEncoder(audioEncoder) videoEncoder = TheoraVideoEncoder() videoEncoder.worker = 'worker' save.setVideoEncoder(videoEncoder) save.setMuxer('ogg-muxer', 'muxer-worker') porter = self._createPorter() save.addPorter(porter, 'audio-video') streamer = self._createHTTPStreamer() streamer.setPorter(porter) save.addConsumer(streamer, 'audio-video') configuration = save.getXML() testsuite.diffStrings( XMLWriter.encoding + \ ('<planet>\n' ' <atmosphere>\n' ' <component name="porter-audio-video"\n' ' type="porter"\n' ' project="flumotion"\n' ' worker="porter-worker"\n' ' version="%(version)s">\n' ' \n' ' <property name="password">password</property>\n' ' <property name="port">8080</property>\n' ' <property name="socket-path">flu-XXXX.socket</property>\n' ' <property name="username">username</property>\n' ' </component>\n' ' </atmosphere>\n' ' <flow name="flow">\n' ' <component name="producer-audio"\n' ' type="audiotest-producer"\n' ' project="flumotion"\n' ' worker="worker"\n' ' version="%(version)s">\n' ' \n' ' <property name="samplerate">44100</property>\n' ' </component>\n' ' <component name="producer-video"\n' ' type="videotest-producer"\n' ' project="flumotion"\n' ' worker="worker"\n' ' version="%(version)s">\n' ' \n' ' <property name="height">240</property>\n' ' <property name="pattern">0</property>\n' ' <property name="width">320</property>\n' ' </component>\n' ' <component name="overlay-video"\n' ' type="overlay-converter"\n' ' project="flumotion"\n' ' worker="overlay-worker"\n' ' version="%(version)s">\n' ' <eater name="default">\n' ' <feed>producer-video</feed>\n' ' </eater>\n' ' \n' ' <property name="fluendo-logo">True</property>\n' ' <property name="show-text">True</property>\n' ' <property name="text">Flumotion</property>\n' ' <property name="xiph-logo">True</property>\n' ' </component>\n' ' <component name="encoder-video"\n' ' type="theora-encoder"\n' ' project="flumotion"\n' ' worker="worker"\n' ' version="%(version)s">\n' ' <eater name="default">\n' ' <feed>overlay-video</feed>\n' ' </eater>\n' ' \n' ' <property name="bitrate">400000</property>\n' ' <property name="keyframe-maxdistance">50</property>\n' ' <property name="speed">3</property>\n' ' </component>\n' ' <component name="encoder-audio"\n' ' type="vorbis-encoder"\n' ' project="flumotion"\n' ' worker="worker"\n' ' version="%(version)s">\n' ' <eater name="default">\n' ' <feed>producer-audio</feed>\n' ' </eater>\n' ' \n' ' <property name="bitrate">64000</property>\n' ' </component>\n' ' <component name="muxer-audio-video"\n' ' type="ogg-muxer"\n' ' project="flumotion"\n' ' worker="muxer-worker"\n' ' version="%(version)s">\n' ' <eater name="default">\n' ' <feed>encoder-audio</feed>\n' ' <feed>encoder-video</feed>\n' ' </eater>\n' ' </component>\n' ' <component name="http-audio-video"\n' ' type="http-streamer"\n' ' project="flumotion"\n' ' worker="streamer-worker"\n' ' version="%(version)s">\n' ' <eater name="default">\n' ' <feed>muxer-audio-video</feed>\n' ' </eater>\n' ' \n' ' <property name="burst-on-connect">False</property>\n' ' <property name="port">8080</property>\n' ' <property name="porter-password">password</property>\n' ' <property name="porter-socket-path">flu-XXXX.socket' '</property>\n' ' <property name="porter-username">username</property>\n' ' <property name="type">slave</property>\n' ' </component>\n' ' </flow>\n' '</planet>\n' % dict(version=configure.version)), configuration)