def test_video_resolution(name, width, height, interlace): res = get_resolution(name) assert res assert isinstance(res, VideoResolution) assert res.width == width, "Width mismatch" assert res.height == height, "Height mismatch" assert res.interlace is interlace, "Interlace mismatch"
def normalize_resolution(self, tokens): for stream_name, resolution in [("h264", tokens[5]), ("mjpeg", tokens[5])]: if "x" in resolution: height, width = resolution.split("x") else: resolution = get_resolution(resolution.lower()) height, width = resolution.height, resolution.width yield self.make_media_streams_video_admin_status(name=stream_name, admin_status=True) yield self.make_media_streams_video_resolution_height( name=stream_name, height=height) yield self.make_media_streams_video_resolution_width( name=stream_name, width=width) if stream_name == "mjpeg": yield self.make_media_streams_video_codec_mpeg4( name=stream_name) yield self.make_stream_rtsp_path(name=stream_name, path="/mjpg/video.mjpg") else: yield self.make_media_streams_video_codec_h264( name=stream_name) yield self.make_stream_rtsp_path( name=stream_name, path="/axis-media/media.amp?videocodec=mpeg4")
def test_unknown_resolution(): assert get_resolution("unknown") is None