diff --git a/validate/docs/validate/gst-validate-launcher.xml b/validate/docs/validate/gst-validate-launcher.xml
index b2818ffb87..37f5058bfb 100644
--- a/validate/docs/validate/gst-validate-launcher.xml
+++ b/validate/docs/validate/gst-validate-launcher.xml
@@ -96,6 +96,11 @@ testsuite_folder/
gst-validate-launcher --medias-paths /path/to/sample_files/ --generate-media-info
+
+ gst-validate-launcher allows specifying that a local media file should also be tested in push mode.
+ To do so you will need to generate (or symlink) a media info file with the extension .media_info.push.
+ In that case a "pushfile" source will be used instead of the usual "filesource".
+
For remote streams, you should use gst-validate-media-check-&GST_API_VERSION;. For an http stream you can for example do:
diff --git a/validate/launcher/apps/gstvalidate.py b/validate/launcher/apps/gstvalidate.py
index ffeb5e4ad2..50e98778c5 100644
--- a/validate/launcher/apps/gstvalidate.py
+++ b/validate/launcher/apps/gstvalidate.py
@@ -833,48 +833,56 @@ not been tested and explicitely activated if you set use --wanted-tests ALL""")
self.debug("Exception: %s for %s", e, media_info)
def _discover_file(self, uri, fpath):
- try:
- media_info = "%s.%s" % (
- fpath, GstValidateMediaDescriptor.MEDIA_INFO_EXT)
- args = GstValidateBaseTestManager.MEDIA_CHECK_COMMAND.split(" ")
- args.append(uri)
- if os.path.isfile(media_info) and not self.options.update_media_info:
- self._add_media(media_info, uri)
- return True
- elif fpath.endswith(GstValidateMediaDescriptor.STREAM_INFO_EXT):
- self._add_media(fpath)
- return True
- elif not self.options.generate_info and not self.options.update_media_info and not self.options.validate_uris:
- self.info(
- "%s not present. Use --generate-media-info", media_info)
- return True
- elif self.options.update_media_info and not os.path.isfile(media_info):
- self.info(
- "%s not present. Use --generate-media-info", media_info)
- return True
+ for ext in (GstValidateMediaDescriptor.MEDIA_INFO_EXT,
+ GstValidateMediaDescriptor.PUSH_MEDIA_INFO_EXT):
+ try:
+ is_push = False
+ media_info = "%s.%s" % (fpath, ext)
+ if ext == GstValidateMediaDescriptor.PUSH_MEDIA_INFO_EXT:
+ if not os.path.exists(media_info):
+ continue
+ is_push = True
+ uri = "push" + uri
+ args = GstValidateBaseTestManager.MEDIA_CHECK_COMMAND.split(" ")
- include_frames = 0
- if self.options.update_media_info:
- include_frames = 2
- elif self.options.generate_info_full:
- include_frames = 1
+ args.append(uri)
+ if os.path.isfile(media_info) and not self.options.update_media_info:
+ self._add_media(media_info, uri)
+ continue
+ elif fpath.endswith(GstValidateMediaDescriptor.STREAM_INFO_EXT):
+ self._add_media(fpath)
+ continue
+ elif not self.options.generate_info and not self.options.update_media_info and not self.options.validate_uris:
+ continue
+ elif self.options.update_media_info and not os.path.isfile(media_info):
+ self.info(
+ "%s not present. Use --generate-media-info", media_info)
+ continue
+ elif os.path.islink(media_info):
+ self.info(
+ "%s is a symlink, not updating and hopefully the actual file gets updated!", media_info)
+ continue
- media_descriptor = GstValidateMediaDescriptor.new_from_uri(
- uri, True,
- include_frames)
- if media_descriptor:
- self._add_media(media_descriptor, uri)
- else:
- self.warning("Could not get any descriptor for %s" % uri)
+ include_frames = 0
+ if self.options.update_media_info:
+ include_frames = 2
+ elif self.options.generate_info_full:
+ include_frames = 1
- return True
+ media_descriptor = GstValidateMediaDescriptor.new_from_uri(
+ uri, True, include_frames, is_push)
+ if media_descriptor:
+ self._add_media(media_descriptor, uri)
+ else:
+ self.warning("Could not get any descriptor for %s" % uri)
- except subprocess.CalledProcessError as e:
- if self.options.generate_info:
- printc("Result: Failed", Colors.FAIL)
- else:
- self.error("Exception: %s", e)
- return False
+ except subprocess.CalledProcessError as e:
+ if self.options.generate_info:
+ printc("Result: Failed", Colors.FAIL)
+ else:
+ self.error("Exception: %s", e)
+ return False
+ return True
def _list_uris(self):
if self._uris:
diff --git a/validate/launcher/baseclasses.py b/validate/launcher/baseclasses.py
index c7f7c17dca..eb6b25a387 100644
--- a/validate/launcher/baseclasses.py
+++ b/validate/launcher/baseclasses.py
@@ -2065,6 +2065,9 @@ class MediaDescriptor(Loggable):
def get_path(self):
raise NotImplemented
+ def has_frames(self):
+ return False
+
def get_media_filepath(self):
raise NotImplemented
@@ -2153,6 +2156,7 @@ class MediaDescriptor(Loggable):
class GstValidateMediaDescriptor(MediaDescriptor):
# Some extension file for discovering results
MEDIA_INFO_EXT = "media_info"
+ PUSH_MEDIA_INFO_EXT = "media_info.push"
STREAM_INFO_EXT = "stream_info"
def __init__(self, xml_path):
@@ -2174,6 +2178,9 @@ class GstValidateMediaDescriptor(MediaDescriptor):
def skip_parsers(self):
return self._skip_parsers
+ def has_frames(self):
+ return self._has_frames
+
def _extract_data(self, media_xml):
# Extract the information we need from the xml
self._caps = media_xml.findall("streams")[0].attrib["caps"]
@@ -2188,6 +2195,7 @@ class GstValidateMediaDescriptor(MediaDescriptor):
(stream.attrib["type"], stream.attrib["caps"]))
self._uri = media_xml.attrib["uri"]
self._skip_parsers = bool(int(media_xml.attrib.get('skip-parsers', 0)))
+ self._has_frames = bool(int(media_xml.attrib["frame-detection"]))
self._duration = int(media_xml.attrib["duration"])
self._protocol = media_xml.get("protocol", None)
self._is_seekable = media_xml.attrib["seekable"].lower() == "true"
@@ -2201,7 +2209,7 @@ class GstValidateMediaDescriptor(MediaDescriptor):
self._track_types.append(stream.attrib["type"])
@staticmethod
- def new_from_uri(uri, verbose=False, include_frames=False):
+ def new_from_uri(uri, verbose=False, include_frames=False, is_push=False):
"""
include_frames = 0 # Never
include_frames = 1 # always
@@ -2210,8 +2218,9 @@ class GstValidateMediaDescriptor(MediaDescriptor):
"""
media_path = utils.url2path(uri)
- descriptor_path = "%s.%s" % (
- media_path, GstValidateMediaDescriptor.MEDIA_INFO_EXT)
+ ext = GstValidateMediaDescriptor.PUSH_MEDIA_INFO_EXT if is_push else \
+ GstValidateMediaDescriptor.MEDIA_INFO_EXT
+ descriptor_path = "%s.%s" % (media_path, ext)
args = GstValidateBaseTestManager.MEDIA_CHECK_COMMAND.split(" ")
args.append(uri)
if include_frames == 2:
@@ -2262,6 +2271,8 @@ class GstValidateMediaDescriptor(MediaDescriptor):
def get_media_filepath(self):
if self.get_protocol() == Protocols.FILE:
return self._xml_path.replace("." + self.MEDIA_INFO_EXT, "")
+ elif self.get_protocol() == Protocols.PUSHFILE:
+ return self._xml_path.replace("." + self.PUSH_MEDIA_INFO_EXT, "")
else:
return self._xml_path.replace("." + self.STREAM_INFO_EXT, "")
@@ -2278,7 +2289,10 @@ class GstValidateMediaDescriptor(MediaDescriptor):
return self._duration
def set_protocol(self, protocol):
- self._protocol = protocol
+ if self._xml_path.endswith(GstValidateMediaDescriptor.PUSH_MEDIA_INFO_EXT):
+ self._protocol = Protocols.PUSHFILE
+ else:
+ self._protocol = protocol
def get_protocol(self):
return self._protocol
diff --git a/validate/launcher/utils.py b/validate/launcher/utils.py
index 45420cf2b3..a1dc684ab3 100644
--- a/validate/launcher/utils.py
+++ b/validate/launcher/utils.py
@@ -63,6 +63,7 @@ class Result(object):
class Protocols(object):
HTTP = "http"
FILE = "file"
+ PUSHFILE = "pushfile"
HLS = "hls"
DASH = "dash"
RTSP = "rtsp"