mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
validate:launcher: Add support for the imagesequence protocol
This commit is contained in:
parent
e4ea35d25c
commit
080fdf8e2f
4 changed files with 35 additions and 16 deletions
|
@ -305,6 +305,7 @@ stream_id_is_equal (const gchar * uri, const gchar * rid, const gchar * cid)
|
||||||
|
|
||||||
/* If it's not from file or from our local http server, it should have been the same */
|
/* If it's not from file or from our local http server, it should have been the same */
|
||||||
if (!g_str_has_prefix (uri, "file://")
|
if (!g_str_has_prefix (uri, "file://")
|
||||||
|
&& !g_str_has_prefix (uri, "imagesequence:/")
|
||||||
&& !g_str_has_prefix (uri, "http://127.0.0.1"))
|
&& !g_str_has_prefix (uri, "http://127.0.0.1"))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
|
@ -937,7 +937,7 @@ not been tested and explicitely activated if you set use --wanted-tests ALL""")
|
||||||
try:
|
try:
|
||||||
# Just testing that the vairous mandatory infos are present
|
# Just testing that the vairous mandatory infos are present
|
||||||
caps = media_descriptor.get_caps()
|
caps = media_descriptor.get_caps()
|
||||||
if uri is None:
|
if uri is None or media_descriptor.get_protocol() == Protocols.IMAGESEQUENCE:
|
||||||
uri = media_descriptor.get_uri()
|
uri = media_descriptor.get_uri()
|
||||||
|
|
||||||
# Adjust local http uri
|
# Adjust local http uri
|
||||||
|
@ -1052,10 +1052,11 @@ not been tested and explicitely activated if you set use --wanted-tests ALL""")
|
||||||
uri = test.media_descriptor.get_uri()
|
uri = test.media_descriptor.get_uri()
|
||||||
uri_requires_http_server = False
|
uri_requires_http_server = False
|
||||||
if uri:
|
if uri:
|
||||||
expanded_uri = uri % {
|
if 'http-server-port' in uri:
|
||||||
'http-server-port': self.options.http_server_port}
|
expanded_uri = uri % {
|
||||||
uri_requires_http_server = expanded_uri.find(
|
'http-server-port': self.options.http_server_port}
|
||||||
"127.0.0.1:%s" % self.options.http_server_port) != -1
|
uri_requires_http_server = expanded_uri.find(
|
||||||
|
"127.0.0.1:%s" % self.options.http_server_port) != -1
|
||||||
if protocol in [Protocols.HTTP, Protocols.HLS, Protocols.DASH] or uri_requires_http_server:
|
if protocol in [Protocols.HTTP, Protocols.HLS, Protocols.DASH] or uri_requires_http_server:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -2492,6 +2492,7 @@ class GstValidateMediaDescriptor(MediaDescriptor):
|
||||||
def __init__(self, xml_path):
|
def __init__(self, xml_path):
|
||||||
super(GstValidateMediaDescriptor, self).__init__()
|
super(GstValidateMediaDescriptor, self).__init__()
|
||||||
|
|
||||||
|
self._media_file_path = None
|
||||||
main_descriptor = self.__all_descriptors.get(xml_path)
|
main_descriptor = self.__all_descriptors.get(xml_path)
|
||||||
if main_descriptor:
|
if main_descriptor:
|
||||||
self._copy_data_from_main(main_descriptor)
|
self._copy_data_from_main(main_descriptor)
|
||||||
|
@ -2507,8 +2508,7 @@ class GstValidateMediaDescriptor(MediaDescriptor):
|
||||||
raise
|
raise
|
||||||
self._extract_data(media_xml)
|
self._extract_data(media_xml)
|
||||||
|
|
||||||
self.set_protocol(urllib.parse.urlparse(
|
self.set_protocol(urllib.parse.urlparse(self.get_uri()).scheme)
|
||||||
urllib.parse.urlparse(self.get_uri()).scheme).scheme)
|
|
||||||
|
|
||||||
def skip_parsers(self):
|
def skip_parsers(self):
|
||||||
return self._skip_parsers
|
return self._skip_parsers
|
||||||
|
@ -2536,7 +2536,15 @@ class GstValidateMediaDescriptor(MediaDescriptor):
|
||||||
self._skip_parsers = bool(int(media_xml.attrib.get('skip-parsers', 0)))
|
self._skip_parsers = bool(int(media_xml.attrib.get('skip-parsers', 0)))
|
||||||
self._has_frames = bool(int(media_xml.attrib["frame-detection"]))
|
self._has_frames = bool(int(media_xml.attrib["frame-detection"]))
|
||||||
self._duration = int(media_xml.attrib["duration"])
|
self._duration = int(media_xml.attrib["duration"])
|
||||||
self._protocol = media_xml.get("protocol", None)
|
self._uri = media_xml.attrib["uri"]
|
||||||
|
parsed_uri = urllib.parse.urlparse(self.get_uri())
|
||||||
|
self._protocol = media_xml.get("protocol", parsed_uri.scheme)
|
||||||
|
if parsed_uri.scheme == "file":
|
||||||
|
if not os.path.exists(parsed_uri.path) and os.path.exists(self.get_media_filepath()):
|
||||||
|
self._uri = "file://" + self.get_media_filepath()
|
||||||
|
elif parsed_uri.scheme == Protocols.IMAGESEQUENCE:
|
||||||
|
self._media_file_path = os.path.join(os.path.dirname(self.__cleanup_media_info_ext()), os.path.basename(parsed_uri.path))
|
||||||
|
self._uri = parsed_uri._replace(path=os.path.join(os.path.dirname(self.__cleanup_media_info_ext()), os.path.basename(self._media_file_path))).geturl()
|
||||||
self._is_seekable = media_xml.attrib["seekable"].lower() == "true"
|
self._is_seekable = media_xml.attrib["seekable"].lower() == "true"
|
||||||
self._is_live = media_xml.get("live", "false").lower() == "true"
|
self._is_live = media_xml.get("live", "false").lower() == "true"
|
||||||
self._is_image = False
|
self._is_image = False
|
||||||
|
@ -2547,6 +2555,14 @@ class GstValidateMediaDescriptor(MediaDescriptor):
|
||||||
for stream in media_xml.findall("streams")[0].findall("stream"):
|
for stream in media_xml.findall("streams")[0].findall("stream"):
|
||||||
self._track_types.append(stream.attrib["type"])
|
self._track_types.append(stream.attrib["type"])
|
||||||
|
|
||||||
|
def __cleanup_media_info_ext(self):
|
||||||
|
for ext in [self.MEDIA_INFO_EXT, self.PUSH_MEDIA_INFO_EXT, self.STREAM_INFO_EXT,
|
||||||
|
]:
|
||||||
|
if self._xml_path.endswith(ext):
|
||||||
|
return self._xml_path[:len(self._xml_path) - (len(ext) + 1)]
|
||||||
|
|
||||||
|
assert "Not reached" is None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def new_from_uri(uri, verbose=False, include_frames=False, is_push=False):
|
def new_from_uri(uri, verbose=False, include_frames=False, is_push=False):
|
||||||
"""
|
"""
|
||||||
|
@ -2561,11 +2577,13 @@ class GstValidateMediaDescriptor(MediaDescriptor):
|
||||||
GstValidateMediaDescriptor.MEDIA_INFO_EXT
|
GstValidateMediaDescriptor.MEDIA_INFO_EXT
|
||||||
descriptor_path = "%s.%s" % (media_path, ext)
|
descriptor_path = "%s.%s" % (media_path, ext)
|
||||||
args = GstValidateBaseTestManager.MEDIA_CHECK_COMMAND.split(" ")
|
args = GstValidateBaseTestManager.MEDIA_CHECK_COMMAND.split(" ")
|
||||||
args.append(uri)
|
|
||||||
if include_frames == 2:
|
if include_frames == 2:
|
||||||
try:
|
try:
|
||||||
media_xml = ET.parse(descriptor_path).getroot()
|
media_xml = ET.parse(descriptor_path).getroot()
|
||||||
|
prev_uri = urllib.parse.urlparse(media_xml.attrib['uri'])
|
||||||
|
if prev_uri.scheme == Protocols.IMAGESEQUENCE:
|
||||||
|
parsed_uri = urllib.parse.urlparse(uri)
|
||||||
|
uri = prev_uri._replace(path=os.path.join(os.path.dirname(parsed_uri.path), os.path.basename(prev_uri.path))).geturl()
|
||||||
include_frames = bool(int(media_xml.attrib["frame-detection"]))
|
include_frames = bool(int(media_xml.attrib["frame-detection"]))
|
||||||
if bool(int(media_xml.attrib.get("skip-parsers", 0))):
|
if bool(int(media_xml.attrib.get("skip-parsers", 0))):
|
||||||
args.append("--skip-parsers")
|
args.append("--skip-parsers")
|
||||||
|
@ -2573,6 +2591,7 @@ class GstValidateMediaDescriptor(MediaDescriptor):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
include_frames = bool(include_frames)
|
include_frames = bool(include_frames)
|
||||||
|
args.append(uri)
|
||||||
|
|
||||||
args.extend(["--output-file", descriptor_path])
|
args.extend(["--output-file", descriptor_path])
|
||||||
if include_frames:
|
if include_frames:
|
||||||
|
@ -2608,12 +2627,9 @@ class GstValidateMediaDescriptor(MediaDescriptor):
|
||||||
return Protocols.needs_clock_sync(self.get_protocol())
|
return Protocols.needs_clock_sync(self.get_protocol())
|
||||||
|
|
||||||
def get_media_filepath(self):
|
def get_media_filepath(self):
|
||||||
if self.get_protocol() == Protocols.FILE:
|
if self._media_file_path is None:
|
||||||
return self._xml_path.replace("." + self.MEDIA_INFO_EXT, "")
|
self._media_file_path = self.__cleanup_media_info_ext()
|
||||||
elif self.get_protocol() == Protocols.PUSHFILE:
|
return self._media_file_path
|
||||||
return self._xml_path.replace("." + self.PUSH_MEDIA_INFO_EXT, "")
|
|
||||||
else:
|
|
||||||
return self._xml_path.replace("." + self.STREAM_INFO_EXT, "")
|
|
||||||
|
|
||||||
def get_caps(self):
|
def get_caps(self):
|
||||||
return self._caps
|
return self._caps
|
||||||
|
|
|
@ -79,6 +79,7 @@ class Protocols(object):
|
||||||
HLS = "hls"
|
HLS = "hls"
|
||||||
DASH = "dash"
|
DASH = "dash"
|
||||||
RTSP = "rtsp"
|
RTSP = "rtsp"
|
||||||
|
IMAGESEQUENCE = "imagesequence"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def needs_clock_sync(protocol):
|
def needs_clock_sync(protocol):
|
||||||
|
|
Loading…
Reference in a new issue