Beispiel #1
0
                           )
    parser.add_argument('-x', '--window_xid',
                    dest='window_xid', type=int,
                    required=True,
                    help='GTK DrawingArea window xid')
    args = parser.parse_args()

    return args


if __name__ == '__main__':
    logging.basicConfig(format='[%(levelname)s] %(message)s', level=logging.DEBUG)

    args = parse_args()

    p = WindowProcess(args.window_xid)
    try:
        p.start()
        response = p(command='select_video_caps', ack=True)['response']
        logging.info('[response] %s' % response)
        device, caps_str = response['device'], response['caps_str']

        for i in range(2):
            response = p(command='create', device=device,
                    caps_str=caps_str, bitrate=150000,
                            output_path='test_output.avi', ack=True)
            logging.info('[response] %s' % response)

            response = p(command='start', ack=True)
            logging.info('[response] %s' % response)
            time.sleep(5)
Beispiel #2
0
    parser.add_argument("--force_aspect_ratio", action="store_true")
    parser.add_argument("port", default=8080, type=int, nargs="?")
    args = parser.parse_args()

    return args


if __name__ == "__main__":
    logging.basicConfig(format="[%(levelname)s] %(message)s", loglevel=logging.INFO)

    args = parse_args()
    print args

    # Create a GStreamer window server process, with an initial `window_xid`
    # set to zero.  The `window_xid` can be set via the server proxy API to
    # specify which window buffer the GStreamer frames should be drawn to.
    service = WindowProcess(0, port=args.port, force_aspect_ratio=args.force_aspect_ratio)

    logging.info("Starting server")
    service.start()

    port = service.parent_pipe.recv()
    logging.info("Received port %s from child process", port)

    try:
        service.join()
    except KeyboardInterrupt:
        pass
    finally:
        service.terminate()