Package brisa :: Package upnp :: Package didl :: Module dlna
[hide private]
[frames] | no frames]

Source Code for Module brisa.upnp.didl.dlna

 1  # Licensed under the MIT license 
 2  # http://opensource.org/licenses/mit-license.php or see LICENSE file. 
 3  # Copyright 2007-2008 Brisa Team <brisa-develop@garage.maemo.org> 
 4  # Thanks to ushare project for informations in your dlna.h file 
 5   
 6  """ Digital Living Network Alliance constants and flags. 
 7  """ 
 8   
 9  # Play speed 
10  #    1 normal 
11  #    0 invalid 
12  DLNA_ORG_PS = 'DLNA.ORG_PS' 
13  DLNA_ORG_PS_VAL = '01' 
14   
15  # Convertion Indicator 
16  #    1 transcoded 
17  #    0 not transcoded 
18  DLNA_ORG_CI = 'DLNA.ORG_CI' 
19  DLNA_ORG_CI_VAL = '0' 
20   
21  # Operations 
22  #    00 not time seek range, not range 
23  #    01 range supported 
24  #    10 time seek range supported 
25  #    11 both supported 
26  DLNA_ORG_OP = 'DLNA.ORG_OP' 
27  DLNA_ORG_OP_VAL = '01' 
28   
29  # Flags 
30  #    senderPaced                      80000000  31 
31  #    lsopTimeBasedSeekSupported       40000000  30 
32  #    lsopByteBasedSeekSupported       20000000  29 
33  #    playcontainerSupported           10000000  28 
34  #    s0IncreasingSupported            8000000   27 
35  #    sNIncreasingSupported            4000000   26 
36  #    rtspPauseSupported               2000000   25 
37  #    streamingTransferModeSupported   1000000   24 
38  #    interactiveTransferModeSupported 800000    23 
39  #    backgroundTransferModeSupported  400000    22 
40  #    connectionStallingSupported      200000    21 
41  #    dlnaVersion15Supported           100000    20 
42  DLNA_ORG_FLAGS = 'DLNA.ORG_FLAGS' 
43  DLNA_ORG_FLAGS_VAL = '01500000000000000000000000000000' 
44   
45  # Media Format 
46  DLNA_ORG_PN = 'DLNA.ORG_PN' 
47   
48  protocol_info_dict = {'audio/mpeg': 'MP3', 'audio/mp4': 'AAC_ISO_320', 
49                        'audio/x-ms-wma': 'WMABASE', 'image/jpeg': 'JPEG_SM', 
50                        'video/mpeg': 'MPEG_PS_PAL', 
51                        'video/mp4': 'MPEG4_P2_MP4_SP_AAC', 
52                        'video/x-ms-wmv': 'WMVMED_BASE'} 
53   
54   
55 -def get_protocol_info(type):
56 ''' Return DLNA protocolInfo ''' 57 58 if type == 'video/x-msvideo': 59 type = 'video/avi' 60 61 mtype = protocol_info_dict.get(type) 62 63 if not mtype: 64 mtype = '' 65 66 info = '%s=%s;%s=%s;%s=%s;%s=%s;%s=%s'%(DLNA_ORG_PS, DLNA_ORG_PS_VAL, 67 DLNA_ORG_CI, DLNA_ORG_CI_VAL, 68 DLNA_ORG_OP, DLNA_ORG_OP_VAL, 69 DLNA_ORG_PN, mtype, 70 DLNA_ORG_FLAGS, DLNA_ORG_FLAGS_VAL) 71 72 protocol_info = 'http-get:*:%s:%s' % (type, info) 73 74 return protocol_info
75