Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1#!/usr/bin/env python 

2# This file is part of Xpra. 

3# Copyright (C) 2016-2018 Antoine Martin <antoine@xpra.org> 

4# Xpra is released under the terms of the GNU GPL v2, or, at your option, any 

5# later version. See the file COPYING for details. 

6 

7 

8from xpra.util import csv, engs 

9from xpra.log import Logger 

10log = Logger("sound") 

11 

12 

13VORBIS = "vorbis" 

14AAC = "aac" 

15FLAC = "flac" 

16MP3 = "mp3" 

17WAV = "wav" 

18OPUS = "opus" 

19SPEEX = "speex" 

20WAVPACK = "wavpack" 

21 

22OGG = "ogg" 

23MKA = "mka" 

24MPEG4 = "mpeg4" 

25ID3V2 = "id3v2" 

26#RTP = "rtp" 

27RAW = "raw" 

28 

29#stream compression 

30LZ4 = "lz4" 

31LZO = "lzo" 

32 

33FLAC_OGG = FLAC+"+"+OGG 

34OPUS_OGG = OPUS+"+"+OGG 

35SPEEX_OGG = SPEEX+"+"+OGG 

36VORBIS_OGG = VORBIS+"+"+OGG 

37OPUS_MKA = OPUS+"+"+MKA 

38#OPUS_RTP = OPUS+"+"+RTP 

39VORBIS_MKA = VORBIS+"+"+MKA 

40AAC_MPEG4 = AAC+"+"+MPEG4 

41WAV_LZ4 = WAV+"+"+LZ4 

42WAV_LZO = WAV+"+"+LZO 

43MP3_MPEG4 = MP3+"+"+MPEG4 

44MP3_ID3V2 = MP3+"+"+ID3V2 

45 

46 

47#used for parsing codec names specified on the command line: 

48def sound_option_or_all(name, options, all_values): 

49 log("sound_option_or_all%s", (name, options, all_values)) 

50 if not options: 

51 v = all_values #not specified on command line: use default 

52 else: 

53 v = [] 

54 invalid_options = [] 

55 for x in options: 

56 #options is a list, but it may have csv embedded: 

57 for o in x.split(","): 

58 o = o.strip() 

59 if o not in all_values: 

60 invalid_options.append(o) 

61 else: 

62 v.append(o) 

63 if invalid_options: 

64 if all_values: 

65 log.warn("Warning: invalid value%s for '%s': %s", engs(invalid_options), name, csv(invalid_options)) 

66 log.warn(" valid option%s: %s", engs(all_values), csv(all_values)) 

67 else: 

68 log.warn("Warning: no '%ss' available", name) 

69 log("%s=%s", name, csv(v)) 

70 return v