├── .waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372 └── waflib │ ├── Build.py │ ├── Build.pyc │ ├── ConfigSet.py │ ├── ConfigSet.pyc │ ├── Configure.py │ ├── Configure.pyc │ ├── Context.py │ ├── Context.pyc │ ├── Errors.py │ ├── Errors.pyc │ ├── Logs.py │ ├── Logs.pyc │ ├── Node.py │ ├── Node.pyc │ ├── Options.py │ ├── Options.pyc │ ├── Runner.py │ ├── Runner.pyc │ ├── Scripting.py │ ├── Scripting.pyc │ ├── Task.py │ ├── Task.pyc │ ├── TaskGen.py │ ├── TaskGen.pyc │ ├── Tools │ ├── __init__.py │ ├── __init__.pyc │ ├── ar.py │ ├── ar.pyc │ ├── asm.py │ ├── bison.py │ ├── c.py │ ├── c.pyc │ ├── c_aliases.py │ ├── c_aliases.pyc │ ├── c_config.py │ ├── c_config.pyc │ ├── c_osx.py │ ├── c_osx.pyc │ ├── c_preproc.py │ ├── c_preproc.pyc │ ├── c_tests.py │ ├── c_tests.pyc │ ├── ccroot.py │ ├── ccroot.pyc │ ├── compiler_c.py │ ├── compiler_c.pyc │ ├── compiler_cxx.py │ ├── compiler_cxx.pyc │ ├── compiler_d.py │ ├── compiler_fc.py │ ├── cs.py │ ├── cxx.py │ ├── cxx.pyc │ ├── d.py │ ├── d_config.py │ ├── d_scan.py │ ├── dbus.py │ ├── dmd.py │ ├── errcheck.py │ ├── fc.py │ ├── fc_config.py │ ├── fc_scan.py │ ├── flex.py │ ├── g95.py │ ├── gas.py │ ├── gcc.py │ ├── gcc.pyc │ ├── gdc.py │ ├── gfortran.py │ ├── glib2.py │ ├── gnu_dirs.py │ ├── gxx.py │ ├── gxx.pyc │ ├── icc.py │ ├── icpc.py │ ├── ifort.py │ ├── intltool.py │ ├── irixcc.py │ ├── javaw.py │ ├── kde4.py │ ├── ldc2.py │ ├── lua.py │ ├── msvc.py │ ├── nasm.py │ ├── perl.py │ ├── python.py │ ├── qt4.py │ ├── ruby.py │ ├── suncc.py │ ├── suncxx.py │ ├── tex.py │ ├── vala.py │ ├── waf_unit_test.py │ ├── winres.py │ ├── xlc.py │ └── xlcxx.py │ ├── Utils.py │ ├── Utils.pyc │ ├── __init__.py │ ├── __init__.pyc │ ├── ansiterm.py │ ├── ansiterm.pyc │ ├── extras │ ├── __init__.py │ └── compat15.py │ ├── fixpy2.py │ └── fixpy2.pyc ├── README.md ├── all ├── appsrc-pull-stream.cpp ├── appsrc-push-stream.cpp ├── appsrc-stream.c ├── appsrc-stream.cpp ├── appsrc-stream2.c ├── appsrc-stream2.cpp ├── appsrc.c ├── appsrc.cpp ├── capture.cpp ├── capture_mp4.cpp ├── capture_playback.cpp ├── capture_simple.cpp ├── capture_withaudio.cpp ├── fileinfo.cpp ├── frame.cpp ├── haha ├── haha.mp4 ├── haha.ogg ├── hehe.mp3 ├── helloworld.c ├── helloworld.cpp ├── info.cpp ├── init.c ├── lowerlevel.c ├── lowerlevel.c.bk ├── lowerlevel.cpp ├── makefile ├── manual ├── .gitignore └── hehe.mp3 ├── me.ogg ├── mp4.cpp ├── mp4_playback.cpp ├── mp4_withaudio.cpp ├── playback_1.0.c ├── record.cpp ├── tools.hpp ├── typefind.cpp ├── waf ├── wscript └── wscript.loli /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Build.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Build.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/ConfigSet.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import copy,re,os 6 | from waflib import Logs,Utils 7 | re_imp=re.compile('^(#)*?([^#=]*?)\ =\ (.*?)$',re.M) 8 | class ConfigSet(object): 9 | __slots__=('table','parent') 10 | def __init__(self,filename=None): 11 | self.table={} 12 | if filename: 13 | self.load(filename) 14 | def __contains__(self,key): 15 | if key in self.table:return True 16 | try:return self.parent.__contains__(key) 17 | except AttributeError:return False 18 | def keys(self): 19 | keys=set() 20 | cur=self 21 | while cur: 22 | keys.update(cur.table.keys()) 23 | cur=getattr(cur,'parent',None) 24 | keys=list(keys) 25 | keys.sort() 26 | return keys 27 | def __str__(self): 28 | return"\n".join(["%r %r"%(x,self.__getitem__(x))for x in self.keys()]) 29 | def __getitem__(self,key): 30 | try: 31 | while 1: 32 | x=self.table.get(key,None) 33 | if not x is None: 34 | return x 35 | self=self.parent 36 | except AttributeError: 37 | return[] 38 | def __setitem__(self,key,value): 39 | self.table[key]=value 40 | def __delitem__(self,key): 41 | self[key]=[] 42 | def __getattr__(self,name): 43 | if name in self.__slots__: 44 | return object.__getattr__(self,name) 45 | else: 46 | return self[name] 47 | def __setattr__(self,name,value): 48 | if name in self.__slots__: 49 | object.__setattr__(self,name,value) 50 | else: 51 | self[name]=value 52 | def __delattr__(self,name): 53 | if name in self.__slots__: 54 | object.__delattr__(self,name) 55 | else: 56 | del self[name] 57 | def derive(self): 58 | newenv=ConfigSet() 59 | newenv.parent=self 60 | return newenv 61 | def detach(self): 62 | tbl=self.get_merged_dict() 63 | try: 64 | delattr(self,'parent') 65 | except AttributeError: 66 | pass 67 | else: 68 | keys=tbl.keys() 69 | for x in keys: 70 | tbl[x]=copy.deepcopy(tbl[x]) 71 | self.table=tbl 72 | def get_flat(self,key): 73 | s=self[key] 74 | if isinstance(s,str):return s 75 | return' '.join(s) 76 | def _get_list_value_for_modification(self,key): 77 | try: 78 | value=self.table[key] 79 | except KeyError: 80 | try:value=self.parent[key] 81 | except AttributeError:value=[] 82 | if isinstance(value,list): 83 | value=value[:] 84 | else: 85 | value=[value] 86 | else: 87 | if not isinstance(value,list): 88 | value=[value] 89 | self.table[key]=value 90 | return value 91 | def append_value(self,var,val): 92 | current_value=self._get_list_value_for_modification(var) 93 | if isinstance(val,str): 94 | val=[val] 95 | current_value.extend(val) 96 | def prepend_value(self,var,val): 97 | if isinstance(val,str): 98 | val=[val] 99 | self.table[var]=val+self._get_list_value_for_modification(var) 100 | def append_unique(self,var,val): 101 | if isinstance(val,str): 102 | val=[val] 103 | current_value=self._get_list_value_for_modification(var) 104 | for x in val: 105 | if x not in current_value: 106 | current_value.append(x) 107 | def get_merged_dict(self): 108 | table_list=[] 109 | env=self 110 | while 1: 111 | table_list.insert(0,env.table) 112 | try:env=env.parent 113 | except AttributeError:break 114 | merged_table={} 115 | for table in table_list: 116 | merged_table.update(table) 117 | return merged_table 118 | def store(self,filename): 119 | try: 120 | os.makedirs(os.path.split(filename)[0]) 121 | except OSError: 122 | pass 123 | buf=[] 124 | merged_table=self.get_merged_dict() 125 | keys=list(merged_table.keys()) 126 | keys.sort() 127 | try: 128 | fun=ascii 129 | except NameError: 130 | fun=repr 131 | for k in keys: 132 | if k!='undo_stack': 133 | buf.append('%s = %s\n'%(k,fun(merged_table[k]))) 134 | Utils.writef(filename,''.join(buf)) 135 | def load(self,filename): 136 | tbl=self.table 137 | code=Utils.readf(filename,m='rU') 138 | for m in re_imp.finditer(code): 139 | g=m.group 140 | tbl[g(2)]=eval(g(3)) 141 | Logs.debug('env: %s'%str(self.table)) 142 | def update(self,d): 143 | for k,v in d.items(): 144 | self[k]=v 145 | def stash(self): 146 | orig=self.table 147 | tbl=self.table=self.table.copy() 148 | for x in tbl.keys(): 149 | tbl[x]=copy.deepcopy(tbl[x]) 150 | self.undo_stack=self.undo_stack+[orig] 151 | def revert(self): 152 | self.table=self.undo_stack.pop(-1) 153 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/ConfigSet.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/ConfigSet.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Configure.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Configure.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Context.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Context.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Errors.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import traceback,sys 6 | class WafError(Exception): 7 | def __init__(self,msg='',ex=None): 8 | self.msg=msg 9 | assert not isinstance(msg,Exception) 10 | self.stack=[] 11 | if ex: 12 | if not msg: 13 | self.msg=str(ex) 14 | if isinstance(ex,WafError): 15 | self.stack=ex.stack 16 | else: 17 | self.stack=traceback.extract_tb(sys.exc_info()[2]) 18 | self.stack+=traceback.extract_stack()[:-1] 19 | self.verbose_msg=''.join(traceback.format_list(self.stack)) 20 | def __str__(self): 21 | return str(self.msg) 22 | class BuildError(WafError): 23 | def __init__(self,error_tasks=[]): 24 | self.tasks=error_tasks 25 | WafError.__init__(self,self.format_error()) 26 | def format_error(self): 27 | lst=['Build failed'] 28 | for tsk in self.tasks: 29 | txt=tsk.format_error() 30 | if txt:lst.append(txt) 31 | return'\n'.join(lst) 32 | class ConfigurationError(WafError): 33 | pass 34 | class TaskRescan(WafError): 35 | pass 36 | class TaskNotReady(WafError): 37 | pass 38 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Errors.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Errors.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Logs.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os,re,traceback,sys 6 | _nocolor=os.environ.get('NOCOLOR','no')not in('no','0','false') 7 | try: 8 | if not _nocolor: 9 | import waflib.ansiterm 10 | except ImportError: 11 | pass 12 | try: 13 | import threading 14 | except ImportError: 15 | if not'JOBS'in os.environ: 16 | os.environ['JOBS']='1' 17 | else: 18 | wlock=threading.Lock() 19 | class sync_stream(object): 20 | def __init__(self,stream): 21 | self.stream=stream 22 | self.encoding=self.stream.encoding 23 | def write(self,txt): 24 | try: 25 | wlock.acquire() 26 | self.stream.write(txt) 27 | self.stream.flush() 28 | finally: 29 | wlock.release() 30 | def fileno(self): 31 | return self.stream.fileno() 32 | def flush(self): 33 | self.stream.flush() 34 | def isatty(self): 35 | return self.stream.isatty() 36 | if not os.environ.get('NOSYNC',False): 37 | if id(sys.stdout)==id(sys.__stdout__): 38 | sys.stdout=sync_stream(sys.stdout) 39 | sys.stderr=sync_stream(sys.stderr) 40 | import logging 41 | LOG_FORMAT="%(asctime)s %(c1)s%(zone)s%(c2)s %(message)s" 42 | HOUR_FORMAT="%H:%M:%S" 43 | zones='' 44 | verbose=0 45 | colors_lst={'USE':True,'BOLD':'\x1b[01;1m','RED':'\x1b[01;31m','GREEN':'\x1b[32m','YELLOW':'\x1b[33m','PINK':'\x1b[35m','BLUE':'\x1b[01;34m','CYAN':'\x1b[36m','NORMAL':'\x1b[0m','cursor_on':'\x1b[?25h','cursor_off':'\x1b[?25l',} 46 | got_tty=not os.environ.get('TERM','dumb')in['dumb','emacs'] 47 | if got_tty: 48 | try: 49 | got_tty=sys.stderr.isatty()and sys.stdout.isatty() 50 | except AttributeError: 51 | got_tty=False 52 | if(not got_tty and os.environ.get('TERM','dumb')!='msys')or _nocolor: 53 | colors_lst['USE']=False 54 | def get_term_cols(): 55 | return 80 56 | try: 57 | import struct,fcntl,termios 58 | except ImportError: 59 | pass 60 | else: 61 | if got_tty: 62 | def get_term_cols_real(): 63 | dummy_lines,cols=struct.unpack("HHHH",fcntl.ioctl(sys.stderr.fileno(),termios.TIOCGWINSZ,struct.pack("HHHH",0,0,0,0)))[:2] 64 | return cols 65 | try: 66 | get_term_cols_real() 67 | except Exception: 68 | pass 69 | else: 70 | get_term_cols=get_term_cols_real 71 | get_term_cols.__doc__=""" 72 | Get the console width in characters. 73 | 74 | :return: the number of characters per line 75 | :rtype: int 76 | """ 77 | def get_color(cl): 78 | if not colors_lst['USE']:return'' 79 | return colors_lst.get(cl,'') 80 | class color_dict(object): 81 | def __getattr__(self,a): 82 | return get_color(a) 83 | def __call__(self,a): 84 | return get_color(a) 85 | colors=color_dict() 86 | re_log=re.compile(r'(\w+): (.*)',re.M) 87 | class log_filter(logging.Filter): 88 | def __init__(self,name=None): 89 | pass 90 | def filter(self,rec): 91 | rec.c1=colors.PINK 92 | rec.c2=colors.NORMAL 93 | rec.zone=rec.module 94 | if rec.levelno>=logging.INFO: 95 | if rec.levelno>=logging.ERROR: 96 | rec.c1=colors.RED 97 | elif rec.levelno>=logging.WARNING: 98 | rec.c1=colors.YELLOW 99 | else: 100 | rec.c1=colors.GREEN 101 | return True 102 | m=re_log.match(rec.msg) 103 | if m: 104 | rec.zone=m.group(1) 105 | rec.msg=m.group(2) 106 | if zones: 107 | return getattr(rec,'zone','')in zones or'*'in zones 108 | elif not verbose>2: 109 | return False 110 | return True 111 | class formatter(logging.Formatter): 112 | def __init__(self): 113 | logging.Formatter.__init__(self,LOG_FORMAT,HOUR_FORMAT) 114 | def format(self,rec): 115 | if rec.levelno>=logging.WARNING or rec.levelno==logging.INFO: 116 | try: 117 | msg=rec.msg.decode('utf-8') 118 | except Exception: 119 | msg=rec.msg 120 | return'%s%s%s'%(rec.c1,msg,rec.c2) 121 | return logging.Formatter.format(self,rec) 122 | log=None 123 | def debug(*k,**kw): 124 | if verbose: 125 | k=list(k) 126 | k[0]=k[0].replace('\n',' ') 127 | global log 128 | log.debug(*k,**kw) 129 | def error(*k,**kw): 130 | global log 131 | log.error(*k,**kw) 132 | if verbose>2: 133 | st=traceback.extract_stack() 134 | if st: 135 | st=st[:-1] 136 | buf=[] 137 | for filename,lineno,name,line in st: 138 | buf.append(' File "%s", line %d, in %s'%(filename,lineno,name)) 139 | if line: 140 | buf.append(' %s'%line.strip()) 141 | if buf:log.error("\n".join(buf)) 142 | def warn(*k,**kw): 143 | global log 144 | log.warn(*k,**kw) 145 | def info(*k,**kw): 146 | global log 147 | log.info(*k,**kw) 148 | def init_log(): 149 | global log 150 | log=logging.getLogger('waflib') 151 | log.handlers=[] 152 | log.filters=[] 153 | hdlr=logging.StreamHandler() 154 | hdlr.setFormatter(formatter()) 155 | log.addHandler(hdlr) 156 | log.addFilter(log_filter()) 157 | log.setLevel(logging.DEBUG) 158 | def make_logger(path,name): 159 | logger=logging.getLogger(name) 160 | hdlr=logging.FileHandler(path,'w') 161 | formatter=logging.Formatter('%(message)s') 162 | hdlr.setFormatter(formatter) 163 | logger.addHandler(hdlr) 164 | logger.setLevel(logging.DEBUG) 165 | return logger 166 | def make_mem_logger(name,to_log,size=10000): 167 | from logging.handlers import MemoryHandler 168 | logger=logging.getLogger(name) 169 | hdlr=MemoryHandler(size,target=to_log) 170 | formatter=logging.Formatter('%(message)s') 171 | hdlr.setFormatter(formatter) 172 | logger.addHandler(hdlr) 173 | logger.memhandler=hdlr 174 | logger.setLevel(logging.DEBUG) 175 | return logger 176 | def pprint(col,str,label='',sep='\n'): 177 | sys.stderr.write("%s%s%s %s%s"%(colors(col),str,colors.NORMAL,label,sep)) 178 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Logs.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Logs.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Node.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Node.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Options.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os,tempfile,optparse,sys,re 6 | from waflib import Logs,Utils,Context 7 | cmds='distclean configure build install clean uninstall check dist distcheck'.split() 8 | options={} 9 | commands=[] 10 | lockfile=os.environ.get('WAFLOCK','.lock-waf_%s_build'%sys.platform) 11 | try:cache_global=os.path.abspath(os.environ['WAFCACHE']) 12 | except KeyError:cache_global='' 13 | platform=Utils.unversioned_sys_platform() 14 | class opt_parser(optparse.OptionParser): 15 | def __init__(self,ctx): 16 | optparse.OptionParser.__init__(self,conflict_handler="resolve",version='waf %s (%s)'%(Context.WAFVERSION,Context.WAFREVISION)) 17 | self.formatter.width=Logs.get_term_cols() 18 | p=self.add_option 19 | self.ctx=ctx 20 | jobs=ctx.jobs() 21 | p('-j','--jobs',dest='jobs',default=jobs,type='int',help='amount of parallel jobs (%r)'%jobs) 22 | p('-k','--keep',dest='keep',default=0,action='count',help='keep running happily even if errors are found') 23 | p('-v','--verbose',dest='verbose',default=0,action='count',help='verbosity level -v -vv or -vvv [default: 0]') 24 | p('--nocache',dest='nocache',default=False,action='store_true',help='ignore the WAFCACHE (if set)') 25 | p('--zones',dest='zones',default='',action='store',help='debugging zones (task_gen, deps, tasks, etc)') 26 | gr=optparse.OptionGroup(self,'configure options') 27 | self.add_option_group(gr) 28 | gr.add_option('-o','--out',action='store',default='',help='build dir for the project',dest='out') 29 | gr.add_option('-t','--top',action='store',default='',help='src dir for the project',dest='top') 30 | default_prefix=os.environ.get('PREFIX') 31 | if not default_prefix: 32 | if platform=='win32': 33 | d=tempfile.gettempdir() 34 | default_prefix=d[0].upper()+d[1:] 35 | else: 36 | default_prefix='/usr/local/' 37 | gr.add_option('--prefix',dest='prefix',default=default_prefix,help='installation prefix [default: %r]'%default_prefix) 38 | gr.add_option('--download',dest='download',default=False,action='store_true',help='try to download the tools if missing') 39 | gr=optparse.OptionGroup(self,'build and install options') 40 | self.add_option_group(gr) 41 | gr.add_option('-p','--progress',dest='progress_bar',default=0,action='count',help='-p: progress bar; -pp: ide output') 42 | gr.add_option('--targets',dest='targets',default='',action='store',help='task generators, e.g. "target1,target2"') 43 | gr=optparse.OptionGroup(self,'step options') 44 | self.add_option_group(gr) 45 | gr.add_option('--files',dest='files',default='',action='store',help='files to process, by regexp, e.g. "*/main.c,*/test/main.o"') 46 | default_destdir=os.environ.get('DESTDIR','') 47 | gr=optparse.OptionGroup(self,'install/uninstall options') 48 | self.add_option_group(gr) 49 | gr.add_option('--destdir',help='installation root [default: %r]'%default_destdir,default=default_destdir,dest='destdir') 50 | gr.add_option('-f','--force',dest='force',default=False,action='store_true',help='force file installation') 51 | gr.add_option('--distcheck-args',help='arguments to pass to distcheck',default=None,action='store') 52 | def get_usage(self): 53 | cmds_str={} 54 | for cls in Context.classes: 55 | if not cls.cmd or cls.cmd=='options': 56 | continue 57 | s=cls.__doc__ or'' 58 | cmds_str[cls.cmd]=s 59 | if Context.g_module: 60 | for(k,v)in Context.g_module.__dict__.items(): 61 | if k in['options','init','shutdown']: 62 | continue 63 | if type(v)is type(Context.create_context): 64 | if v.__doc__ and not k.startswith('_'): 65 | cmds_str[k]=v.__doc__ 66 | just=0 67 | for k in cmds_str: 68 | just=max(just,len(k)) 69 | lst=[' %s: %s'%(k.ljust(just),v)for(k,v)in cmds_str.items()] 70 | lst.sort() 71 | ret='\n'.join(lst) 72 | return'''waf [commands] [options] 73 | 74 | Main commands (example: ./waf build -j4) 75 | %s 76 | '''%ret 77 | class OptionsContext(Context.Context): 78 | cmd='options' 79 | fun='options' 80 | def __init__(self,**kw): 81 | super(OptionsContext,self).__init__(**kw) 82 | self.parser=opt_parser(self) 83 | self.option_groups={} 84 | def jobs(self): 85 | count=int(os.environ.get('JOBS',0)) 86 | if count<1: 87 | if'NUMBER_OF_PROCESSORS'in os.environ: 88 | count=int(os.environ.get('NUMBER_OF_PROCESSORS',1)) 89 | else: 90 | if hasattr(os,'sysconf_names'): 91 | if'SC_NPROCESSORS_ONLN'in os.sysconf_names: 92 | count=int(os.sysconf('SC_NPROCESSORS_ONLN')) 93 | elif'SC_NPROCESSORS_CONF'in os.sysconf_names: 94 | count=int(os.sysconf('SC_NPROCESSORS_CONF')) 95 | if not count and os.name not in('nt','java'): 96 | try: 97 | tmp=self.cmd_and_log(['sysctl','-n','hw.ncpu'],quiet=0) 98 | except Exception: 99 | pass 100 | else: 101 | if re.match('^[0-9]+$',tmp): 102 | count=int(tmp) 103 | if count<1: 104 | count=1 105 | elif count>1024: 106 | count=1024 107 | return count 108 | def add_option(self,*k,**kw): 109 | return self.parser.add_option(*k,**kw) 110 | def add_option_group(self,*k,**kw): 111 | try: 112 | gr=self.option_groups[k[0]] 113 | except KeyError: 114 | gr=self.parser.add_option_group(*k,**kw) 115 | self.option_groups[k[0]]=gr 116 | return gr 117 | def get_option_group(self,opt_str): 118 | try: 119 | return self.option_groups[opt_str] 120 | except KeyError: 121 | for group in self.parser.option_groups: 122 | if group.title==opt_str: 123 | return group 124 | return None 125 | def parse_args(self,_args=None): 126 | global options,commands 127 | (options,leftover_args)=self.parser.parse_args(args=_args) 128 | commands=leftover_args 129 | if options.destdir: 130 | options.destdir=os.path.abspath(os.path.expanduser(options.destdir)) 131 | if options.verbose>=1: 132 | self.load('errcheck') 133 | def execute(self): 134 | super(OptionsContext,self).execute() 135 | self.parse_args() 136 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Options.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Options.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Runner.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import random,atexit 6 | try: 7 | from queue import Queue 8 | except ImportError: 9 | from Queue import Queue 10 | from waflib import Utils,Task,Errors,Logs 11 | GAP=10 12 | class TaskConsumer(Utils.threading.Thread): 13 | def __init__(self): 14 | Utils.threading.Thread.__init__(self) 15 | self.ready=Queue() 16 | self.setDaemon(1) 17 | self.start() 18 | def run(self): 19 | try: 20 | self.loop() 21 | except Exception: 22 | pass 23 | def loop(self): 24 | while 1: 25 | tsk=self.ready.get() 26 | if not isinstance(tsk,Task.TaskBase): 27 | tsk(self) 28 | else: 29 | tsk.process() 30 | pool=Queue() 31 | def get_pool(): 32 | try: 33 | return pool.get(False) 34 | except Exception: 35 | return TaskConsumer() 36 | def put_pool(x): 37 | pool.put(x) 38 | def _free_resources(): 39 | global pool 40 | lst=[] 41 | while pool.qsize(): 42 | lst.append(pool.get()) 43 | for x in lst: 44 | x.ready.put(None) 45 | for x in lst: 46 | x.join() 47 | pool=None 48 | atexit.register(_free_resources) 49 | class Parallel(object): 50 | def __init__(self,bld,j=2): 51 | self.numjobs=j 52 | self.bld=bld 53 | self.outstanding=[] 54 | self.frozen=[] 55 | self.out=Queue(0) 56 | self.count=0 57 | self.processed=1 58 | self.stop=False 59 | self.error=[] 60 | self.biter=None 61 | self.dirty=False 62 | def get_next_task(self): 63 | if not self.outstanding: 64 | return None 65 | return self.outstanding.pop(0) 66 | def postpone(self,tsk): 67 | if random.randint(0,1): 68 | self.frozen.insert(0,tsk) 69 | else: 70 | self.frozen.append(tsk) 71 | def refill_task_list(self): 72 | while self.count>self.numjobs*GAP: 73 | self.get_out() 74 | while not self.outstanding: 75 | if self.count: 76 | self.get_out() 77 | elif self.frozen: 78 | try: 79 | cond=self.deadlock==self.processed 80 | except AttributeError: 81 | pass 82 | else: 83 | if cond: 84 | msg='check the build order for the tasks' 85 | for tsk in self.frozen: 86 | if not tsk.run_after: 87 | msg='check the methods runnable_status' 88 | break 89 | lst=[] 90 | for tsk in self.frozen: 91 | lst.append('%s\t-> %r'%(repr(tsk),[id(x)for x in tsk.run_after])) 92 | raise Errors.WafError('Deadlock detected: %s%s'%(msg,''.join(lst))) 93 | self.deadlock=self.processed 94 | if self.frozen: 95 | self.outstanding+=self.frozen 96 | self.frozen=[] 97 | elif not self.count: 98 | self.outstanding.extend(self.biter.next()) 99 | self.total=self.bld.total() 100 | break 101 | def add_more_tasks(self,tsk): 102 | if getattr(tsk,'more_tasks',None): 103 | self.outstanding+=tsk.more_tasks 104 | self.total+=len(tsk.more_tasks) 105 | def get_out(self): 106 | tsk=self.out.get() 107 | if not self.stop: 108 | self.add_more_tasks(tsk) 109 | self.count-=1 110 | self.dirty=True 111 | return tsk 112 | def error_handler(self,tsk): 113 | if not self.bld.keep: 114 | self.stop=True 115 | self.error.append(tsk) 116 | def add_task(self,tsk): 117 | try: 118 | self.pool 119 | except AttributeError: 120 | self.init_task_pool() 121 | self.ready.put(tsk) 122 | def init_task_pool(self): 123 | pool=self.pool=[get_pool()for i in range(self.numjobs)] 124 | self.ready=Queue(0) 125 | def setq(consumer): 126 | consumer.ready=self.ready 127 | for x in pool: 128 | x.ready.put(setq) 129 | return pool 130 | def free_task_pool(self): 131 | def setq(consumer): 132 | consumer.ready=Queue(0) 133 | self.out.put(self) 134 | try: 135 | pool=self.pool 136 | except AttributeError: 137 | pass 138 | else: 139 | for x in pool: 140 | self.ready.put(setq) 141 | for x in pool: 142 | self.get_out() 143 | for x in pool: 144 | put_pool(x) 145 | self.pool=[] 146 | def start(self): 147 | self.total=self.bld.total() 148 | while not self.stop: 149 | self.refill_task_list() 150 | tsk=self.get_next_task() 151 | if not tsk: 152 | if self.count: 153 | continue 154 | else: 155 | break 156 | if tsk.hasrun: 157 | self.processed+=1 158 | continue 159 | if self.stop: 160 | break 161 | try: 162 | st=tsk.runnable_status() 163 | except Exception: 164 | self.processed+=1 165 | tsk.err_msg=Utils.ex_stack() 166 | if not self.stop and self.bld.keep: 167 | tsk.hasrun=Task.SKIPPED 168 | if self.bld.keep==1: 169 | if Logs.verbose>1 or not self.error: 170 | self.error.append(tsk) 171 | self.stop=True 172 | else: 173 | if Logs.verbose>1: 174 | self.error.append(tsk) 175 | continue 176 | tsk.hasrun=Task.EXCEPTION 177 | self.error_handler(tsk) 178 | continue 179 | if st==Task.ASK_LATER: 180 | self.postpone(tsk) 181 | elif st==Task.SKIP_ME: 182 | self.processed+=1 183 | tsk.hasrun=Task.SKIPPED 184 | self.add_more_tasks(tsk) 185 | else: 186 | tsk.position=(self.processed,self.total) 187 | self.count+=1 188 | tsk.master=self 189 | self.processed+=1 190 | if self.numjobs==1: 191 | tsk.process() 192 | else: 193 | self.add_task(tsk) 194 | while self.error and self.count: 195 | self.get_out() 196 | assert(self.count==0 or self.stop) 197 | self.free_task_pool() 198 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Runner.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Runner.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Scripting.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Scripting.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Task.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Task.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/TaskGen.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/TaskGen.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/__init__.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/__init__.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/ar.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | from waflib.Configure import conf 6 | @conf 7 | def find_ar(conf): 8 | conf.load('ar') 9 | def configure(conf): 10 | conf.find_program('ar',var='AR') 11 | conf.env.ARFLAGS='rcs' 12 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/ar.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/ar.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/asm.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os,sys 6 | from waflib import Task,Utils 7 | import waflib.Task 8 | from waflib.Tools.ccroot import link_task,stlink_task 9 | from waflib.TaskGen import extension,feature 10 | class asm(Task.Task): 11 | color='BLUE' 12 | run_str='${AS} ${ASFLAGS} ${ASMPATH_ST:INCPATHS} ${AS_SRC_F}${SRC} ${AS_TGT_F}${TGT}' 13 | @extension('.s','.S','.asm','.ASM','.spp','.SPP') 14 | def asm_hook(self,node): 15 | return self.create_compiled_task('asm',node) 16 | class asmprogram(link_task): 17 | run_str='${ASLINK} ${ASLINKFLAGS} ${ASLNK_TGT_F}${TGT} ${ASLNK_SRC_F}${SRC}' 18 | ext_out=['.bin'] 19 | inst_to='${BINDIR}' 20 | class asmshlib(asmprogram): 21 | inst_to='${LIBDIR}' 22 | class asmstlib(stlink_task): 23 | pass 24 | def configure(conf): 25 | conf.env['ASMPATH_ST']='-I%s' 26 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/bison.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | from waflib import Task 6 | from waflib.TaskGen import extension 7 | class bison(Task.Task): 8 | color='BLUE' 9 | run_str='${BISON} ${BISONFLAGS} ${SRC[0].abspath()} -o ${TGT[0].name}' 10 | ext_out=['.h'] 11 | @extension('.y','.yc','.yy') 12 | def big_bison(self,node): 13 | has_h='-d'in self.env['BISONFLAGS'] 14 | outs=[] 15 | if node.name.endswith('.yc'): 16 | outs.append(node.change_ext('.tab.cc')) 17 | if has_h: 18 | outs.append(node.change_ext('.tab.hh')) 19 | else: 20 | outs.append(node.change_ext('.tab.c')) 21 | if has_h: 22 | outs.append(node.change_ext('.tab.h')) 23 | tsk=self.create_task('bison',node,outs) 24 | tsk.cwd=node.parent.get_bld().abspath() 25 | self.source.append(outs[0]) 26 | def configure(conf): 27 | conf.find_program('bison',var='BISON') 28 | conf.env.BISONFLAGS=['-d'] 29 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/c.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | from waflib import TaskGen,Task,Utils 6 | from waflib.Tools import c_preproc 7 | from waflib.Tools.ccroot import link_task,stlink_task 8 | @TaskGen.extension('.c') 9 | def c_hook(self,node): 10 | return self.create_compiled_task('c',node) 11 | class c(Task.Task): 12 | run_str='${CC} ${ARCH_ST:ARCH} ${CFLAGS} ${CPPFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT}' 13 | vars=['CCDEPS'] 14 | ext_in=['.h'] 15 | scan=c_preproc.scan 16 | class cprogram(link_task): 17 | run_str='${LINK_CC} ${LINKFLAGS} ${CCLNK_SRC_F}${SRC} ${CCLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${FRAMEWORK_ST:FRAMEWORK} ${ARCH_ST:ARCH} ${STLIB_MARKER} ${STLIBPATH_ST:STLIBPATH} ${STLIB_ST:STLIB} ${SHLIB_MARKER} ${LIBPATH_ST:LIBPATH} ${LIB_ST:LIB}' 18 | ext_out=['.bin'] 19 | vars=['LINKDEPS'] 20 | inst_to='${BINDIR}' 21 | class cshlib(cprogram): 22 | inst_to='${LIBDIR}' 23 | class cstlib(stlink_task): 24 | pass 25 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/c.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/c.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/c_aliases.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os,sys,re 6 | from waflib import Utils,Build 7 | from waflib.Configure import conf 8 | def get_extensions(lst): 9 | ret=[] 10 | for x in Utils.to_list(lst): 11 | try: 12 | if not isinstance(x,str): 13 | x=x.name 14 | ret.append(x[x.rfind('.')+1:]) 15 | except Exception: 16 | pass 17 | return ret 18 | def sniff_features(**kw): 19 | exts=get_extensions(kw['source']) 20 | type=kw['_type'] 21 | feats=[] 22 | if'cxx'in exts or'cpp'in exts or'c++'in exts or'cc'in exts or'C'in exts: 23 | feats.append('cxx') 24 | if'c'in exts or'vala'in exts: 25 | feats.append('c') 26 | if'd'in exts: 27 | feats.append('d') 28 | if'java'in exts: 29 | feats.append('java') 30 | if'java'in exts: 31 | return'java' 32 | if type in['program','shlib','stlib']: 33 | for x in feats: 34 | if x in['cxx','d','c']: 35 | feats.append(x+type) 36 | return feats 37 | def set_features(kw,_type): 38 | kw['_type']=_type 39 | kw['features']=Utils.to_list(kw.get('features',[]))+Utils.to_list(sniff_features(**kw)) 40 | @conf 41 | def program(bld,*k,**kw): 42 | set_features(kw,'program') 43 | return bld(*k,**kw) 44 | @conf 45 | def shlib(bld,*k,**kw): 46 | set_features(kw,'shlib') 47 | return bld(*k,**kw) 48 | @conf 49 | def stlib(bld,*k,**kw): 50 | set_features(kw,'stlib') 51 | return bld(*k,**kw) 52 | @conf 53 | def objects(bld,*k,**kw): 54 | set_features(kw,'objects') 55 | return bld(*k,**kw) 56 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/c_aliases.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/c_aliases.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/c_config.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/c_config.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/c_osx.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os,shutil,sys,platform 6 | from waflib import TaskGen,Task,Build,Options,Utils,Errors 7 | from waflib.TaskGen import taskgen_method,feature,after_method,before_method 8 | app_info=''' 9 | 10 | 11 | 12 | 13 | CFBundlePackageType 14 | APPL 15 | CFBundleGetInfoString 16 | Created by Waf 17 | CFBundleSignature 18 | ???? 19 | NOTE 20 | THIS IS A GENERATED FILE, DO NOT MODIFY 21 | CFBundleExecutable 22 | %s 23 | 24 | 25 | ''' 26 | @feature('c','cxx') 27 | def set_macosx_deployment_target(self): 28 | if self.env['MACOSX_DEPLOYMENT_TARGET']: 29 | os.environ['MACOSX_DEPLOYMENT_TARGET']=self.env['MACOSX_DEPLOYMENT_TARGET'] 30 | elif'MACOSX_DEPLOYMENT_TARGET'not in os.environ: 31 | if Utils.unversioned_sys_platform()=='darwin': 32 | os.environ['MACOSX_DEPLOYMENT_TARGET']='.'.join(platform.mac_ver()[0].split('.')[:2]) 33 | @taskgen_method 34 | def create_bundle_dirs(self,name,out): 35 | bld=self.bld 36 | dir=out.parent.find_or_declare(name) 37 | dir.mkdir() 38 | macos=dir.find_or_declare(['Contents','MacOS']) 39 | macos.mkdir() 40 | return dir 41 | def bundle_name_for_output(out): 42 | name=out.name 43 | k=name.rfind('.') 44 | if k>=0: 45 | name=name[:k]+'.app' 46 | else: 47 | name=name+'.app' 48 | return name 49 | @feature('cprogram','cxxprogram') 50 | @after_method('apply_link') 51 | def create_task_macapp(self): 52 | if self.env['MACAPP']or getattr(self,'mac_app',False): 53 | out=self.link_task.outputs[0] 54 | name=bundle_name_for_output(out) 55 | dir=self.create_bundle_dirs(name,out) 56 | n1=dir.find_or_declare(['Contents','MacOS',out.name]) 57 | self.apptask=self.create_task('macapp',self.link_task.outputs,n1) 58 | inst_to=getattr(self,'install_path','/Applications')+'/%s/Contents/MacOS/'%name 59 | self.bld.install_files(inst_to,n1,chmod=Utils.O755) 60 | if getattr(self,'mac_resources',None): 61 | res_dir=n1.parent.parent.make_node('Resources') 62 | inst_to=getattr(self,'install_path','/Applications')+'/%s/Resources'%name 63 | for x in self.to_list(self.mac_resources): 64 | node=self.path.find_node(x) 65 | if not node: 66 | raise Errors.WafError('Missing mac_resource %r in %r'%(x,self)) 67 | parent=node.parent 68 | if os.path.isdir(node.abspath()): 69 | nodes=node.ant_glob('**') 70 | else: 71 | nodes=[node] 72 | for node in nodes: 73 | rel=node.path_from(parent) 74 | tsk=self.create_task('macapp',node,res_dir.make_node(rel)) 75 | self.bld.install_as(inst_to+'/%s'%rel,node) 76 | if getattr(self.bld,'is_install',None): 77 | self.install_task.hasrun=Task.SKIP_ME 78 | @feature('cprogram','cxxprogram') 79 | @after_method('apply_link') 80 | def create_task_macplist(self): 81 | if self.env['MACAPP']or getattr(self,'mac_app',False): 82 | out=self.link_task.outputs[0] 83 | name=bundle_name_for_output(out) 84 | dir=self.create_bundle_dirs(name,out) 85 | n1=dir.find_or_declare(['Contents','Info.plist']) 86 | self.plisttask=plisttask=self.create_task('macplist',[],n1) 87 | if getattr(self,'mac_plist',False): 88 | node=self.path.find_resource(self.mac_plist) 89 | if node: 90 | plisttask.inputs.append(node) 91 | else: 92 | plisttask.code=self.mac_plist 93 | else: 94 | plisttask.code=app_info%self.link_task.outputs[0].name 95 | inst_to=getattr(self,'install_path','/Applications')+'/%s/Contents/'%name 96 | self.bld.install_files(inst_to,n1) 97 | @feature('cshlib','cxxshlib') 98 | @before_method('apply_link','propagate_uselib_vars') 99 | def apply_bundle(self): 100 | if self.env['MACBUNDLE']or getattr(self,'mac_bundle',False): 101 | self.env['LINKFLAGS_cshlib']=self.env['LINKFLAGS_cxxshlib']=[] 102 | self.env['cshlib_PATTERN']=self.env['cxxshlib_PATTERN']=self.env['macbundle_PATTERN'] 103 | use=self.use=self.to_list(getattr(self,'use',[])) 104 | if not'MACBUNDLE'in use: 105 | use.append('MACBUNDLE') 106 | app_dirs=['Contents','Contents/MacOS','Contents/Resources'] 107 | class macapp(Task.Task): 108 | color='PINK' 109 | def run(self): 110 | self.outputs[0].parent.mkdir() 111 | shutil.copy2(self.inputs[0].srcpath(),self.outputs[0].abspath()) 112 | class macplist(Task.Task): 113 | color='PINK' 114 | ext_in=['.bin'] 115 | def run(self): 116 | if getattr(self,'code',None): 117 | txt=self.code 118 | else: 119 | txt=self.inputs[0].read() 120 | self.outputs[0].write(txt) 121 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/c_osx.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/c_osx.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/c_preproc.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/c_preproc.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/c_tests.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | from waflib import Task 6 | from waflib.Configure import conf 7 | from waflib.TaskGen import feature,before_method,after_method 8 | import sys 9 | LIB_CODE=''' 10 | #ifdef _MSC_VER 11 | #define testEXPORT __declspec(dllexport) 12 | #else 13 | #define testEXPORT 14 | #endif 15 | testEXPORT int lib_func(void) { return 9; } 16 | ''' 17 | MAIN_CODE=''' 18 | #ifdef _MSC_VER 19 | #define testEXPORT __declspec(dllimport) 20 | #else 21 | #define testEXPORT 22 | #endif 23 | testEXPORT int lib_func(void); 24 | int main(int argc, char **argv) { 25 | (void)argc; (void)argv; 26 | return !(lib_func() == 9); 27 | } 28 | ''' 29 | @feature('link_lib_test') 30 | @before_method('process_source') 31 | def link_lib_test_fun(self): 32 | def write_test_file(task): 33 | task.outputs[0].write(task.generator.code) 34 | rpath=[] 35 | if getattr(self,'add_rpath',False): 36 | rpath=[self.bld.path.get_bld().abspath()] 37 | mode=self.mode 38 | m='%s %s'%(mode,mode) 39 | ex=self.test_exec and'test_exec'or'' 40 | bld=self.bld 41 | bld(rule=write_test_file,target='test.'+mode,code=LIB_CODE) 42 | bld(rule=write_test_file,target='main.'+mode,code=MAIN_CODE) 43 | bld(features='%sshlib'%m,source='test.'+mode,target='test') 44 | bld(features='%sprogram %s'%(m,ex),source='main.'+mode,target='app',use='test',rpath=rpath) 45 | @conf 46 | def check_library(self,mode=None,test_exec=True): 47 | if not mode: 48 | mode='c' 49 | if self.env.CXX: 50 | mode='cxx' 51 | self.check(compile_filename=[],features='link_lib_test',msg='Checking for libraries',mode=mode,test_exec=test_exec,) 52 | INLINE_CODE=''' 53 | typedef int foo_t; 54 | static %s foo_t static_foo () {return 0; } 55 | %s foo_t foo () { 56 | return 0; 57 | } 58 | ''' 59 | INLINE_VALUES=['inline','__inline__','__inline'] 60 | @conf 61 | def check_inline(self,**kw): 62 | self.start_msg('Checking for inline') 63 | if not'define_name'in kw: 64 | kw['define_name']='INLINE_MACRO' 65 | if not'features'in kw: 66 | if self.env.CXX: 67 | kw['features']=['cxx'] 68 | else: 69 | kw['features']=['c'] 70 | for x in INLINE_VALUES: 71 | kw['fragment']=INLINE_CODE%(x,x) 72 | try: 73 | self.check(**kw) 74 | except self.errors.ConfigurationError: 75 | continue 76 | else: 77 | self.end_msg(x) 78 | if x!='inline': 79 | self.define('inline',x,quote=False) 80 | return x 81 | self.fatal('could not use inline functions') 82 | LARGE_FRAGMENT='''#include 83 | int main(int argc, char **argv) { 84 | (void)argc; (void)argv; 85 | return !(sizeof(off_t) >= 8); 86 | } 87 | ''' 88 | @conf 89 | def check_large_file(self,**kw): 90 | if not'define_name'in kw: 91 | kw['define_name']='HAVE_LARGEFILE' 92 | if not'execute'in kw: 93 | kw['execute']=True 94 | if not'features'in kw: 95 | if self.env.CXX: 96 | kw['features']=['cxx','cxxprogram'] 97 | else: 98 | kw['features']=['c','cprogram'] 99 | kw['fragment']=LARGE_FRAGMENT 100 | kw['msg']='Checking for large file support' 101 | ret=True 102 | try: 103 | if self.env.DEST_BINFMT!='pe': 104 | ret=self.check(**kw) 105 | except self.errors.ConfigurationError: 106 | pass 107 | else: 108 | if ret: 109 | return True 110 | kw['msg']='Checking for -D_FILE_OFFSET_BITS=64' 111 | kw['defines']=['_FILE_OFFSET_BITS=64'] 112 | try: 113 | ret=self.check(**kw) 114 | except self.errors.ConfigurationError: 115 | pass 116 | else: 117 | self.define('_FILE_OFFSET_BITS',64) 118 | return ret 119 | self.fatal('There is no support for large files') 120 | ENDIAN_FRAGMENT=''' 121 | short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; 122 | short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; 123 | int use_ascii (int i) { 124 | return ascii_mm[i] + ascii_ii[i]; 125 | } 126 | short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; 127 | short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; 128 | int use_ebcdic (int i) { 129 | return ebcdic_mm[i] + ebcdic_ii[i]; 130 | } 131 | extern int foo; 132 | ''' 133 | class grep_for_endianness(Task.Task): 134 | color='PINK' 135 | def run(self): 136 | txt=self.inputs[0].read(flags='rb').decode('iso8859-1') 137 | if txt.find('LiTTleEnDian')>-1: 138 | self.generator.tmp.append('little') 139 | elif txt.find('BIGenDianSyS')>-1: 140 | self.generator.tmp.append('big') 141 | else: 142 | return-1 143 | @feature('grep_for_endianness') 144 | @after_method('process_source') 145 | def grep_for_endianness_fun(self): 146 | self.create_task('grep_for_endianness',self.compiled_tasks[0].outputs[0]) 147 | @conf 148 | def check_endianness(self): 149 | tmp=[] 150 | def check_msg(self): 151 | return tmp[0] 152 | self.check(fragment=ENDIAN_FRAGMENT,features='c grep_for_endianness',msg="Checking for endianness",define='ENDIANNESS',tmp=tmp,okmsg=check_msg) 153 | return tmp[0] 154 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/c_tests.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/c_tests.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/ccroot.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/ccroot.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/compiler_c.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os,sys,imp,types 6 | from waflib.Tools import ccroot 7 | from waflib import Utils,Configure 8 | from waflib.Logs import debug 9 | c_compiler={'win32':['msvc','gcc'],'cygwin':['gcc'],'darwin':['gcc'],'aix':['xlc','gcc'],'linux':['gcc','icc'],'sunos':['suncc','gcc'],'irix':['gcc','irixcc'],'hpux':['gcc'],'gnu':['gcc'],'java':['gcc','msvc','icc'],'default':['gcc'],} 10 | def configure(conf): 11 | try:test_for_compiler=conf.options.check_c_compiler 12 | except AttributeError:conf.fatal("Add options(opt): opt.load('compiler_c')") 13 | for compiler in test_for_compiler.split(): 14 | conf.env.stash() 15 | conf.start_msg('Checking for %r (c compiler)'%compiler) 16 | try: 17 | conf.load(compiler) 18 | except conf.errors.ConfigurationError ,e: 19 | conf.env.revert() 20 | conf.end_msg(False) 21 | debug('compiler_c: %r'%e) 22 | else: 23 | if conf.env['CC']: 24 | conf.end_msg(conf.env.get_flat('CC')) 25 | conf.env['COMPILER_CC']=compiler 26 | break 27 | conf.end_msg(False) 28 | else: 29 | conf.fatal('could not configure a c compiler!') 30 | def options(opt): 31 | opt.load_special_tools('c_*.py',ban=['c_dumbpreproc.py']) 32 | global c_compiler 33 | build_platform=Utils.unversioned_sys_platform() 34 | possible_compiler_list=c_compiler[build_platform in c_compiler and build_platform or'default'] 35 | test_for_compiler=' '.join(possible_compiler_list) 36 | cc_compiler_opts=opt.add_option_group("C Compiler Options") 37 | cc_compiler_opts.add_option('--check-c-compiler',default="%s"%test_for_compiler,help='On this platform (%s) the following C-Compiler will be checked by default: "%s"'%(build_platform,test_for_compiler),dest="check_c_compiler") 38 | for x in test_for_compiler.split(): 39 | opt.load('%s'%x) 40 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/compiler_c.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/compiler_c.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/compiler_cxx.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os,sys,imp,types 6 | from waflib.Tools import ccroot 7 | from waflib import Utils,Configure 8 | from waflib.Logs import debug 9 | cxx_compiler={'win32':['msvc','g++'],'cygwin':['g++'],'darwin':['g++'],'aix':['xlc++','g++'],'linux':['g++','icpc'],'sunos':['sunc++','g++'],'irix':['g++'],'hpux':['g++'],'gnu':['g++'],'java':['g++','msvc','icpc'],'default':['g++']} 10 | def configure(conf): 11 | try:test_for_compiler=conf.options.check_cxx_compiler 12 | except AttributeError:conf.fatal("Add options(opt): opt.load('compiler_cxx')") 13 | for compiler in test_for_compiler.split(): 14 | conf.env.stash() 15 | conf.start_msg('Checking for %r (c++ compiler)'%compiler) 16 | try: 17 | conf.load(compiler) 18 | except conf.errors.ConfigurationError ,e: 19 | conf.env.revert() 20 | conf.end_msg(False) 21 | debug('compiler_cxx: %r'%e) 22 | else: 23 | if conf.env['CXX']: 24 | conf.end_msg(conf.env.get_flat('CXX')) 25 | conf.env['COMPILER_CXX']=compiler 26 | break 27 | conf.end_msg(False) 28 | else: 29 | conf.fatal('could not configure a c++ compiler!') 30 | def options(opt): 31 | opt.load_special_tools('cxx_*.py') 32 | global cxx_compiler 33 | build_platform=Utils.unversioned_sys_platform() 34 | possible_compiler_list=cxx_compiler[build_platform in cxx_compiler and build_platform or'default'] 35 | test_for_compiler=' '.join(possible_compiler_list) 36 | cxx_compiler_opts=opt.add_option_group('C++ Compiler Options') 37 | cxx_compiler_opts.add_option('--check-cxx-compiler',default="%s"%test_for_compiler,help='On this platform (%s) the following C++ Compiler will be checked by default: "%s"'%(build_platform,test_for_compiler),dest="check_cxx_compiler") 38 | for x in test_for_compiler.split(): 39 | opt.load('%s'%x) 40 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/compiler_cxx.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/compiler_cxx.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/compiler_d.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os,sys,imp,types 6 | from waflib import Utils,Configure,Options,Logs 7 | def configure(conf): 8 | for compiler in conf.options.dcheck.split(','): 9 | conf.env.stash() 10 | conf.start_msg('Checking for %r (d compiler)'%compiler) 11 | try: 12 | conf.load(compiler) 13 | except conf.errors.ConfigurationError ,e: 14 | conf.env.revert() 15 | conf.end_msg(False) 16 | Logs.debug('compiler_d: %r'%e) 17 | else: 18 | if conf.env.D: 19 | conf.end_msg(conf.env.get_flat('D')) 20 | conf.env['COMPILER_D']=compiler 21 | break 22 | conf.end_msg(False) 23 | else: 24 | conf.fatal('no suitable d compiler was found') 25 | def options(opt): 26 | d_compiler_opts=opt.add_option_group('D Compiler Options') 27 | d_compiler_opts.add_option('--check-d-compiler',default='gdc,dmd,ldc2',action='store',help='check for the compiler [Default:gdc,dmd,ldc2]',dest='dcheck') 28 | for d_compiler in['gdc','dmd','ldc2']: 29 | opt.load('%s'%d_compiler) 30 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/compiler_fc.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os,sys,imp,types 6 | from waflib import Utils,Configure,Options,Logs,Errors 7 | from waflib.Tools import fc 8 | fc_compiler={'win32':['gfortran','ifort'],'darwin':['gfortran','g95','ifort'],'linux':['gfortran','g95','ifort'],'java':['gfortran','g95','ifort'],'default':['gfortran'],'aix':['gfortran']} 9 | def __list_possible_compiler(platform): 10 | try: 11 | return fc_compiler[platform] 12 | except KeyError: 13 | return fc_compiler["default"] 14 | def configure(conf): 15 | try:test_for_compiler=conf.options.check_fc 16 | except AttributeError:conf.fatal("Add options(opt): opt.load('compiler_fc')") 17 | for compiler in test_for_compiler.split(): 18 | conf.env.stash() 19 | conf.start_msg('Checking for %r (fortran compiler)'%compiler) 20 | try: 21 | conf.load(compiler) 22 | except conf.errors.ConfigurationError ,e: 23 | conf.env.revert() 24 | conf.end_msg(False) 25 | Logs.debug('compiler_fortran: %r'%e) 26 | else: 27 | if conf.env['FC']: 28 | conf.end_msg(conf.env.get_flat('FC')) 29 | conf.env.COMPILER_FORTRAN=compiler 30 | break 31 | conf.end_msg(False) 32 | else: 33 | conf.fatal('could not configure a fortran compiler!') 34 | def options(opt): 35 | opt.load_special_tools('fc_*.py') 36 | build_platform=Utils.unversioned_sys_platform() 37 | detected_platform=Options.platform 38 | possible_compiler_list=__list_possible_compiler(detected_platform) 39 | test_for_compiler=' '.join(possible_compiler_list) 40 | fortran_compiler_opts=opt.add_option_group("Fortran Compiler Options") 41 | fortran_compiler_opts.add_option('--check-fortran-compiler',default="%s"%test_for_compiler,help='On this platform (%s) the following Fortran Compiler will be checked by default: "%s"'%(detected_platform,test_for_compiler),dest="check_fc") 42 | for compiler in test_for_compiler.split(): 43 | opt.load('%s'%compiler) 44 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/cs.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | from waflib import Utils,Task,Options,Logs,Errors 6 | from waflib.TaskGen import before_method,after_method,feature 7 | from waflib.Tools import ccroot 8 | from waflib.Configure import conf 9 | import os,tempfile 10 | ccroot.USELIB_VARS['cs']=set(['CSFLAGS','ASSEMBLIES','RESOURCES']) 11 | ccroot.lib_patterns['csshlib']=['%s'] 12 | @feature('cs') 13 | @before_method('process_source') 14 | def apply_cs(self): 15 | cs_nodes=[] 16 | no_nodes=[] 17 | for x in self.to_nodes(self.source): 18 | if x.name.endswith('.cs'): 19 | cs_nodes.append(x) 20 | else: 21 | no_nodes.append(x) 22 | self.source=no_nodes 23 | bintype=getattr(self,'bintype',self.gen.endswith('.dll')and'library'or'exe') 24 | self.cs_task=tsk=self.create_task('mcs',cs_nodes,self.path.find_or_declare(self.gen)) 25 | tsk.env.CSTYPE='/target:%s'%bintype 26 | tsk.env.OUT='/out:%s'%tsk.outputs[0].abspath() 27 | self.env.append_value('CSFLAGS','/platform:%s'%getattr(self,'platform','anycpu')) 28 | inst_to=getattr(self,'install_path',bintype=='exe'and'${BINDIR}'or'${LIBDIR}') 29 | if inst_to: 30 | mod=getattr(self,'chmod',bintype=='exe'and Utils.O755 or Utils.O644) 31 | self.install_task=self.bld.install_files(inst_to,self.cs_task.outputs[:],env=self.env,chmod=mod) 32 | @feature('cs') 33 | @after_method('apply_cs') 34 | def use_cs(self): 35 | names=self.to_list(getattr(self,'use',[])) 36 | get=self.bld.get_tgen_by_name 37 | for x in names: 38 | try: 39 | y=get(x) 40 | except Errors.WafError: 41 | self.env.append_value('CSFLAGS','/reference:%s'%x) 42 | continue 43 | y.post() 44 | tsk=getattr(y,'cs_task',None)or getattr(y,'link_task',None) 45 | if not tsk: 46 | self.bld.fatal('cs task has no link task for use %r'%self) 47 | self.cs_task.dep_nodes.extend(tsk.outputs) 48 | self.cs_task.set_run_after(tsk) 49 | self.env.append_value('CSFLAGS','/reference:%s'%tsk.outputs[0].abspath()) 50 | @feature('cs') 51 | @after_method('apply_cs','use_cs') 52 | def debug_cs(self): 53 | csdebug=getattr(self,'csdebug',self.env.CSDEBUG) 54 | if not csdebug: 55 | return 56 | node=self.cs_task.outputs[0] 57 | if self.env.CS_NAME=='mono': 58 | out=node.parent.find_or_declare(node.name+'.mdb') 59 | else: 60 | out=node.change_ext('.pdb') 61 | self.cs_task.outputs.append(out) 62 | try: 63 | self.install_task.source.append(out) 64 | except AttributeError: 65 | pass 66 | if csdebug=='pdbonly': 67 | val=['/debug+','/debug:pdbonly'] 68 | elif csdebug=='full': 69 | val=['/debug+','/debug:full'] 70 | else: 71 | val=['/debug-'] 72 | self.env.append_value('CSFLAGS',val) 73 | class mcs(Task.Task): 74 | color='YELLOW' 75 | run_str='${MCS} ${CSTYPE} ${CSFLAGS} ${ASS_ST:ASSEMBLIES} ${RES_ST:RESOURCES} ${OUT} ${SRC}' 76 | def exec_command(self,cmd,**kw): 77 | bld=self.generator.bld 78 | try: 79 | if not kw.get('cwd',None): 80 | kw['cwd']=bld.cwd 81 | except AttributeError: 82 | bld.cwd=kw['cwd']=bld.variant_dir 83 | try: 84 | tmp=None 85 | if isinstance(cmd,list)and len(' '.join(cmd))>=8192: 86 | program=cmd[0] 87 | cmd=[self.quote_response_command(x)for x in cmd] 88 | (fd,tmp)=tempfile.mkstemp() 89 | os.write(fd,'\r\n'.join(i.replace('\\','\\\\')for i in cmd[1:])) 90 | os.close(fd) 91 | cmd=[program,'@'+tmp] 92 | ret=self.generator.bld.exec_command(cmd,**kw) 93 | finally: 94 | if tmp: 95 | try: 96 | os.remove(tmp) 97 | except OSError: 98 | pass 99 | return ret 100 | def quote_response_command(self,flag): 101 | if flag.lower()=='/noconfig': 102 | return'' 103 | if flag.find(' ')>-1: 104 | for x in('/r:','/reference:','/resource:','/lib:','/out:'): 105 | if flag.startswith(x): 106 | flag='%s"%s"'%(x,'","'.join(flag[len(x):].split(','))) 107 | break 108 | else: 109 | flag='"%s"'%flag 110 | return flag 111 | def configure(conf): 112 | csc=getattr(Options.options,'cscbinary',None) 113 | if csc: 114 | conf.env.MCS=csc 115 | conf.find_program(['csc','mcs','gmcs'],var='MCS') 116 | conf.env.ASS_ST='/r:%s' 117 | conf.env.RES_ST='/resource:%s' 118 | conf.env.CS_NAME='csc' 119 | if str(conf.env.MCS).lower().find('mcs')>-1: 120 | conf.env.CS_NAME='mono' 121 | def options(opt): 122 | opt.add_option('--with-csc-binary',type='string',dest='cscbinary') 123 | class fake_csshlib(Task.Task): 124 | color='YELLOW' 125 | inst_to=None 126 | def runnable_status(self): 127 | for x in self.outputs: 128 | x.sig=Utils.h_file(x.abspath()) 129 | return Task.SKIP_ME 130 | @conf 131 | def read_csshlib(self,name,paths=[]): 132 | return self(name=name,features='fake_lib',lib_paths=paths,lib_type='csshlib') 133 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/cxx.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | from waflib import TaskGen,Task,Utils 6 | from waflib.Tools import c_preproc 7 | from waflib.Tools.ccroot import link_task,stlink_task 8 | @TaskGen.extension('.cpp','.cc','.cxx','.C','.c++') 9 | def cxx_hook(self,node): 10 | return self.create_compiled_task('cxx',node) 11 | if not'.c'in TaskGen.task_gen.mappings: 12 | TaskGen.task_gen.mappings['.c']=TaskGen.task_gen.mappings['.cpp'] 13 | class cxx(Task.Task): 14 | run_str='${CXX} ${ARCH_ST:ARCH} ${CXXFLAGS} ${CPPFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CXX_SRC_F}${SRC} ${CXX_TGT_F}${TGT}' 15 | vars=['CXXDEPS'] 16 | ext_in=['.h'] 17 | scan=c_preproc.scan 18 | class cxxprogram(link_task): 19 | run_str='${LINK_CXX} ${LINKFLAGS} ${CXXLNK_SRC_F}${SRC} ${CXXLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${FRAMEWORK_ST:FRAMEWORK} ${ARCH_ST:ARCH} ${STLIB_MARKER} ${STLIBPATH_ST:STLIBPATH} ${STLIB_ST:STLIB} ${SHLIB_MARKER} ${LIBPATH_ST:LIBPATH} ${LIB_ST:LIB}' 20 | vars=['LINKDEPS'] 21 | ext_out=['.bin'] 22 | inst_to='${BINDIR}' 23 | class cxxshlib(cxxprogram): 24 | inst_to='${LIBDIR}' 25 | class cxxstlib(stlink_task): 26 | pass 27 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/cxx.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/cxx.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/d.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | from waflib import Utils,Task,Errors 6 | from waflib.TaskGen import taskgen_method,feature,extension 7 | from waflib.Tools import d_scan,d_config 8 | from waflib.Tools.ccroot import link_task,stlink_task 9 | class d(Task.Task): 10 | color='GREEN' 11 | run_str='${D} ${DFLAGS} ${DINC_ST:INCPATHS} ${D_SRC_F:SRC} ${D_TGT_F:TGT}' 12 | scan=d_scan.scan 13 | class d_with_header(d): 14 | run_str='${D} ${DFLAGS} ${DINC_ST:INCPATHS} ${D_HDR_F:tgt.outputs[1].bldpath()} ${D_SRC_F:SRC} ${D_TGT_F:tgt.outputs[0].bldpath()}' 15 | class d_header(Task.Task): 16 | color='BLUE' 17 | run_str='${D} ${D_HEADER} ${SRC}' 18 | class dprogram(link_task): 19 | run_str='${D_LINKER} ${LINKFLAGS} ${DLNK_SRC_F}${SRC} ${DLNK_TGT_F:TGT} ${RPATH_ST:RPATH} ${DSTLIB_MARKER} ${DSTLIBPATH_ST:STLIBPATH} ${DSTLIB_ST:STLIB} ${DSHLIB_MARKER} ${DLIBPATH_ST:LIBPATH} ${DSHLIB_ST:LIB}' 20 | inst_to='${BINDIR}' 21 | class dshlib(dprogram): 22 | inst_to='${LIBDIR}' 23 | class dstlib(stlink_task): 24 | pass 25 | @extension('.d','.di','.D') 26 | def d_hook(self,node): 27 | ext=Utils.destos_to_binfmt(self.env.DEST_OS)=='pe'and'obj'or'o' 28 | out='%s.%d.%s'%(node.name,self.idx,ext) 29 | def create_compiled_task(self,name,node): 30 | task=self.create_task(name,node,node.parent.find_or_declare(out)) 31 | try: 32 | self.compiled_tasks.append(task) 33 | except AttributeError: 34 | self.compiled_tasks=[task] 35 | return task 36 | if getattr(self,'generate_headers',None): 37 | tsk=create_compiled_task(self,'d_with_header',node) 38 | tsk.outputs.append(node.change_ext(self.env['DHEADER_ext'])) 39 | else: 40 | tsk=create_compiled_task(self,'d',node) 41 | return tsk 42 | @taskgen_method 43 | def generate_header(self,filename): 44 | try: 45 | self.header_lst.append([filename,self.install_path]) 46 | except AttributeError: 47 | self.header_lst=[[filename,self.install_path]] 48 | @feature('d') 49 | def process_header(self): 50 | for i in getattr(self,'header_lst',[]): 51 | node=self.path.find_resource(i[0]) 52 | if not node: 53 | raise Errors.WafError('file %r not found on d obj'%i[0]) 54 | self.create_task('d_header',node,node.change_ext('.di')) 55 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/d_config.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | from waflib import Utils 6 | from waflib.Configure import conf 7 | @conf 8 | def d_platform_flags(self): 9 | v=self.env 10 | if not v.DEST_OS: 11 | v.DEST_OS=Utils.unversioned_sys_platform() 12 | binfmt=Utils.destos_to_binfmt(self.env.DEST_OS) 13 | if binfmt=='pe': 14 | v['dprogram_PATTERN']='%s.exe' 15 | v['dshlib_PATTERN']='lib%s.dll' 16 | v['dstlib_PATTERN']='lib%s.a' 17 | elif binfmt=='mac-o': 18 | v['dprogram_PATTERN']='%s' 19 | v['dshlib_PATTERN']='lib%s.dylib' 20 | v['dstlib_PATTERN']='lib%s.a' 21 | else: 22 | v['dprogram_PATTERN']='%s' 23 | v['dshlib_PATTERN']='lib%s.so' 24 | v['dstlib_PATTERN']='lib%s.a' 25 | DLIB=''' 26 | version(D_Version2) { 27 | import std.stdio; 28 | int main() { 29 | writefln("phobos2"); 30 | return 0; 31 | } 32 | } else { 33 | version(Tango) { 34 | import tango.stdc.stdio; 35 | int main() { 36 | printf("tango"); 37 | return 0; 38 | } 39 | } else { 40 | import std.stdio; 41 | int main() { 42 | writefln("phobos1"); 43 | return 0; 44 | } 45 | } 46 | } 47 | ''' 48 | @conf 49 | def check_dlibrary(self,execute=True): 50 | ret=self.check_cc(features='d dprogram',fragment=DLIB,compile_filename='test.d',execute=execute,define_ret=True) 51 | if execute: 52 | self.env.DLIBRARY=ret.strip() 53 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/d_scan.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import re 6 | from waflib import Utils,Logs 7 | def filter_comments(filename): 8 | txt=Utils.readf(filename) 9 | i=0 10 | buf=[] 11 | max=len(txt) 12 | begin=0 13 | while i-1: 45 | conf.fatal('dmd2 on Windows is not supported, use gdc or ldc2 instead') 46 | conf.load('ar') 47 | conf.load('d') 48 | conf.common_flags_dmd() 49 | conf.d_platform_flags() 50 | if str(conf.env.D).find('ldc')>-1: 51 | conf.common_flags_ldc() 52 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/errcheck.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | typos={'feature':'features','sources':'source','targets':'target','include':'includes','export_include':'export_includes','define':'defines','importpath':'includes','installpath':'install_path','iscopy':'is_copy',} 6 | meths_typos=['__call__','program','shlib','stlib','objects'] 7 | from waflib import Logs,Build,Node,Task,TaskGen,ConfigSet,Errors,Utils 8 | import waflib.Tools.ccroot 9 | def check_same_targets(self): 10 | mp=Utils.defaultdict(list) 11 | uids={} 12 | def check_task(tsk): 13 | if not isinstance(tsk,Task.Task): 14 | return 15 | for node in tsk.outputs: 16 | mp[node].append(tsk) 17 | try: 18 | uids[tsk.uid()].append(tsk) 19 | except KeyError: 20 | uids[tsk.uid()]=[tsk] 21 | for g in self.groups: 22 | for tg in g: 23 | try: 24 | for tsk in tg.tasks: 25 | check_task(tsk) 26 | except AttributeError: 27 | check_task(tg) 28 | dupe=False 29 | for(k,v)in mp.items(): 30 | if len(v)>1: 31 | dupe=True 32 | msg='* Node %r is created more than once%s. The task generators are:'%(k,Logs.verbose==1 and" (full message on 'waf -v -v')"or"") 33 | Logs.error(msg) 34 | for x in v: 35 | if Logs.verbose>1: 36 | Logs.error(' %d. %r'%(1+v.index(x),x.generator)) 37 | else: 38 | Logs.error(' %d. %r in %r'%(1+v.index(x),x.generator.name,getattr(x.generator,'path',None))) 39 | if not dupe: 40 | for(k,v)in uids.items(): 41 | if len(v)>1: 42 | Logs.error('* Several tasks use the same identifier. Please check the information on\n http://docs.waf.googlecode.com/git/apidocs_16/Task.html#waflib.Task.Task.uid') 43 | for tsk in v: 44 | Logs.error(' - object %r (%r) defined in %r'%(tsk.__class__.__name__,tsk,tsk.generator)) 45 | def check_invalid_constraints(self): 46 | feat=set([]) 47 | for x in list(TaskGen.feats.values()): 48 | feat.union(set(x)) 49 | for(x,y)in TaskGen.task_gen.prec.items(): 50 | feat.add(x) 51 | feat.union(set(y)) 52 | ext=set([]) 53 | for x in TaskGen.task_gen.mappings.values(): 54 | ext.add(x.__name__) 55 | invalid=ext&feat 56 | if invalid: 57 | Logs.error('The methods %r have invalid annotations: @extension <-> @feature/@before_method/@after_method'%list(invalid)) 58 | for cls in list(Task.classes.values()): 59 | for x in('before','after'): 60 | for y in Utils.to_list(getattr(cls,x,[])): 61 | if not Task.classes.get(y,None): 62 | Logs.error('Erroneous order constraint %r=%r on task class %r'%(x,y,cls.__name__)) 63 | if getattr(cls,'rule',None): 64 | Logs.error('Erroneous attribute "rule" on task class %r (rename to "run_str")'%cls.__name__) 65 | def replace(m): 66 | oldcall=getattr(Build.BuildContext,m) 67 | def call(self,*k,**kw): 68 | ret=oldcall(self,*k,**kw) 69 | for x in typos: 70 | if x in kw: 71 | if x=='iscopy'and'subst'in getattr(self,'features',''): 72 | continue 73 | err=True 74 | Logs.error('Fix the typo %r -> %r on %r'%(x,typos[x],ret)) 75 | return ret 76 | setattr(Build.BuildContext,m,call) 77 | def enhance_lib(): 78 | for m in meths_typos: 79 | replace(m) 80 | def ant_glob(self,*k,**kw): 81 | if k: 82 | lst=Utils.to_list(k[0]) 83 | for pat in lst: 84 | if'..'in pat.split('/'): 85 | Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'"%k[0]) 86 | if kw.get('remove',True): 87 | try: 88 | if self.is_child_of(self.ctx.bldnode)and not kw.get('quiet',False): 89 | Logs.error('Using ant_glob on the build folder (%r) is dangerous (quiet=True to disable this warning)'%self) 90 | except AttributeError: 91 | pass 92 | return self.old_ant_glob(*k,**kw) 93 | Node.Node.old_ant_glob=Node.Node.ant_glob 94 | Node.Node.ant_glob=ant_glob 95 | old=Task.is_before 96 | def is_before(t1,t2): 97 | ret=old(t1,t2) 98 | if ret and old(t2,t1): 99 | Logs.error('Contradictory order constraints in classes %r %r'%(t1,t2)) 100 | return ret 101 | Task.is_before=is_before 102 | def check_err_features(self): 103 | lst=self.to_list(self.features) 104 | if'shlib'in lst: 105 | Logs.error('feature shlib -> cshlib, dshlib or cxxshlib') 106 | for x in('c','cxx','d','fc'): 107 | if not x in lst and lst and lst[0]in[x+y for y in('program','shlib','stlib')]: 108 | Logs.error('%r features is probably missing %r'%(self,x)) 109 | TaskGen.feature('*')(check_err_features) 110 | def check_err_order(self): 111 | if not hasattr(self,'rule')and not'subst'in Utils.to_list(self.features): 112 | for x in('before','after','ext_in','ext_out'): 113 | if hasattr(self,x): 114 | Logs.warn('Erroneous order constraint %r on non-rule based task generator %r'%(x,self)) 115 | else: 116 | for x in('before','after'): 117 | for y in self.to_list(getattr(self,x,[])): 118 | if not Task.classes.get(y,None): 119 | Logs.error('Erroneous order constraint %s=%r on %r (no such class)'%(x,y,self)) 120 | TaskGen.feature('*')(check_err_order) 121 | def check_compile(self): 122 | check_invalid_constraints(self) 123 | try: 124 | ret=self.orig_compile() 125 | finally: 126 | check_same_targets(self) 127 | return ret 128 | Build.BuildContext.orig_compile=Build.BuildContext.compile 129 | Build.BuildContext.compile=check_compile 130 | def use_rec(self,name,**kw): 131 | try: 132 | y=self.bld.get_tgen_by_name(name) 133 | except Errors.WafError: 134 | pass 135 | else: 136 | idx=self.bld.get_group_idx(self) 137 | odx=self.bld.get_group_idx(y) 138 | if odx>idx: 139 | msg="Invalid 'use' across build groups:" 140 | if Logs.verbose>1: 141 | msg+='\n target %r\n uses:\n %r'%(self,y) 142 | else: 143 | msg+=" %r uses %r (try 'waf -v -v' for the full error)"%(self.name,name) 144 | raise Errors.WafError(msg) 145 | self.orig_use_rec(name,**kw) 146 | TaskGen.task_gen.orig_use_rec=TaskGen.task_gen.use_rec 147 | TaskGen.task_gen.use_rec=use_rec 148 | def getattri(self,name,default=None): 149 | if name=='append'or name=='add': 150 | raise Errors.WafError('env.append and env.add do not exist: use env.append_value/env.append_unique') 151 | elif name=='prepend': 152 | raise Errors.WafError('env.prepend does not exist: use env.prepend_value') 153 | if name in self.__slots__: 154 | return object.__getattr__(self,name,default) 155 | else: 156 | return self[name] 157 | ConfigSet.ConfigSet.__getattr__=getattri 158 | def options(opt): 159 | enhance_lib() 160 | def configure(conf): 161 | pass 162 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/fc.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import re 6 | from waflib import Utils,Task,TaskGen,Logs 7 | from waflib.Tools import ccroot,fc_config,fc_scan 8 | from waflib.TaskGen import feature,before_method,after_method,extension 9 | from waflib.Configure import conf 10 | ccroot.USELIB_VARS['fc']=set(['FCFLAGS','DEFINES','INCLUDES']) 11 | ccroot.USELIB_VARS['fcprogram_test']=ccroot.USELIB_VARS['fcprogram']=set(['LIB','STLIB','LIBPATH','STLIBPATH','LINKFLAGS','RPATH','LINKDEPS']) 12 | ccroot.USELIB_VARS['fcshlib']=set(['LIB','STLIB','LIBPATH','STLIBPATH','LINKFLAGS','RPATH','LINKDEPS']) 13 | ccroot.USELIB_VARS['fcstlib']=set(['ARFLAGS','LINKDEPS']) 14 | @feature('fcprogram','fcshlib','fcstlib','fcprogram_test') 15 | def dummy(self): 16 | pass 17 | @extension('.f','.f90','.F','.F90','.for','.FOR') 18 | def fc_hook(self,node): 19 | return self.create_compiled_task('fc',node) 20 | @conf 21 | def modfile(conf,name): 22 | return{'lower':name.lower()+'.mod','lower.MOD':name.upper()+'.MOD','UPPER.mod':name.upper()+'.mod','UPPER':name.upper()+'.MOD'}[conf.env.FC_MOD_CAPITALIZATION or'lower'] 23 | def get_fortran_tasks(tsk): 24 | bld=tsk.generator.bld 25 | tasks=bld.get_tasks_group(bld.get_group_idx(tsk.generator)) 26 | return[x for x in tasks if isinstance(x,fc)and not getattr(x,'nomod',None)and not getattr(x,'mod_fortran_done',None)] 27 | class fc(Task.Task): 28 | color='GREEN' 29 | run_str='${FC} ${FCFLAGS} ${FCINCPATH_ST:INCPATHS} ${FCDEFINES_ST:DEFINES} ${_FCMODOUTFLAGS} ${FC_TGT_F}${TGT[0].abspath()} ${FC_SRC_F}${SRC[0].abspath()}' 30 | vars=["FORTRANMODPATHFLAG"] 31 | def scan(self): 32 | tmp=fc_scan.fortran_parser(self.generator.includes_nodes) 33 | tmp.task=self 34 | tmp.start(self.inputs[0]) 35 | if Logs.verbose: 36 | Logs.debug('deps: deps for %r: %r; unresolved %r'%(self.inputs,tmp.nodes,tmp.names)) 37 | return(tmp.nodes,tmp.names) 38 | def runnable_status(self): 39 | if getattr(self,'mod_fortran_done',None): 40 | return super(fc,self).runnable_status() 41 | bld=self.generator.bld 42 | lst=get_fortran_tasks(self) 43 | for tsk in lst: 44 | tsk.mod_fortran_done=True 45 | for tsk in lst: 46 | ret=tsk.runnable_status() 47 | if ret==Task.ASK_LATER: 48 | for x in lst: 49 | x.mod_fortran_done=None 50 | return Task.ASK_LATER 51 | ins=Utils.defaultdict(set) 52 | outs=Utils.defaultdict(set) 53 | for tsk in lst: 54 | key=tsk.uid() 55 | for x in bld.raw_deps[key]: 56 | if x.startswith('MOD@'): 57 | name=bld.modfile(x.replace('MOD@','')) 58 | node=bld.srcnode.find_or_declare(name) 59 | tsk.set_outputs(node) 60 | outs[id(node)].add(tsk) 61 | for tsk in lst: 62 | key=tsk.uid() 63 | for x in bld.raw_deps[key]: 64 | if x.startswith('USE@'): 65 | name=bld.modfile(x.replace('USE@','')) 66 | node=bld.srcnode.find_resource(name) 67 | if node and node not in tsk.outputs: 68 | if not node in bld.node_deps[key]: 69 | bld.node_deps[key].append(node) 70 | ins[id(node)].add(tsk) 71 | for k in ins.keys(): 72 | for a in ins[k]: 73 | a.run_after.update(outs[k]) 74 | tmp=[] 75 | for t in outs[k]: 76 | tmp.extend(t.outputs) 77 | a.dep_nodes.extend(tmp) 78 | a.dep_nodes.sort(key=lambda x:x.abspath()) 79 | for tsk in lst: 80 | try: 81 | delattr(tsk,'cache_sig') 82 | except AttributeError: 83 | pass 84 | return super(fc,self).runnable_status() 85 | class fcprogram(ccroot.link_task): 86 | color='YELLOW' 87 | run_str='${FC} ${LINKFLAGS} ${FCLNK_SRC_F}${SRC} ${FCLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FCSTLIB_MARKER} ${FCSTLIBPATH_ST:STLIBPATH} ${FCSTLIB_ST:STLIB} ${FCSHLIB_MARKER} ${FCLIBPATH_ST:LIBPATH} ${FCLIB_ST:LIB}' 88 | inst_to='${BINDIR}' 89 | class fcshlib(fcprogram): 90 | inst_to='${LIBDIR}' 91 | class fcprogram_test(fcprogram): 92 | def can_retrieve_cache(self): 93 | return False 94 | def runnable_status(self): 95 | ret=super(fcprogram_test,self).runnable_status() 96 | if ret==Task.SKIP_ME: 97 | ret=Task.RUN_ME 98 | return ret 99 | def exec_command(self,cmd,**kw): 100 | bld=self.generator.bld 101 | kw['shell']=isinstance(cmd,str) 102 | kw['stdout']=kw['stderr']=Utils.subprocess.PIPE 103 | kw['cwd']=bld.variant_dir 104 | bld.out=bld.err='' 105 | bld.to_log('command: %s\n'%cmd) 106 | kw['output']=0 107 | try: 108 | (bld.out,bld.err)=bld.cmd_and_log(cmd,**kw) 109 | except Exception ,e: 110 | return-1 111 | if bld.out: 112 | bld.to_log("out: %s\n"%bld.out) 113 | if bld.err: 114 | bld.to_log("err: %s\n"%bld.err) 115 | class fcstlib(ccroot.stlink_task): 116 | pass 117 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/fc_scan.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import re 6 | from waflib import Utils,Task,TaskGen,Logs 7 | from waflib.TaskGen import feature,before_method,after_method,extension 8 | from waflib.Configure import conf 9 | INC_REGEX="""(?:^|['">]\s*;)\s*(?:|#\s*)INCLUDE\s+(?:\w+_)?[<"'](.+?)(?=["'>])""" 10 | USE_REGEX="""(?:^|;)\s*USE(?:\s+|(?:(?:\s*,\s*(?:NON_)?INTRINSIC)?\s*::))\s*(\w+)""" 11 | MOD_REGEX="""(?:^|;)\s*MODULE(?!\s*PROCEDURE)(?:\s+|(?:(?:\s*,\s*(?:NON_)?INTRINSIC)?\s*::))\s*(\w+)""" 12 | re_inc=re.compile(INC_REGEX,re.I) 13 | re_use=re.compile(USE_REGEX,re.I) 14 | re_mod=re.compile(MOD_REGEX,re.I) 15 | class fortran_parser(object): 16 | def __init__(self,incpaths): 17 | self.seen=[] 18 | self.nodes=[] 19 | self.names=[] 20 | self.incpaths=incpaths 21 | def find_deps(self,node): 22 | txt=node.read() 23 | incs=[] 24 | uses=[] 25 | mods=[] 26 | for line in txt.splitlines(): 27 | m=re_inc.search(line) 28 | if m: 29 | incs.append(m.group(1)) 30 | m=re_use.search(line) 31 | if m: 32 | uses.append(m.group(1)) 33 | m=re_mod.search(line) 34 | if m: 35 | mods.append(m.group(1)) 36 | return(incs,uses,mods) 37 | def start(self,node): 38 | self.waiting=[node] 39 | while self.waiting: 40 | nd=self.waiting.pop(0) 41 | self.iter(nd) 42 | def iter(self,node): 43 | path=node.abspath() 44 | incs,uses,mods=self.find_deps(node) 45 | for x in incs: 46 | if x in self.seen: 47 | continue 48 | self.seen.append(x) 49 | self.tryfind_header(x) 50 | for x in uses: 51 | name="USE@%s"%x 52 | if not name in self.names: 53 | self.names.append(name) 54 | for x in mods: 55 | name="MOD@%s"%x 56 | if not name in self.names: 57 | self.names.append(name) 58 | def tryfind_header(self,filename): 59 | found=None 60 | for n in self.incpaths: 61 | found=n.find_resource(filename) 62 | if found: 63 | self.nodes.append(found) 64 | self.waiting.append(found) 65 | break 66 | if not found: 67 | if not filename in self.names: 68 | self.names.append(filename) 69 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/flex.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import waflib.TaskGen,os,re 6 | def decide_ext(self,node): 7 | if'cxx'in self.features: 8 | return['.lex.cc'] 9 | return['.lex.c'] 10 | def flexfun(tsk): 11 | env=tsk.env 12 | bld=tsk.generator.bld 13 | wd=bld.variant_dir 14 | def to_list(xx): 15 | if isinstance(xx,str):return[xx] 16 | return xx 17 | tsk.last_cmd=lst=[] 18 | lst.extend(to_list(env['FLEX'])) 19 | lst.extend(to_list(env['FLEXFLAGS'])) 20 | inputs=[a.path_from(bld.bldnode)for a in tsk.inputs] 21 | if env.FLEX_MSYS: 22 | inputs=[x.replace(os.sep,'/')for x in inputs] 23 | lst.extend(inputs) 24 | lst=[x for x in lst if x] 25 | txt=bld.cmd_and_log(lst,cwd=wd,env=env.env or None,quiet=0) 26 | tsk.outputs[0].write(txt.replace('\r\n','\n').replace('\r','\n')) 27 | waflib.TaskGen.declare_chain(name='flex',rule=flexfun,ext_in='.l',decider=decide_ext,) 28 | def configure(conf): 29 | conf.find_program('flex',var='FLEX') 30 | conf.env.FLEXFLAGS=['-t'] 31 | if re.search(r"\\msys\\[0-9.]+\\bin\\flex.exe$",conf.env.FLEX): 32 | conf.env.FLEX_MSYS=True 33 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/g95.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import re 6 | from waflib import Utils 7 | from waflib.Tools import fc,fc_config,fc_scan,ar 8 | from waflib.Configure import conf 9 | @conf 10 | def find_g95(conf): 11 | fc=conf.find_program('g95',var='FC') 12 | fc=conf.cmd_to_list(fc) 13 | conf.get_g95_version(fc) 14 | conf.env.FC_NAME='G95' 15 | @conf 16 | def g95_flags(conf): 17 | v=conf.env 18 | v['FCFLAGS_fcshlib']=['-fPIC'] 19 | v['FORTRANMODFLAG']=['-fmod=',''] 20 | v['FCFLAGS_DEBUG']=['-Werror'] 21 | @conf 22 | def g95_modifier_win32(conf): 23 | fc_config.fortran_modifier_win32(conf) 24 | @conf 25 | def g95_modifier_cygwin(conf): 26 | fc_config.fortran_modifier_cygwin(conf) 27 | @conf 28 | def g95_modifier_darwin(conf): 29 | fc_config.fortran_modifier_darwin(conf) 30 | @conf 31 | def g95_modifier_platform(conf): 32 | dest_os=conf.env['DEST_OS']or Utils.unversioned_sys_platform() 33 | g95_modifier_func=getattr(conf,'g95_modifier_'+dest_os,None) 34 | if g95_modifier_func: 35 | g95_modifier_func() 36 | @conf 37 | def get_g95_version(conf,fc): 38 | version_re=re.compile(r"g95\s*(?P\d*)\.(?P\d*)").search 39 | cmd=fc+['--version'] 40 | out,err=fc_config.getoutput(conf,cmd,stdin=False) 41 | if out: 42 | match=version_re(out) 43 | else: 44 | match=version_re(err) 45 | if not match: 46 | conf.fatal('cannot determine g95 version') 47 | k=match.groupdict() 48 | conf.env['FC_VERSION']=(k['major'],k['minor']) 49 | def configure(conf): 50 | conf.find_g95() 51 | conf.find_ar() 52 | conf.fc_flags() 53 | conf.fc_add_flags() 54 | conf.g95_flags() 55 | conf.g95_modifier_platform() 56 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/gas.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import waflib.Tools.asm 6 | from waflib.Tools import ar 7 | def configure(conf): 8 | conf.find_program(['gas','gcc'],var='AS') 9 | conf.env.AS_TGT_F=['-c','-o'] 10 | conf.env.ASLNK_TGT_F=['-o'] 11 | conf.find_ar() 12 | conf.load('asm') 13 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/gcc.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | from waflib.Tools import ccroot,ar 6 | from waflib.Configure import conf 7 | @conf 8 | def find_gcc(conf): 9 | cc=conf.find_program(['gcc','cc'],var='CC') 10 | cc=conf.cmd_to_list(cc) 11 | conf.get_cc_version(cc,gcc=True) 12 | conf.env.CC_NAME='gcc' 13 | conf.env.CC=cc 14 | @conf 15 | def gcc_common_flags(conf): 16 | v=conf.env 17 | v['CC_SRC_F']=[] 18 | v['CC_TGT_F']=['-c','-o'] 19 | if not v['LINK_CC']:v['LINK_CC']=v['CC'] 20 | v['CCLNK_SRC_F']=[] 21 | v['CCLNK_TGT_F']=['-o'] 22 | v['CPPPATH_ST']='-I%s' 23 | v['DEFINES_ST']='-D%s' 24 | v['LIB_ST']='-l%s' 25 | v['LIBPATH_ST']='-L%s' 26 | v['STLIB_ST']='-l%s' 27 | v['STLIBPATH_ST']='-L%s' 28 | v['RPATH_ST']='-Wl,-rpath,%s' 29 | v['SONAME_ST']='-Wl,-h,%s' 30 | v['SHLIB_MARKER']='-Wl,-Bdynamic' 31 | v['STLIB_MARKER']='-Wl,-Bstatic' 32 | v['cprogram_PATTERN']='%s' 33 | v['CFLAGS_cshlib']=['-fPIC'] 34 | v['LINKFLAGS_cshlib']=['-shared'] 35 | v['cshlib_PATTERN']='lib%s.so' 36 | v['LINKFLAGS_cstlib']=['-Wl,-Bstatic'] 37 | v['cstlib_PATTERN']='lib%s.a' 38 | v['LINKFLAGS_MACBUNDLE']=['-bundle','-undefined','dynamic_lookup'] 39 | v['CFLAGS_MACBUNDLE']=['-fPIC'] 40 | v['macbundle_PATTERN']='%s.bundle' 41 | @conf 42 | def gcc_modifier_win32(conf): 43 | v=conf.env 44 | v['cprogram_PATTERN']='%s.exe' 45 | v['cshlib_PATTERN']='%s.dll' 46 | v['implib_PATTERN']='lib%s.dll.a' 47 | v['IMPLIB_ST']='-Wl,--out-implib,%s' 48 | v['CFLAGS_cshlib']=[] 49 | v.append_value('LINKFLAGS',['-Wl,--enable-auto-import']) 50 | @conf 51 | def gcc_modifier_cygwin(conf): 52 | gcc_modifier_win32(conf) 53 | v=conf.env 54 | v['cshlib_PATTERN']='cyg%s.dll' 55 | v.append_value('LINKFLAGS_cshlib',['-Wl,--enable-auto-image-base']) 56 | v['CFLAGS_cshlib']=[] 57 | @conf 58 | def gcc_modifier_darwin(conf): 59 | v=conf.env 60 | v['CFLAGS_cshlib']=['-fPIC'] 61 | v['LINKFLAGS_cshlib']=['-dynamiclib','-Wl,-compatibility_version,1','-Wl,-current_version,1'] 62 | v['cshlib_PATTERN']='lib%s.dylib' 63 | v['FRAMEWORKPATH_ST']='-F%s' 64 | v['FRAMEWORK_ST']=['-framework'] 65 | v['ARCH_ST']=['-arch'] 66 | v['LINKFLAGS_cstlib']=[] 67 | v['SHLIB_MARKER']=[] 68 | v['STLIB_MARKER']=[] 69 | v['SONAME_ST']=[] 70 | @conf 71 | def gcc_modifier_aix(conf): 72 | v=conf.env 73 | v['LINKFLAGS_cprogram']=['-Wl,-brtl'] 74 | v['LINKFLAGS_cshlib']=['-shared','-Wl,-brtl,-bexpfull'] 75 | v['SHLIB_MARKER']=[] 76 | @conf 77 | def gcc_modifier_hpux(conf): 78 | v=conf.env 79 | v['SHLIB_MARKER']=[] 80 | v['STLIB_MARKER']='-Bstatic' 81 | v['CFLAGS_cshlib']=['-fPIC','-DPIC'] 82 | v['cshlib_PATTERN']='lib%s.sl' 83 | @conf 84 | def gcc_modifier_openbsd(conf): 85 | conf.env.SONAME_ST=[] 86 | @conf 87 | def gcc_modifier_platform(conf): 88 | gcc_modifier_func=getattr(conf,'gcc_modifier_'+conf.env.DEST_OS,None) 89 | if gcc_modifier_func: 90 | gcc_modifier_func() 91 | def configure(conf): 92 | conf.find_gcc() 93 | conf.find_ar() 94 | conf.gcc_common_flags() 95 | conf.gcc_modifier_platform() 96 | conf.cc_load_tools() 97 | conf.cc_add_flags() 98 | conf.link_add_flags() 99 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/gcc.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/gcc.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/gdc.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import sys 6 | from waflib.Tools import ar,d 7 | from waflib.Configure import conf 8 | @conf 9 | def find_gdc(conf): 10 | conf.find_program('gdc',var='D') 11 | out=conf.cmd_and_log([conf.env.D,'--version']) 12 | if out.find("gdc ")==-1: 13 | conf.fatal("detected compiler is not gdc") 14 | @conf 15 | def common_flags_gdc(conf): 16 | v=conf.env 17 | v['DFLAGS']=[] 18 | v['D_SRC_F']=['-c'] 19 | v['D_TGT_F']='-o%s' 20 | v['D_LINKER']=v['D'] 21 | v['DLNK_SRC_F']='' 22 | v['DLNK_TGT_F']='-o%s' 23 | v['DINC_ST']='-I%s' 24 | v['DSHLIB_MARKER']=v['DSTLIB_MARKER']='' 25 | v['DSTLIB_ST']=v['DSHLIB_ST']='-l%s' 26 | v['DSTLIBPATH_ST']=v['DLIBPATH_ST']='-L%s' 27 | v['LINKFLAGS_dshlib']=['-shared'] 28 | v['DHEADER_ext']='.di' 29 | v.DFLAGS_d_with_header='-fintfc' 30 | v['D_HDR_F']='-fintfc-file=%s' 31 | def configure(conf): 32 | conf.find_gdc() 33 | conf.load('ar') 34 | conf.load('d') 35 | conf.common_flags_gdc() 36 | conf.d_platform_flags() 37 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/gfortran.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import re 6 | from waflib import Utils 7 | from waflib.Tools import fc,fc_config,fc_scan,ar 8 | from waflib.Configure import conf 9 | @conf 10 | def find_gfortran(conf): 11 | fc=conf.find_program(['gfortran','g77'],var='FC') 12 | fc=conf.cmd_to_list(fc) 13 | conf.get_gfortran_version(fc) 14 | conf.env.FC_NAME='GFORTRAN' 15 | @conf 16 | def gfortran_flags(conf): 17 | v=conf.env 18 | v['FCFLAGS_fcshlib']=['-fPIC'] 19 | v['FORTRANMODFLAG']=['-J',''] 20 | v['FCFLAGS_DEBUG']=['-Werror'] 21 | @conf 22 | def gfortran_modifier_win32(conf): 23 | fc_config.fortran_modifier_win32(conf) 24 | @conf 25 | def gfortran_modifier_cygwin(conf): 26 | fc_config.fortran_modifier_cygwin(conf) 27 | @conf 28 | def gfortran_modifier_darwin(conf): 29 | fc_config.fortran_modifier_darwin(conf) 30 | @conf 31 | def gfortran_modifier_platform(conf): 32 | dest_os=conf.env['DEST_OS']or Utils.unversioned_sys_platform() 33 | gfortran_modifier_func=getattr(conf,'gfortran_modifier_'+dest_os,None) 34 | if gfortran_modifier_func: 35 | gfortran_modifier_func() 36 | @conf 37 | def get_gfortran_version(conf,fc): 38 | version_re=re.compile(r"GNU\s*Fortran",re.I).search 39 | cmd=fc+['--version'] 40 | out,err=fc_config.getoutput(conf,cmd,stdin=False) 41 | if out:match=version_re(out) 42 | else:match=version_re(err) 43 | if not match: 44 | conf.fatal('Could not determine the compiler type') 45 | cmd=fc+['-dM','-E','-'] 46 | out,err=fc_config.getoutput(conf,cmd,stdin=True) 47 | if out.find('__GNUC__')<0: 48 | conf.fatal('Could not determine the compiler type') 49 | k={} 50 | out=out.split('\n') 51 | import shlex 52 | for line in out: 53 | lst=shlex.split(line) 54 | if len(lst)>2: 55 | key=lst[1] 56 | val=lst[2] 57 | k[key]=val 58 | def isD(var): 59 | return var in k 60 | def isT(var): 61 | return var in k and k[var]!='0' 62 | conf.env['FC_VERSION']=(k['__GNUC__'],k['__GNUC_MINOR__'],k['__GNUC_PATCHLEVEL__']) 63 | def configure(conf): 64 | conf.find_gfortran() 65 | conf.find_ar() 66 | conf.fc_flags() 67 | conf.fc_add_flags() 68 | conf.gfortran_flags() 69 | conf.gfortran_modifier_platform() 70 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/gnu_dirs.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os 6 | from waflib import Utils,Options,Context 7 | _options=[x.split(', ')for x in''' 8 | bindir, user executables, ${EXEC_PREFIX}/bin 9 | sbindir, system admin executables, ${EXEC_PREFIX}/sbin 10 | libexecdir, program executables, ${EXEC_PREFIX}/libexec 11 | sysconfdir, read-only single-machine data, ${PREFIX}/etc 12 | sharedstatedir, modifiable architecture-independent data, ${PREFIX}/com 13 | localstatedir, modifiable single-machine data, ${PREFIX}/var 14 | libdir, object code libraries, ${EXEC_PREFIX}/lib 15 | includedir, C header files, ${PREFIX}/include 16 | oldincludedir, C header files for non-gcc, /usr/include 17 | datarootdir, read-only arch.-independent data root, ${PREFIX}/share 18 | datadir, read-only architecture-independent data, ${DATAROOTDIR} 19 | infodir, info documentation, ${DATAROOTDIR}/info 20 | localedir, locale-dependent data, ${DATAROOTDIR}/locale 21 | mandir, man documentation, ${DATAROOTDIR}/man 22 | docdir, documentation root, ${DATAROOTDIR}/doc/${PACKAGE} 23 | htmldir, html documentation, ${DOCDIR} 24 | dvidir, dvi documentation, ${DOCDIR} 25 | pdfdir, pdf documentation, ${DOCDIR} 26 | psdir, ps documentation, ${DOCDIR} 27 | '''.split('\n')if x] 28 | def configure(conf): 29 | def get_param(varname,default): 30 | return getattr(Options.options,varname,'')or default 31 | env=conf.env 32 | env.LIBDIR=env.BINDIR=[] 33 | env.EXEC_PREFIX=get_param('EXEC_PREFIX',env.PREFIX) 34 | env.PACKAGE=getattr(Context.g_module,'APPNAME',None)or env.PACKAGE 35 | complete=False 36 | iter=0 37 | while not complete and iter\d*)\.(?P\d*)",re.I).search 33 | cmd=fc+['--version'] 34 | out,err=fc_config.getoutput(conf,cmd,stdin=False) 35 | if out: 36 | match=version_re(out) 37 | else: 38 | match=version_re(err) 39 | if not match: 40 | conf.fatal('cannot determine ifort version.') 41 | k=match.groupdict() 42 | conf.env['FC_VERSION']=(k['major'],k['minor']) 43 | def configure(conf): 44 | conf.find_ifort() 45 | conf.find_program('xiar',var='AR') 46 | conf.env.ARFLAGS='rcs' 47 | conf.fc_flags() 48 | conf.fc_add_flags() 49 | conf.ifort_modifier_platform() 50 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/intltool.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os,re 6 | from waflib import Configure,TaskGen,Task,Utils,Runner,Options,Build,Logs 7 | import waflib.Tools.ccroot 8 | from waflib.TaskGen import feature,before_method 9 | from waflib.Logs import error 10 | @before_method('process_source') 11 | @feature('intltool_in') 12 | def apply_intltool_in_f(self): 13 | try:self.meths.remove('process_source') 14 | except ValueError:pass 15 | if not self.env.LOCALEDIR: 16 | self.env.LOCALEDIR=self.env.PREFIX+'/share/locale' 17 | for i in self.to_list(self.source): 18 | node=self.path.find_resource(i) 19 | podir=getattr(self,'podir','po') 20 | podirnode=self.path.find_dir(podir) 21 | if not podirnode: 22 | error("could not find the podir %r"%podir) 23 | continue 24 | cache=getattr(self,'intlcache','.intlcache') 25 | self.env['INTLCACHE']=os.path.join(self.path.bldpath(),podir,cache) 26 | self.env['INTLPODIR']=podirnode.bldpath() 27 | self.env['INTLFLAGS']=getattr(self,'flags',['-q','-u','-c']) 28 | task=self.create_task('intltool',node,node.change_ext('')) 29 | inst=getattr(self,'install_path','${LOCALEDIR}') 30 | if inst: 31 | self.bld.install_files(inst,task.outputs) 32 | @feature('intltool_po') 33 | def apply_intltool_po(self): 34 | try:self.meths.remove('process_source') 35 | except ValueError:pass 36 | if not self.env.LOCALEDIR: 37 | self.env.LOCALEDIR=self.env.PREFIX+'/share/locale' 38 | appname=getattr(self,'appname','set_your_app_name') 39 | podir=getattr(self,'podir','') 40 | inst=getattr(self,'install_path','${LOCALEDIR}') 41 | linguas=self.path.find_node(os.path.join(podir,'LINGUAS')) 42 | if linguas: 43 | file=open(linguas.abspath()) 44 | langs=[] 45 | for line in file.readlines(): 46 | if not line.startswith('#'): 47 | langs+=line.split() 48 | file.close() 49 | re_linguas=re.compile('[-a-zA-Z_@.]+') 50 | for lang in langs: 51 | if re_linguas.match(lang): 52 | node=self.path.find_resource(os.path.join(podir,re_linguas.match(lang).group()+'.po')) 53 | task=self.create_task('po',node,node.change_ext('.mo')) 54 | if inst: 55 | filename=task.outputs[0].name 56 | (langname,ext)=os.path.splitext(filename) 57 | inst_file=inst+os.sep+langname+os.sep+'LC_MESSAGES'+os.sep+appname+'.mo' 58 | self.bld.install_as(inst_file,task.outputs[0],chmod=getattr(self,'chmod',Utils.O644),env=task.env) 59 | else: 60 | Logs.pprint('RED',"Error no LINGUAS file found in po directory") 61 | class po(Task.Task): 62 | run_str='${MSGFMT} -o ${TGT} ${SRC}' 63 | color='BLUE' 64 | class intltool(Task.Task): 65 | run_str='${INTLTOOL} ${INTLFLAGS} ${INTLCACHE} ${INTLPODIR} ${SRC} ${TGT}' 66 | color='BLUE' 67 | def configure(conf): 68 | conf.find_program('msgfmt',var='MSGFMT') 69 | conf.find_perl_program('intltool-merge',var='INTLTOOL') 70 | prefix=conf.env.PREFIX 71 | datadir=conf.env.DATADIR 72 | if not datadir: 73 | datadir=os.path.join(prefix,'share') 74 | conf.define('LOCALEDIR',os.path.join(datadir,'locale').replace('\\','\\\\')) 75 | conf.define('DATADIR',datadir.replace('\\','\\\\')) 76 | if conf.env.CC or conf.env.CXX: 77 | conf.check(header_name='locale.h') 78 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/irixcc.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os 6 | from waflib import Utils 7 | from waflib.Tools import ccroot,ar 8 | from waflib.Configure import conf 9 | @conf 10 | def find_irixcc(conf): 11 | v=conf.env 12 | cc=None 13 | if v['CC']:cc=v['CC'] 14 | elif'CC'in conf.environ:cc=conf.environ['CC'] 15 | if not cc:cc=conf.find_program('cc',var='CC') 16 | if not cc:conf.fatal('irixcc was not found') 17 | cc=conf.cmd_to_list(cc) 18 | try: 19 | conf.cmd_and_log(cc+['-version']) 20 | except Exception: 21 | conf.fatal('%r -version could not be executed'%cc) 22 | v['CC']=cc 23 | v['CC_NAME']='irix' 24 | @conf 25 | def irixcc_common_flags(conf): 26 | v=conf.env 27 | v['CC_SRC_F']='' 28 | v['CC_TGT_F']=['-c','-o'] 29 | v['CPPPATH_ST']='-I%s' 30 | v['DEFINES_ST']='-D%s' 31 | if not v['LINK_CC']:v['LINK_CC']=v['CC'] 32 | v['CCLNK_SRC_F']='' 33 | v['CCLNK_TGT_F']=['-o'] 34 | v['LIB_ST']='-l%s' 35 | v['LIBPATH_ST']='-L%s' 36 | v['STLIB_ST']='-l%s' 37 | v['STLIBPATH_ST']='-L%s' 38 | v['cprogram_PATTERN']='%s' 39 | v['cshlib_PATTERN']='lib%s.so' 40 | v['cstlib_PATTERN']='lib%s.a' 41 | def configure(conf): 42 | conf.find_irixcc() 43 | conf.find_cpp() 44 | conf.find_ar() 45 | conf.irixcc_common_flags() 46 | conf.cc_load_tools() 47 | conf.cc_add_flags() 48 | conf.link_add_flags() 49 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/kde4.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os,sys,re 6 | from waflib import Options,TaskGen,Task,Utils 7 | from waflib.TaskGen import feature,after_method 8 | @feature('msgfmt') 9 | def apply_msgfmt(self): 10 | for lang in self.to_list(self.langs): 11 | node=self.path.find_resource(lang+'.po') 12 | task=self.create_task('msgfmt',node,node.change_ext('.mo')) 13 | langname=lang.split('/') 14 | langname=langname[-1] 15 | inst=getattr(self,'install_path','${KDE4_LOCALE_INSTALL_DIR}') 16 | self.bld.install_as(inst+os.sep+langname+os.sep+'LC_MESSAGES'+os.sep+getattr(self,'appname','set_your_appname')+'.mo',task.outputs[0],chmod=getattr(self,'chmod',Utils.O644)) 17 | class msgfmt(Task.Task): 18 | color='BLUE' 19 | run_str='${MSGFMT} ${SRC} -o ${TGT}' 20 | def configure(self): 21 | kdeconfig=self.find_program('kde4-config') 22 | prefix=self.cmd_and_log('%s --prefix'%kdeconfig).strip() 23 | fname='%s/share/apps/cmake/modules/KDELibsDependencies.cmake'%prefix 24 | try:os.stat(fname) 25 | except OSError: 26 | fname='%s/share/kde4/apps/cmake/modules/KDELibsDependencies.cmake'%prefix 27 | try:os.stat(fname) 28 | except OSError:self.fatal('could not open %s'%fname) 29 | try: 30 | txt=Utils.readf(fname) 31 | except(OSError,IOError): 32 | self.fatal('could not read %s'%fname) 33 | txt=txt.replace('\\\n','\n') 34 | fu=re.compile('#(.*)\n') 35 | txt=fu.sub('',txt) 36 | setregexp=re.compile('([sS][eE][tT]\s*\()\s*([^\s]+)\s+\"([^"]+)\"\)') 37 | found=setregexp.findall(txt) 38 | for(_,key,val)in found: 39 | self.env[key]=val 40 | self.env['LIB_KDECORE']=['kdecore'] 41 | self.env['LIB_KDEUI']=['kdeui'] 42 | self.env['LIB_KIO']=['kio'] 43 | self.env['LIB_KHTML']=['khtml'] 44 | self.env['LIB_KPARTS']=['kparts'] 45 | self.env['LIBPATH_KDECORE']=[os.path.join(self.env.KDE4_LIB_INSTALL_DIR,'kde4','devel'),self.env.KDE4_LIB_INSTALL_DIR] 46 | self.env['INCLUDES_KDECORE']=[self.env['KDE4_INCLUDE_INSTALL_DIR']] 47 | self.env.append_value('INCLUDES_KDECORE',[self.env['KDE4_INCLUDE_INSTALL_DIR']+os.sep+'KDE']) 48 | self.find_program('msgfmt',var='MSGFMT') 49 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/ldc2.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import sys 6 | from waflib.Tools import ar,d 7 | from waflib.Configure import conf 8 | @conf 9 | def find_ldc2(conf): 10 | conf.find_program(['ldc2'],var='D') 11 | out=conf.cmd_and_log([conf.env.D,'-version']) 12 | if out.find("based on DMD v2.")==-1: 13 | conf.fatal("detected compiler is not ldc2") 14 | @conf 15 | def common_flags_ldc2(conf): 16 | v=conf.env 17 | v['D_SRC_F']=['-c'] 18 | v['D_TGT_F']='-of%s' 19 | v['D_LINKER']=v['D'] 20 | v['DLNK_SRC_F']='' 21 | v['DLNK_TGT_F']='-of%s' 22 | v['DINC_ST']='-I%s' 23 | v['DSHLIB_MARKER']=v['DSTLIB_MARKER']='' 24 | v['DSTLIB_ST']=v['DSHLIB_ST']='-L-l%s' 25 | v['DSTLIBPATH_ST']=v['DLIBPATH_ST']='-L-L%s' 26 | v['LINKFLAGS_dshlib']=['-L-shared'] 27 | v['DHEADER_ext']='.di' 28 | v['DFLAGS_d_with_header']=['-H','-Hf'] 29 | v['D_HDR_F']='%s' 30 | v['LINKFLAGS']=[] 31 | v['DFLAGS_dshlib']=['-relocation-model=pic'] 32 | def configure(conf): 33 | conf.find_ldc2() 34 | conf.load('ar') 35 | conf.load('d') 36 | conf.common_flags_ldc2() 37 | conf.d_platform_flags() 38 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/lua.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | from waflib.TaskGen import extension 6 | from waflib import Task,Utils 7 | @extension('.lua') 8 | def add_lua(self,node): 9 | tsk=self.create_task('luac',node,node.change_ext('.luac')) 10 | inst_to=getattr(self,'install_path',self.env.LUADIR and'${LUADIR}'or None) 11 | if inst_to: 12 | self.bld.install_files(inst_to,tsk.outputs) 13 | return tsk 14 | class luac(Task.Task): 15 | run_str='${LUAC} -s -o ${TGT} ${SRC}' 16 | color='PINK' 17 | def configure(conf): 18 | conf.find_program('luac',var='LUAC') 19 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/nasm.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os 6 | import waflib.Tools.asm 7 | from waflib.TaskGen import feature 8 | @feature('asm') 9 | def apply_nasm_vars(self): 10 | self.env.append_value('ASFLAGS',self.to_list(getattr(self,'nasm_flags',[]))) 11 | def configure(conf): 12 | nasm=conf.find_program(['nasm','yasm'],var='AS') 13 | conf.env.AS_TGT_F=['-o'] 14 | conf.env.ASLNK_TGT_F=['-o'] 15 | conf.load('asm') 16 | conf.env.ASMPATH_ST='-I%s'+os.sep 17 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/perl.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os 6 | from waflib import Task,Options,Utils 7 | from waflib.Configure import conf 8 | from waflib.TaskGen import extension,feature,before_method 9 | @before_method('apply_incpaths','apply_link','propagate_uselib_vars') 10 | @feature('perlext') 11 | def init_perlext(self): 12 | self.uselib=self.to_list(getattr(self,'uselib',[])) 13 | if not'PERLEXT'in self.uselib:self.uselib.append('PERLEXT') 14 | self.env['cshlib_PATTERN']=self.env['cxxshlib_PATTERN']=self.env['perlext_PATTERN'] 15 | @extension('.xs') 16 | def xsubpp_file(self,node): 17 | outnode=node.change_ext('.c') 18 | self.create_task('xsubpp',node,outnode) 19 | self.source.append(outnode) 20 | class xsubpp(Task.Task): 21 | run_str='${PERL} ${XSUBPP} -noprototypes -typemap ${EXTUTILS_TYPEMAP} ${SRC} > ${TGT}' 22 | color='BLUE' 23 | ext_out=['.h'] 24 | @conf 25 | def check_perl_version(self,minver=None): 26 | res=True 27 | if minver: 28 | cver='.'.join(map(str,minver)) 29 | else: 30 | cver='' 31 | self.start_msg('Checking for minimum perl version %s'%cver) 32 | perl=getattr(Options.options,'perlbinary',None) 33 | if not perl: 34 | perl=self.find_program('perl',var='PERL') 35 | if not perl: 36 | self.end_msg("Perl not found",color="YELLOW") 37 | return False 38 | self.env['PERL']=perl 39 | version=self.cmd_and_log([perl,"-e",'printf \"%vd\", $^V']) 40 | if not version: 41 | res=False 42 | version="Unknown" 43 | elif not minver is None: 44 | ver=tuple(map(int,version.split("."))) 45 | if ver=(1,9,0): 61 | ruby_hdrdir=read_config('rubyhdrdir') 62 | cpppath+=ruby_hdrdir 63 | cpppath+=[os.path.join(ruby_hdrdir[0],read_config('arch')[0])] 64 | self.check(header_name='ruby.h',includes=cpppath,errmsg='could not find ruby header file') 65 | self.env.LIBPATH_RUBYEXT=read_config('libdir') 66 | self.env.LIBPATH_RUBYEXT+=archdir 67 | self.env.INCLUDES_RUBYEXT=cpppath 68 | self.env.CFLAGS_RUBYEXT=read_config('CCDLFLAGS') 69 | self.env.rubyext_PATTERN='%s.'+read_config('DLEXT')[0] 70 | flags=read_config('LDSHARED') 71 | while flags and flags[0][0]!='-': 72 | flags=flags[1:] 73 | if len(flags)>1 and flags[1]=="ppc": 74 | flags=flags[2:] 75 | self.env.LINKFLAGS_RUBYEXT=flags 76 | self.env.LINKFLAGS_RUBYEXT+=read_config('LIBS') 77 | self.env.LINKFLAGS_RUBYEXT+=read_config('LIBRUBYARG_SHARED') 78 | if Options.options.rubyarchdir: 79 | self.env.ARCHDIR_RUBY=Options.options.rubyarchdir 80 | else: 81 | self.env.ARCHDIR_RUBY=read_config('sitearchdir')[0] 82 | if Options.options.rubylibdir: 83 | self.env.LIBDIR_RUBY=Options.options.rubylibdir 84 | else: 85 | self.env.LIBDIR_RUBY=read_config('sitelibdir')[0] 86 | @conf 87 | def check_ruby_module(self,module_name): 88 | self.start_msg('Ruby module %s'%module_name) 89 | try: 90 | self.cmd_and_log([self.env['RUBY'],'-e','require \'%s\';puts 1'%module_name]) 91 | except Exception: 92 | self.end_msg(False) 93 | self.fatal('Could not find the ruby module %r'%module_name) 94 | self.end_msg(True) 95 | @extension('.rb') 96 | def process(self,node): 97 | tsk=self.create_task('run_ruby',node) 98 | class run_ruby(Task.Task): 99 | run_str='${RUBY} ${RBFLAGS} -I ${SRC[0].parent.abspath()} ${SRC}' 100 | def options(opt): 101 | opt.add_option('--with-ruby-archdir',type='string',dest='rubyarchdir',help='Specify directory where to install arch specific files') 102 | opt.add_option('--with-ruby-libdir',type='string',dest='rubylibdir',help='Specify alternate ruby library path') 103 | opt.add_option('--with-ruby-binary',type='string',dest='rubybinary',help='Specify alternate ruby binary') 104 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/suncc.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os 6 | from waflib import Utils 7 | from waflib.Tools import ccroot,ar 8 | from waflib.Configure import conf 9 | @conf 10 | def find_scc(conf): 11 | v=conf.env 12 | cc=None 13 | if v['CC']:cc=v['CC'] 14 | elif'CC'in conf.environ:cc=conf.environ['CC'] 15 | if not cc:cc=conf.find_program('cc',var='CC') 16 | if not cc:conf.fatal('Could not find a Sun C compiler') 17 | cc=conf.cmd_to_list(cc) 18 | try: 19 | conf.cmd_and_log(cc+['-flags']) 20 | except Exception: 21 | conf.fatal('%r is not a Sun compiler'%cc) 22 | v['CC']=cc 23 | v['CC_NAME']='sun' 24 | conf.get_suncc_version(cc) 25 | @conf 26 | def scc_common_flags(conf): 27 | v=conf.env 28 | v['CC_SRC_F']=[] 29 | v['CC_TGT_F']=['-c','-o'] 30 | if not v['LINK_CC']:v['LINK_CC']=v['CC'] 31 | v['CCLNK_SRC_F']='' 32 | v['CCLNK_TGT_F']=['-o'] 33 | v['CPPPATH_ST']='-I%s' 34 | v['DEFINES_ST']='-D%s' 35 | v['LIB_ST']='-l%s' 36 | v['LIBPATH_ST']='-L%s' 37 | v['STLIB_ST']='-l%s' 38 | v['STLIBPATH_ST']='-L%s' 39 | v['SONAME_ST']='-Wl,-h,%s' 40 | v['SHLIB_MARKER']='-Bdynamic' 41 | v['STLIB_MARKER']='-Bstatic' 42 | v['cprogram_PATTERN']='%s' 43 | v['CFLAGS_cshlib']=['-Kpic','-DPIC'] 44 | v['LINKFLAGS_cshlib']=['-G'] 45 | v['cshlib_PATTERN']='lib%s.so' 46 | v['LINKFLAGS_cstlib']=['-Bstatic'] 47 | v['cstlib_PATTERN']='lib%s.a' 48 | def configure(conf): 49 | conf.find_scc() 50 | conf.find_ar() 51 | conf.scc_common_flags() 52 | conf.cc_load_tools() 53 | conf.cc_add_flags() 54 | conf.link_add_flags() 55 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/suncxx.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os 6 | from waflib import Utils 7 | from waflib.Tools import ccroot,ar 8 | from waflib.Configure import conf 9 | @conf 10 | def find_sxx(conf): 11 | v=conf.env 12 | cc=None 13 | if v['CXX']:cc=v['CXX'] 14 | elif'CXX'in conf.environ:cc=conf.environ['CXX'] 15 | if not cc:cc=conf.find_program('CC',var='CXX') 16 | if not cc:cc=conf.find_program('c++',var='CXX') 17 | if not cc:conf.fatal('Could not find a Sun C++ compiler') 18 | cc=conf.cmd_to_list(cc) 19 | try: 20 | conf.cmd_and_log(cc+['-flags']) 21 | except Exception: 22 | conf.fatal('%r is not a Sun compiler'%cc) 23 | v['CXX']=cc 24 | v['CXX_NAME']='sun' 25 | conf.get_suncc_version(cc) 26 | @conf 27 | def sxx_common_flags(conf): 28 | v=conf.env 29 | v['CXX_SRC_F']=[] 30 | v['CXX_TGT_F']=['-c','-o'] 31 | if not v['LINK_CXX']:v['LINK_CXX']=v['CXX'] 32 | v['CXXLNK_SRC_F']=[] 33 | v['CXXLNK_TGT_F']=['-o'] 34 | v['CPPPATH_ST']='-I%s' 35 | v['DEFINES_ST']='-D%s' 36 | v['LIB_ST']='-l%s' 37 | v['LIBPATH_ST']='-L%s' 38 | v['STLIB_ST']='-l%s' 39 | v['STLIBPATH_ST']='-L%s' 40 | v['SONAME_ST']='-Wl,-h,%s' 41 | v['SHLIB_MARKER']='-Bdynamic' 42 | v['STLIB_MARKER']='-Bstatic' 43 | v['cxxprogram_PATTERN']='%s' 44 | v['CXXFLAGS_cxxshlib']=['-Kpic','-DPIC'] 45 | v['LINKFLAGS_cxxshlib']=['-G'] 46 | v['cxxshlib_PATTERN']='lib%s.so' 47 | v['LINKFLAGS_cxxstlib']=['-Bstatic'] 48 | v['cxxstlib_PATTERN']='lib%s.a' 49 | def configure(conf): 50 | conf.find_sxx() 51 | conf.find_ar() 52 | conf.sxx_common_flags() 53 | conf.cxx_load_tools() 54 | conf.cxx_add_flags() 55 | conf.link_add_flags() 56 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/waf_unit_test.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os,sys 6 | from waflib.TaskGen import feature,after_method 7 | from waflib import Utils,Task,Logs,Options 8 | testlock=Utils.threading.Lock() 9 | @feature('test') 10 | @after_method('apply_link') 11 | def make_test(self): 12 | if getattr(self,'link_task',None): 13 | self.create_task('utest',self.link_task.outputs) 14 | class utest(Task.Task): 15 | color='PINK' 16 | after=['vnum','inst'] 17 | vars=[] 18 | def runnable_status(self): 19 | if getattr(Options.options,'no_tests',False): 20 | return Task.SKIP_ME 21 | ret=super(utest,self).runnable_status() 22 | if ret==Task.SKIP_ME: 23 | if getattr(Options.options,'all_tests',False): 24 | return Task.RUN_ME 25 | return ret 26 | def run(self): 27 | filename=self.inputs[0].abspath() 28 | self.ut_exec=getattr(self.generator,'ut_exec',[filename]) 29 | if getattr(self.generator,'ut_fun',None): 30 | self.generator.ut_fun(self) 31 | try: 32 | fu=getattr(self.generator.bld,'all_test_paths') 33 | except AttributeError: 34 | fu=os.environ.copy() 35 | lst=[] 36 | for g in self.generator.bld.groups: 37 | for tg in g: 38 | if getattr(tg,'link_task',None): 39 | s=tg.link_task.outputs[0].parent.abspath() 40 | if s not in lst: 41 | lst.append(s) 42 | def add_path(dct,path,var): 43 | dct[var]=os.pathsep.join(Utils.to_list(path)+[os.environ.get(var,'')]) 44 | if Utils.is_win32: 45 | add_path(fu,lst,'PATH') 46 | elif Utils.unversioned_sys_platform()=='darwin': 47 | add_path(fu,lst,'DYLD_LIBRARY_PATH') 48 | add_path(fu,lst,'LD_LIBRARY_PATH') 49 | else: 50 | add_path(fu,lst,'LD_LIBRARY_PATH') 51 | self.generator.bld.all_test_paths=fu 52 | cwd=getattr(self.generator,'ut_cwd','')or self.inputs[0].parent.abspath() 53 | testcmd=getattr(Options.options,'testcmd',False) 54 | if testcmd: 55 | self.ut_exec=(testcmd%self.ut_exec[0]).split(' ') 56 | proc=Utils.subprocess.Popen(self.ut_exec,cwd=cwd,env=fu,stderr=Utils.subprocess.PIPE,stdout=Utils.subprocess.PIPE) 57 | (stdout,stderr)=proc.communicate() 58 | tup=(filename,proc.returncode,stdout,stderr) 59 | self.generator.utest_result=tup 60 | testlock.acquire() 61 | try: 62 | bld=self.generator.bld 63 | Logs.debug("ut: %r",tup) 64 | try: 65 | bld.utest_results.append(tup) 66 | except AttributeError: 67 | bld.utest_results=[tup] 68 | finally: 69 | testlock.release() 70 | def summary(bld): 71 | lst=getattr(bld,'utest_results',[]) 72 | if lst: 73 | Logs.pprint('CYAN','execution summary') 74 | total=len(lst) 75 | tfail=len([x for x in lst if x[1]]) 76 | Logs.pprint('CYAN',' tests that pass %d/%d'%(total-tfail,total)) 77 | for(f,code,out,err)in lst: 78 | if not code: 79 | Logs.pprint('CYAN',' %s'%f) 80 | Logs.pprint('CYAN',' tests that fail %d/%d'%(tfail,total)) 81 | for(f,code,out,err)in lst: 82 | if code: 83 | Logs.pprint('CYAN',' %s'%f) 84 | def set_exit_code(bld): 85 | lst=getattr(bld,'utest_results',[]) 86 | for(f,code,out,err)in lst: 87 | if code: 88 | msg=[] 89 | if out: 90 | msg.append('stdout:%s%s'%(os.linesep,out.decode('utf-8'))) 91 | if err: 92 | msg.append('stderr:%s%s'%(os.linesep,err.decode('utf-8'))) 93 | bld.fatal(os.linesep.join(msg)) 94 | def options(opt): 95 | opt.add_option('--notests',action='store_true',default=False,help='Exec no unit tests',dest='no_tests') 96 | opt.add_option('--alltests',action='store_true',default=False,help='Exec all unit tests',dest='all_tests') 97 | opt.add_option('--testcmd',action='store',default=False,help='Run the unit tests using the test-cmd string'' example "--test-cmd="valgrind --error-exitcode=1'' %s" to run under valgrind',dest='testcmd') 98 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/winres.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import re,traceback 6 | from waflib import Task,Logs,Utils 7 | from waflib.TaskGen import extension 8 | from waflib.Tools import c_preproc 9 | @extension('.rc') 10 | def rc_file(self,node): 11 | obj_ext='.rc.o' 12 | if self.env['WINRC_TGT_F']=='/fo': 13 | obj_ext='.res' 14 | rctask=self.create_task('winrc',node,node.change_ext(obj_ext)) 15 | try: 16 | self.compiled_tasks.append(rctask) 17 | except AttributeError: 18 | self.compiled_tasks=[rctask] 19 | re_lines=re.compile('(?:^[ \t]*(#|%:)[ \t]*(ifdef|ifndef|if|else|elif|endif|include|import|define|undef|pragma)[ \t]*(.*?)\s*$)|''(?:^\w+[ \t]*(ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)[ \t]*(.*?)\s*$)',re.IGNORECASE|re.MULTILINE) 20 | class rc_parser(c_preproc.c_parser): 21 | def filter_comments(self,filepath): 22 | code=Utils.readf(filepath) 23 | if c_preproc.use_trigraphs: 24 | for(a,b)in c_preproc.trig_def:code=code.split(a).join(b) 25 | code=c_preproc.re_nl.sub('',code) 26 | code=c_preproc.re_cpp.sub(c_preproc.repl,code) 27 | ret=[] 28 | for m in re.finditer(re_lines,code): 29 | if m.group(2): 30 | ret.append((m.group(2),m.group(3))) 31 | else: 32 | ret.append(('include',m.group(5))) 33 | return ret 34 | def addlines(self,node): 35 | self.currentnode_stack.append(node.parent) 36 | filepath=node.abspath() 37 | self.count_files+=1 38 | if self.count_files>c_preproc.recursion_limit: 39 | raise c_preproc.PreprocError("recursion limit exceeded") 40 | pc=self.parse_cache 41 | Logs.debug('preproc: reading file %r',filepath) 42 | try: 43 | lns=pc[filepath] 44 | except KeyError: 45 | pass 46 | else: 47 | self.lines.extend(lns) 48 | return 49 | try: 50 | lines=self.filter_comments(filepath) 51 | lines.append((c_preproc.POPFILE,'')) 52 | lines.reverse() 53 | pc[filepath]=lines 54 | self.lines.extend(lines) 55 | except IOError: 56 | raise c_preproc.PreprocError("could not read the file %s"%filepath) 57 | except Exception: 58 | if Logs.verbose>0: 59 | Logs.error("parsing %s failed"%filepath) 60 | traceback.print_exc() 61 | class winrc(Task.Task): 62 | run_str='${WINRC} ${WINRCFLAGS} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${WINRC_TGT_F} ${TGT} ${WINRC_SRC_F} ${SRC}' 63 | color='BLUE' 64 | def scan(self): 65 | tmp=rc_parser(self.generator.includes_nodes) 66 | tmp.start(self.inputs[0],self.env) 67 | nodes=tmp.nodes 68 | names=tmp.names 69 | if Logs.verbose: 70 | Logs.debug('deps: deps for %s: %r; unresolved %r'%(str(self),nodes,names)) 71 | return(nodes,names) 72 | def configure(conf): 73 | v=conf.env 74 | v['WINRC_TGT_F']='-o' 75 | v['WINRC_SRC_F']='-i' 76 | if not conf.env.WINRC: 77 | if v.CC_NAME=='msvc': 78 | conf.find_program('RC',var='WINRC',path_list=v['PATH']) 79 | v['WINRC_TGT_F']='/fo' 80 | v['WINRC_SRC_F']='' 81 | else: 82 | conf.find_program('windres',var='WINRC',path_list=v['PATH']) 83 | if not conf.env.WINRC: 84 | conf.fatal('winrc was not found!') 85 | v['WINRCFLAGS']=[] 86 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/xlc.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | from waflib.Tools import ccroot,ar 6 | from waflib.Configure import conf 7 | @conf 8 | def find_xlc(conf): 9 | cc=conf.find_program(['xlc_r','xlc'],var='CC') 10 | cc=conf.cmd_to_list(cc) 11 | conf.get_xlc_version(cc) 12 | conf.env.CC_NAME='xlc' 13 | conf.env.CC=cc 14 | @conf 15 | def xlc_common_flags(conf): 16 | v=conf.env 17 | v['CC_SRC_F']=[] 18 | v['CC_TGT_F']=['-c','-o'] 19 | if not v['LINK_CC']:v['LINK_CC']=v['CC'] 20 | v['CCLNK_SRC_F']=[] 21 | v['CCLNK_TGT_F']=['-o'] 22 | v['CPPPATH_ST']='-I%s' 23 | v['DEFINES_ST']='-D%s' 24 | v['LIB_ST']='-l%s' 25 | v['LIBPATH_ST']='-L%s' 26 | v['STLIB_ST']='-l%s' 27 | v['STLIBPATH_ST']='-L%s' 28 | v['RPATH_ST']='-Wl,-rpath,%s' 29 | v['SONAME_ST']=[] 30 | v['SHLIB_MARKER']=[] 31 | v['STLIB_MARKER']=[] 32 | v['LINKFLAGS_cprogram']=['-Wl,-brtl'] 33 | v['cprogram_PATTERN']='%s' 34 | v['CFLAGS_cshlib']=['-fPIC'] 35 | v['LINKFLAGS_cshlib']=['-G','-Wl,-brtl,-bexpfull'] 36 | v['cshlib_PATTERN']='lib%s.so' 37 | v['LINKFLAGS_cstlib']=[] 38 | v['cstlib_PATTERN']='lib%s.a' 39 | def configure(conf): 40 | conf.find_xlc() 41 | conf.find_ar() 42 | conf.xlc_common_flags() 43 | conf.cc_load_tools() 44 | conf.cc_add_flags() 45 | conf.link_add_flags() 46 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Tools/xlcxx.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | from waflib.Tools import ccroot,ar 6 | from waflib.Configure import conf 7 | @conf 8 | def find_xlcxx(conf): 9 | cxx=conf.find_program(['xlc++_r','xlc++'],var='CXX') 10 | cxx=conf.cmd_to_list(cxx) 11 | conf.get_xlc_version(cxx) 12 | conf.env.CXX_NAME='xlc++' 13 | conf.env.CXX=cxx 14 | @conf 15 | def xlcxx_common_flags(conf): 16 | v=conf.env 17 | v['CXX_SRC_F']=[] 18 | v['CXX_TGT_F']=['-c','-o'] 19 | if not v['LINK_CXX']:v['LINK_CXX']=v['CXX'] 20 | v['CXXLNK_SRC_F']=[] 21 | v['CXXLNK_TGT_F']=['-o'] 22 | v['CPPPATH_ST']='-I%s' 23 | v['DEFINES_ST']='-D%s' 24 | v['LIB_ST']='-l%s' 25 | v['LIBPATH_ST']='-L%s' 26 | v['STLIB_ST']='-l%s' 27 | v['STLIBPATH_ST']='-L%s' 28 | v['RPATH_ST']='-Wl,-rpath,%s' 29 | v['SONAME_ST']=[] 30 | v['SHLIB_MARKER']=[] 31 | v['STLIB_MARKER']=[] 32 | v['LINKFLAGS_cxxprogram']=['-Wl,-brtl'] 33 | v['cxxprogram_PATTERN']='%s' 34 | v['CXXFLAGS_cxxshlib']=['-fPIC'] 35 | v['LINKFLAGS_cxxshlib']=['-G','-Wl,-brtl,-bexpfull'] 36 | v['cxxshlib_PATTERN']='lib%s.so' 37 | v['LINKFLAGS_cxxstlib']=[] 38 | v['cxxstlib_PATTERN']='lib%s.a' 39 | def configure(conf): 40 | conf.find_xlcxx() 41 | conf.find_ar() 42 | conf.xlcxx_common_flags() 43 | conf.cxx_load_tools() 44 | conf.cxx_add_flags() 45 | conf.link_add_flags() 46 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Utils.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/Utils.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/__init__.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/__init__.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/ansiterm.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/ansiterm.pyc -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/extras/__init__.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/fixpy2.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # encoding: utf-8 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 | 5 | import os 6 | all_modifs={} 7 | def fixdir(dir): 8 | global all_modifs 9 | for k in all_modifs: 10 | for v in all_modifs[k]: 11 | modif(os.path.join(dir,'waflib'),k,v) 12 | def modif(dir,name,fun): 13 | if name=='*': 14 | lst=[] 15 | for y in'. Tools extras'.split(): 16 | for x in os.listdir(os.path.join(dir,y)): 17 | if x.endswith('.py'): 18 | lst.append(y+os.sep+x) 19 | for x in lst: 20 | modif(dir,x,fun) 21 | return 22 | filename=os.path.join(dir,name) 23 | f=open(filename,'r') 24 | try: 25 | txt=f.read() 26 | finally: 27 | f.close() 28 | txt=fun(txt) 29 | f=open(filename,'w') 30 | try: 31 | f.write(txt) 32 | finally: 33 | f.close() 34 | def subst(*k): 35 | def do_subst(fun): 36 | global all_modifs 37 | for x in k: 38 | try: 39 | all_modifs[x].append(fun) 40 | except KeyError: 41 | all_modifs[x]=[fun] 42 | return fun 43 | return do_subst 44 | @subst('*') 45 | def r1(code): 46 | code=code.replace(',e:',',e:') 47 | code=code.replace("",'') 48 | code=code.replace('','') 49 | return code 50 | @subst('Runner.py') 51 | def r4(code): 52 | code=code.replace('next(self.biter)','self.biter.next()') 53 | return code 54 | -------------------------------------------------------------------------------- /.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/fixpy2.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/.waf-1.7.15-81b0724e6c87060fe73ce80b83ec6372/waflib/fixpy2.pyc -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | gstreamer-all 2 | ============= 3 | 4 | All test files about gstreamer-1.0 5 | -------------------------------------------------------------------------------- /appsrc.c: -------------------------------------------------------------------------------- 1 | 2 | /*** block from ../../../docs/manual/advanced-dataaccess.xml ***/ 3 | #include 4 | 5 | static GMainLoop *loop; 6 | 7 | static void 8 | cb_need_data (GstElement *appsrc, 9 | guint unused_size, 10 | gpointer user_data) 11 | { 12 | static gboolean white = FALSE; 13 | static GstClockTime timestamp = 0; 14 | GstBuffer *buffer; 15 | guint size; 16 | GstFlowReturn ret; 17 | 18 | size = 385 * 288 * 2; 19 | 20 | buffer = gst_buffer_new_allocate (NULL, size, NULL); 21 | 22 | /* this makes the image black/white */ 23 | gst_buffer_memset (buffer, 0, white ? 0xff : 0x0, size); 24 | 25 | white = !white; 26 | 27 | GST_BUFFER_PTS (buffer) = timestamp; 28 | GST_BUFFER_DURATION (buffer) = gst_util_uint64_scale_int (1, GST_SECOND, 2); 29 | 30 | timestamp += GST_BUFFER_DURATION (buffer); 31 | 32 | g_signal_emit_by_name (appsrc, "push-buffer", buffer, &ret); 33 | 34 | if (ret != GST_FLOW_OK) { 35 | /* something wrong, stop pushing */ 36 | g_main_loop_quit (loop); 37 | } 38 | } 39 | 40 | gint 41 | main (gint argc, 42 | gchar *argv[]) 43 | { 44 | GstElement *pipeline, *appsrc, *conv, *videosink; 45 | 46 | /* init GStreamer */ 47 | gst_init (&argc, &argv); 48 | loop = g_main_loop_new (NULL, FALSE); 49 | 50 | /* setup pipeline */ 51 | pipeline = gst_pipeline_new ("pipeline"); 52 | appsrc = gst_element_factory_make ("appsrc", "source"); 53 | conv = gst_element_factory_make ("videoconvert", "conv"); 54 | videosink = gst_element_factory_make ("xvimagesink", "videosink"); 55 | 56 | /* setup */ 57 | g_object_set (G_OBJECT (appsrc), "caps", 58 | gst_caps_new_simple ("video/x-raw", 59 | "format", G_TYPE_STRING, "RGB16", 60 | "width", G_TYPE_INT, 384, 61 | "height", G_TYPE_INT, 288, 62 | "framerate", GST_TYPE_FRACTION, 0, 1, 63 | NULL), NULL); 64 | gst_bin_add_many (GST_BIN (pipeline), appsrc, conv, videosink, NULL); 65 | gst_element_link_many (appsrc, conv, videosink, NULL); 66 | 67 | /* setup appsrc */ 68 | g_object_set (G_OBJECT (appsrc), 69 | "stream-type", 0, 70 | "format", GST_FORMAT_TIME, NULL); 71 | g_signal_connect (appsrc, "need-data", G_CALLBACK (cb_need_data), NULL); 72 | 73 | /* play */ 74 | gst_element_set_state (pipeline, GST_STATE_PLAYING); 75 | g_main_loop_run (loop); 76 | 77 | /* clean up */ 78 | gst_element_set_state (pipeline, GST_STATE_NULL); 79 | gst_object_unref (GST_OBJECT (pipeline)); 80 | g_main_loop_unref (loop); 81 | 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /appsrc.cpp: -------------------------------------------------------------------------------- 1 | 2 | /*** block from ../../../docs/manual/advanced-dataaccess.xml ***/ 3 | #include 4 | 5 | static GMainLoop *loop; 6 | 7 | static void 8 | cb_need_data (GstElement *appsrc, 9 | guint unused_size, 10 | gpointer user_data) 11 | { 12 | static gboolean white = FALSE; 13 | static GstClockTime timestamp = 0; 14 | GstBuffer *buffer; 15 | guint size; 16 | GstFlowReturn ret; 17 | 18 | size = 385 * 288 * 2; 19 | 20 | buffer = gst_buffer_new_allocate (NULL, size, NULL); 21 | 22 | /* this makes the image black/white */ 23 | gst_buffer_memset (buffer, 0, white ? 0xff : 0x0, size); 24 | 25 | white = !white; 26 | 27 | GST_BUFFER_PTS (buffer) = timestamp; 28 | GST_BUFFER_DURATION (buffer) = gst_util_uint64_scale_int (1, GST_SECOND, 2); 29 | 30 | timestamp += GST_BUFFER_DURATION (buffer); 31 | 32 | g_signal_emit_by_name (appsrc, "push-buffer", buffer, &ret); 33 | 34 | if (ret != GST_FLOW_OK) { 35 | /* something wrong, stop pushing */ 36 | g_main_loop_quit (loop); 37 | } 38 | } 39 | 40 | gint 41 | main (gint argc, 42 | gchar *argv[]) 43 | { 44 | GstElement *pipeline, *appsrc, *conv, *videosink; 45 | 46 | /* init GStreamer */ 47 | gst_init (&argc, &argv); 48 | loop = g_main_loop_new (NULL, FALSE); 49 | 50 | /* setup pipeline */ 51 | pipeline = gst_pipeline_new ("pipeline"); 52 | appsrc = gst_element_factory_make ("appsrc", "source"); 53 | conv = gst_element_factory_make ("videoconvert", "conv"); 54 | videosink = gst_element_factory_make ("autovideosink", "videosink"); 55 | 56 | /* setup */ 57 | g_object_set (G_OBJECT (appsrc), "caps", 58 | gst_caps_new_simple ("video/x-raw", 59 | "format", G_TYPE_STRING, "RGB16", 60 | "width", G_TYPE_INT, 384, 61 | "height", G_TYPE_INT, 288, 62 | "framerate", GST_TYPE_FRACTION, 0, 1, 63 | NULL), NULL); 64 | gst_bin_add_many (GST_BIN (pipeline), appsrc, conv, videosink, NULL); 65 | gst_element_link_many (appsrc, conv, videosink, NULL); 66 | 67 | /* setup appsrc */ 68 | g_object_set (G_OBJECT (appsrc), 69 | "stream-type", 0, 70 | "format", GST_FORMAT_TIME, NULL); 71 | g_signal_connect (appsrc, "need-data", G_CALLBACK (cb_need_data), NULL); 72 | 73 | /* play */ 74 | gst_element_set_state (pipeline, GST_STATE_PLAYING); 75 | g_main_loop_run (loop); 76 | 77 | /* clean up */ 78 | gst_element_set_state (pipeline, GST_STATE_NULL); 79 | gst_object_unref (GST_OBJECT (pipeline)); 80 | g_main_loop_unref (loop); 81 | 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /capture.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | struct Parser 6 | { 7 | GstElement *video; 8 | GstElement *audio; 9 | }; 10 | 11 | static gboolean 12 | bus_call (GstBus *bus, 13 | GstMessage *msg, 14 | gpointer data) 15 | 16 | { 17 | GMainLoop *loop = (GMainLoop *) data; 18 | switch (GST_MESSAGE_TYPE (msg)) { 19 | case GST_MESSAGE_EOS: 20 | g_print ("End of stream\n"); 21 | g_main_loop_quit (loop); 22 | break; 23 | case GST_MESSAGE_ERROR: { 24 | gchar *debug; 25 | GError *error; 26 | gst_message_parse_error (msg, &error, &debug); 27 | g_free (debug); 28 | g_printerr ("Error: %s\n", error->message); 29 | g_error_free (error); 30 | g_main_loop_quit (loop); 31 | break; 32 | } 33 | default: 34 | break; 35 | } 36 | return TRUE; 37 | } 38 | 39 | static void 40 | on_pad_added (GstElement *element, 41 | GstPad *pad, 42 | gpointer data) 43 | { 44 | GstPad *sinkpad; 45 | GstCaps *caps; 46 | Parser *parser = (Parser *) data; 47 | // GstElement *parser = (GstElement *) data; 48 | GstStructure *str; 49 | std::string type; 50 | /* We can now link this pad with the h264parse sink pad */ 51 | caps = gst_pad_get_current_caps (pad); 52 | str = gst_caps_get_structure (caps, 0); 53 | type = gst_structure_get_name (str); 54 | 55 | g_print("%s\n", gst_caps_to_string(caps)); 56 | 57 | if(type.find("video") != std::string::npos) 58 | { 59 | sinkpad = gst_element_get_static_pad (parser->video, "sink"); 60 | gst_pad_link (pad, sinkpad); 61 | gst_object_unref (sinkpad); 62 | g_print ("linking demuxer/h264parse\n"); 63 | } 64 | else 65 | { 66 | sinkpad = gst_element_get_static_pad (parser->audio, "sink"); 67 | gst_pad_link (pad, sinkpad); 68 | gst_object_unref (sinkpad); 69 | g_print ("linking demuxer/accparse\n"); 70 | } 71 | } 72 | 73 | int 74 | main (int argc, 75 | char *argv[]) 76 | { 77 | GMainLoop *loop; 78 | GstElement *pipeline, *source, *demuxer,*video_encoder, *video_parser, *video_decoder, *video_sink, * audio_decoder, * audio_sink; 79 | Parser parser; 80 | Parser queue; 81 | GstBus *bus; 82 | /* Initialisation */ 83 | gst_init (&argc, &argv); 84 | loop = g_main_loop_new (NULL, FALSE); 85 | /* Check input arguments */ 86 | /* Create gstreamer elements */ 87 | pipeline = gst_pipeline_new ("capture-player"); 88 | source = gst_element_factory_make ("wrappercamerabinsrc", "camera-source"); 89 | // demuxer = gst_element_factory_make ("qtdemux", "demuxer"); 90 | // queue.video = gst_element_factory_make ("queue", "video_queue"); 91 | // queue.audio = gst_element_factory_make ("queue", "audio_queue"); 92 | // parser.video = gst_element_factory_make ("h264parse", "video_parser"); 93 | // parser.audio = gst_element_factory_make ("aacparse", "audio_parser"); 94 | // video_decoder = gst_element_factory_make ("avdec_h264", "video_decoder"); 95 | // audio_decoder= gst_element_factory_make ("faad", "audio_decoder"); 96 | video_encoder = gst_element_factory_make("x264enc", "video_encoder"); 97 | video_parser = gst_element_factory_make("h264parse", "video_parser"); 98 | video_decoder = gst_element_factory_make("avdec_h264", "video_decoder"); 99 | video_sink = gst_element_factory_make ("autovideosink", "video_sinker"); 100 | // audio_sink = gst_element_factory_make ("autoaudiosink", "audio_sink"); 101 | // if (!pipeline || !source || !demuxer || !queue.video || !queue.audio || !parser.video || !parser.audio || 102 | // !video_decoder || !audio_decoder || !video_sink|| !audio_sink) { 103 | // g_printerr ("One element could not be created. Exiting.\n"); 104 | // return -1; 105 | // } 106 | /* Set up the pipeline */ 107 | 108 | /* we add a message handler */ 109 | bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); 110 | gst_bus_add_watch (bus, bus_call, loop); 111 | gst_object_unref (bus); 112 | /* we add all elements into the pipeline */ 113 | // gst_bin_add_many (GST_BIN (pipeline), source, demuxer, queue.audio, 114 | // gst_bin_add_many (GST_BIN (pipeline), source, demuxer,queue.audio, queue.video, parser.video, video_decoder, video_sink, 115 | // parser.audio, audio_decoder, audio_sink, NULL); 116 | gst_bin_add_many (GST_BIN (pipeline), source, video_encoder, video_parser, video_decoder, video_sink, NULL); 117 | /* we link the elements together */ 118 | // gst_element_link_many (queue.audio, audio_sink, NULL); 119 | gst_element_link_many (source, video_encoder, video_parser, video_decoder, video_sink, NULL); 120 | // g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added_queue), queue); 121 | // g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), &queue); 122 | /* Set the pipeline to "playing" state*/ 123 | gst_element_set_state (pipeline, GST_STATE_PLAYING); 124 | /* Iterate */ 125 | g_print ("Running...\n"); 126 | g_main_loop_run (loop); 127 | /* Out of the main loop, clean up nicely */ 128 | g_print ("Returned, stopping playback\n"); 129 | gst_element_set_state (pipeline, GST_STATE_NULL); 130 | g_print ("Deleting pipeline\n"); 131 | gst_object_unref (GST_OBJECT (pipeline)); 132 | return 0; 133 | } 134 | -------------------------------------------------------------------------------- /capture_simple.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | struct Parser 6 | { 7 | GstElement *video; 8 | GstElement *audio; 9 | }; 10 | 11 | static void 12 | *produce_frame(void * threadData) 13 | { 14 | GstCaps *caps; 15 | GstSample *sample; 16 | std::string streaminfo; 17 | GstBuffer *buffer; 18 | GstMapInfo map; 19 | GstElement* sink; 20 | sink = (GstElement *) threadData; 21 | 22 | size_t framenumber = 0; 23 | do { 24 | g_signal_emit_by_name (sink, "pull-sample", &sample); 25 | if (sample == NULL){ 26 | g_print("Meet the EOS!\n"); 27 | break; 28 | } 29 | if ( framenumber == 0) 30 | { 31 | caps = gst_sample_get_caps(sample); 32 | streaminfo = gst_caps_to_string(caps); 33 | // Name streaminfoVideoSuffix("video"); 34 | // std::cout << streaminfo << std::endl; 35 | // producerStreaminfo->produce(streaminfoVideoSuffix, (uint8_t *)streaminfo.c_str(), streaminfo.size()+1); 36 | std::cout << "produce video streaminfo OK! " << streaminfo << std::endl; 37 | std::cout << "streaminfo size "<< streaminfo.size() + 1 << std::endl; 38 | } 39 | buffer = gst_sample_get_buffer (sample); 40 | gst_buffer_map (buffer, &map, GST_MAP_READ); 41 | // Name frameSuffix("video/" + std::to_string(framenumber)); 42 | std::cout << "Frame number: "<< framenumber <produce(frameSuffix, (uint8_t *)map.data, map.size * sizeof(uint8_t)); 46 | framenumber ++; 47 | // if ( framenumber > 2500) 48 | // break; 49 | if (sample) 50 | gst_sample_unref (sample); 51 | }while (sample != NULL); 52 | 53 | pthread_exit(NULL); 54 | } 55 | 56 | static gboolean 57 | bus_call (GstBus *bus, 58 | GstMessage *msg, 59 | gpointer data) 60 | 61 | { 62 | GMainLoop *loop = (GMainLoop *) data; 63 | switch (GST_MESSAGE_TYPE (msg)) { 64 | case GST_MESSAGE_EOS: 65 | g_print ("End of stream\n"); 66 | g_main_loop_quit (loop); 67 | break; 68 | case GST_MESSAGE_ERROR: { 69 | gchar *debug; 70 | GError *error; 71 | gst_message_parse_error (msg, &error, &debug); 72 | g_free (debug); 73 | g_printerr ("Error: %s\n", error->message); 74 | g_error_free (error); 75 | g_main_loop_quit (loop); 76 | break; 77 | } 78 | default: 79 | break; 80 | } 81 | return TRUE; 82 | } 83 | 84 | static void 85 | on_pad_added (GstElement *element, 86 | GstPad *pad, 87 | gpointer data) 88 | { 89 | GstPad *sinkpad; 90 | GstCaps *caps; 91 | Parser *parser = (Parser *) data; 92 | // GstElement *parser = (GstElement *) data; 93 | GstStructure *str; 94 | std::string type; 95 | /* We can now link this pad with the h264parse sink pad */ 96 | caps = gst_pad_get_current_caps (pad); 97 | str = gst_caps_get_structure (caps, 0); 98 | type = gst_structure_get_name (str); 99 | 100 | g_print("%s\n", gst_caps_to_string(caps)); 101 | 102 | if(type.find("video") != std::string::npos) 103 | { 104 | sinkpad = gst_element_get_static_pad (parser->video, "sink"); 105 | gst_pad_link (pad, sinkpad); 106 | gst_object_unref (sinkpad); 107 | g_print ("linking demuxer/h264parse\n"); 108 | } 109 | else 110 | { 111 | sinkpad = gst_element_get_static_pad (parser->audio, "sink"); 112 | gst_pad_link (pad, sinkpad); 113 | gst_object_unref (sinkpad); 114 | g_print ("linking demuxer/accparse\n"); 115 | } 116 | } 117 | 118 | int 119 | main (int argc, 120 | char *argv[]) 121 | { 122 | GMainLoop *loop; 123 | GstElement *pipeline, *video_source, *demuxer,*video_encoder, *video_parser, *video_decoder, *video_sink, * audio_decoder, * audio_sink, *audio_source, *audio_encoder, *audio_convert, *audio_parser; 124 | GstBus *bus; 125 | 126 | /* Initialisation */ 127 | gst_init (&argc, &argv); 128 | loop = g_main_loop_new (NULL, FALSE); 129 | /* Check input arguments */ 130 | /* Create gstreamer elements */ 131 | pipeline = gst_pipeline_new ("capture-player"); 132 | video_source = gst_element_factory_make ("autovideosrc", "camera-source"); 133 | // video_source = gst_element_factory_make ("wrappercamerabinsrc", "camera-source"); 134 | video_encoder = gst_element_factory_make("x264enc", "video_encoder"); 135 | video_parser = gst_element_factory_make("h264parse", "video_parser"); 136 | video_decoder = gst_element_factory_make("avdec_h264", "video_decoder"); 137 | video_sink = gst_element_factory_make ("appsink", "video_sinker"); 138 | 139 | audio_source = gst_element_factory_make ("autoaudiosrc", "MIC-source"); 140 | audio_convert = gst_element_factory_make ("audioconvert", "audio-convert"); 141 | audio_encoder = gst_element_factory_make("voaacenc", "audio_encoder"); 142 | audio_parser = gst_element_factory_make("aacparse", "audio_parser"); 143 | audio_decoder= gst_element_factory_make("faad", "audio_decoder"); 144 | audio_sink = gst_element_factory_make ("appsink", "audio_sinker"); 145 | // if (!pipeline || !video_source || !demuxer || !queue.video || !queue.audio || !parser.video || !parser.audio || 146 | // !video_decoder || !audio_decoder || !video_sink|| !audio_sink) { 147 | // g_printerr ("One element could not be created. Exiting.\n"); 148 | // return -1; 149 | // } 150 | /* Set up the pipeline */ 151 | 152 | g_object_set (G_OBJECT (video_sink), "sync", FALSE, NULL); 153 | g_object_set (G_OBJECT (audio_sink), "sync", FALSE, NULL); 154 | /* we add a message handler */ 155 | bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); 156 | gst_bus_add_watch (bus, bus_call, loop); 157 | gst_object_unref (bus); 158 | /* we add all elements into the pipeline */ 159 | gst_bin_add_many (GST_BIN (pipeline), video_source, video_sink, NULL); 160 | /* we link the elements together */ 161 | gst_element_link_many (video_source, video_sink, NULL); 162 | 163 | gst_bin_add_many (GST_BIN (pipeline), audio_source, audio_convert, audio_sink, NULL); 164 | /* we link the elements together */ 165 | gst_element_link_many (audio_source, audio_convert, audio_sink, NULL); 166 | /* Set the pipeline to "playing" state*/ 167 | gst_element_set_state (pipeline, GST_STATE_PLAYING); 168 | 169 | pthread_t video_thread; 170 | int video_rc; 171 | video_rc = pthread_create(&video_thread, NULL, produce_frame, (void *)video_sink); 172 | 173 | pthread_t audio_thread; 174 | int audio_rc; 175 | audio_rc = pthread_create(&audio_thread, NULL, produce_frame, (void *)audio_sink); 176 | 177 | /* Iterate */ 178 | g_print ("Running...\n"); 179 | g_main_loop_run (loop); 180 | /* Out of the main loop, clean up nicely */ 181 | g_print ("Returned, stopping playback\n"); 182 | gst_element_set_state (pipeline, GST_STATE_NULL); 183 | g_print ("Deleting pipeline\n"); 184 | gst_object_unref (GST_OBJECT (pipeline)); 185 | return 0; 186 | } 187 | -------------------------------------------------------------------------------- /fileinfo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "tools.hpp" 3 | static gboolean 4 | bus_call (GstBus *bus, 5 | GstMessage *msg, 6 | gpointer data) 7 | 8 | { 9 | GMainLoop *loop = (GMainLoop *) data; 10 | switch (GST_MESSAGE_TYPE (msg)) { 11 | case GST_MESSAGE_EOS: 12 | g_print ("End of stream\n"); 13 | g_main_loop_quit (loop); 14 | break; 15 | case GST_MESSAGE_ERROR: { 16 | gchar *debug; 17 | GError *error; 18 | gst_message_parse_error (msg, &error, &debug); 19 | g_free (debug); 20 | g_printerr ("Error: %s\n", error->message); 21 | g_error_free (error); 22 | g_main_loop_quit (loop); 23 | break; 24 | } 25 | default: 26 | break; 27 | } 28 | return TRUE; 29 | } 30 | 31 | struct VideoAudio 32 | { 33 | GstElement *video_parser; 34 | std::string video_info; 35 | GstElement *audio_parser; 36 | std::string audio_info; 37 | } ; 38 | static void 39 | on_pad_added(GstElement *element, 40 | GstPad *pad, 41 | gpointer data) 42 | { 43 | GstPad *sinkpad; 44 | GstCaps *caps; 45 | const GstStructure *str; 46 | std::string type; 47 | struct VideoAudio * video_audio = (struct VideoAudio *) data; 48 | 49 | caps = gst_pad_get_current_caps (pad); 50 | str = gst_caps_get_structure (caps, 0); 51 | type = gst_structure_get_name (str); 52 | 53 | std::cout << "TYPE: " << type << std::endl; 54 | if(type.find("video") != std::string::npos) 55 | { 56 | video_audio->video_info = gst_caps_to_string(caps); 57 | /* We can now link this pad with the h264parse sink pad */ 58 | g_print ("Dynamic pad created, linking demuxer/video_parser\n"); 59 | std::cout << "Caps inside on_pad_added: " << video_audio->video_info <video_parser, "sink"); 61 | gst_pad_link (pad, sinkpad); 62 | gst_object_unref (sinkpad); 63 | } 64 | return; 65 | } 66 | 67 | int 68 | main (int argc, 69 | char *argv[]) 70 | { 71 | struct VideoAudio video_audio; 72 | 73 | GstElement *pipeline, *source, *demuxer, *sink; 74 | GstCaps *caps; 75 | 76 | GstBuffer *buffer; 77 | GstSample *sample; 78 | GstMapInfo map; 79 | 80 | /* Initialisation */ 81 | gst_init (&argc, &argv); 82 | /* Check input arguments */ 83 | if (argc != 2) { 84 | g_printerr ("Usage: %s \n", argv[0]); 85 | return -1; 86 | } 87 | /* Create gstreamer elements */ 88 | pipeline = gst_pipeline_new ("mp4-player"); 89 | source = gst_element_factory_make ("filesrc", "file-source"); 90 | demuxer = gst_element_factory_make ("qtdemux", "demuxer"); 91 | video_audio.video_parser = gst_element_factory_make ("h264parse", "parser"); 92 | sink = gst_element_factory_make ("appsink", NULL); 93 | 94 | g_object_set (G_OBJECT (sink), "sync", FALSE, NULL); 95 | 96 | if (!pipeline || !source || !demuxer || !video_audio.video_parser || !sink) { 97 | g_printerr ("One element could not be created. Exiting.\n"); 98 | return -1; 99 | } 100 | /* Set up the pipeline */ 101 | /* we set the input filename to the source element */ 102 | g_object_set (G_OBJECT (source), "location", argv[1], NULL); 103 | /* we add a message handler */ 104 | /* we add all elements into the pipeline */ 105 | gst_bin_add_many (GST_BIN (pipeline), source, demuxer, video_audio.video_parser, sink, NULL); 106 | /* we link the elements together */ 107 | gst_element_link (source, demuxer); 108 | gst_element_link_many (video_audio.video_parser, sink, NULL); 109 | g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), &video_audio); 110 | /* Set the pipeline to "playing" state*/ 111 | g_print ("Now playing: %s\n", argv[1]); 112 | gst_element_set_state (pipeline, GST_STATE_PLAYING); 113 | 114 | g_signal_emit_by_name (sink, "pull-sample", &sample); 115 | caps = gst_sample_get_caps(sample); 116 | // Tools::read_video_props(caps); 117 | g_print("caps: %s\n", gst_caps_to_string(caps)); 118 | std::cout << "video_info " << video_audio.video_info << std::endl; 119 | 120 | if (sample) 121 | gst_sample_unref (sample); 122 | 123 | /* Iterate */ 124 | gst_element_set_state (pipeline, GST_STATE_NULL); 125 | gst_object_unref (GST_OBJECT (pipeline)); 126 | return 0; 127 | } 128 | -------------------------------------------------------------------------------- /haha.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/haha.mp4 -------------------------------------------------------------------------------- /haha.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/haha.ogg -------------------------------------------------------------------------------- /hehe.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/hehe.mp3 -------------------------------------------------------------------------------- /helloworld.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static gboolean 4 | bus_call (GstBus * bus, GstMessage * msg, gpointer data) 5 | { 6 | GMainLoop *loop = (GMainLoop *) data; 7 | 8 | switch (GST_MESSAGE_TYPE (msg)) { 9 | case GST_MESSAGE_EOS:{ 10 | g_print ("End-of-stream\n"); 11 | g_main_loop_quit (loop); 12 | break; 13 | } 14 | case GST_MESSAGE_ERROR:{ 15 | gchar *debug; 16 | GError *err; 17 | 18 | gst_message_parse_error (msg, &err, &debug); 19 | g_printerr ("Debugging info: %s\n", (debug) ? debug : "none"); 20 | g_free (debug); 21 | 22 | g_print ("Error: %s\n", err->message); 23 | g_error_free (err); 24 | 25 | g_main_loop_quit (loop); 26 | 27 | break; 28 | } 29 | default: 30 | break; 31 | } 32 | return TRUE; 33 | } 34 | 35 | gint 36 | main (gint argc, gchar * argv[]) 37 | { 38 | GstElement *playbin; 39 | GMainLoop *loop; 40 | GstBus *bus; 41 | guint bus_watch_id; 42 | gchar *uri; 43 | 44 | gst_init (&argc, &argv); 45 | 46 | if (argc < 2) { 47 | g_print ("usage: %s \n", argv[0]); 48 | return 1; 49 | } 50 | 51 | playbin = gst_element_factory_make ("playbin", NULL); 52 | if (!playbin) { 53 | g_print ("'playbin' gstreamer plugin missing\n"); 54 | return 1; 55 | } 56 | 57 | /* take the commandline argument and ensure that it is a uri */ 58 | if (gst_uri_is_valid (argv[1])) 59 | uri = g_strdup (argv[1]); 60 | else 61 | uri = gst_filename_to_uri (argv[1], NULL); 62 | g_object_set (playbin, "uri", uri, NULL); 63 | g_free (uri); 64 | 65 | /* create and event loop and feed gstreamer bus mesages to it */ 66 | loop = g_main_loop_new (NULL, TRUE); 67 | 68 | bus = gst_element_get_bus (playbin); 69 | bus_watch_id = gst_bus_add_watch (bus, bus_call, loop); 70 | g_object_unref (bus); 71 | 72 | /* start play back and listed to events */ 73 | gst_element_set_state (playbin, GST_STATE_PLAYING); 74 | g_main_loop_run (loop); 75 | 76 | /* cleanup */ 77 | gst_element_set_state (playbin, GST_STATE_NULL); 78 | g_object_unref (playbin); 79 | g_source_remove (bus_watch_id); 80 | g_main_loop_unref (loop); 81 | 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /helloworld.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static gboolean 4 | bus_call (GstBus * bus, GstMessage * msg, gpointer data) 5 | { 6 | g_print ("bus_call here!\n"); 7 | GMainLoop *loop = (GMainLoop *) data; 8 | 9 | switch (GST_MESSAGE_TYPE (msg)) { 10 | case GST_MESSAGE_EOS:{ 11 | g_print ("End-of-stream\n"); 12 | g_main_loop_quit (loop); 13 | break; 14 | } 15 | case GST_MESSAGE_ERROR:{ 16 | gchar *debug; 17 | GError *err; 18 | 19 | gst_message_parse_error (msg, &err, &debug); 20 | g_printerr ("Debugging info: %s\n", (debug) ? debug : "none"); 21 | g_free (debug); 22 | 23 | g_print ("Error: %s\n", err->message); 24 | g_error_free (err); 25 | 26 | g_main_loop_quit (loop); 27 | 28 | break; 29 | } 30 | default: 31 | break; 32 | } 33 | return TRUE; 34 | } 35 | 36 | gint 37 | main (gint argc, gchar * argv[]) 38 | { 39 | GstElement *playbin; 40 | GMainLoop *loop; 41 | GstBus *bus; 42 | guint bus_watch_id; 43 | gchar *uri; 44 | 45 | gst_init (&argc, &argv); 46 | 47 | if (argc < 2) { 48 | g_print ("usage: %s \n", argv[0]); 49 | return 1; 50 | } 51 | 52 | playbin = gst_element_factory_make ("playbin", NULL); 53 | if (!playbin) { 54 | g_print ("'playbin' gstreamer plugin missing\n"); 55 | return 1; 56 | } 57 | 58 | /* take the commandline argument and ensure that it is a uri */ 59 | if (gst_uri_is_valid (argv[1])) 60 | uri = g_strdup (argv[1]); 61 | else 62 | uri = gst_filename_to_uri (argv[1], NULL); 63 | g_object_set (playbin, "uri", uri, NULL); 64 | g_free (uri); 65 | 66 | /* create and event loop and feed gstreamer bus mesages to it */ 67 | loop = g_main_loop_new (NULL, FALSE); 68 | 69 | bus = gst_element_get_bus (playbin); 70 | bus_watch_id = gst_bus_add_watch (bus, bus_call, loop); 71 | g_object_unref (bus); 72 | 73 | /* start play back and listed to events */ 74 | gst_element_set_state (playbin, GST_STATE_PLAYING); 75 | g_main_loop_run (loop); 76 | 77 | /* cleanup */ 78 | gst_element_set_state (playbin, GST_STATE_NULL); 79 | g_object_unref (playbin); 80 | g_source_remove (bus_watch_id); 81 | g_main_loop_unref (loop); 82 | 83 | return 0; 84 | } 85 | -------------------------------------------------------------------------------- /info.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | static gboolean 7 | bus_call (GstBus * bus, GstMessage * msg, gpointer data) 8 | { 9 | // g_print ("bus_call here!\n"); 10 | GMainLoop *loop = (GMainLoop *) data; 11 | 12 | switch (GST_MESSAGE_TYPE (msg)) { 13 | case GST_MESSAGE_EOS:{ 14 | g_print ("End-of-stream\n"); 15 | g_main_loop_quit (loop); 16 | break; 17 | } 18 | case GST_MESSAGE_ERROR:{ 19 | gchar *debug; 20 | GError *err; 21 | 22 | gst_message_parse_error (msg, &err, &debug); 23 | g_printerr ("Debugging info: %s\n", (debug) ? debug : "none"); 24 | g_free (debug); 25 | 26 | g_print ("Error: %s\n", err->message); 27 | g_error_free (err); 28 | 29 | g_main_loop_quit (loop); 30 | 31 | break; 32 | } 33 | default: 34 | break; 35 | } 36 | return TRUE; 37 | } 38 | 39 | static void 40 | read_video_props (GstCaps *caps) 41 | { 42 | gint width, height, num, denom; 43 | const GstStructure *str; 44 | const char *format; 45 | const char *type; 46 | 47 | g_return_if_fail (gst_caps_is_fixed (caps)); 48 | 49 | str = gst_caps_get_structure (caps, 0); 50 | type = gst_structure_get_name (str); 51 | format = gst_structure_get_string (str, "format"); 52 | if (!gst_structure_get_int (str, "width", &width) || 53 | !gst_structure_get_int (str, "height", &height) || 54 | !gst_structure_get_fraction (str, "framerate", &num, &denom)) { 55 | g_print ("No width/height available\n"); 56 | return; 57 | } 58 | 59 | g_print ("The video size of this set of capabilities is %d x %d and the frame rate is %d/%d\nformat:%s type:%s\n",width, height,num,denom,format,type); 60 | g_print("caps: %s\n", gst_caps_to_string(caps)); 61 | } 62 | 63 | gint 64 | main (gint argc, gchar * argv[]) 65 | { 66 | GstElement *playbin, *fakevideosink, *fakeaudiosink; 67 | GMainLoop *loop; 68 | GstBus *bus; 69 | guint bus_watch_id; 70 | gchar *uri; 71 | GstState state = GST_STATE_NULL; 72 | GstPad *pad; 73 | GstCaps *caps; 74 | GstBuffer *buffer; 75 | std::string filename = "/Users/Loli/video/duoyan.mp4"; 76 | 77 | gst_init (NULL, NULL); 78 | 79 | playbin = gst_element_factory_make ("playbin", NULL); 80 | if (!playbin) { 81 | g_print ("'playbin' gstreamer plugin missing\n"); 82 | return 1; 83 | } 84 | 85 | /* take the commandline argument and ensure that it is a uri */ 86 | if(argc >=2 ) 87 | filename = argv[1]; 88 | if (gst_uri_is_valid (filename.c_str())) 89 | uri = g_strdup (filename.c_str()); 90 | else 91 | uri = gst_filename_to_uri (filename.c_str(), NULL); 92 | 93 | fakevideosink = gst_element_factory_make ("fakesink", NULL); 94 | fakeaudiosink = gst_element_factory_make ("fakesink", NULL); 95 | 96 | g_object_set (playbin, "uri", uri, NULL); 97 | g_free (uri); 98 | 99 | g_object_set (playbin, "video-sink", fakevideosink, NULL); 100 | g_object_set (playbin, "audio-sink", fakeaudiosink, NULL); 101 | 102 | gst_element_set_state (playbin, GST_STATE_PAUSED); 103 | gst_element_get_state (playbin, &state, NULL, GST_SECOND * 1); 104 | //fail_unless (state == GST_STATE_PAUSED); 105 | g_signal_emit_by_name (playbin, "get-video-pad", 0, &pad, NULL); 106 | GstSample *sample; 107 | // g_object_set (playbin, "sample", &sample, NULL); 108 | g_signal_emit_by_name (playbin, "convert-sample",NULL, &sample); 109 | buffer = gst_sample_get_buffer (sample); 110 | std::cout << gst_buffer_get_size (buffer) << std::endl; 111 | 112 | caps = gst_pad_get_current_caps (pad); 113 | read_video_props(caps); 114 | 115 | /* create and event loop and feed gstreamer bus mesages to it */ 116 | loop = g_main_loop_new (NULL, FALSE); 117 | 118 | bus = gst_element_get_bus (playbin); 119 | bus_watch_id = gst_bus_add_watch (bus, bus_call, loop); 120 | g_object_unref (bus); 121 | 122 | /* start play back and listed to events */ 123 | gst_element_set_state (playbin, GST_STATE_PLAYING); 124 | g_main_loop_run (loop); 125 | 126 | /* cleanup */ 127 | gst_element_set_state (playbin, GST_STATE_NULL); 128 | g_object_unref (playbin); 129 | g_source_remove (bus_watch_id); 130 | g_main_loop_unref (loop); 131 | // sleep(300); 132 | 133 | return 0; 134 | } 135 | -------------------------------------------------------------------------------- /init.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int 5 | main (int argc, 6 | char *argv[]) 7 | { 8 | const gchar *nano_str; 9 | guint major, minor, micro, nano; 10 | 11 | gst_init (&argc, &argv); 12 | 13 | gst_version (&major, &minor, µ, &nano); 14 | 15 | if (nano == 1) 16 | nano_str = "(CVS)"; 17 | else if (nano == 2) 18 | nano_str = "(Prerelease)"; 19 | else 20 | nano_str = ""; 21 | 22 | printf ("This program is linked against GStreamer %d.%d.%d %s\n", 23 | major, minor, micro, nano_str); 24 | 25 | return 0; 26 | } -------------------------------------------------------------------------------- /lowerlevel.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static gboolean 6 | bus_call (GstBus *bus, 7 | GstMessage *msg, 8 | gpointer data) 9 | { 10 | GMainLoop *loop = (GMainLoop *) data; 11 | 12 | switch (GST_MESSAGE_TYPE (msg)) { 13 | 14 | case GST_MESSAGE_EOS: 15 | g_print ("End of stream\n"); 16 | g_main_loop_quit (loop); 17 | break; 18 | 19 | case GST_MESSAGE_ERROR: { 20 | gchar *debug; 21 | GError *error; 22 | 23 | gst_message_parse_error (msg, &error, &debug); 24 | g_free (debug); 25 | 26 | g_printerr ("Error: %s\n", error->message); 27 | g_error_free (error); 28 | 29 | g_main_loop_quit (loop); 30 | break; 31 | } 32 | default: 33 | break; 34 | } 35 | 36 | return TRUE; 37 | } 38 | 39 | 40 | static void 41 | on_pad_added (GstElement *element, 42 | GstPad *pad, 43 | gpointer data) 44 | { 45 | GstPad *sinkpad; 46 | GstElement *decoder = (GstElement *) data; 47 | 48 | /* We can now link this pad with the vorbis-decoder sink pad */ 49 | g_print ("Dynamic pad created, linking demuxer/decoder\n"); 50 | 51 | sinkpad = gst_element_get_static_pad (decoder, "sink"); 52 | 53 | gst_pad_link (pad, sinkpad); 54 | 55 | gst_object_unref (sinkpad); 56 | } 57 | 58 | 59 | 60 | int 61 | main (int argc, 62 | char *argv[]) 63 | { 64 | GMainLoop *loop; 65 | 66 | GstElement *pipeline, *source, *demuxer, *decoder, *conv, *sink; 67 | GstBus *bus; 68 | guint bus_watch_id; 69 | 70 | /* Initialisation */ 71 | gst_init (&argc, &argv); 72 | 73 | loop = g_main_loop_new (NULL, FALSE); 74 | 75 | 76 | /* Check input arguments */ 77 | if (argc != 2) { 78 | g_printerr ("Usage: %s \n", argv[0]); 79 | return -1; 80 | } 81 | 82 | std::ifstream filestr; 83 | long size; 84 | char * buffer; 85 | // binary open 86 | filestr.open ("/Users/Loli/Video/me.ogg", std::ios::binary); 87 | // get the size 88 | filestr.seekg(0, std::ios::end); 89 | size = filestr.tellg(); 90 | filestr.seekg(0, std::ios::beg); 91 | // malloc the memory 92 | buffer=new char[size]; 93 | 94 | filestr.read(buffer, size); 95 | std::cout << "byte = " << size << std::endl; 96 | std::cout << "content = " << buffer << std::endl; 97 | 98 | filestr.close(); 99 | 100 | 101 | /* Create gstreamer elements */ 102 | pipeline = gst_pipeline_new ("audio-player"); 103 | source = gst_element_factory_make ("filesrc", "file-source"); 104 | demuxer = gst_element_factory_make ("oggdemux", "ogg-demuxer"); 105 | decoder = gst_element_factory_make ("vorbisdec", "vorbis-decoder"); 106 | conv = gst_element_factory_make ("audioconvert", "converter"); 107 | sink = gst_element_factory_make ("autoaudiosink", "audio-output"); 108 | 109 | if (!pipeline || !source || !demuxer || !decoder || !conv || !sink) { 110 | g_printerr ("One element could not be created. Exiting.\n"); 111 | return -1; 112 | } 113 | 114 | /* Set up the pipeline */ 115 | 116 | /* we set the input filename to the source element */ 117 | g_object_set (G_OBJECT (source), "location", argv[1], NULL); 118 | 119 | /* we add a message handler */ 120 | bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); 121 | bus_watch_id = gst_bus_add_watch (bus, bus_call, loop); 122 | gst_object_unref (bus); 123 | 124 | /* we add all elements into the pipeline */ 125 | /* file-source | ogg-demuxer | vorbis-decoder | converter | alsa-output */ 126 | gst_bin_add_many (GST_BIN (pipeline), 127 | source, demuxer, decoder, conv, sink, NULL); 128 | 129 | /* we link the elements together */ 130 | /* file-source -> ogg-demuxer ~> vorbis-decoder -> converter -> alsa-output */ 131 | gst_element_link (source, demuxer); 132 | gst_element_link_many (decoder, conv, sink, NULL); 133 | g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), decoder); 134 | 135 | /* note that the demuxer will be linked to the decoder dynamically. 136 | The reason is that Ogg may contain various streams (for example 137 | audio and video). The source pad(s) will be created at run time, 138 | by the demuxer when it detects the amount and nature of streams. 139 | Therefore we connect a callback function which will be executed 140 | when the "pad-added" is emitted.*/ 141 | 142 | 143 | /* Set the pipeline to "playing" state*/ 144 | g_print ("Now playing: %s\n", argv[1]); 145 | gst_element_set_state (pipeline, GST_STATE_PLAYING); 146 | 147 | 148 | /* Iterate */ 149 | g_print ("Running...\n"); 150 | g_main_loop_run (loop); 151 | 152 | 153 | /* Out of the main loop, clean up nicely */ 154 | g_print ("Returned, stopping playback\n"); 155 | gst_element_set_state (pipeline, GST_STATE_NULL); 156 | 157 | g_print ("Deleting pipeline\n"); 158 | gst_object_unref (GST_OBJECT (pipeline)); 159 | g_source_remove (bus_watch_id); 160 | g_main_loop_unref (loop); 161 | 162 | return 0; 163 | } 164 | -------------------------------------------------------------------------------- /lowerlevel.c.bk: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | static gboolean 6 | bus_call (GstBus *bus, 7 | GstMessage *msg, 8 | gpointer data) 9 | { 10 | GMainLoop *loop = (GMainLoop *) data; 11 | 12 | switch (GST_MESSAGE_TYPE (msg)) { 13 | 14 | case GST_MESSAGE_EOS: 15 | g_print ("End of stream\n"); 16 | g_main_loop_quit (loop); 17 | break; 18 | 19 | case GST_MESSAGE_ERROR: { 20 | gchar *debug; 21 | GError *error; 22 | 23 | gst_message_parse_error (msg, &error, &debug); 24 | g_free (debug); 25 | 26 | g_printerr ("Error: %s\n", error->message); 27 | g_error_free (error); 28 | 29 | g_main_loop_quit (loop); 30 | break; 31 | } 32 | default: 33 | break; 34 | } 35 | 36 | return TRUE; 37 | } 38 | 39 | 40 | static void 41 | on_pad_added (GstElement *element, 42 | GstPad *pad, 43 | gpointer data) 44 | { 45 | GstPad *sinkpad; 46 | GstElement *decoder = (GstElement *) data; 47 | 48 | /* We can now link this pad with the vorbis-decoder sink pad */ 49 | g_print ("Dynamic pad created, linking demuxer/decoder\n"); 50 | 51 | sinkpad = gst_element_get_static_pad (decoder, "sink"); 52 | 53 | gst_pad_link (pad, sinkpad); 54 | 55 | gst_object_unref (sinkpad); 56 | } 57 | 58 | 59 | 60 | int 61 | main (int argc, 62 | char *argv[]) 63 | { 64 | GMainLoop *loop; 65 | 66 | GstElement *pipeline, *source, *demuxer, *decoder, *conv, *sink; 67 | GstBus *bus; 68 | guint bus_watch_id; 69 | 70 | /* Initialisation */ 71 | gst_init (&argc, &argv); 72 | 73 | loop = g_main_loop_new (NULL, FALSE); 74 | 75 | 76 | /* Check input arguments */ 77 | if (argc != 2) { 78 | g_printerr ("Usage: %s \n", argv[0]); 79 | return -1; 80 | } 81 | 82 | 83 | /* Create gstreamer elements */ 84 | pipeline = gst_pipeline_new ("audio-player"); 85 | source = gst_element_factory_make ("filesrc", "file-source"); 86 | demuxer = gst_element_factory_make ("oggdemux", "ogg-demuxer"); 87 | decoder = gst_element_factory_make ("vorbisdec", "vorbis-decoder"); 88 | conv = gst_element_factory_make ("audioconvert", "converter"); 89 | sink = gst_element_factory_make ("autoaudiosink", "audio-output"); 90 | 91 | if (!pipeline || !source || !demuxer || !decoder || !conv || !sink) { 92 | g_printerr ("One element could not be created. Exiting.\n"); 93 | return -1; 94 | } 95 | 96 | /* Set up the pipeline */ 97 | 98 | /* we set the input filename to the source element */ 99 | g_object_set (G_OBJECT (source), "location", argv[1], NULL); 100 | 101 | /* we add a message handler */ 102 | bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); 103 | bus_watch_id = gst_bus_add_watch (bus, bus_call, loop); 104 | gst_object_unref (bus); 105 | 106 | /* we add all elements into the pipeline */ 107 | /* file-source | ogg-demuxer | vorbis-decoder | converter | alsa-output */ 108 | gst_bin_add_many (GST_BIN (pipeline), 109 | source, demuxer, decoder, conv, sink, NULL); 110 | 111 | /* we link the elements together */ 112 | /* file-source -> ogg-demuxer ~> vorbis-decoder -> converter -> alsa-output */ 113 | gst_element_link (source, demuxer); 114 | gst_element_link_many (decoder, conv, sink, NULL); 115 | g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), decoder); 116 | 117 | /* note that the demuxer will be linked to the decoder dynamically. 118 | The reason is that Ogg may contain various streams (for example 119 | audio and video). The source pad(s) will be created at run time, 120 | by the demuxer when it detects the amount and nature of streams. 121 | Therefore we connect a callback function which will be executed 122 | when the "pad-added" is emitted.*/ 123 | 124 | 125 | /* Set the pipeline to "playing" state*/ 126 | g_print ("Now playing: %s\n", argv[1]); 127 | gst_element_set_state (pipeline, GST_STATE_PLAYING); 128 | 129 | 130 | /* Iterate */ 131 | g_print ("Running...\n"); 132 | g_main_loop_run (loop); 133 | 134 | 135 | /* Out of the main loop, clean up nicely */ 136 | g_print ("Returned, stopping playback\n"); 137 | gst_element_set_state (pipeline, GST_STATE_NULL); 138 | 139 | g_print ("Deleting pipeline\n"); 140 | gst_object_unref (GST_OBJECT (pipeline)); 141 | g_source_remove (bus_watch_id); 142 | g_main_loop_unref (loop); 143 | 144 | return 0; 145 | } -------------------------------------------------------------------------------- /lowerlevel.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | static gboolean 7 | bus_call (GstBus *bus, 8 | GstMessage *msg, 9 | gpointer data) 10 | { 11 | GMainLoop *loop = (GMainLoop *) data; 12 | 13 | switch (GST_MESSAGE_TYPE (msg)) { 14 | 15 | case GST_MESSAGE_EOS: 16 | g_print ("End of stream\n"); 17 | g_main_loop_quit (loop); 18 | break; 19 | 20 | case GST_MESSAGE_ERROR: { 21 | gchar *debug; 22 | GError *error; 23 | 24 | gst_message_parse_error (msg, &error, &debug); 25 | g_free (debug); 26 | 27 | g_printerr ("Error: %s\n", error->message); 28 | g_error_free (error); 29 | 30 | g_main_loop_quit (loop); 31 | break; 32 | } 33 | default: 34 | break; 35 | } 36 | 37 | return TRUE; 38 | } 39 | 40 | 41 | static void 42 | on_pad_added (GstElement *element, 43 | GstPad *pad, 44 | gpointer data) 45 | { 46 | GstPad *sinkpad; 47 | GstElement *decoder = (GstElement *) data; 48 | 49 | /* We can now link this pad with the vorbis-decoder sink pad */ 50 | g_print ("Dynamic pad created, linking demuxer/decoder\n"); 51 | 52 | sinkpad = gst_element_get_static_pad (decoder, "sink"); 53 | 54 | gst_pad_link (pad, sinkpad); 55 | 56 | gst_object_unref (sinkpad); 57 | } 58 | 59 | 60 | 61 | int 62 | main (int argc, 63 | char *argv[]) 64 | { 65 | GMainLoop *loop; 66 | 67 | GstElement *pipeline, *source, *demuxer, *decoder, *conv, *sink; 68 | GstBus *bus; 69 | guint bus_watch_id; 70 | 71 | /* Initialisation */ 72 | gst_init (&argc, &argv); 73 | 74 | loop = g_main_loop_new (NULL, FALSE); 75 | 76 | 77 | /* Check input arguments */ 78 | if (argc != 2) { 79 | g_printerr ("Usage: %s \n", argv[0]); 80 | return -1; 81 | } 82 | 83 | std::ifstream filestr; 84 | long size; 85 | char * buffer; 86 | // binary open 87 | filestr.open ("/Users/Loli/Video/me.ogg", std::ios::binary); 88 | // get the size 89 | filestr.seekg(0, std::ios::end); 90 | size = filestr.tellg(); 91 | filestr.seekg(0, std::ios::beg); 92 | // malloc the memory 93 | buffer=new char[size]; 94 | 95 | filestr.read(buffer, size); 96 | std::cout << "byte = " << size << std::endl; 97 | std::cout << "content = " << buffer << std::endl; 98 | 99 | filestr.close(); 100 | 101 | 102 | /* Create gstreamer elements */ 103 | pipeline = gst_pipeline_new ("audio-player"); 104 | source = gst_element_factory_make ("filesrc", "file-source"); 105 | demuxer = gst_element_factory_make ("oggdemux", "ogg-demuxer"); 106 | decoder = gst_element_factory_make ("vorbisdec", "vorbis-decoder"); 107 | conv = gst_element_factory_make ("audioconvert", "converter"); 108 | sink = gst_element_factory_make ("autoaudiosink", "audio-output"); 109 | 110 | if (!pipeline || !source || !demuxer || !decoder || !conv || !sink) { 111 | g_printerr ("One element could not be created. Exiting.\n"); 112 | return -1; 113 | } 114 | 115 | /* Set up the pipeline */ 116 | 117 | /* we set the input filename to the source element */ 118 | g_object_set (G_OBJECT (source), "location", argv[1], NULL); 119 | 120 | /* we add a message handler */ 121 | bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); 122 | bus_watch_id = gst_bus_add_watch (bus, bus_call, loop); 123 | gst_object_unref (bus); 124 | 125 | /* we add all elements into the pipeline */ 126 | /* file-source | ogg-demuxer | vorbis-decoder | converter | alsa-output */ 127 | gst_bin_add_many (GST_BIN (pipeline), 128 | source, demuxer, decoder, conv, sink, NULL); 129 | 130 | /* we link the elements together */ 131 | /* file-source -> ogg-demuxer ~> vorbis-decoder -> converter -> alsa-output */ 132 | gst_element_link (source, demuxer); 133 | gst_element_link_many (decoder, conv, sink, NULL); 134 | g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), decoder); 135 | 136 | /* note that the demuxer will be linked to the decoder dynamically. 137 | The reason is that Ogg may contain various streams (for example 138 | audio and video). The source pad(s) will be created at run time, 139 | by the demuxer when it detects the amount and nature of streams. 140 | Therefore we connect a callback function which will be executed 141 | when the "pad-added" is emitted.*/ 142 | 143 | 144 | /* Set the pipeline to "playing" state*/ 145 | g_print ("Now playing: %s\n", argv[1]); 146 | gst_element_set_state (pipeline, GST_STATE_PLAYING); 147 | 148 | 149 | /* Iterate */ 150 | g_print ("Running...\n"); 151 | g_main_loop_run (loop); 152 | 153 | 154 | /* Out of the main loop, clean up nicely */ 155 | g_print ("Returned, stopping playback\n"); 156 | gst_element_set_state (pipeline, GST_STATE_NULL); 157 | 158 | g_print ("Deleting pipeline\n"); 159 | gst_object_unref (GST_OBJECT (pipeline)); 160 | g_source_remove (bus_watch_id); 161 | g_main_loop_unref (loop); 162 | 163 | return 0; 164 | } 165 | -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | # Set up basic variables: 2 | CC = gcc 3 | CFLAGS = -Wall 4 | LDFLAGS = 5 | 6 | # List of sources: 7 | SOURCES = helloworld.c 8 | 9 | # Name of executable target: 10 | EXECUTABLE = helloworld 11 | 12 | # MRPT specific flags: 13 | # Here we invoke "pkg-config" passing it as argument the list of the 14 | # MRPT libraries needed by our program (see available libs 15 | # with "pkg-config --list-all | grep mrpt"). 16 | # 17 | CFLAGS += `pkg-config --cflags --libs gstreamer-1.0` 18 | #LDFLAGS += `pkg-config --libs gstreamer-1.0` 19 | 20 | 21 | $(EXECUTABLE):$(SOURCES) 22 | $(CC) $(SOURCES) -o $(EXECUTABLE) $(CFLAGS) 23 | 24 | lowerlevel:lowerlevel.c 25 | $(CC) init.c -o init $(CFLAGS) 26 | 27 | lowerlevel:lowerlevel.c 28 | $(CC) lowerlevel.c -o lowerlevel $(CFLAGS) 29 | 30 | playback_1.0:playback_1.0.c 31 | $(CC) playback_1.0 -o playback_1.0 $(CFLAGS) 32 | 33 | clean: 34 | rm $(EXECUTABLE) lowerlevel playback_1.0 35 | -------------------------------------------------------------------------------- /manual/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | *.c 4 | *.o 5 | *.lo 6 | *.la 7 | .deps 8 | .libs 9 | 10 | appsink 11 | appsrc 12 | blockprobe 13 | dynformat 14 | elementget 15 | elementmake 16 | gnome 17 | helloworld 18 | helloworld2 19 | init 20 | popt 21 | queue 22 | threads 23 | bin 24 | decodebin 25 | dynamic 26 | elementcreate 27 | elementfactory 28 | elementlink 29 | ghostpad 30 | pad 31 | playbin 32 | playsink 33 | norebuffer 34 | probe 35 | query 36 | fakesrc 37 | typefind 38 | effectswitch 39 | testrtpool 40 | 41 | xml-mp3 42 | xml 43 | xmlTest.gst 44 | README 45 | 46 | *.bb 47 | *.bbg 48 | *.da 49 | 50 | test-registry.* 51 | -------------------------------------------------------------------------------- /manual/hehe.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/manual/hehe.mp3 -------------------------------------------------------------------------------- /me.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/me.ogg -------------------------------------------------------------------------------- /mp4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "tools.hpp" 3 | static gboolean 4 | bus_call (GstBus *bus, 5 | GstMessage *msg, 6 | gpointer data) 7 | 8 | { 9 | GMainLoop *loop = (GMainLoop *) data; 10 | switch (GST_MESSAGE_TYPE (msg)) { 11 | case GST_MESSAGE_EOS: 12 | g_print ("End of stream\n"); 13 | g_main_loop_quit (loop); 14 | break; 15 | case GST_MESSAGE_ERROR: { 16 | gchar *debug; 17 | GError *error; 18 | gst_message_parse_error (msg, &error, &debug); 19 | g_free (debug); 20 | g_printerr ("Error: %s\n", error->message); 21 | g_error_free (error); 22 | g_main_loop_quit (loop); 23 | break; 24 | } 25 | default: 26 | break; 27 | } 28 | return TRUE; 29 | } 30 | 31 | static void 32 | on_pad_added (GstElement *element, 33 | GstPad *pad, 34 | gpointer data) 35 | { 36 | GstPad *sinkpad; 37 | GstElement *parser = (GstElement *) data; 38 | /* We can now link this pad with the h264parse sink pad */ 39 | g_print ("Dynamic pad created, linking demuxer/parser\n"); 40 | sinkpad = gst_element_get_static_pad (parser, "sink"); 41 | gst_pad_link (pad, sinkpad); 42 | gst_object_unref (sinkpad); 43 | } 44 | 45 | int 46 | main (int argc, 47 | char *argv[]) 48 | { 49 | GMainLoop *loop; 50 | GstElement *pipeline, *source, *demuxer, *parser, *sink; 51 | GstBus *bus; 52 | GstCaps *caps; 53 | 54 | GstBuffer *buffer; 55 | GstSample *sample; 56 | GstMapInfo map; 57 | 58 | /* Initialisation */ 59 | gst_init (&argc, &argv); 60 | loop = g_main_loop_new (NULL, FALSE); 61 | /* Check input arguments */ 62 | if (argc != 2) { 63 | g_printerr ("Usage: %s \n", argv[0]); 64 | return -1; 65 | } 66 | /* Create gstreamer elements */ 67 | pipeline = gst_pipeline_new ("mp4-player"); 68 | source = gst_element_factory_make ("filesrc", "file-source"); 69 | demuxer = gst_element_factory_make ("qtdemux", "demuxer"); 70 | parser = gst_element_factory_make ("h264parse", "parser"); 71 | sink = gst_element_factory_make ("appsink", NULL); 72 | 73 | g_object_set (G_OBJECT (sink), "sync", FALSE, NULL); 74 | 75 | if (!pipeline || !source || !demuxer || !parser || !sink) { 76 | g_printerr ("One element could not be created. Exiting.\n"); 77 | return -1; 78 | } 79 | /* Set up the pipeline */ 80 | /* we set the input filename to the source element */ 81 | g_object_set (G_OBJECT (source), "location", argv[1], NULL); 82 | /* we add a message handler */ 83 | bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); 84 | gst_bus_add_watch (bus, bus_call, loop); 85 | gst_object_unref (bus); 86 | /* we add all elements into the pipeline */ 87 | gst_bin_add_many (GST_BIN (pipeline), 88 | source, demuxer, parser, sink, NULL); 89 | /* we link the elements together */ 90 | gst_element_link (source, demuxer); 91 | gst_element_link_many (parser, sink, NULL); 92 | g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), parser); 93 | /* Set the pipeline to "playing" state*/ 94 | g_print ("Now playing: %s\n", argv[1]); 95 | gst_element_set_state (pipeline, GST_STATE_PLAYING); 96 | time_t time_start = std::time(0); 97 | int framenumber = 0; 98 | 99 | do { 100 | g_signal_emit_by_name (sink, "pull-sample", &sample); 101 | // g_print("After calling pull-sample "); 102 | if (sample == NULL){ 103 | g_print("Meet the EOS!\n"); 104 | break; 105 | } 106 | caps = gst_sample_get_caps(sample); 107 | Tools::read_video_props(caps); 108 | buffer = gst_sample_get_buffer (sample); 109 | // info = gst_sample_get_info(sample); 110 | // segment = gst_sample_get_segment(sample); 111 | gst_buffer_map (buffer, &map, GST_MAP_READ); 112 | // Name frameSuffix(std::to_string(framenumber)); 113 | std::cout << "Frame number: "<< framenumber <produce(frameSuffix, (uint8_t *)map.data, map.size); 115 | std::cout << "Map Size: "<< map.size < 2 | #include 3 | #include 4 | #include 5 | static gboolean 6 | bus_call (GstBus *bus, 7 | GstMessage *msg, 8 | gpointer data) 9 | 10 | { 11 | GMainLoop *loop = (GMainLoop *) data; 12 | switch (GST_MESSAGE_TYPE (msg)) { 13 | case GST_MESSAGE_EOS: 14 | g_print ("End of stream\n"); 15 | g_main_loop_quit (loop); 16 | break; 17 | case GST_MESSAGE_ERROR: { 18 | gchar *debug; 19 | GError *error; 20 | gst_message_parse_error (msg, &error, &debug); 21 | g_free (debug); 22 | g_printerr ("Error: %s\n", error->message); 23 | g_error_free (error); 24 | g_main_loop_quit (loop); 25 | break; 26 | } 27 | default: 28 | break; 29 | } 30 | return TRUE; 31 | } 32 | 33 | static void 34 | on_pad_added (GstElement *element, 35 | GstPad *pad, 36 | gpointer data) 37 | { 38 | GstPad *sinkpad; 39 | GstCaps *caps; 40 | GstElement *parser = (GstElement *) data; 41 | GstStructure *str; 42 | /* We can now link this pad with the h264parse sink pad */ 43 | caps = gst_pad_get_current_caps (pad); 44 | 45 | g_print ("Dynamic pad created, linking demuxer/parser\n"); 46 | g_print("%s\n", gst_caps_to_string(caps)); 47 | caps = gst_caps_make_writable(caps); 48 | str = gst_caps_get_structure (caps, 0); 49 | // gst_structure_remove_fields (str,"level", "profile", "height", "width", "framerate", "pixel-aspect-ratio", NULL); 50 | const char * lala = gst_caps_to_string (caps); 51 | GstCaps *ee = gst_caps_from_string(lala); 52 | 53 | std::cout << "ee " << gst_caps_to_string (ee) << std::endl; 54 | sinkpad = gst_element_get_static_pad (parser, "sink"); 55 | gst_pad_link (pad, sinkpad); 56 | gst_object_unref (sinkpad); 57 | } 58 | 59 | static void 60 | on_pad_added_parser (GstElement *element, 61 | GstPad *pad, 62 | gpointer data) 63 | { 64 | GstPad *sinkpad; 65 | GstCaps *caps; 66 | GstElement *decoder = (GstElement *) data; 67 | /* We can now link this pad with the h264parse sink pad */ 68 | // gst_pad_use_fixed_caps (pad); 69 | // caps = gst_pad_get_current_caps (pad); 70 | // 71 | // g_print ("Dynamic pad created, linking parser/decoder\n"); 72 | // g_print("caps: %s\n", gst_caps_to_string(caps)); 73 | // sinkpad = gst_element_get_static_pad (decoder, "sink"); 74 | // gst_pad_link (pad, sinkpad); 75 | // gst_object_unref (sinkpad); 76 | // gst_element_link(element, decoder); 77 | } 78 | 79 | int 80 | main (int argc, 81 | char *argv[]) 82 | { 83 | GMainLoop *loop; 84 | GstElement *pipeline, *source, *demuxer, *parser, *decoder, *conv, *sink; 85 | GstBus *bus; 86 | /* Initialisation */ 87 | gst_init (&argc, &argv); 88 | loop = g_main_loop_new (NULL, FALSE); 89 | /* Check input arguments */ 90 | std::string filename; 91 | if (argc != 2) { 92 | filename = "/Users/Loli/video/duoyan.mp4"; 93 | }else 94 | filename = argv[1]; 95 | /* Create gstreamer elements */ 96 | pipeline = gst_pipeline_new ("mp4-player"); 97 | source = gst_element_factory_make ("filesrc", "file-source"); 98 | demuxer = gst_element_factory_make ("qtdemux", "demuxer"); 99 | parser = gst_element_factory_make ("h264parse", "parser"); 100 | decoder = gst_element_factory_make ("avdec_h264", "decoder"); 101 | sink = gst_element_factory_make ("autovideosink", "video-output"); 102 | if (!pipeline || !source || !demuxer || !parser || !decoder || !sink) { 103 | g_printerr ("One element could not be created. Exiting.\n"); 104 | return -1; 105 | } 106 | /* Set up the pipeline */ 107 | /* we set the input filename to the source element */ 108 | 109 | g_object_set (G_OBJECT (source), "location", filename.c_str(), NULL); 110 | /* we add a message handler */ 111 | bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); 112 | gst_bus_add_watch (bus, bus_call, loop); 113 | gst_object_unref (bus); 114 | /* we add all elements into the pipeline */ 115 | gst_bin_add_many (GST_BIN (pipeline), 116 | source, demuxer, parser, decoder, sink, NULL); 117 | /* we link the elements together */ 118 | gst_element_link (source, demuxer); 119 | gst_element_link_many (parser, decoder, sink, NULL); 120 | g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), parser); 121 | g_signal_connect (parser, "pad-added", G_CALLBACK (on_pad_added_parser), decoder); 122 | /* note that the demuxer will be linked to the decoder dynamically. 123 | The reason is that Mp4 may contain various streams (for example 124 | audio and video). The source pad(s) will be created at run time, 125 | by the demuxer when it detects the amount and nature of streams. 126 | Therefore we connect a callback function which will be executed 127 | when the "pad-added" is emitted.*/ 128 | /* Set the pipeline to "playing" state*/ 129 | g_print ("Now playing: %s\n", filename.c_str()); 130 | gst_element_set_state (pipeline, GST_STATE_PLAYING); 131 | /* Iterate */ 132 | g_print ("Running...\n"); 133 | g_main_loop_run (loop); 134 | /* Out of the main loop, clean up nicely */ 135 | g_print ("Returned, stopping playback\n"); 136 | gst_element_set_state (pipeline, GST_STATE_NULL); 137 | g_print ("Deleting pipeline\n"); 138 | gst_object_unref (GST_OBJECT (pipeline)); 139 | return 0; 140 | } 141 | -------------------------------------------------------------------------------- /mp4_withaudio.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | struct Parser 6 | { 7 | GstElement *video; 8 | GstElement *audio; 9 | }; 10 | 11 | static gboolean 12 | bus_call (GstBus *bus, 13 | GstMessage *msg, 14 | gpointer data) 15 | 16 | { 17 | GMainLoop *loop = (GMainLoop *) data; 18 | switch (GST_MESSAGE_TYPE (msg)) { 19 | case GST_MESSAGE_EOS: 20 | g_print ("End of stream\n"); 21 | g_main_loop_quit (loop); 22 | break; 23 | case GST_MESSAGE_ERROR: { 24 | gchar *debug; 25 | GError *error; 26 | gst_message_parse_error (msg, &error, &debug); 27 | g_free (debug); 28 | g_printerr ("Error: %s\n", error->message); 29 | g_error_free (error); 30 | g_main_loop_quit (loop); 31 | break; 32 | } 33 | default: 34 | break; 35 | } 36 | return TRUE; 37 | } 38 | 39 | static void 40 | on_pad_added_queue (GstElement *element, 41 | GstPad *pad, 42 | gpointer data) 43 | { 44 | GstPad *sinkpad; 45 | GstCaps *caps; 46 | GstElement *queue = (GstElement *) data; 47 | GstStructure *str; 48 | std::string type; 49 | /* We can now link this pad with the h264parse sink pad */ 50 | caps = gst_pad_get_current_caps (pad); 51 | str = gst_caps_get_structure (caps, 0); 52 | type = gst_structure_get_name (str); 53 | 54 | g_print("%s\n", gst_caps_to_string(caps)); 55 | 56 | if(type.find("video") != std::string::npos) 57 | { 58 | // sinkpad = gst_element_get_static_pad (queue, "sink"); 59 | // gst_pad_link (pad, sinkpad); 60 | // gst_object_unref (sinkpad); 61 | // g_print ("linking demuxer/queue\n"); 62 | } 63 | else 64 | { 65 | sinkpad = gst_element_get_static_pad (queue, "sink"); 66 | gst_pad_link (pad, sinkpad); 67 | gst_object_unref (sinkpad); 68 | g_print ("linking demuxer/queue\n"); 69 | } 70 | } 71 | static void 72 | on_pad_added (GstElement *element, 73 | GstPad *pad, 74 | gpointer data) 75 | { 76 | GstPad *sinkpad; 77 | GstCaps *caps; 78 | Parser *parser = (Parser *) data; 79 | // GstElement *parser = (GstElement *) data; 80 | GstStructure *str; 81 | std::string type; 82 | /* We can now link this pad with the h264parse sink pad */ 83 | caps = gst_pad_get_current_caps (pad); 84 | str = gst_caps_get_structure (caps, 0); 85 | type = gst_structure_get_name (str); 86 | 87 | g_print("%s\n", gst_caps_to_string(caps)); 88 | 89 | if(type.find("video") != std::string::npos) 90 | { 91 | sinkpad = gst_element_get_static_pad (parser->video, "sink"); 92 | gst_pad_link (pad, sinkpad); 93 | gst_object_unref (sinkpad); 94 | g_print ("linking demuxer/h264parse\n"); 95 | } 96 | else 97 | { 98 | sinkpad = gst_element_get_static_pad (parser->audio, "sink"); 99 | gst_pad_link (pad, sinkpad); 100 | gst_object_unref (sinkpad); 101 | g_print ("linking demuxer/accparse\n"); 102 | } 103 | } 104 | 105 | int 106 | main (int argc, 107 | char *argv[]) 108 | { 109 | GMainLoop *loop; 110 | GstElement *pipeline, *source, *demuxer, *video_decoder, *video_sink, * audio_decoder, * audio_sink; 111 | Parser parser; 112 | Parser queue; 113 | GstBus *bus; 114 | /* Initialisation */ 115 | gst_init (&argc, &argv); 116 | loop = g_main_loop_new (NULL, FALSE); 117 | /* Check input arguments */ 118 | std::string filename; 119 | if (argc != 2) { 120 | filename = "/Users/Lijing/Movies/duoyan.mp4"; 121 | }else 122 | filename = argv[1]; 123 | /* Create gstreamer elements */ 124 | pipeline = gst_pipeline_new ("mp4-player"); 125 | source = gst_element_factory_make ("filesrc", "file-source"); 126 | demuxer = gst_element_factory_make ("qtdemux", "demuxer"); 127 | queue.video = gst_element_factory_make ("queue", "video_queue"); 128 | queue.audio = gst_element_factory_make ("queue", "audio_queue"); 129 | parser.video = gst_element_factory_make ("h264parse", "video_parser"); 130 | parser.audio = gst_element_factory_make ("aacparse", "audio_parser"); 131 | video_decoder = gst_element_factory_make ("avdec_h264", "video_decoder"); 132 | audio_decoder= gst_element_factory_make ("faad", "audio_decoder"); 133 | video_sink = gst_element_factory_make ("autovideosink", "video_sink"); 134 | audio_sink = gst_element_factory_make ("autoaudiosink", "audio_sink"); 135 | if (!pipeline || !source || !demuxer || !queue.video || !queue.audio || !parser.video || !parser.audio || 136 | !video_decoder || !audio_decoder || !video_sink|| !audio_sink) { 137 | g_printerr ("One element could not be created. Exiting.\n"); 138 | return -1; 139 | } 140 | /* Set up the pipeline */ 141 | /* we set the input filename to the source element */ 142 | 143 | g_object_set (G_OBJECT (source), "location", filename.c_str(), NULL); 144 | /* we add a message handler */ 145 | bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); 146 | gst_bus_add_watch (bus, bus_call, loop); 147 | gst_object_unref (bus); 148 | /* we add all elements into the pipeline */ 149 | // gst_bin_add_many (GST_BIN (pipeline), source, demuxer, queue.audio, 150 | gst_bin_add_many (GST_BIN (pipeline), source, demuxer,queue.audio, queue.video, parser.video, video_decoder, video_sink, 151 | parser.audio, audio_decoder, audio_sink, NULL); 152 | /* we link the elements together */ 153 | gst_element_link (source, demuxer); 154 | gst_element_link_many (queue.audio, parser.audio, audio_decoder, audio_sink, NULL); 155 | gst_element_link_many (queue.video, parser.video, video_decoder, video_sink, NULL); 156 | // g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added_queue), queue); 157 | g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), &queue); 158 | /* note that the demuxer will be linked to the decoder dynamically. 159 | The reason is that Mp4 may contain various streams (for example 160 | audio and video). The source pad(s) will be created at run time, 161 | by the demuxer when it detects the amount and nature of streams. 162 | Therefore we connect a callback function which will be executed 163 | when the "pad-added" is emitted.*/ 164 | /* Set the pipeline to "playing" state*/ 165 | g_print ("Now playing: %s\n", filename.c_str()); 166 | gst_element_set_state (pipeline, GST_STATE_PLAYING); 167 | /* Iterate */ 168 | g_print ("Running...\n"); 169 | g_main_loop_run (loop); 170 | /* Out of the main loop, clean up nicely */ 171 | g_print ("Returned, stopping playback\n"); 172 | gst_element_set_state (pipeline, GST_STATE_NULL); 173 | g_print ("Deleting pipeline\n"); 174 | gst_object_unref (GST_OBJECT (pipeline)); 175 | return 0; 176 | } 177 | -------------------------------------------------------------------------------- /playback_1.0.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static gboolean 5 | my_bus_callback(GstBus *bus, 6 | GstMessage *msg, 7 | gpointer data) 8 | { 9 | // printf("CALL BACK NOW!\n"); 10 | return TRUE; 11 | } 12 | gint 13 | main (gint argc, 14 | gchar *argv[]) 15 | { 16 | GMainLoop *loop; 17 | GstElement *play; 18 | GstBus *bus; 19 | 20 | /* init GStreamer */ 21 | gst_init (&argc, &argv); 22 | loop = g_main_loop_new (NULL, FALSE); 23 | 24 | /* make sure we have a URI */ 25 | if (argc != 2) { 26 | g_print ("Usage: %s \n", argv[0]); 27 | return -1; 28 | } 29 | 30 | /* set up */ 31 | play = gst_element_factory_make ("playbin", "play"); 32 | g_object_set (G_OBJECT (play), "uri", argv[1], NULL); 33 | 34 | bus = gst_pipeline_get_bus (GST_PIPELINE (play)); 35 | gst_bus_add_watch (bus, my_bus_callback, loop); 36 | gst_object_unref (bus); 37 | 38 | gst_element_set_state (play, GST_STATE_PLAYING); 39 | 40 | /* now run */ 41 | g_main_loop_run (loop); 42 | 43 | /* also clean up */ 44 | gst_element_set_state (play, GST_STATE_NULL); 45 | gst_object_unref (GST_OBJECT (play)); 46 | 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /record.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | struct Parser 6 | { 7 | GstElement *video; 8 | GstElement *audio; 9 | }; 10 | 11 | static void 12 | *produce_frame(void * threadData) 13 | { 14 | GstCaps *caps; 15 | GstSample *sample; 16 | std::string streaminfo; 17 | GstBuffer *buffer; 18 | GstMapInfo map; 19 | GstElement* sink; 20 | sink = (GstElement *) threadData; 21 | 22 | size_t framenumber = 0; 23 | do { 24 | g_signal_emit_by_name (sink, "pull-sample", &sample); 25 | if (sample == NULL){ 26 | g_print("Meet the EOS!\n"); 27 | break; 28 | } 29 | if ( framenumber == 0) 30 | { 31 | caps = gst_sample_get_caps(sample); 32 | streaminfo = gst_caps_to_string(caps); 33 | // Name streaminfoVideoSuffix("video"); 34 | // std::cout << streaminfo << std::endl; 35 | // producerStreaminfo->produce(streaminfoVideoSuffix, (uint8_t *)streaminfo.c_str(), streaminfo.size()+1); 36 | std::cout << "produce video streaminfo OK! " << streaminfo << std::endl; 37 | std::cout << "streaminfo size "<< streaminfo.size() + 1 << std::endl; 38 | } 39 | buffer = gst_sample_get_buffer (sample); 40 | gst_buffer_map (buffer, &map, GST_MAP_READ); 41 | // Name frameSuffix("video/" + std::to_string(framenumber)); 42 | std::cout << "Frame number: "<< framenumber <produce(frameSuffix, (uint8_t *)map.data, map.size * sizeof(uint8_t)); 46 | framenumber ++; 47 | // if ( framenumber > 2500) 48 | // break; 49 | if (sample) 50 | gst_sample_unref (sample); 51 | }while (sample != NULL); 52 | 53 | pthread_exit(NULL); 54 | } 55 | 56 | static gboolean 57 | bus_call (GstBus *bus, 58 | GstMessage *msg, 59 | gpointer data) 60 | 61 | { 62 | GMainLoop *loop = (GMainLoop *) data; 63 | switch (GST_MESSAGE_TYPE (msg)) { 64 | case GST_MESSAGE_EOS: 65 | g_print ("End of stream\n"); 66 | g_main_loop_quit (loop); 67 | break; 68 | case GST_MESSAGE_ERROR: { 69 | gchar *debug; 70 | GError *error; 71 | gst_message_parse_error (msg, &error, &debug); 72 | g_free (debug); 73 | g_printerr ("Error: %s\n", error->message); 74 | g_error_free (error); 75 | g_main_loop_quit (loop); 76 | break; 77 | } 78 | default: 79 | break; 80 | } 81 | return TRUE; 82 | } 83 | 84 | static void 85 | on_pad_added (GstElement *element, 86 | GstPad *pad, 87 | gpointer data) 88 | { 89 | GstPad *sinkpad; 90 | GstCaps *caps; 91 | Parser *parser = (Parser *) data; 92 | // GstElement *parser = (GstElement *) data; 93 | GstStructure *str; 94 | std::string type; 95 | /* We can now link this pad with the h264parse sink pad */ 96 | caps = gst_pad_get_current_caps (pad); 97 | str = gst_caps_get_structure (caps, 0); 98 | type = gst_structure_get_name (str); 99 | 100 | g_print("%s\n", gst_caps_to_string(caps)); 101 | 102 | if(type.find("video") != std::string::npos) 103 | { 104 | sinkpad = gst_element_get_static_pad (parser->video, "sink"); 105 | gst_pad_link (pad, sinkpad); 106 | gst_object_unref (sinkpad); 107 | g_print ("linking demuxer/h264parse\n"); 108 | } 109 | else 110 | { 111 | sinkpad = gst_element_get_static_pad (parser->audio, "sink"); 112 | gst_pad_link (pad, sinkpad); 113 | gst_object_unref (sinkpad); 114 | g_print ("linking demuxer/accparse\n"); 115 | } 116 | } 117 | 118 | int 119 | main (int argc, 120 | char *argv[]) 121 | { 122 | GMainLoop *loop; 123 | GstElement *pipeline, *video_source, *demuxer,*video_encoder, *video_parser, *video_decoder, *video_sink, * audio_decoder, * audio_sink, *audio_source, *audio_encoder, *audio_convert, *audio_parser; 124 | GstBus *bus; 125 | 126 | /* Initialisation */ 127 | gst_init (&argc, &argv); 128 | loop = g_main_loop_new (NULL, FALSE); 129 | /* Check input arguments */ 130 | /* Create gstreamer elements */ 131 | pipeline = gst_pipeline_new ("capture-player"); 132 | video_source = gst_element_factory_make ("autovideosrc", "camera-source"); 133 | // video_source = gst_element_factory_make ("wrappercamerabinsrc", "camera-source"); 134 | video_encoder = gst_element_factory_make("x264enc", "video_encoder"); 135 | video_parser = gst_element_factory_make("h264parse", "video_parser"); 136 | video_decoder = gst_element_factory_make("avdec_h264", "video_decoder"); 137 | video_sink = gst_element_factory_make ("appsink", "video_sinker"); 138 | 139 | audio_source = gst_element_factory_make ("autoaudiosrc", "MIC-source"); 140 | audio_convert = gst_element_factory_make ("audioconvert", "audio-convert"); 141 | audio_encoder = gst_element_factory_make("voaacenc", "audio_encoder"); 142 | audio_parser = gst_element_factory_make("aacparse", "audio_parser"); 143 | audio_decoder= gst_element_factory_make("faad", "audio_decoder"); 144 | audio_sink = gst_element_factory_make ("appsink", "audio_sinker"); 145 | // if (!pipeline || !video_source || !demuxer || !queue.video || !queue.audio || !parser.video || !parser.audio || 146 | // !video_decoder || !audio_decoder || !video_sink|| !audio_sink) { 147 | // g_printerr ("One element could not be created. Exiting.\n"); 148 | // return -1; 149 | // } 150 | /* Set up the pipeline */ 151 | 152 | g_object_set (G_OBJECT (video_sink), "sync", FALSE, NULL); 153 | g_object_set (G_OBJECT (audio_sink), "sync", FALSE, NULL); 154 | /* we add a message handler */ 155 | bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); 156 | gst_bus_add_watch (bus, bus_call, loop); 157 | gst_object_unref (bus); 158 | /* we add all elements into the pipeline */ 159 | gst_bin_add_many (GST_BIN (pipeline), video_source, video_encoder, video_parser, video_sink, NULL); 160 | /* we link the elements together */ 161 | gst_element_link_many (video_source, video_encoder, video_parser, video_sink, NULL); 162 | 163 | gst_bin_add_many (GST_BIN (pipeline), audio_source, audio_convert, audio_encoder, audio_parser, audio_sink, NULL); 164 | /* we link the elements together */ 165 | gst_element_link_many (audio_source, audio_convert, audio_encoder, audio_parser, audio_sink, NULL); 166 | /* Set the pipeline to "playing" state*/ 167 | gst_element_set_state (pipeline, GST_STATE_PLAYING); 168 | 169 | pthread_t video_thread; 170 | int video_rc; 171 | video_rc = pthread_create(&video_thread, NULL, produce_frame, (void *)video_sink); 172 | 173 | pthread_t audio_thread; 174 | int audio_rc; 175 | audio_rc = pthread_create(&audio_thread, NULL, produce_frame, (void *)audio_sink); 176 | 177 | /* Iterate */ 178 | g_print ("Running...\n"); 179 | g_main_loop_run (loop); 180 | /* Out of the main loop, clean up nicely */ 181 | g_print ("Returned, stopping playback\n"); 182 | gst_element_set_state (pipeline, GST_STATE_NULL); 183 | g_print ("Deleting pipeline\n"); 184 | gst_object_unref (GST_OBJECT (pipeline)); 185 | return 0; 186 | } 187 | -------------------------------------------------------------------------------- /tools.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | class Tools 8 | { 9 | public: 10 | 11 | static void 12 | read_video_props (GstCaps *caps) 13 | { 14 | gint width, height, num, denom; 15 | const GstStructure *str; 16 | const char *format; 17 | const char *type; 18 | 19 | g_return_if_fail (gst_caps_is_fixed (caps)); 20 | str = gst_caps_get_structure (caps, 0); 21 | type = gst_structure_get_name (str); 22 | format = gst_structure_get_string (str, "format"); 23 | if (!gst_structure_get_int (str, "width", &width) || 24 | !gst_structure_get_int (str, "height", &height) || 25 | !gst_structure_get_fraction (str, "framerate", &num, &denom)) { 26 | g_print ("No width/height available\n"); 27 | return; 28 | } 29 | g_print ("The video size of this set of capabilities is %d x %d and the frame rate is %d/%d\nformat:%s type:%s\n",width, height,num,denom,format,type); 30 | g_print("caps: %s\n", gst_caps_to_string(caps)); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /typefind.cpp: -------------------------------------------------------------------------------- 1 | 2 | /*** block a from ../../../docs/manual/advanced-autoplugging.xml ***/ 3 | #include 4 | 5 | /*** block b from ../../../docs/manual/advanced-autoplugging.xml ***/ 6 | static gboolean 7 | my_bus_callback (GstBus *bus, 8 | GstMessage *message, 9 | gpointer data) 10 | { 11 | GMainLoop *loop = (GMainLoop *)data; 12 | 13 | switch (GST_MESSAGE_TYPE (message)) { 14 | case GST_MESSAGE_ERROR: { 15 | GError *err; 16 | gchar *debug; 17 | 18 | gst_message_parse_error (message, &err, &debug); 19 | g_print ("Error: %s\n", err->message); 20 | g_error_free (err); 21 | g_free (debug); 22 | 23 | g_main_loop_quit (loop); 24 | break; 25 | } 26 | case GST_MESSAGE_EOS: 27 | /* end-of-stream */ 28 | g_main_loop_quit (loop); 29 | break; 30 | default: 31 | break; 32 | } 33 | 34 | /* remove from queue */ 35 | return TRUE; 36 | } 37 | 38 | /*** block c from ../../../docs/manual/advanced-autoplugging.xml ***/ 39 | static gboolean 40 | idle_exit_loop (gpointer data) 41 | { 42 | g_main_loop_quit ((GMainLoop *) data); 43 | 44 | /* once */ 45 | return FALSE; 46 | } 47 | 48 | static void 49 | cb_typefound (GstElement *typefind, 50 | guint probability, 51 | GstCaps *caps, 52 | gpointer data) 53 | { 54 | GMainLoop *loop = (GMainLoop *)data; 55 | gchar *type; 56 | 57 | type = gst_caps_to_string (caps); 58 | g_print ("Media type %s found, probability %d%%\n", type, probability); 59 | g_free (type); 60 | 61 | /* since we connect to a signal in the pipeline thread context, we need 62 | * to set an idle handler to exit the main loop in the mainloop context. 63 | * Normally, your app should not need to worry about such things. */ 64 | g_idle_add (idle_exit_loop, loop); 65 | } 66 | 67 | gint 68 | main (gint argc, 69 | gchar *argv[]) 70 | { 71 | GMainLoop *loop; 72 | GstElement *pipeline, *filesrc, *typefind, *fakesink; 73 | GstBus *bus; 74 | 75 | /* init GStreamer */ 76 | gst_init (&argc, &argv); 77 | loop = g_main_loop_new (NULL, FALSE); 78 | 79 | /* check args */ 80 | if (argc != 2) { 81 | g_print ("Usage: %s \n", argv[0]); 82 | return -1; 83 | } 84 | 85 | /* create a new pipeline to hold the elements */ 86 | pipeline = gst_pipeline_new ("pipe"); 87 | 88 | bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); 89 | gst_bus_add_watch (bus, my_bus_callback, NULL); 90 | gst_object_unref (bus); 91 | 92 | /* create file source and typefind element */ 93 | filesrc = gst_element_factory_make ("filesrc", "source"); 94 | g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); 95 | typefind = gst_element_factory_make ("typefind", "typefinder"); 96 | g_signal_connect (typefind, "have-type", G_CALLBACK (cb_typefound), loop); 97 | fakesink = gst_element_factory_make ("fakesink", "sink"); 98 | 99 | /* setup */ 100 | gst_bin_add_many (GST_BIN (pipeline), filesrc, typefind, fakesink, NULL); 101 | gst_element_link_many (filesrc, typefind, fakesink, NULL); 102 | gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); 103 | g_main_loop_run (loop); 104 | 105 | /* unset */ 106 | gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); 107 | gst_object_unref (GST_OBJECT (pipeline)); 108 | 109 | return 0; 110 | } 111 | -------------------------------------------------------------------------------- /waf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PhdLoLi/gstreamer-all/35ee5b77dab877a4cb7aa96ff493ab9cf9f4d47d/waf -------------------------------------------------------------------------------- /wscript: -------------------------------------------------------------------------------- 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- 2 | from waflib import Logs, Configure 3 | 4 | pargs = ['--cflags', '--libs'] 5 | 6 | def options(opt): 7 | opt.load('compiler_cxx compiler_c') 8 | def configure(conf): 9 | defaultFlags = ['-std=c++0x', '-std=c++11', 10 | '-stdlib=libc++', # clang on OSX < 10.9 by default uses gcc's 11 | # libstdc++, which is not C++11 compatible 12 | '-pedantic', '-Wall'] 13 | conf.load('compiler_cxx compiler_c') 14 | conf.add_supported_cxxflags(defaultFlags) 15 | conf.check_cfg(atleast_pkgconfig_version='0.0.0') 16 | conf.check_cfg(package='gstreamer-1.0', uselib_store='GSTREAMER', args=pargs) 17 | conf.env.LIB_PTHREAD = 'pthread' 18 | 19 | @Configure.conf 20 | def add_supported_cxxflags(self, cxxflags): 21 | 22 | self.start_msg('Checking supported CXXFLAGS') 23 | 24 | supportedFlags = [] 25 | for flag in cxxflags: 26 | if self.check_cxx(cxxflags=['-Werror', flag], mandatory=False): 27 | supportedFlags += [flag] 28 | 29 | self.end_msg(' '.join(supportedFlags)) 30 | self.env.CXXFLAGS = supportedFlags + self.env.CXXFLAGS 31 | 32 | def build(bld): 33 | for app in bld.path.ant_glob('*.cpp'): 34 | bld(features=['cxx', 'cxxprogram'], 35 | target = '%s' % (str(app.change_ext('','.cpp'))), 36 | source = app, 37 | use = 'GSTREAMER PTHREAD', 38 | install_path = None, 39 | ) 40 | -------------------------------------------------------------------------------- /wscript.loli: -------------------------------------------------------------------------------- 1 | def options(opt): 2 | opt.load('compiler_c compiler_cxx') 3 | 4 | def configure(cnf): 5 | cnf.load('compiler_c compiler_cxx') 6 | cnf.check(features='cxx cxxprogram', lib=['m'], cflags=['-Wall'], defines=['var=foo'], uselib_store='M') 7 | 8 | def build(bld): 9 | bld(features='c cshlib', source='b.c', target='mylib') 10 | bld(features='c cxx cxxprogram', source='a.c main.cpp', target='app', use=['M','mylib'], lib=['dl']) 11 | --------------------------------------------------------------------------------