Commit 01a1c54f authored by Stefan Popa's avatar Stefan Popa Committed by Alexandru Băluț

proxy: Allow audio stream outside of container

Allows using supported audio streams even if they are not inside
a container.

Fixes T7756.
Reviewed-by: Alexandru Băluț's avatarAlex Băluț <alexandru.balut@gmail.com>
Differential Revision: https://phabricator.freedesktop.org/D1800
parent 1b235f53
......@@ -87,17 +87,25 @@ class ProxyManager(GObject.Object, Loggable):
object)),
}
WHITELIST_CONTAINER_CAPS = ["video/quicktime", "application/ogg",
"video/x-matroska", "video/webm"]
WHITELIST_AUDIO_CAPS = ["audio/mpeg", "audio/x-vorbis",
"audio/x-raw", "audio/x-flac"]
WHITELIST_VIDEO_CAPS = ["video/x-h264", "image/jpeg",
"video/x-raw", "video/x-vp8",
"video/x-theora"]
WHITELIST_FORMATS = []
for container in ["video/quicktime", "application/ogg",
"video/x-matroska", "video/webm"]:
for audio in ["audio/mpeg", "audio/x-vorbis",
"audio/x-raw", "audio/x-flac"]:
for video in ["video/x-h264", "image/jpeg",
"video/x-raw", "video/x-vp8",
"video/x-theora"]:
for container in WHITELIST_CONTAINER_CAPS:
for audio in WHITELIST_AUDIO_CAPS:
for video in WHITELIST_VIDEO_CAPS:
WHITELIST_FORMATS.append(createEncodingProfileSimple(
container, audio, video))
for audio in WHITELIST_AUDIO_CAPS:
a = GstPbutils.EncodingAudioProfile.new(Gst.Caps(audio), None, None, 0)
WHITELIST_FORMATS.append(a)
proxy_extension = "proxy.mkv"
def __init__(self, app):
......@@ -133,6 +141,16 @@ class ProxyManager(GObject.Object, Loggable):
return not info.get_caps().intersect(profile.get_format()).is_empty()
info = asset.get_info()
if isinstance(encoding_profile, GstPbutils.EncodingAudioProfile):
if isinstance(info.get_stream_info(), GstPbutils.DiscovererContainerInfo):
return False
audios = info.get_audio_streams()
if len(audios) != 1 or not capsMatch(audios[0], encoding_profile):
return False
if info.get_video_streams():
return False
return True
container = info.get_stream_info()
if container:
if not capsMatch(container, encoding_profile):
......
......@@ -217,6 +217,9 @@ class TestMediaLibrary(BaseTestMediaLibrary):
self.assertEqual(asset.creation_progress, 100)
self.assertEqual(asset.get_proxy(), proxy)
def test_supported_out_of_container_audio(self):
self.runCheckImport(["mp3_sample.mp3"], check_no_transcoding=True)
def testMissingUriDisplayed(self):
with common.created_project_file() as uri:
self._customSetUp(project_uri=uri)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment