mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 21:21:12 +00:00
validate: launcher: Keep variable framerate from input when possible
But disable it if forcing a framerate for some reason Fixing our support for variable framerate in the encoding profile serialization format. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3122>
This commit is contained in:
parent
fbddaffc62
commit
1577911d75
2 changed files with 34 additions and 8 deletions
|
@ -17,6 +17,7 @@
|
||||||
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||||
# Boston, MA 02110-1301, USA.
|
# Boston, MA 02110-1301, USA.
|
||||||
import argparse
|
import argparse
|
||||||
|
from fractions import Fraction
|
||||||
import os
|
import os
|
||||||
import copy
|
import copy
|
||||||
import sys
|
import sys
|
||||||
|
@ -34,7 +35,7 @@ from launcher.loggable import Loggable, error
|
||||||
from launcher.baseclasses import GstValidateTest, Test, \
|
from launcher.baseclasses import GstValidateTest, Test, \
|
||||||
ScenarioManager, NamedDic, GstValidateTestsGenerator, \
|
ScenarioManager, NamedDic, GstValidateTestsGenerator, \
|
||||||
GstValidateMediaDescriptor, GstValidateEncodingTestInterface, \
|
GstValidateMediaDescriptor, GstValidateEncodingTestInterface, \
|
||||||
GstValidateBaseTestManager, MediaDescriptor, MediaFormatCombination
|
GstValidateBaseTestManager, MediaDescriptor, MediaFormatCombination, VariableFramerateMode
|
||||||
|
|
||||||
from launcher.utils import path2url, url2path, DEFAULT_TIMEOUT, which, \
|
from launcher.utils import path2url, url2path, DEFAULT_TIMEOUT, which, \
|
||||||
GST_SECOND, Result, Protocols, mkdir, printc, Colors, get_data_file, \
|
GST_SECOND, Result, Protocols, mkdir, printc, Colors, get_data_file, \
|
||||||
|
@ -819,7 +820,18 @@ class GstValidateTranscodingTest(GstValidateTest, GstValidateEncodingTestInterfa
|
||||||
if urllib.parse.urlparse(self.dest_file).scheme == "":
|
if urllib.parse.urlparse(self.dest_file).scheme == "":
|
||||||
self.dest_file = path2url(self.dest_file)
|
self.dest_file = path2url(self.dest_file)
|
||||||
|
|
||||||
profile = self.get_profile()
|
variable_framerate = VariableFramerateMode.DISABLED
|
||||||
|
if self.media_descriptor.get_num_tracks("video") == 1:
|
||||||
|
caps, = [c for (t, c) in self.media_descriptor.get_tracks_caps() if t == 'video']
|
||||||
|
framerate = None
|
||||||
|
for struct, _ in GstCaps.new_from_str(caps):
|
||||||
|
framerate = struct.get("framerate", None)
|
||||||
|
if framerate is not None and \
|
||||||
|
framerate.numerator == 0 and framerate.denominator == 1:
|
||||||
|
variable_framerate = VariableFramerateMode.AUTO
|
||||||
|
break
|
||||||
|
|
||||||
|
profile = self.get_profile(variable_framerate=variable_framerate)
|
||||||
self.add_arguments("-o", profile)
|
self.add_arguments("-o", profile)
|
||||||
|
|
||||||
def build_arguments(self):
|
def build_arguments(self):
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
""" Class representing tests and test managers. """
|
""" Class representing tests and test managers. """
|
||||||
|
|
||||||
|
from enum import Enum
|
||||||
import importlib.util
|
import importlib.util
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
@ -43,7 +44,7 @@ import uuid
|
||||||
from itertools import cycle
|
from itertools import cycle
|
||||||
from fractions import Fraction
|
from fractions import Fraction
|
||||||
|
|
||||||
from .utils import which
|
from .utils import GstCaps, which
|
||||||
from . import reporters
|
from . import reporters
|
||||||
from . import loggable
|
from . import loggable
|
||||||
from .loggable import Loggable
|
from .loggable import Loggable
|
||||||
|
@ -1218,6 +1219,12 @@ class GstValidateTest(Test):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
class VariableFramerateMode(Enum):
|
||||||
|
DISABLED = 1
|
||||||
|
ENABLED = 2
|
||||||
|
AUTO = 3
|
||||||
|
|
||||||
|
|
||||||
class GstValidateEncodingTestInterface(object):
|
class GstValidateEncodingTestInterface(object):
|
||||||
DURATION_TOLERANCE = GST_SECOND / 4
|
DURATION_TOLERANCE = GST_SECOND / 4
|
||||||
|
|
||||||
|
@ -1243,7 +1250,9 @@ class GstValidateEncodingTestInterface(object):
|
||||||
|
|
||||||
def _get_profile_full(self, muxer, venc, aenc, video_restriction=None,
|
def _get_profile_full(self, muxer, venc, aenc, video_restriction=None,
|
||||||
audio_restriction=None, audio_presence=0,
|
audio_restriction=None, audio_presence=0,
|
||||||
video_presence=0, variable_framerate=False):
|
video_presence=0,
|
||||||
|
variable_framerate=VariableFramerateMode.DISABLED):
|
||||||
|
|
||||||
ret = ""
|
ret = ""
|
||||||
if muxer:
|
if muxer:
|
||||||
ret += muxer
|
ret += muxer
|
||||||
|
@ -1254,9 +1263,14 @@ class GstValidateEncodingTestInterface(object):
|
||||||
ret += venc
|
ret += venc
|
||||||
props = ""
|
props = ""
|
||||||
if video_presence:
|
if video_presence:
|
||||||
props += 'presence=%s,' % str(video_presence)
|
props += 'presence=%s|' % str(video_presence)
|
||||||
if variable_framerate:
|
if variable_framerate == VariableFramerateMode.AUTO:
|
||||||
props += 'variable-framerate=true,'
|
if video_restriction and "framerate" in video_restriction:
|
||||||
|
variable_framerate = VariableFramerateMode.DISABLED
|
||||||
|
else:
|
||||||
|
variable_framerate = VariableFramerateMode.ENABLED
|
||||||
|
if variable_framerate == VariableFramerateMode.ENABLED:
|
||||||
|
props += 'variable-framerate=true|'
|
||||||
if props:
|
if props:
|
||||||
ret = ret + '|' + props[:-1]
|
ret = ret + '|' + props[:-1]
|
||||||
if aenc:
|
if aenc:
|
||||||
|
@ -1270,7 +1284,7 @@ class GstValidateEncodingTestInterface(object):
|
||||||
return ret.replace("::", ":")
|
return ret.replace("::", ":")
|
||||||
|
|
||||||
def get_profile(self, video_restriction=None, audio_restriction=None,
|
def get_profile(self, video_restriction=None, audio_restriction=None,
|
||||||
variable_framerate=False):
|
variable_framerate=VariableFramerateMode.DISABLED):
|
||||||
vcaps = self.combination.get_video_caps()
|
vcaps = self.combination.get_video_caps()
|
||||||
acaps = self.combination.get_audio_caps()
|
acaps = self.combination.get_audio_caps()
|
||||||
if video_restriction is None:
|
if video_restriction is None:
|
||||||
|
|
Loading…
Reference in a new issue