mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 03:00:35 +00:00
validate:tools: Set video/webm instead of video/x-matroska as caps for webm
+ some mirore indentation cleanups
This commit is contained in:
parent
384dd33843
commit
c7aa259c78
2 changed files with 39 additions and 24 deletions
|
@ -138,8 +138,9 @@ class Test(Loggable):
|
||||||
self.command = "%s " % (self.application)
|
self.command = "%s " % (self.application)
|
||||||
self._starting_time = time.time()
|
self._starting_time = time.time()
|
||||||
self.build_arguments()
|
self.build_arguments()
|
||||||
printc("Launching:%s '%s' -- logs are in %s" % (Colors.ENDC, self.command,
|
printc("Launching: %s %s -> '%s' -- logs are in %s"
|
||||||
self.reporter.out.name), Colors.OKBLUE)
|
% (Colors.ENDC, self.classname, self.command,
|
||||||
|
self.reporter.out.name), Colors.OKBLUE)
|
||||||
try:
|
try:
|
||||||
self.process = subprocess.Popen(self.command,
|
self.process = subprocess.Popen(self.command,
|
||||||
stderr=self.reporter.out,
|
stderr=self.reporter.out,
|
||||||
|
|
|
@ -110,6 +110,7 @@ def launch_command(command, color=None):
|
||||||
printc(command, Colors.OKGREEN, True)
|
printc(command, Colors.OKGREEN, True)
|
||||||
os.system(command)
|
os.system(command)
|
||||||
|
|
||||||
|
|
||||||
def path2url(path):
|
def path2url(path):
|
||||||
return urlparse.urljoin('file:', urllib.pathname2url(path))
|
return urlparse.urljoin('file:', urllib.pathname2url(path))
|
||||||
|
|
||||||
|
@ -138,7 +139,7 @@ FORMATS = {"aac": "audio/mpeg,mpegversion=4",
|
||||||
"ogg": "application/ogg",
|
"ogg": "application/ogg",
|
||||||
"mkv": "video/x-matroska",
|
"mkv": "video/x-matroska",
|
||||||
"mp4": "video/quicktime,variant=iso;",
|
"mp4": "video/quicktime,variant=iso;",
|
||||||
"webm": "video/x-matroska"}
|
"webm": "video/webm"}
|
||||||
|
|
||||||
def get_profile_full(muxer, venc, aenc, video_restriction=None,
|
def get_profile_full(muxer, venc, aenc, video_restriction=None,
|
||||||
audio_restriction=None,
|
audio_restriction=None,
|
||||||
|
@ -177,12 +178,17 @@ def get_profile(combination):
|
||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _parse_position(p):
|
def _parse_position(p):
|
||||||
def parse_gsttimeargs(time):
|
def parse_gsttimeargs(time):
|
||||||
return int(time.split(":")[0]) * 3600 + int(time.split(":")[1]) * 60 + int(time.split(":")[2].split(".")[0]) * 60
|
return int(time.split(":")[0]) * 3600 + int(time.split(":")[1]) * 60 + int(time.split(":")[2].split(".")[0]) * 60
|
||||||
start_stop = p.replace("<Position: ", '').replace("/>", '').split(" / ")
|
start_stop = p.replace("<position: ", '').replace("/>", "").split(" duration: ")
|
||||||
|
|
||||||
|
if len(start_stop) < 2:
|
||||||
|
loggable.warning("utils", "Got a unparsable value: %s" % p)
|
||||||
|
return 0, 0
|
||||||
|
|
||||||
|
if " speed: "in start_stop[1]:
|
||||||
|
start_stop[1] = start_stop[1].split("speed: ")[0]
|
||||||
|
|
||||||
return parse_gsttimeargs(start_stop[0]), parse_gsttimeargs(start_stop[1])
|
return parse_gsttimeargs(start_stop[0]), parse_gsttimeargs(start_stop[1])
|
||||||
|
|
||||||
|
@ -192,15 +198,17 @@ def _get_position(test):
|
||||||
|
|
||||||
test.reporter.out.seek(0)
|
test.reporter.out.seek(0)
|
||||||
m = None
|
m = None
|
||||||
for l in test.reporter.out.readlines():
|
for l in reversed(test.reporter.out.readlines()):
|
||||||
if "<Position:" in l:
|
l = l.lower()
|
||||||
|
if "<position:" in l:
|
||||||
m = l
|
m = l
|
||||||
|
break
|
||||||
|
|
||||||
if m is None:
|
if m is None:
|
||||||
return position, duration
|
return position, duration
|
||||||
|
|
||||||
for j in m.split("\r"):
|
for j in m.split("\r"):
|
||||||
if j.startswith("<Position:") and j.endswith("/>"):
|
if j.startswith("<position:") and j.endswith("/>"):
|
||||||
position, duration = _parse_position(j)
|
position, duration = _parse_position(j)
|
||||||
|
|
||||||
return position, duration
|
return position, duration
|
||||||
|
@ -227,23 +235,29 @@ def get_current_size(test):
|
||||||
|
|
||||||
return os.stat(urlparse.urlparse(test.dest_file).path).st_size
|
return os.stat(urlparse.urlparse(test.dest_file).path).st_size
|
||||||
|
|
||||||
|
def get_duration(media_file):
|
||||||
|
duration = 0
|
||||||
|
def parse_gsttimeargs(time):
|
||||||
|
stime = time.split(":")
|
||||||
|
sns = stime[2].split(".")
|
||||||
|
stime[2] = sns[0]
|
||||||
|
stime.append(sns[1])
|
||||||
|
return (int(stime[0]) * 3600 + int(stime[1]) * 60 + int(stime[2]) * 60) * GST_SECOND + int(stime[3])
|
||||||
|
try:
|
||||||
|
res = subprocess.check_output([DISCOVERER_COMMAND, media_file])
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
# gst-media-check returns !0 if seeking is not possible, we do not care in that case.
|
||||||
|
pass
|
||||||
|
|
||||||
|
for l in res.split('\n'):
|
||||||
|
if "Duration: " in l:
|
||||||
|
duration = parse_gsttimeargs(l.replace("Duration: ", ""))
|
||||||
|
break
|
||||||
|
|
||||||
|
return duration
|
||||||
|
|
||||||
def compare_rendered_with_original(orig_duration, dest_file, tolerance=DURATION_TOLERANCE):
|
def compare_rendered_with_original(orig_duration, dest_file, tolerance=DURATION_TOLERANCE):
|
||||||
def parse_gsttimeargs(time):
|
duration = get_duration(dest_file)
|
||||||
stime = time.split(":")
|
|
||||||
sns = stime[2].split(".")
|
|
||||||
stime[2] = sns[0]
|
|
||||||
stime.append(sns[1])
|
|
||||||
return (int(stime[0]) * 3600 + int(stime[1]) * 60 + int(stime[2]) * 60) * GST_SECOND + int(stime[3])
|
|
||||||
try:
|
|
||||||
res = subprocess.check_output([DISCOVERER_COMMAND, dest_file])
|
|
||||||
except subprocess.CalledProcessError:
|
|
||||||
# gst-media-check returns !0 if seeking is not possible, we do not care in that case.
|
|
||||||
pass
|
|
||||||
|
|
||||||
for l in res.split('\n'):
|
|
||||||
if "Duration: " in l:
|
|
||||||
duration = parse_gsttimeargs(l.replace("Duration: ", ""))
|
|
||||||
|
|
||||||
if orig_duration - tolerance >= duration >= orig_duration + tolerance:
|
if orig_duration - tolerance >= duration >= orig_duration + tolerance:
|
||||||
return (Result.FAILED, "Duration of encoded file is "
|
return (Result.FAILED, "Duration of encoded file is "
|
||||||
|
|
Loading…
Reference in a new issue