def __init__(self, *args, **kwargs):
super(GStreamerAction, self).__init__(*args, **kwargs)
self.settings = self.combine_settings(self.settings, self.client.minion.get('settings'), self.action.get('settings'))
self.fade_length = self.settings.get('media_fade')
self.input_pipeline = self.settings.get('camera_pipeline')
try:
self.resolution = (
int(self.settings.get('camera_width')),
int(self.settings.get('camera_height'))
)
except ValueError:
self.resolution = Window.size
self.texture = Texture.create(size = self.resolution, colorfmt = 'rgb')
self.texture.flip_vertical()
self.image = Image(texture = self.texture)
if self.settings.get('media_preserve_aspect') == 'no':
self.image.keep_ratio = False
self.image.opacity = 0
caps = 'video/x-raw,format=RGB,width={},height={}'.format(*self.resolution)
pl = '{} ! videoconvert ! videoscale ! appsink name=appsink emit-signals=True caps={}'
self.pipeline = Gst.parse_launch(pl.format(self.input_pipeline, caps))
self.appsink = self.pipeline.get_by_name('appsink')
self.appsink.connect('new-sample', self.new_sample)
self.pipeline.set_state(Gst.State.READY)
评论列表
文章目录