diff
stringlengths 41
2.03M
| msg
stringlengths 1
1.5k
⌀ | repo
stringlengths 5
40
| sha
stringlengths 40
40
| time
stringlengths 20
20
|
---|---|---|---|---|
mmm a / lib / IRGen / CMakeLists . txt <nl> ppp b / lib / IRGen / CMakeLists . txt <nl> <nl> add_swift_library ( swiftIRGen <nl> Cleanup . h <nl> Condition . h <nl> + DiverseStack . cpp <nl> GenArray . cpp <nl> GenControl . cpp <nl> GenExpr . cpp <nl> new file mode 100644 <nl> index 000000000000 . . e0ea3d5b38bb <nl> mmm / dev / null <nl> ppp b / lib / IRGen / DiverseStack . cpp <nl> <nl> + / / = = = mmm IRGen . cpp - Out - of - line code for the heterogenous stack mmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2015 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See http : / / swift . org / LICENSE . txt for license information <nl> + / / See http : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This file implements the small amount of code for the heterogenous <nl> + / / stack helper . <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + # include < DiverseStack . h > <nl> + <nl> + void swift : : irgen : : DiverseStackBase : : pushNewStorageSlow ( std : : size_t needed ) { <nl> + bool wasInline = isAllocatedInline ( ) ; <nl> + <nl> + std : : size_t capacity = End - Allocated ; <nl> + std : : size_t requiredCapacity = capacity + needed ; <nl> + do { <nl> + capacity = 2 * capacity + 16 ; <nl> + } while ( capacity < requiredCapacity ) ; <nl> + <nl> + assert ( capacity % 16 = = 0 & & " not allocating multiple of alignment " ) ; <nl> + <nl> + char * oldAllocation = Allocated ; <nl> + char * oldBegin = Begin ; <nl> + std : : size_t oldSize = End - oldBegin ; <nl> + <nl> + Allocated = new char [ capacity ] ; <nl> + End = Allocated + capacity ; <nl> + Begin = End - oldSize ; <nl> + std : : memcpy ( Begin , oldBegin , oldSize ) ; <nl> + <nl> + if ( ! wasInline ) delete [ ] oldAllocation ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . ed092ecec474 <nl> mmm / dev / null <nl> ppp b / lib / IRGen / DiverseStack . h <nl> <nl> + / / = = = mmm DiverseStack . h - Stack of variably - sized objects mmmmmm - * - C + + - * - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2015 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See http : / / swift . org / LICENSE . txt for license information <nl> + / / See http : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This file defines a data structure for representing a stack of <nl> + / / variably - sized objects . It is a requirement that the object type <nl> + / / be trivially movable , meaning that it has a trivial move <nl> + / / constructor and a trivial destructor . <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + # ifndef SWIFT_IRGEN_DIVERSESTACK_H <nl> + # define SWIFT_IRGEN_DIVERSESTACK_H <nl> + <nl> + # include < cassert > <nl> + # include < cstring > <nl> + # include < type_traits > <nl> + # include < utility > <nl> + <nl> + namespace swift { <nl> + namespace irgen { <nl> + <nl> + template < class T > class DiverseStackImpl ; <nl> + <nl> + / / / DiverseStack - A stack of heterogenously - typed objects . <nl> + / / / <nl> + / / / \ param T - A common base class of the objects on the stack ; must <nl> + / / / provide an allocated_size ( ) const method . <nl> + / / / \ param InlineCapacity - the amount of inline storage to provide , in bytes <nl> + template < class T , unsigned InlineCapacity > <nl> + class DiverseStack : public DiverseStackImpl < T > { <nl> + char InlineStorage [ InlineCapacity ] ; <nl> + <nl> + public : <nl> + DiverseStack ( ) : DiverseStackImpl < T > ( InlineStorage + InlineCapacity ) { } <nl> + DiverseStack ( const DiverseStack & other ) <nl> + : DiverseStackImpl < T > ( other , InlineStorage + InlineCapacity ) { } <nl> + DiverseStack ( const DiverseStackImpl < T > & other ) <nl> + : DiverseStackImpl < T > ( other , InlineStorage + InlineCapacity ) { } <nl> + DiverseStack ( DiverseStack < T , InlineCapacity > & & other ) <nl> + : DiverseStackImpl < T > ( std : : move ( other ) , InlineStorage + InlineCapacity ) { } <nl> + DiverseStack ( DiverseStackImpl < T > & & other ) <nl> + : DiverseStackImpl < T > ( std : : move ( other ) , InlineStorage + InlineCapacity ) { } <nl> + } ; <nl> + <nl> + / / / A base class for DiverseStackImpl . <nl> + class DiverseStackBase { <nl> + public : <nl> + / / / The top of the stack . <nl> + char * Begin ; <nl> + <nl> + / / / The bottom of the stack , i . e . the end of the allocation . <nl> + char * End ; <nl> + <nl> + / / / The beginning of the allocation . <nl> + char * Allocated ; <nl> + <nl> + bool isAllocatedInline ( ) const { <nl> + return ( Allocated = = reinterpret_cast < const char * > ( this + 1 ) ) ; <nl> + } <nl> + <nl> + void checkValid ( ) const { <nl> + assert ( Allocated < = Begin ) ; <nl> + assert ( Begin < = End ) ; <nl> + } <nl> + <nl> + void initialize ( char * end ) { <nl> + Begin = End = end ; <nl> + Allocated = reinterpret_cast < char * > ( this + 1 ) ; <nl> + } <nl> + void copyFrom ( const DiverseStackBase & other ) { <nl> + / / Ensure that we ' re large enough to store all the data . <nl> + std : : size_t size = static_cast < std : : size_t > ( other . End - other . Begin ) ; <nl> + pushNewStorage ( size ) ; <nl> + std : : memcpy ( Begin , other . Begin , size ) ; <nl> + } <nl> + void pushNewStorage ( std : : size_t needed ) { <nl> + checkValid ( ) ; <nl> + if ( std : : size_t ( Begin - Allocated ) > = needed ) { <nl> + Begin - = needed ; <nl> + } else { <nl> + pushNewStorageSlow ( needed ) ; <nl> + } <nl> + } <nl> + void pushNewStorageSlow ( std : : size_t needed ) ; <nl> + <nl> + / / / A stable iterator is the equivalent of an index into the stack . <nl> + / / / It ' s an iterator that stays stable across modification of the <nl> + / / / stack . <nl> + class stable_iterator { <nl> + std : : size_t Depth ; <nl> + friend class DiverseStackBase ; <nl> + template < class T > friend class DiverseStackImpl ; <nl> + stable_iterator ( std : : size_t depth ) : Depth ( depth ) { } <nl> + public : <nl> + stable_iterator ( ) = default ; <nl> + friend bool operator = = ( stable_iterator a , stable_iterator b ) { <nl> + return a . Depth = = b . Depth ; <nl> + } <nl> + friend bool operator ! = ( stable_iterator a , stable_iterator b ) { <nl> + return a . Depth ! = b . Depth ; <nl> + } <nl> + } ; <nl> + stable_iterator stable_begin ( ) const { <nl> + return stable_iterator ( End - Begin ) ; <nl> + } <nl> + static stable_iterator stable_end ( ) { <nl> + return stable_iterator ( 0 ) ; <nl> + } <nl> + } ; <nl> + <nl> + template < class T > class DiverseStackImpl : private DiverseStackBase { <nl> + DiverseStackImpl ( const DiverseStackImpl < T > & other ) = delete ; <nl> + DiverseStackImpl ( DiverseStackImpl < T > & & other ) = delete ; <nl> + <nl> + static_assert ( std : : is_trivially_destructible < T > : : value , <nl> + " element base type must be trivially destructible " ) ; <nl> + static_assert ( std : : is_trivially_move_constructible < T > : : value , <nl> + " element base type must be trivially moveable " ) ; <nl> + static_assert ( std : : is_trivially_copy_constructible < T > : : value , <nl> + " element base type msut be trivially copyable " ) ; <nl> + <nl> + protected : <nl> + DiverseStackImpl ( char * end ) { <nl> + initialize ( end ) ; <nl> + } <nl> + <nl> + DiverseStackImpl ( const DiverseStackImpl < T > & other , char * end ) { <nl> + initialize ( end ) ; <nl> + copyFrom ( other ) ; <nl> + } <nl> + <nl> + DiverseStackImpl ( DiverseStackImpl < T > & & other , char * end ) { <nl> + / / If the other is allocated inline , just initialize and copy . <nl> + if ( other . isAllocatedInline ( ) ) { <nl> + initialize ( end ) ; <nl> + copyFrom ( other ) ; <nl> + return ; <nl> + } <nl> + <nl> + / / Otherwise , steal its allocations . <nl> + Begin = other . Begin ; <nl> + End = other . End ; <nl> + Allocated = other . Allocated ; <nl> + other . Begin = other . End = other . Allocated = other + 1 ; <nl> + assert ( other . isAllocatedInline ( ) ) ; <nl> + } <nl> + <nl> + public : <nl> + ~ DiverseStackImpl ( ) { <nl> + checkValid ( ) ; <nl> + if ( ! isAllocatedInline ( ) ) <nl> + delete [ ] Allocated ; <nl> + } <nl> + <nl> + bool empty ( ) const { checkValid ( ) ; return Begin = = End ; } <nl> + T * top ( ) { assert ( ! empty ( ) ) ; return static_cast < T * > ( Begin ) ; } <nl> + const T * top ( ) const { assert ( ! empty ( ) ) ; return static_cast < T * > ( Begin ) ; } <nl> + <nl> + class const_iterator ; <nl> + class iterator { <nl> + char * Ptr ; <nl> + friend class DiverseStackImpl ; <nl> + friend class const_iterator ; <nl> + iterator ( char * ptr ) : Ptr ( ptr ) { } <nl> + public : <nl> + iterator ( ) = default ; <nl> + <nl> + T & operator * ( ) const { return * static_cast < T * > ( Ptr ) ; } <nl> + T * operator - > ( ) const { return static_cast < T * > ( Ptr ) ; } <nl> + iterator & operator + + ( ) { <nl> + Ptr + = ( * this ) - > allocated_size ( ) ; <nl> + return * this ; <nl> + } <nl> + iterator operator + + ( int _ ) { <nl> + iterator copy = * this ; <nl> + operator + + ( ) ; <nl> + return copy ; <nl> + } <nl> + <nl> + / / / advancePast - Like operator + + , but asserting that the current <nl> + / / / object has a known type . <nl> + template < class U > void advancePast ( ) { <nl> + assert ( ( * this ) - > allocated_size ( ) = = sizeof ( U ) ) ; <nl> + Ptr + = sizeof ( U ) ; <nl> + } <nl> + <nl> + friend bool operator = = ( iterator a , iterator b ) { return a . Ptr = = b . Ptr ; } <nl> + friend bool operator ! = ( iterator a , iterator b ) { return a . Ptr ! = b . Ptr ; } <nl> + } ; <nl> + iterator begin ( ) { checkValid ( ) ; return iterator ( Begin ) ; } <nl> + iterator end ( ) { checkValid ( ) ; return iterator ( End ) ; } <nl> + iterator find ( stable_iterator it ) { <nl> + checkValid ( ) ; <nl> + assert ( it . Depth < = End - Begin ) ; <nl> + return iterator ( End - it . Depth ) ; <nl> + } <nl> + stable_iterator stabilize ( iterator it ) const { <nl> + checkValid ( ) ; <nl> + assert ( Begin < = it . Ptr & & it . Ptr < = End ) ; <nl> + return stable_iterator ( End - it . Ptr ) ; <nl> + } <nl> + <nl> + class const_iterator { <nl> + const char * Ptr ; <nl> + friend class DiverseStackImpl ; <nl> + const_iterator ( const char * ptr ) : Ptr ( ptr ) { } <nl> + public : <nl> + const_iterator ( ) = default ; <nl> + const_iterator ( iterator it ) : Ptr ( it . Ptr ) { } <nl> + <nl> + const T & operator * ( ) const { return * static_cast < const T * > ( Ptr ) ; } <nl> + const T * operator - > ( ) const { return static_cast < const T * > ( Ptr ) ; } <nl> + const_iterator & operator + + ( ) { <nl> + Ptr + = ( * this ) - > allocated_size ( ) ; <nl> + return * this ; <nl> + } <nl> + const_iterator operator + + ( int _ ) { <nl> + const_iterator copy = * this ; <nl> + operator + + ( ) ; <nl> + return copy ; <nl> + } <nl> + <nl> + / / / advancePast - Like operator + + , but asserting that the current <nl> + / / / object has a known type . <nl> + template < class U > void advancePast ( ) { <nl> + assert ( ( * this ) - > allocated_size ( ) = = sizeof ( U ) ) ; <nl> + Ptr + = sizeof ( U ) ; <nl> + } <nl> + <nl> + friend bool operator = = ( const_iterator a , const_iterator b ) { <nl> + return a . Ptr = = b . Ptr ; <nl> + } <nl> + friend bool operator ! = ( const_iterator a , const_iterator b ) { <nl> + return a . Ptr ! = b . Ptr ; <nl> + } <nl> + } ; <nl> + const_iterator begin ( ) const { checkValid ( ) ; return const_iterator ( Begin ) ; } <nl> + const_iterator end ( ) const { checkValid ( ) ; return const_iterator ( End ) ; } <nl> + const_iterator find ( stable_iterator it ) const { <nl> + checkValid ( ) ; <nl> + assert ( it . Depth < = End - Begin ) ; <nl> + return const_iterator ( End - it . Depth ) ; <nl> + } <nl> + stable_iterator stabilize ( const_iterator it ) const { <nl> + checkValid ( ) ; <nl> + assert ( Begin < = it . Ptr & & it . Ptr < = End ) ; <nl> + return stable_iterator ( End - it . Ptr ) ; <nl> + } <nl> + <nl> + / / / Push a new object onto the stack . <nl> + template < class U , class . . . A > U * push ( A & & . . . args ) { <nl> + static_assert ( std : : is_trivially_destructible < U > : : value , <nl> + " pushed type must be trivially destructible " ) ; <nl> + static_assert ( std : : is_trivially_move_constructible < U > : : value , <nl> + " pushed type must be trivially moveable " ) ; <nl> + static_assert ( std : : is_trivially_copy_constructible < U > : : value , <nl> + " pushed type must be trivially copyable " ) ; <nl> + <nl> + pushNewStorage ( sizeof ( U ) ) ; <nl> + return : : new ( Begin ) U ( : : std : : forward < A > ( args ) . . . ) ; <nl> + } <nl> + <nl> + / / / Pop an object off the stack . <nl> + void pop ( ) { <nl> + assert ( ! empty ( ) ) ; <nl> + Begin + = top ( ) . allocated_size ( ) ; <nl> + } <nl> + <nl> + / / / Pop an object of known type off the stack . <nl> + template < class U > void pop ( ) { <nl> + assert ( ! empty ( ) ) ; <nl> + assert ( sizeof ( U ) = = top ( ) . allocated_size ( ) ) ; <nl> + Begin + = sizeof ( U ) ; <nl> + } <nl> + } ; <nl> + <nl> + } / / end namespace irgen <nl> + } / / end namespace swift <nl> + <nl> + # endif <nl>
|
Utility class for a stack of heterogenous objects . I ' m going
|
apple/swift
|
c7f58d354130339640e46dba76aee74f09e08ccc
|
2011-12-15T09:18:02Z
|
mmm a / html5 / render / vue / components / scrollable / loading - indicator . js <nl> ppp b / html5 / render / vue / components / scrollable / loading - indicator . js <nl> function processStyle ( vm ) { <nl> const style = extractComponentStyle ( vm ) <nl> const color = style . color <nl> const rgb = color & & getRgb ( color ) <nl> - if ( ! rgb ) { <nl> - return <nl> + if ( rgb ) { <nl> + setKeyframeColor ( vm , rgb ) <nl> } <nl> - setKeyframeColor ( vm , rgb ) <nl> + return style <nl> } <nl> <nl> export default { <nl>
|
* [ html5 ] update
|
apache/incubator-weex
|
76ab14b92b94f76f1b27812cbb01647da967ab1d
|
2017-06-21T09:44:23Z
|
mmm a / BUILD . gn <nl> ppp b / BUILD . gn <nl> v8_source_set ( " v8_base " ) { <nl> ] <nl> } else if ( v8_target_arch = = " mips64el " ) { <nl> sources + = [ <nl> - " compiler / mips64 / code - generator - mips64 . cc " , <nl> - " compiler / mips64 / instruction - codes - mips64 . h " , <nl> - " compiler / mips64 / instruction - scheduler - mips64 . cc " , <nl> - " compiler / mips64 / instruction - selector - mips64 . cc " , <nl> + " src / compiler / mips64 / code - generator - mips64 . cc " , <nl> + " src / compiler / mips64 / instruction - codes - mips64 . h " , <nl> + " src / compiler / mips64 / instruction - scheduler - mips64 . cc " , <nl> + " src / compiler / mips64 / instruction - selector - mips64 . cc " , <nl> " src / crankshaft / mips64 / lithium - codegen - mips64 . cc " , <nl> " src / crankshaft / mips64 / lithium - codegen - mips64 . h " , <nl> " src / crankshaft / mips64 / lithium - gap - resolver - mips64 . cc " , <nl>
|
Fix MIPS64 compilation issue with GN build system
|
v8/v8
|
4a96bc2a947e17a7bb55bc5174a73ab290c91b46
|
2016-05-18T14:44:37Z
|
mmm a / jstests / sharding / auth . js <nl> ppp b / jstests / sharding / auth . js <nl> assert . writeOK ( s . getDB ( " config " ) . settings . update ( <nl> printjson ( s . getDB ( " config " ) . settings . find ( ) . toArray ( ) ) ; <nl> <nl> print ( " Restart mongos with different auth options " ) ; <nl> - s . restartMongos ( 0 , { port : s . port , <nl> - v : 2 , <nl> + s . restartMongos ( 0 , { v : 2 , <nl> configdb : s . _configDB , <nl> keyFile : " jstests / libs / key1 " , <nl> chunkSize : 1 } ) ; <nl> mmm a / src / mongo / shell / shardingtest . js <nl> ppp b / src / mongo / shell / shardingtest . js <nl> <nl> * enableBalancer { boolean } : if true , enable the balancer <nl> * manualAddShard { boolean } : shards will not be added if true . <nl> * <nl> + * useBridge { boolean } : If true , then a mongobridge process is started for each node in the <nl> + * sharded cluster . Defaults to false . <nl> + * <nl> * / / replica Set only : <nl> * rsOptions { Object } : same as the rs property above . Can be used to <nl> * specify options that are common all replica members . <nl> var ShardingTest = function ( params ) { <nl> <nl> this . stop = function ( ) { <nl> for ( var i = 0 ; i < this . _mongos . length ; i + + ) { <nl> - MongoRunner . stopMongos ( this . _mongos [ i ] . port ) ; <nl> + this . stopMongos ( i ) ; <nl> } <nl> <nl> for ( var i = 0 ; i < this . _connections . length ; i + + ) { <nl> if ( this . _rs [ i ] ) { <nl> this . _rs [ i ] . test . stopSet ( 15 ) ; <nl> } else { <nl> - MongoRunner . stopMongod ( this . _connections [ i ] . port ) ; <nl> + this . stopMongod ( i ) ; <nl> } <nl> } <nl> <nl> var ShardingTest = function ( params ) { <nl> } else { <nl> / / Old style config triplet <nl> for ( var i = 0 ; i < this . _configServers . length ; i + + ) { <nl> - MongoRunner . stopMongod ( this . _configServers [ i ] ) ; <nl> + if ( otherParams . useBridge ) { <nl> + MongoRunner . stopMongod ( unbridgedConfigServers [ i ] ) ; <nl> + this . _configServers [ i ] . stop ( ) ; <nl> + } else { <nl> + MongoRunner . stopMongod ( this . _configServers [ i ] ) ; <nl> + } <nl> } <nl> } <nl> <nl> var ShardingTest = function ( params ) { <nl> * Kills the mongos with index n . <nl> * / <nl> this . stopMongos = function ( n ) { <nl> - MongoRunner . stopMongos ( this [ ' s ' + n ] . port ) ; <nl> + if ( otherParams . useBridge ) { <nl> + MongoRunner . stopMongos ( unbridgedMongos [ n ] ) ; <nl> + this [ " s " + n ] . stop ( ) ; <nl> + } else { <nl> + MongoRunner . stopMongos ( this [ " s " + n ] ) ; <nl> + } <nl> } ; <nl> <nl> / * * <nl> * Kills the mongod with index n . <nl> * / <nl> this . stopMongod = function ( n ) { <nl> - MongoRunner . stopMongod ( this [ ' d ' + n ] . port ) ; <nl> + if ( otherParams . useBridge ) { <nl> + MongoRunner . stopMongod ( unbridgedConnections [ n ] ) ; <nl> + this [ " d " + n ] . stop ( ) ; <nl> + } else { <nl> + MongoRunner . stopMongod ( this [ " d " + n ] ) ; <nl> + } <nl> } ; <nl> <nl> / * * <nl> var ShardingTest = function ( params ) { <nl> * Warning : Overwrites the old s ( if n = 0 ) admin , config , and sn member variables . <nl> * / <nl> this . restartMongos = function ( n , opts ) { <nl> - var mongos = this [ ' s ' + n ] ; <nl> + var mongos ; <nl> <nl> - if ( opts = = = undefined ) { <nl> - opts = this [ ' s ' + n ] ; <nl> - opts . restart = true ; <nl> + if ( otherParams . useBridge ) { <nl> + mongos = unbridgedMongos [ n ] ; <nl> + } else { <nl> + mongos = this [ " s " + n ] ; <nl> } <nl> <nl> - MongoRunner . stopMongos ( mongos ) ; <nl> + opts = opts | | mongos ; <nl> + opts . port = opts . port | | mongos . port ; <nl> + <nl> + this . stopMongos ( n ) ; <nl> + <nl> + if ( otherParams . useBridge ) { <nl> + this . _mongos [ n ] = new MongoBridge ( { <nl> + hostName : otherParams . useHostname ? hostName : " localhost " , <nl> + port : this . _mongos [ n ] . port , <nl> + / / The mongos processes identify themselves to mongobridge as host : port , where the <nl> + / / host is the actual hostname of the machine and not localhost . <nl> + dest : hostName + " : " + opts . port , <nl> + } ) ; <nl> + } <nl> <nl> var newConn = MongoRunner . runMongos ( opts ) ; <nl> + if ( ! newConn ) { <nl> + throw new Error ( " Failed to restart mongos " + n ) ; <nl> + } <nl> + <nl> + if ( otherParams . useBridge ) { <nl> + this . _mongos [ n ] . connectToBridge ( ) ; <nl> + unbridgedMongos [ n ] = newConn ; <nl> + } else { <nl> + this . _mongos [ n ] = newConn ; <nl> + } <nl> <nl> - this [ ' s ' + n ] = newConn ; <nl> + this [ ' s ' + n ] = this . _mongos [ n ] ; <nl> if ( n = = 0 ) { <nl> - this . s = newConn ; <nl> - this . admin = newConn . getDB ( ' admin ' ) ; <nl> - this . config = newConn . getDB ( ' config ' ) ; <nl> + this . s = this . _mongos [ n ] ; <nl> + this . admin = this . _mongos [ n ] . getDB ( ' admin ' ) ; <nl> + this . config = this . _mongos [ n ] . getDB ( ' config ' ) ; <nl> } <nl> } ; <nl> <nl> var ShardingTest = function ( params ) { <nl> * Warning : Overwrites the old dn member variables . <nl> * / <nl> this . restartMongod = function ( n ) { <nl> - var mongod = this [ ' d ' + n ] ; <nl> - MongoRunner . stopMongod ( mongod ) ; <nl> - mongod . restart = true ; <nl> + var mongod ; <nl> + <nl> + if ( otherParams . useBridge ) { <nl> + mongod = unbridgedConnections [ n ] ; <nl> + } else { <nl> + mongod = this [ " d " + n ] ; <nl> + } <nl> + <nl> + this . stopMongod ( n ) ; <nl> <nl> + if ( otherParams . useBridge ) { <nl> + this . _connections [ n ] = new MongoBridge ( { <nl> + hostName : otherParams . useHostname ? hostName : " localhost " , <nl> + port : this . _connections [ n ] . port , <nl> + / / The mongod processes identify themselves to mongobridge as host : port , where the <nl> + / / host is the actual hostname of the machine and not localhost . <nl> + dest : hostName + " : " + mongod . port , <nl> + } ) ; <nl> + } <nl> + <nl> + mongod . restart = true ; <nl> var newConn = MongoRunner . runMongod ( mongod ) ; <nl> + if ( ! newConn ) { <nl> + throw new Error ( " Failed to restart shard " + n ) ; <nl> + } <nl> + <nl> + if ( otherParams . useBridge ) { <nl> + this . _connections [ n ] . connectToBridge ( ) ; <nl> + unbridgedConnections [ n ] = newConn ; <nl> + } else { <nl> + this . _connections [ n ] = newConn ; <nl> + } <nl> <nl> - this [ ' d ' + n ] = newConn ; <nl> + this [ " shard " + n ] = this . _connections [ n ] ; <nl> + this [ " d " + n ] = this . _connections [ n ] ; <nl> } ; <nl> <nl> / * * <nl> var ShardingTest = function ( params ) { <nl> otherParams . extraOptions = otherParams . extraOptions | | { } ; <nl> otherParams . useHostname = otherParams . useHostname = = undefined ? <nl> true : otherParams . useHostname ; <nl> + otherParams . useBridge = otherParams . useBridge | | false ; <nl> var keyFile = otherParams . keyFile | | otherParams . extraOptions . keyFile <nl> + var hostName = getHostName ( ) ; <nl> <nl> this . _testName = testName <nl> this . _otherParams = otherParams <nl> var ShardingTest = function ( params ) { <nl> this . _rs = [ ] <nl> this . _rsObjects = [ ] <nl> <nl> + if ( otherParams . useBridge ) { <nl> + var unbridgedConnections = [ ] ; <nl> + var unbridgedConfigServers = [ ] ; <nl> + var unbridgedMongos = [ ] ; <nl> + } <nl> + <nl> / / Start the MongoD servers ( shards ) <nl> for ( var i = 0 ; i < numShards ; i + + ) { <nl> if ( otherParams . rs | | otherParams [ " rs " + i ] ) { <nl> var ShardingTest = function ( params ) { <nl> var rs = new ReplSetTest ( { name : setName , <nl> nodes : numReplicas , <nl> useHostName : otherParams . useHostname , <nl> + useBridge : otherParams . useBridge , <nl> keyFile : keyFile , <nl> protocolVersion : protocolVersion , <nl> shardSvr : true } ) ; <nl> var ShardingTest = function ( params ) { <nl> <nl> this . _rsObjects [ i ] = rs <nl> <nl> - this . _alldbpaths . push ( null ) <nl> - this . _connections . push ( null ) <nl> + this . _alldbpaths . push ( null ) ; <nl> + this . _connections . push ( null ) ; <nl> + <nl> + if ( otherParams . useBridge ) { <nl> + unbridgedConnections . push ( null ) ; <nl> + } <nl> } <nl> else { <nl> var options = { <nl> var ShardingTest = function ( params ) { <nl> options = Object . merge ( options , otherParams . shardOptions ) <nl> options = Object . merge ( options , otherParams [ " d " + i ] ) <nl> <nl> + options . port = options . port | | allocatePort ( ) ; <nl> + <nl> + if ( otherParams . useBridge ) { <nl> + var bridge = new MongoBridge ( { <nl> + hostName : otherParams . useHostname ? hostName : " localhost " , <nl> + / / The mongod processes identify themselves to mongobridge as host : port , where <nl> + / / the host is the actual hostname of the machine and not localhost . <nl> + dest : hostName + " : " + options . port , <nl> + } ) ; <nl> + } <nl> + <nl> var conn = MongoRunner . runMongod ( options ) ; <nl> + if ( ! conn ) { <nl> + throw new Error ( " Failed to start shard " + i ) ; <nl> + } <nl> + <nl> + if ( otherParams . useBridge ) { <nl> + bridge . connectToBridge ( ) ; <nl> + this . _connections . push ( bridge ) ; <nl> + unbridgedConnections . push ( conn ) <nl> + } else { <nl> + this . _connections . push ( conn ) ; <nl> + } <nl> <nl> - this . _alldbpaths . push ( testName + i ) <nl> - this . _connections . push ( conn ) ; <nl> - this [ " shard " + i ] = conn <nl> - this [ " d " + i ] = conn <nl> + this . _alldbpaths . push ( testName + i ) ; <nl> + this [ " shard " + i ] = this . _connections [ i ] ; <nl> + this [ " d " + i ] = this . _connections [ i ] ; <nl> <nl> - this . _rs [ i ] = null <nl> - this . _rsObjects [ i ] = null <nl> + this . _rs [ i ] = null ; <nl> + this . _rsObjects [ i ] = null ; <nl> } <nl> } <nl> <nl> var ShardingTest = function ( params ) { <nl> options = Object . merge ( options , otherParams . configOptions ) <nl> options = Object . merge ( options , otherParams [ " c " + i ] ) <nl> <nl> - var conn = MongoRunner . runMongod ( options ) <nl> + options . port = options . port | | allocatePort ( ) ; <nl> <nl> - this . _alldbpaths . push ( testName + " - config " + i ) <nl> + if ( otherParams . useBridge ) { <nl> + var bridge = new MongoBridge ( { <nl> + hostName : otherParams . useHostname ? hostName : " localhost " , <nl> + / / The mongod processes identify themselves to mongobridge as host : port , where <nl> + / / the host is the actual hostname of the machine and not localhost . <nl> + dest : hostName + " : " + options . port , <nl> + } ) ; <nl> + } <nl> <nl> - this . _configServers . push ( conn ) ; <nl> - configNames . push ( conn . name ) ; <nl> + var conn = MongoRunner . runMongod ( options ) ; <nl> + if ( ! conn ) { <nl> + throw new Error ( " Failed to start config server " + i ) ; <nl> + } <nl> <nl> - this [ " config " + i ] = conn <nl> - this [ " c " + i ] = conn <nl> + if ( otherParams . useBridge ) { <nl> + bridge . connectToBridge ( ) ; <nl> + this . _configServers . push ( bridge ) ; <nl> + unbridgedConfigServers . push ( conn ) ; <nl> + configNames . push ( bridge . host ) ; <nl> + } else { <nl> + this . _configServers . push ( conn ) ; <nl> + configNames . push ( conn . name ) ; <nl> + } <nl> + <nl> + this . _alldbpaths . push ( testName + " - config " + i ) ; <nl> + this [ " config " + i ] = this . _configServers [ i ] ; <nl> + this [ " c " + i ] = this . _configServers [ i ] ; <nl> } <nl> <nl> this . _configDB = configNames . join ( ' , ' ) ; <nl> var ShardingTest = function ( params ) { <nl> else { <nl> / / Using replica set for config servers <nl> var rstOptions = { useHostName : otherParams . useHostname , <nl> + useBridge : otherParams . useBridge , <nl> keyFile : keyFile , <nl> name : testName + " - configRS " , <nl> } ; <nl> var ShardingTest = function ( params ) { <nl> options = Object . merge ( options , otherParams . extraOptions ) <nl> options = Object . merge ( options , otherParams [ " s " + i ] ) <nl> <nl> - conn = MongoRunner . runMongos ( options ) ; <nl> + options . port = options . port | | allocatePort ( ) ; <nl> <nl> - this . _mongos . push ( conn ) ; <nl> + if ( otherParams . useBridge ) { <nl> + var bridge = new MongoBridge ( { <nl> + hostName : otherParams . useHostname ? hostName : " localhost " , <nl> + / / The mongos processes identify themselves to mongobridge as host : port , where the <nl> + / / host is the actual hostname of the machine and not localhost . <nl> + dest : hostName + " : " + options . port , <nl> + } ) ; <nl> + } <nl> + <nl> + var conn = MongoRunner . runMongos ( options ) ; <nl> + if ( ! conn ) { <nl> + throw new Error ( " Failed to start mongos " + i ) ; <nl> + } <nl> + <nl> + if ( otherParams . useBridge ) { <nl> + bridge . connectToBridge ( ) ; <nl> + this . _mongos . push ( bridge ) ; <nl> + unbridgedMongos . push ( conn ) ; <nl> + } else { <nl> + this . _mongos . push ( conn ) ; <nl> + } <nl> <nl> if ( i = = = 0 ) { <nl> - this . s = conn ; <nl> - this . admin = conn . getDB ( ' admin ' ) ; <nl> - this . config = conn . getDB ( ' config ' ) ; <nl> + this . s = this . _mongos [ i ] ; <nl> + this . admin = this . _mongos [ i ] . getDB ( ' admin ' ) ; <nl> + this . config = this . _mongos [ i ] . getDB ( ' config ' ) ; <nl> } <nl> <nl> - this [ " s " + i ] = conn ; <nl> + this [ " s " + i ] = this . _mongos [ i ] ; <nl> } <nl> <nl> / / Disable the balancer unless it is explicitly turned on <nl>
|
SERVER - 20867 Integrate mongobridge into ShardingTest .
|
mongodb/mongo
|
78d3e85ae6de50fc016433c4d161ad11b801c717
|
2015-11-09T14:56:21Z
|
mmm a / tests / test_browser . py <nl> ppp b / tests / test_browser . py <nl> def test_sdl_audio_quickload ( self ) : <nl> self . run_browser ( ' page . html ' , ' ' , ' / report_result ? 1 ' ) <nl> <nl> def test_sdl_audio_beeps ( self ) : <nl> - if os . environ . get ( ' EMCC_FAST_COMPILER ' ) = = ' 1 ' : return self . skip ( ' todo c + + exceptions in fastcomp ' ) <nl> - <nl> open ( os . path . join ( self . get_dir ( ) , ' sdl_audio_beep . cpp ' ) , ' w ' ) . write ( self . with_report_result ( open ( path_from_root ( ' tests ' , ' sdl_audio_beep . cpp ' ) ) . read ( ) ) ) <nl> <nl> # use closure to check for a possible bug with closure minifying away newer Audio ( ) attributes <nl>
|
enable test_sdl_audio_beeps in fastcomp
|
emscripten-core/emscripten
|
95a8957ce7efbcf6d2d0c0a91ff53a50a823bc2b
|
2014-02-09T19:48:00Z
|
new file mode 100644 <nl> index 00000000000 . . f96c4a51ac2 <nl> mmm / dev / null <nl> ppp b / test / full_test / heavy_backfill . test <nl> <nl> + # Test heavy backfilling while under continuous load <nl> + do_test ( <nl> + " $ RETHINKDB / test / scenarios / more_or_less_secondaries . py - - more - - workload - during ' $ RETHINKDB / bench / stress - client / stress - s $ HOST : $ PORT - w 0 / 0 / 1 / 0 - d infinity - q qps_out ' - - extra - before 1000 " , <nl> + repeat = 3 , <nl> + inputs = [ " build / debug / rethinkdb " , " test / scenarios " , " test / common " , " test / workloads " , " bench / stress - client / stress " ] <nl> + ) <nl> \ No newline at end of file <nl>
|
Adds a test that causes a big backfill to happen .
|
rethinkdb/rethinkdb
|
f77ab82d7370b0b86113d885294327edc1d3c21b
|
2012-06-06T18:59:34Z
|
mmm a / src / rdb_protocol / changefeed . cc <nl> ppp b / src / rdb_protocol / changefeed . cc <nl> void feed_t : : each_sub ( const std : : function < void ( sub_t * ) > & f ) THROWS_NOTHING { <nl> void feed_t : : each_sub_cb ( const std : : function < void ( sub_t * ) > & f , <nl> const std : : vector < int > & sub_threads , <nl> int i ) { <nl> - auto set = & subs [ sub_threads [ i ] ] ; <nl> + std : : set < sub_t * > * set = & subs [ sub_threads [ i ] ] ; <nl> guarantee ( set - > size ( ) ! = 0 ) ; <nl> on_thread_t th ( ( threadnum_t ( sub_threads [ i ] ) ) ) ; <nl> for ( auto it = set - > begin ( ) ; it ! = set - > end ( ) ; + + it ) { <nl>
|
Removed an auto ( style ) .
|
rethinkdb/rethinkdb
|
1a2d3366c1cdae817125aca51395c93599b1bda0
|
2014-05-22T00:04:50Z
|
mmm a / scenario - tests / tests / single_test_driver . py <nl> ppp b / scenario - tests / tests / single_test_driver . py <nl> <nl> <nl> def print_help ( ) : <nl> print ( " " " \ <nl> - { } [ sub_directory ] [ Optional output xunit xml path prefix ] <nl> + % s [ sub_directory ] [ Optional output xunit xml path prefix ] <nl> <nl> This test runs the scenario test located in the sub directory . <nl> Every python file in the sub directory will be executed against pytest . <nl> mmm a / src / nnvm / tvm / python / tvm / contrib / xcode . py <nl> ppp b / src / nnvm / tvm / python / tvm / contrib / xcode . py <nl> def popen_test_rpc ( host , <nl> rpc_root = os . path . join ( curr_path , " . . / . . / . . / apps / ios_rpc " ) <nl> proj_path = os . path . abspath ( os . path . join ( rpc_root , " tvmrpc . xcodeproj " ) ) <nl> if not os . path . exists ( proj_path ) : <nl> - raise RuntimeError ( " Cannot find tvmrpc . xcodeproj in % s , " + <nl> - ( " please set env TVM_IOS_RPC_ROOT correctly " % rpc_root ) ) <nl> + raise RuntimeError ( " Cannot find tvmrpc . xcodeproj in % s , " <nl> + " please set env TVM_IOS_RPC_ROOT correctly " % rpc_root ) <nl> with open ( os . path . join ( rpc_root , " rpc_config . txt " ) , " w " ) as fo : <nl> fo . write ( " % s % d % s \ n " % ( host , port , key ) ) <nl> libs = libs if libs else [ ] <nl> mmm a / src / unity / python / turicreate / cython / cy_pylambda_workers . pyx <nl> ppp b / src / unity / python / turicreate / cython / cy_pylambda_workers . pyx <nl> cdef class lambda_evaluator ( object ) : <nl> for i in range ( n ) : <nl> if lcd . input_keys [ 0 ] [ i ] . size ( ) ! = n_keys : <nl> raise ValueError ( " Row % d does not have the correct number of rows ( % d , should be % d ) " <nl> - % ( lcd . input_keys [ 0 ] [ i ] . size ( ) , n ) ) <nl> + % ( i , lcd . input_keys [ 0 ] [ i ] . size ( ) , n ) ) <nl> <nl> arg_dict = self . arg_dict_base . copy ( ) <nl> <nl>
|
Fix formatting errors shown in
|
apple/turicreate
|
94aa9fae13a39ad5e90b5bf049ddde4f20a10cf8
|
2017-12-11T21:28:59Z
|
mmm a / lib / Sema / TypeCheckProtocol . h <nl> ppp b / lib / Sema / TypeCheckProtocol . h <nl> CheckTypeWitnessResult checkTypeWitness ( Type type , <nl> AssociatedTypeDecl * assocType , <nl> NormalProtocolConformance * Conf ) ; <nl> <nl> + / / / Describes the means of inferring an abstract type witness . <nl> + enum class AbstractTypeWitnessKind : uint8_t { <nl> + / / / The type witness was inferred via a same - type - to - concrete constraint <nl> + / / / in a protocol requirement signature . <nl> + Fixed , <nl> + <nl> + / / / The type witness was inferred via a defaulted associated type . <nl> + Default , <nl> + <nl> + / / / The type witness was inferred to a generic parameter of the <nl> + / / / conforming type . <nl> + GenericParam , <nl> + } ; <nl> + <nl> + / / / A type witness inferred without the aid of a specific potential <nl> + / / / value witness . <nl> + class AbstractTypeWitness { <nl> + AbstractTypeWitnessKind Kind ; <nl> + AssociatedTypeDecl * AssocType ; <nl> + Type TheType ; <nl> + <nl> + / / / When this is a default type witness , the declaration responsible for it . <nl> + / / / May not necessarilly match \ c AssocType . <nl> + AssociatedTypeDecl * DefaultedAssocType ; <nl> + <nl> + AbstractTypeWitness ( AbstractTypeWitnessKind Kind , <nl> + AssociatedTypeDecl * AssocType , Type TheType , <nl> + AssociatedTypeDecl * DefaultedAssocType ) <nl> + : Kind ( Kind ) , AssocType ( AssocType ) , TheType ( TheType ) , <nl> + DefaultedAssocType ( DefaultedAssocType ) { <nl> + assert ( AssocType & & TheType ) ; <nl> + } <nl> + <nl> + public : <nl> + static AbstractTypeWitness forFixed ( AssociatedTypeDecl * assocType , Type type ) ; <nl> + <nl> + static AbstractTypeWitness forDefault ( AssociatedTypeDecl * assocType , <nl> + Type type , <nl> + AssociatedTypeDecl * defaultedAssocType ) ; <nl> + <nl> + static AbstractTypeWitness forGenericParam ( AssociatedTypeDecl * assocType , <nl> + Type type ) ; <nl> + <nl> + public : <nl> + AbstractTypeWitnessKind getKind ( ) const { return Kind ; } <nl> + <nl> + AssociatedTypeDecl * getAssocType ( ) const { return AssocType ; } <nl> + <nl> + Type getType ( ) const { return TheType ; } <nl> + <nl> + AssociatedTypeDecl * getDefaultedAssocType ( ) const { <nl> + return DefaultedAssocType ; <nl> + } <nl> + } ; <nl> + <nl> / / / The set of associated types that have been inferred by matching <nl> / / / the given value witness to its corresponding requirement . <nl> struct InferredAssociatedTypesByWitness { <nl> class AssociatedTypeInference { <nl> <nl> / / / Compute the default type witness from an associated type default , <nl> / / / if there is one . <nl> - Type computeDefaultTypeWitness ( AssociatedTypeDecl * assocType ) ; <nl> + Optional < AbstractTypeWitness > <nl> + computeDefaultTypeWitness ( AssociatedTypeDecl * assocType ) ; <nl> <nl> / / / Compute the " derived " type witness for an associated type that is <nl> / / / known to the compiler . <nl> std : : pair < Type , TypeDecl * > <nl> computeDerivedTypeWitness ( AssociatedTypeDecl * assocType ) ; <nl> <nl> - / / / Compute a type witness without using a specific potential witness , <nl> - / / / e . g . , using a fixed type ( from a refined protocol ) , default type <nl> - / / / on an associated type , or deriving the type . <nl> - Type computeAbstractTypeWitness ( AssociatedTypeDecl * assocType ) ; <nl> + / / / Compute a type witness without using a specific potential witness . <nl> + Optional < AbstractTypeWitness > <nl> + computeAbstractTypeWitness ( AssociatedTypeDecl * assocType ) ; <nl> <nl> / / / Substitute the current type witnesses into the given interface type . <nl> Type substCurrentTypeWitnesses ( Type type ) ; <nl> class AssociatedTypeInference { <nl> / / / requirements of the given constrained extension . <nl> bool checkConstrainedExtension ( ExtensionDecl * ext ) ; <nl> <nl> + / / / Validate the current tentative solution represented by \ p typeWitnesses <nl> + / / / and attempt to resolve abstract type witnesses for associated types that <nl> + / / / could not be inferred otherwise . <nl> + / / / <nl> + / / / \ returns \ c nullptr , or the associated type that failed . <nl> + AssociatedTypeDecl * <nl> + completeSolution ( ArrayRef < AssociatedTypeDecl * > unresolvedAssocTypes , <nl> + unsigned reqDepth ) ; <nl> + <nl> / / / Top - level operation to find solutions for the given unresolved <nl> / / / associated types . <nl> void findSolutions ( <nl> mmm a / lib / Sema / TypeCheckProtocolInference . cpp <nl> ppp b / lib / Sema / TypeCheckProtocolInference . cpp <nl> STATISTIC ( NumDuplicateSolutionStates , <nl> <nl> using namespace swift ; <nl> <nl> + AbstractTypeWitness AbstractTypeWitness : : forFixed ( AssociatedTypeDecl * assocType , <nl> + Type type ) { <nl> + return AbstractTypeWitness ( AbstractTypeWitnessKind : : Fixed , assocType , type , <nl> + nullptr ) ; <nl> + } <nl> + <nl> + AbstractTypeWitness <nl> + AbstractTypeWitness : : forDefault ( AssociatedTypeDecl * assocType , Type type , <nl> + AssociatedTypeDecl * defaultedAssocType ) { <nl> + return AbstractTypeWitness ( AbstractTypeWitnessKind : : Default , assocType , type , <nl> + defaultedAssocType ) ; <nl> + } <nl> + <nl> + AbstractTypeWitness <nl> + AbstractTypeWitness : : forGenericParam ( AssociatedTypeDecl * assocType , Type type ) { <nl> + return AbstractTypeWitness ( AbstractTypeWitnessKind : : GenericParam , assocType , <nl> + type , nullptr ) ; <nl> + } <nl> + <nl> void InferredAssociatedTypesByWitness : : dump ( ) const { <nl> dump ( llvm : : errs ( ) , 0 ) ; <nl> } <nl> Type AssociatedTypeInference : : computeFixedTypeWitness ( <nl> return resultType ; <nl> } <nl> <nl> - Type AssociatedTypeInference : : computeDefaultTypeWitness ( <nl> - AssociatedTypeDecl * assocType ) { <nl> + Optional < AbstractTypeWitness > <nl> + AssociatedTypeInference : : computeDefaultTypeWitness ( <nl> + AssociatedTypeDecl * assocType ) { <nl> / / Go find a default definition . <nl> - auto defaultedAssocType = findDefaultedAssociatedType ( assocType ) ; <nl> - if ( ! defaultedAssocType ) return Type ( ) ; <nl> - <nl> - / / If we don ' t have a default definition , we ' re done . <nl> - auto selfType = proto - > getSelfInterfaceType ( ) ; <nl> - <nl> - / / Create a set of type substitutions for all known associated type . <nl> - / / FIXME : Base this on dependent types rather than archetypes ? <nl> - TypeSubstitutionMap substitutions ; <nl> - substitutions [ proto - > mapTypeIntoContext ( selfType ) <nl> - - > castTo < ArchetypeType > ( ) ] = dc - > mapTypeIntoContext ( adoptee ) ; <nl> - for ( auto assocType : proto - > getAssociatedTypeMembers ( ) ) { <nl> - auto archetype = proto - > mapTypeIntoContext ( <nl> - assocType - > getDeclaredInterfaceType ( ) ) <nl> - - > getAs < ArchetypeType > ( ) ; <nl> - if ( ! archetype ) <nl> - continue ; <nl> - if ( conformance - > hasTypeWitness ( assocType ) ) { <nl> - substitutions [ archetype ] = <nl> - dc - > mapTypeIntoContext ( conformance - > getTypeWitness ( assocType ) ) ; <nl> - } else { <nl> - auto known = typeWitnesses . begin ( assocType ) ; <nl> - if ( known ! = typeWitnesses . end ( ) ) <nl> - substitutions [ archetype ] = known - > first ; <nl> - else <nl> - substitutions [ archetype ] = ErrorType : : get ( archetype ) ; <nl> - } <nl> - } <nl> - <nl> - Type defaultType = defaultedAssocType - > getDefaultDefinitionType ( ) ; <nl> + auto * const defaultedAssocType = findDefaultedAssociatedType ( assocType ) ; <nl> + if ( ! defaultedAssocType ) <nl> + return None ; <nl> <nl> + const Type defaultType = defaultedAssocType - > getDefaultDefinitionType ( ) ; <nl> / / FIXME : Circularity <nl> if ( ! defaultType ) <nl> - return Type ( ) ; <nl> - <nl> - / / Map it into our protocol ' s context . <nl> - defaultType = proto - > mapTypeIntoContext ( defaultType ) ; <nl> - defaultType = defaultType . subst ( <nl> - QueryTypeSubstitutionMap { substitutions } , <nl> - LookUpConformanceInModule ( dc - > getParentModule ( ) ) ) ; <nl> + return None ; <nl> <nl> if ( defaultType - > hasError ( ) ) <nl> - return Type ( ) ; <nl> - <nl> - if ( auto failed = checkTypeWitness ( defaultType , assocType , conformance ) ) { <nl> - / / Record the failure , if we haven ' t seen one already . <nl> - if ( ! failedDefaultedAssocType & & ! failed . isError ( ) ) { <nl> - failedDefaultedAssocType = defaultedAssocType ; <nl> - failedDefaultedWitness = defaultType ; <nl> - failedDefaultedResult = failed ; <nl> - } <nl> - <nl> - return Type ( ) ; <nl> - } <nl> + return None ; <nl> <nl> - return defaultType ; <nl> + return AbstractTypeWitness : : forDefault ( assocType , defaultType , <nl> + defaultedAssocType ) ; <nl> } <nl> <nl> std : : pair < Type , TypeDecl * > <nl> AssociatedTypeInference : : computeDerivedTypeWitness ( <nl> return result ; <nl> } <nl> <nl> - Type <nl> + Optional < AbstractTypeWitness > <nl> AssociatedTypeInference : : computeAbstractTypeWitness ( <nl> - AssociatedTypeDecl * assocType ) { <nl> + AssociatedTypeDecl * assocType ) { <nl> / / We don ' t have a type witness for this associated type , so go <nl> / / looking for more options . <nl> if ( Type concreteType = computeFixedTypeWitness ( assocType ) ) <nl> - return concreteType ; <nl> + return AbstractTypeWitness : : forFixed ( assocType , concreteType ) ; <nl> <nl> / / If we can form a default type , do so . <nl> - if ( Type defaultType = computeDefaultTypeWitness ( assocType ) ) <nl> - return defaultType ; <nl> + if ( auto typeWitness = computeDefaultTypeWitness ( assocType ) ) <nl> + return typeWitness ; <nl> <nl> / / If there is a generic parameter of the named type , use that . <nl> if ( auto genericSig = dc - > getGenericSignatureOfContext ( ) ) { <nl> for ( auto gp : genericSig - > getInnermostGenericParams ( ) ) { <nl> if ( gp - > getName ( ) = = assocType - > getName ( ) ) <nl> - return dc - > mapTypeIntoContext ( gp ) ; <nl> + return AbstractTypeWitness : : forGenericParam ( assocType , gp ) ; <nl> } <nl> } <nl> <nl> - return Type ( ) ; <nl> + return None ; <nl> } <nl> <nl> Type AssociatedTypeInference : : substCurrentTypeWitnesses ( Type type ) { <nl> AssociatedTypeInference : : getSubstOptionsWithCurrentTypeWitnesses ( ) { <nl> if ( auto * aliasTy = dyn_cast < TypeAliasType > ( type . getPointer ( ) ) ) <nl> type = aliasTy - > getSinglyDesugaredType ( ) ; <nl> <nl> - return type - > mapTypeOutOfContext ( ) . getPointer ( ) ; <nl> + return type - > hasArchetype ( ) ? type - > mapTypeOutOfContext ( ) . getPointer ( ) <nl> + : type . getPointer ( ) ; <nl> } ; <nl> return options ; <nl> } <nl> bool AssociatedTypeInference : : checkConstrainedExtension ( ExtensionDecl * ext ) { <nl> llvm_unreachable ( " unhandled result " ) ; <nl> } <nl> <nl> + AssociatedTypeDecl * AssociatedTypeInference : : completeSolution ( <nl> + ArrayRef < AssociatedTypeDecl * > unresolvedAssocTypes , unsigned reqDepth ) { <nl> + / / Examine the solution for errors and attempt to compute abstract type <nl> + / / witnesses for associated types that are still lacking an entry . <nl> + llvm : : SmallVector < AbstractTypeWitness , 2 > abstractTypeWitnesses ; <nl> + for ( auto * const assocType : unresolvedAssocTypes ) { <nl> + const auto typeWitness = typeWitnesses . begin ( assocType ) ; <nl> + if ( typeWitness ! = typeWitnesses . end ( ) ) { <nl> + / / The solution contains an error . <nl> + if ( typeWitness - > first - > hasError ( ) ) { <nl> + return assocType ; <nl> + } <nl> + <nl> + continue ; <nl> + } <nl> + <nl> + / / Try to compute the type without the aid of a specific potential witness . <nl> + if ( const auto & typeWitness = computeAbstractTypeWitness ( assocType ) ) { <nl> + / / Record the type witness immediately to make it available <nl> + / / for substitutions into other tentative type witnesses . <nl> + typeWitnesses . insert ( assocType , { typeWitness - > getType ( ) , reqDepth } ) ; <nl> + <nl> + abstractTypeWitnesses . push_back ( std : : move ( typeWitness . getValue ( ) ) ) ; <nl> + continue ; <nl> + } <nl> + <nl> + / / The solution is incomplete . <nl> + return assocType ; <nl> + } <nl> + <nl> + / / Check each abstract type witness we computed against the generic <nl> + / / requirements on the corresponding associated type . <nl> + for ( const auto & witness : abstractTypeWitnesses ) { <nl> + Type type = witness . getType ( ) ; <nl> + if ( type - > hasTypeParameter ( ) ) { <nl> + if ( witness . getKind ( ) ! = AbstractTypeWitnessKind : : GenericParam ) { <nl> + / / Replace type parameters with other known or tentative type witnesses . <nl> + type = type . subst ( <nl> + [ & ] ( SubstitutableType * type ) { <nl> + if ( type - > isEqual ( proto - > getSelfInterfaceType ( ) ) ) <nl> + return adoptee ; <nl> + <nl> + return Type ( ) ; <nl> + } , <nl> + LookUpConformanceInModule ( dc - > getParentModule ( ) ) , <nl> + getSubstOptionsWithCurrentTypeWitnesses ( ) ) ; <nl> + <nl> + / / If the substitution produced an error , we ' re done . <nl> + if ( type - > hasError ( ) ) <nl> + return witness . getAssocType ( ) ; <nl> + } <nl> + type = dc - > mapTypeIntoContext ( type ) ; <nl> + } <nl> + <nl> + if ( const auto & failed = <nl> + checkTypeWitness ( type , witness . getAssocType ( ) , conformance ) ) { <nl> + / / We failed to satisfy a requirement . If this is a default type <nl> + / / witness failure and we haven ' t seen one already , write it down . <nl> + if ( witness . getKind ( ) = = AbstractTypeWitnessKind : : Default & & <nl> + ! failedDefaultedAssocType & & ! failed . isError ( ) ) { <nl> + failedDefaultedAssocType = witness . getDefaultedAssocType ( ) ; <nl> + failedDefaultedWitness = type ; <nl> + failedDefaultedResult = std : : move ( failed ) ; <nl> + } <nl> + <nl> + return witness . getAssocType ( ) ; <nl> + } <nl> + <nl> + / / Update the solution entry . <nl> + typeWitnesses . insert ( witness . getAssocType ( ) , { type , reqDepth } ) ; <nl> + } <nl> + <nl> + return nullptr ; <nl> + } <nl> + <nl> void AssociatedTypeInference : : findSolutions ( <nl> ArrayRef < AssociatedTypeDecl * > unresolvedAssocTypes , <nl> SmallVectorImpl < InferredTypeWitnessesSolution > & solutions ) { <nl> void AssociatedTypeInference : : findSolutionsRec ( <nl> / / Introduce a hash table scope ; we may add type witnesses here . <nl> TypeWitnessesScope typeWitnessesScope ( typeWitnesses ) ; <nl> <nl> - / / Check for completeness of the solution <nl> - for ( auto assocType : unresolvedAssocTypes ) { <nl> - / / Local function to record a missing associated type . <nl> - auto recordMissing = [ & ] { <nl> - if ( ! missingTypeWitness ) <nl> - missingTypeWitness = assocType ; <nl> - } ; <nl> - <nl> - auto typeWitness = typeWitnesses . begin ( assocType ) ; <nl> - if ( typeWitness ! = typeWitnesses . end ( ) ) { <nl> - / / The solution contains an error . <nl> - if ( typeWitness - > first - > hasError ( ) ) { <nl> - recordMissing ( ) ; <nl> - return ; <nl> - } <nl> - <nl> - continue ; <nl> - } <nl> - <nl> - / / Try to compute the type without the aid of a specific potential <nl> - / / witness . <nl> - if ( Type type = computeAbstractTypeWitness ( assocType ) ) { <nl> - if ( type - > hasError ( ) ) { <nl> - recordMissing ( ) ; <nl> - return ; <nl> - } <nl> - <nl> - typeWitnesses . insert ( assocType , { type , reqDepth } ) ; <nl> - continue ; <nl> - } <nl> + / / Validate and complete the solution . <nl> + if ( auto * const assocType = <nl> + completeSolution ( unresolvedAssocTypes , reqDepth ) ) { <nl> + / / The solution is decisively incomplete ; record the associated type <nl> + / / we failed on and bail out . <nl> + if ( ! missingTypeWitness ) <nl> + missingTypeWitness = assocType ; <nl> <nl> - / / The solution is incomplete . <nl> - recordMissing ( ) ; <nl> return ; <nl> } <nl> <nl> mmm a / test / decl / protocol / req / associated_type_inference . swift <nl> ppp b / test / decl / protocol / req / associated_type_inference . swift <nl> protocol SR_13172_P2 { <nl> enum SR_13172_E2 : SR_13172_P2 { <nl> case bar / / Okay <nl> } <nl> + <nl> + / * * References to type parameters in type witnesses . * / <nl> + <nl> + / / Circular reference through a fixed type witness . <nl> + protocol P35a { <nl> + associatedtype A = Array < B > / / expected - note { { protocol requires nested type ' A ' } } <nl> + associatedtype B / / expected - note { { protocol requires nested type ' B ' } } <nl> + } <nl> + protocol P35b : P35a where B = = A { } <nl> + / / expected - error @ + 2 { { type ' S35 ' does not conform to protocol ' P35a ' } } <nl> + / / expected - error @ + 1 { { type ' S35 ' does not conform to protocol ' P35b ' } } <nl> + struct S35 : P35b { } <nl> + <nl> + / / Circular reference through a value witness . <nl> + protocol P36a { <nl> + associatedtype A / / expected - note { { protocol requires nested type ' A ' } } <nl> + <nl> + func foo ( arg : A ) <nl> + } <nl> + protocol P36b : P36a { <nl> + associatedtype B = ( Self ) - > A / / expected - note { { protocol requires nested type ' B ' } } <nl> + } <nl> + / / expected - error @ + 2 { { type ' S36 ' does not conform to protocol ' P36a ' } } <nl> + / / expected - error @ + 1 { { type ' S36 ' does not conform to protocol ' P36b ' } } <nl> + struct S36 : P36b { <nl> + func foo ( arg : Array < B > ) { } <nl> + } <nl> + <nl> + / / Test that we can resolve abstract type witnesses that reference <nl> + / / other abstract type witnesses . <nl> + protocol P37 { <nl> + associatedtype A = Array < B > <nl> + associatedtype B : Equatable = Never <nl> + } <nl> + struct S37 : P37 { } <nl> + <nl> + protocol P38a { <nl> + associatedtype A = Never <nl> + associatedtype B : Equatable <nl> + } <nl> + protocol P38b : P38a where B = = Array < A > { } <nl> + struct S38 : P38b { } <nl> + <nl> + protocol P39 where A : Sequence { <nl> + associatedtype A = Array < B > <nl> + associatedtype B <nl> + } <nl> + struct S39 < B > : P39 { } <nl> + <nl> + / / Test that we can handle an analogous complex case involving all kinds of <nl> + / / type witness resolution . <nl> + protocol P40a { <nl> + associatedtype A <nl> + associatedtype B : P40a <nl> + <nl> + func foo ( arg : A ) <nl> + } <nl> + protocol P40b : P40a { <nl> + associatedtype C = ( A , B . A , D . D , E ) - > Self <nl> + associatedtype D : P40b <nl> + associatedtype E : Equatable <nl> + } <nl> + protocol P40c : P40b where D = = S40 < Never > { } <nl> + struct S40 < E : Equatable > : P40c { <nl> + func foo ( arg : Never ) { } <nl> + <nl> + typealias B = Self <nl> + } <nl> + <nl> + / / Self is not treated as a fixed type witness . <nl> + protocol FIXME_P1a { <nl> + associatedtype A / / expected - note { { protocol requires nested type ' A ' } } <nl> + } <nl> + protocol FIXME_P1b : FIXME_P1a where A = = Self { } <nl> + / / expected - error @ + 2 { { type ' FIXME_S1 ' does not conform to protocol ' FIXME_P1a ' } } <nl> + / / expected - error @ + 1 { { type ' FIXME_S1 ' does not conform to protocol ' FIXME_P1b ' } } <nl> + struct FIXME_S1 : FIXME_P1b { } <nl> + <nl> + / / Fails to find the fixed type witness B = = FIXME_S2 < A > . <nl> + protocol FIXME_P2a { <nl> + associatedtype A : Equatable = Never / / expected - note { { protocol requires nested type ' A ' } } <nl> + associatedtype B : FIXME_P2a / / expected - note { { protocol requires nested type ' B ' } } <nl> + } <nl> + protocol FIXME_P2b : FIXME_P2a where B = = FIXME_S2 < A > { } <nl> + / / expected - error @ + 2 { { type ' FIXME_S2 < T > ' does not conform to protocol ' FIXME_P2a ' } } <nl> + / / expected - error @ + 1 { { type ' FIXME_S2 < T > ' does not conform to protocol ' FIXME_P2b ' } } <nl> + struct FIXME_S2 < T : Equatable > : FIXME_P2b { } <nl>
|
Merge pull request from AnthonyLatsis / plus - inference
|
apple/swift
|
19f27d9c94e9d96cce8f3e6866bb757d3f1dad68
|
2020-07-15T14:27:26Z
|
mmm a / modules / core / src / ocl . cpp <nl> ppp b / modules / core / src / ocl . cpp <nl> class OpenCLBufferPoolImpl CV_FINAL : public OpenCLBufferPoolBaseImpl < OpenCLBuff <nl> entry . capacity_ = alignSize ( size , ( int ) _allocationGranularity ( size ) ) ; <nl> Context & ctx = Context : : getDefault ( ) ; <nl> cl_int retval = CL_SUCCESS ; <nl> - CV_OCL_CHECK_ ( entry . clBuffer_ = clCreateBuffer ( ( cl_context ) ctx . ptr ( ) , CL_MEM_READ_WRITE | createFlags_ , entry . capacity_ , 0 , & retval ) , retval ) ; <nl> + entry . clBuffer_ = clCreateBuffer ( ( cl_context ) ctx . ptr ( ) , CL_MEM_READ_WRITE | createFlags_ , entry . capacity_ , 0 , & retval ) ; <nl> + CV_OCL_CHECK_RESULT ( retval , cv : : format ( " clCreateBuffer ( capacity = % lld ) = > % p " , ( long long int ) entry . capacity_ , ( void * ) entry . clBuffer_ ) . c_str ( ) ) ; <nl> CV_Assert ( entry . clBuffer_ ! = NULL ) ; <nl> if ( retval = = CL_SUCCESS ) <nl> { <nl> class OpenCLAllocator CV_FINAL : public MatAllocator <nl> { <nl> handle = clCreateBuffer ( ctx_handle , CL_MEM_USE_HOST_PTR | createFlags , <nl> u - > size , u - > origdata , & retval ) ; <nl> + CV_OCL_DBG_CHECK_RESULT ( retval , cv : : format ( " clCreateBuffer ( CL_MEM_USE_HOST_PTR | createFlags , sz = % lld , origdata = % p ) = > % p " , <nl> + ( long long int ) u - > size , u - > origdata , ( void * ) handle ) . c_str ( ) ) ; <nl> } <nl> if ( ( ! handle | | retval < 0 ) & & ! ( accessFlags & ACCESS_FAST ) ) <nl> { <nl> handle = clCreateBuffer ( ctx_handle , CL_MEM_COPY_HOST_PTR | CL_MEM_READ_WRITE | createFlags , <nl> u - > size , u - > origdata , & retval ) ; <nl> + CV_OCL_DBG_CHECK_RESULT ( retval , cv : : format ( " clCreateBuffer ( CL_MEM_COPY_HOST_PTR | CL_MEM_READ_WRITE | createFlags , sz = % lld , origdata = % p ) = > % p " , <nl> + ( long long int ) u - > size , u - > origdata , ( void * ) handle ) . c_str ( ) ) ; <nl> tempUMatFlags | = UMatData : : TEMP_COPIED_UMAT ; <nl> } <nl> } <nl> - CV_OCL_DBG_CHECK_RESULT ( retval , " clCreateBuffer ( ) " ) ; <nl> + CV_OCL_DBG_CHECK_RESULT ( retval , cv : : format ( " clCreateBuffer ( ) = > % p " , ( void * ) handle ) . c_str ( ) ) ; <nl> if ( ! handle | | retval ! = CL_SUCCESS ) <nl> return false ; <nl> u - > handle = handle ; <nl> class OpenCLAllocator CV_FINAL : public MatAllocator <nl> void * data = clEnqueueMapBuffer ( q , ( cl_mem ) u - > handle , CL_TRUE , <nl> ( CL_MAP_READ | CL_MAP_WRITE ) , <nl> 0 , u - > size , 0 , 0 , 0 , & retval ) ; <nl> - CV_OCL_CHECK_RESULT ( retval , " clEnqueueMapBuffer ( ) " ) ; <nl> + CV_OCL_CHECK_RESULT ( retval , cv : : format ( " clEnqueueMapBuffer ( handle = % p , sz = % lld ) = > % p " , ( void * ) u - > handle , ( long long int ) u - > size , data ) . c_str ( ) ) ; <nl> CV_Assert ( u - > origdata = = data ) ; <nl> if ( u - > originalUMatData ) <nl> { <nl> CV_Assert ( u - > originalUMatData - > data = = data ) ; <nl> } <nl> - CV_OCL_CHECK ( clEnqueueUnmapMemObject ( q , ( cl_mem ) u - > handle , data , 0 , 0 , 0 ) ) ; <nl> + retval = clEnqueueUnmapMemObject ( q , ( cl_mem ) u - > handle , data , 0 , 0 , 0 ) ; <nl> + CV_OCL_CHECK_RESULT ( retval , cv : : format ( " clEnqueueUnmapMemObject ( handle = % p , data = % p , [ sz = % lld ] ) " , ( void * ) u - > handle , data , ( long long int ) u - > size ) . c_str ( ) ) ; <nl> CV_OCL_DBG_CHECK ( clFinish ( q ) ) ; <nl> } <nl> } <nl> class OpenCLAllocator CV_FINAL : public MatAllocator <nl> else <nl> # endif <nl> { <nl> - CV_OCL_DBG_CHECK ( clReleaseMemObject ( ( cl_mem ) u - > handle ) ) ; <nl> + cl_int retval = clReleaseMemObject ( ( cl_mem ) u - > handle ) ; <nl> + CV_OCL_DBG_CHECK_RESULT ( retval , cv : : format ( " clReleaseMemObject ( ptr = % p ) " , ( void * ) u - > handle ) . c_str ( ) ) ; <nl> } <nl> u - > handle = 0 ; <nl> u - > markDeviceCopyObsolete ( true ) ; <nl> class OpenCLAllocator CV_FINAL : public MatAllocator <nl> u - > data = ( uchar * ) clEnqueueMapBuffer ( q , ( cl_mem ) u - > handle , CL_TRUE , <nl> ( CL_MAP_READ | CL_MAP_WRITE ) , <nl> 0 , u - > size , 0 , 0 , 0 , & retval ) ; <nl> - CV_OCL_DBG_CHECK_RESULT ( retval , cv : : format ( " clEnqueueMapBuffer ( sz = % lld ) " , ( int64 ) u - > size ) . c_str ( ) ) ; <nl> + CV_OCL_DBG_CHECK_RESULT ( retval , cv : : format ( " clEnqueueMapBuffer ( handle = % p , sz = % lld ) = > % p " , ( void * ) u - > handle , ( long long int ) u - > size , u - > data ) . c_str ( ) ) ; <nl> } <nl> if ( u - > data & & retval = = CL_SUCCESS ) <nl> { <nl> class OpenCLAllocator CV_FINAL : public MatAllocator <nl> # ifdef HAVE_OPENCL_SVM <nl> CV_DbgAssert ( ( u - > allocatorFlags_ & svm : : OPENCL_SVM_BUFFER_MASK ) = = 0 ) ; <nl> # endif <nl> - CV_OCL_CHECK ( clEnqueueReadBuffer ( q , ( cl_mem ) u - > handle , CL_TRUE , <nl> - 0 , u - > size , alignedPtr . getAlignedPtr ( ) , 0 , 0 , 0 ) ) ; <nl> + cl_int retval = clEnqueueReadBuffer ( q , ( cl_mem ) u - > handle , CL_TRUE , <nl> + 0 , u - > size , alignedPtr . getAlignedPtr ( ) , 0 , 0 , 0 ) ; <nl> + CV_OCL_CHECK_RESULT ( retval , cv : : format ( " clEnqueueReadBuffer ( q , handle = % p , CL_TRUE , 0 , sz = % lld , data = % p , 0 , 0 , 0 ) " , <nl> + ( void * ) u - > handle , ( long long int ) u - > size , alignedPtr . getAlignedPtr ( ) ) . c_str ( ) ) ; <nl> u - > markHostCopyObsolete ( false ) ; <nl> } <nl> } <nl> class OpenCLAllocator CV_FINAL : public MatAllocator <nl> if ( u - > refcount = = 0 ) <nl> { <nl> CV_Assert ( u - > mapcount - - = = 1 ) ; <nl> - CV_OCL_CHECK ( retval = clEnqueueUnmapMemObject ( q , ( cl_mem ) u - > handle , u - > data , 0 , 0 , 0 ) ) ; <nl> + retval = clEnqueueUnmapMemObject ( q , ( cl_mem ) u - > handle , u - > data , 0 , 0 , 0 ) ; <nl> + CV_OCL_CHECK_RESULT ( retval , cv : : format ( " clEnqueueUnmapMemObject ( handle = % p , data = % p , [ sz = % lld ] ) " , ( void * ) u - > handle , u - > data , ( long long int ) u - > size ) . c_str ( ) ) ; <nl> if ( Device : : getDefault ( ) . isAMD ( ) ) <nl> { <nl> / / required for multithreaded applications ( see stitching test ) <nl> class OpenCLAllocator CV_FINAL : public MatAllocator <nl> # ifdef HAVE_OPENCL_SVM <nl> CV_DbgAssert ( ( u - > allocatorFlags_ & svm : : OPENCL_SVM_BUFFER_MASK ) = = 0 ) ; <nl> # endif <nl> - CV_OCL_CHECK ( retval = clEnqueueWriteBuffer ( q , ( cl_mem ) u - > handle , CL_TRUE , <nl> - 0 , u - > size , alignedPtr . getAlignedPtr ( ) , 0 , 0 , 0 ) ) ; <nl> + retval = clEnqueueWriteBuffer ( q , ( cl_mem ) u - > handle , CL_TRUE , <nl> + 0 , u - > size , alignedPtr . getAlignedPtr ( ) , 0 , 0 , 0 ) ; <nl> + CV_OCL_CHECK_RESULT ( retval , cv : : format ( " clEnqueueWriteBuffer ( q , handle = % p , CL_TRUE , 0 , sz = % lld , data = % p , 0 , 0 , 0 ) " , <nl> + ( void * ) u - > handle , ( long long int ) u - > size , alignedPtr . getAlignedPtr ( ) ) . c_str ( ) ) ; <nl> u - > markDeviceCopyObsolete ( false ) ; <nl> u - > markHostCopyObsolete ( true ) ; <nl> } <nl> class OpenCLAllocator CV_FINAL : public MatAllocator <nl> if ( iscontinuous ) <nl> { <nl> AlignedDataPtr < true , false > alignedPtr ( ( uchar * ) srcptr , total , CV_OPENCL_DATA_PTR_ALIGNMENT ) ; <nl> - CV_OCL_CHECK ( clEnqueueWriteBuffer ( q , ( cl_mem ) u - > handle , CL_TRUE , <nl> - dstrawofs , total , alignedPtr . getAlignedPtr ( ) , 0 , 0 , 0 ) ) ; <nl> + cl_int retval = clEnqueueWriteBuffer ( q , ( cl_mem ) u - > handle , CL_TRUE , <nl> + dstrawofs , total , alignedPtr . getAlignedPtr ( ) , 0 , 0 , 0 ) ; <nl> + CV_OCL_CHECK_RESULT ( retval , cv : : format ( " clEnqueueWriteBuffer ( q , handle = % p , CL_TRUE , offset = % lld , sz = % lld , data = % p , 0 , 0 , 0 ) " , <nl> + ( void * ) u - > handle , ( long long int ) dstrawofs , ( long long int ) u - > size , alignedPtr . getAlignedPtr ( ) ) . c_str ( ) ) ; <nl> } <nl> else if ( CV_OPENCL_DISABLE_BUFFER_RECT_OPERATIONS ) <nl> { <nl> class OpenCLAllocator CV_FINAL : public MatAllocator <nl> { <nl> if ( iscontinuous ) <nl> { <nl> - CV_OCL_CHECK ( retval = clEnqueueCopyBuffer ( q , ( cl_mem ) src - > handle , ( cl_mem ) dst - > handle , <nl> - srcrawofs , dstrawofs , total , 0 , 0 , 0 ) ) ; <nl> + retval = clEnqueueCopyBuffer ( q , ( cl_mem ) src - > handle , ( cl_mem ) dst - > handle , <nl> + srcrawofs , dstrawofs , total , 0 , 0 , 0 ) ; <nl> + CV_OCL_CHECK_RESULT ( retval , cv : : format ( " clEnqueueCopyBuffer ( q , src = % p , dst = % p , src_offset = % lld , dst_offset = % lld , sz = % lld , 0 , 0 , 0 ) " , <nl> + ( void * ) src - > handle , ( void * ) dst - > handle , ( long long int ) srcrawofs , ( long long int ) dstrawofs , ( long long int ) total ) . c_str ( ) ) ; <nl> } <nl> else if ( CV_OPENCL_DISABLE_BUFFER_RECT_OPERATIONS ) <nl> { <nl> struct Image2D : : Impl <nl> if ( ! alias & & ! src . isContinuous ( ) ) <nl> { <nl> devData = clCreateBuffer ( context , CL_MEM_READ_ONLY , src . cols * src . rows * src . elemSize ( ) , NULL , & err ) ; <nl> - CV_OCL_CHECK_RESULT ( err , " clCreateBuffer ( ) " ) ; <nl> + CV_OCL_CHECK_RESULT ( err , cv : : format ( " clCreateBuffer ( CL_MEM_READ_ONLY , sz = % lld ) = > % p " , <nl> + ( long long int ) ( src . cols * src . rows * src . elemSize ( ) ) , ( void * ) devData <nl> + ) . c_str ( ) ) ; <nl> <nl> const size_t roi [ 3 ] = { static_cast < size_t > ( src . cols ) * src . elemSize ( ) , static_cast < size_t > ( src . rows ) , 1 } ; <nl> CV_OCL_CHECK ( clEnqueueCopyBufferRect ( queue , ( cl_mem ) src . handle ( ACCESS_READ ) , devData , origin , origin , <nl>
|
ocl : improve trace messages of OpenCL calls
|
opencv/opencv
|
670ef403b0c18019b0a2778f7d4e6ae4b37b01ff
|
2018-04-13T11:54:27Z
|
mmm a / cocos / 2d / CCClippingNode . cpp <nl> ppp b / cocos / 2d / CCClippingNode . cpp <nl> bool ClippingNode : : init ( Node * stencil ) <nl> CC_SAFE_RELEASE ( _stencil ) ; <nl> _stencil = stencil ; <nl> CC_SAFE_RETAIN ( _stencil ) ; <nl> - <nl> - _stencilStateManager - > setAlphaThreshold ( 1 . 0f ) ; <nl> - _stencilStateManager - > setInverted ( false ) ; <nl> - <nl> return true ; <nl> } <nl> <nl> mmm a / cocos / base / CCStencilStateManager . cpp <nl> ppp b / cocos / base / CCStencilStateManager . cpp <nl> GLint StencilStateManager : : s_layer = - 1 ; <nl> static GLint g_sStencilBits = - 1 ; <nl> <nl> StencilStateManager : : StencilStateManager ( ) <nl> - : _alphaThreshold ( 0 . 0f ) <nl> + : _alphaThreshold ( 1 . 0f ) <nl> , _inverted ( false ) <nl> , _currentStencilEnabled ( GL_FALSE ) <nl> , _currentStencilWriteMask ( ~ 0 ) <nl>
|
change the default alphaThreshold
|
cocos2d/cocos2d-x
|
03046d6fbd9b9616d515e831bbd7a919b697c5a1
|
2015-11-25T06:31:32Z
|
mmm a / docs / source / jit . rst <nl> ppp b / docs / source / jit . rst <nl> net models . In particular TorchScript supports : <nl> ` ` Optional [ T ] ` ` <nl> A value which is either None or type ` ` T ` ` <nl> <nl> + ` ` ` Dict [ K , V ] ` ` <nl> + A dict with key type ` ` K ` ` and value type ` ` V ` ` . Only ` ` str ` ` , ` ` int ` ` , and <nl> + ` ` float ` ` are allowed as key types . <nl> + <nl> Unlike Python , each variable in TorchScript function must have a single static type . <nl> This makes it easier to optimize TorchScript functions . <nl> <nl> Example : : <nl> <nl> There are 2 scenarios in which you can annotate : <nl> <nl> - 1 . Function Argument Type annotation <nl> + 1 . Function Argument Type Annotation <nl> <nl> By default , all parameters to a TorchScript function are assumed to be Tensor <nl> because this is the most common type used in modules . To specify that an <nl> Example : : <nl> <nl> 2 . Variable Type Annotation <nl> <nl> - For example , a list by default is assumed to be List [ Tensor ] . If you would like to <nl> - have a list of other types . PyTorch provides annotation functions . <nl> + A list by default is assumed to be ` ` List [ Tensor ] ` ` and empty dicts <nl> + ` ` Dict [ str , Tensor ] ` ` . To instantiate an empty list or dict of other types , <nl> + use ` ` torch . jit . annotate ` ` . <nl> <nl> Example : : <nl> <nl> Example : : <nl> from torch . jit import Tensor <nl> from typing import List , Tuple <nl> <nl> - class ListOfTupleOfTensor ( torch . jit . ScriptModule ) : <nl> + class EmptyDataStructures ( torch . jit . ScriptModule ) : <nl> def __init__ ( self ) : <nl> - super ( ListOfTupleOfTensor , self ) . __init__ ( ) <nl> + super ( EmptyDataStructures , self ) . __init__ ( ) <nl> <nl> @ torch . jit . script_method <nl> def forward ( self , x ) : <nl> - # type : ( Tensor ) - > List [ Tuple [ Tensor , Tensor ] ] <nl> + # type : ( Tensor ) - > Tuple [ List [ Tuple [ Tensor , Tensor ] ] , Dict [ int , Tensor ] ] <nl> <nl> - # This annotates the list to be a List [ Tuple [ Tensor , Tensor ] ] <nl> - returns = torch . jit . annotate ( List [ Tuple [ Tensor , Tensor ] ] , [ ] ) <nl> + # This annotates the list to be a ` List [ Tuple [ Tensor , Tensor ] ] ` <nl> + list_of_tuple = torch . jit . annotate ( List [ Tuple [ Tensor , Tensor ] ] , [ ] ) <nl> for i in range ( 10 ) : <nl> - returns . append ( ( x , x ) ) <nl> + list_of_tuple . append ( ( x , x ) ) <nl> <nl> - return returns <nl> + # This annotates the list to be a ` Dict [ int , Tensor ] ` <nl> + int_tensor_dict = torch . jit . annotate ( Dict [ int , Tensor ] , { } ) <nl> + return list_of_tuple , int_tensor_dict <nl> <nl> <nl> Optional Type Refinement : <nl> List Construction <nl> an empty list is assumed have type ` ` List [ Tensor ] ` ` . <nl> The types of other list literals are derived from the type of the members . <nl> <nl> + Dict Construction <nl> + ` ` { ' hello ' : 3 } ` ` , ` ` { } ` ` , ` ` { ' a ' : torch . rand ( 3 ) , ' b ' : torch . rand ( 4 ) } ` ` <nl> + <nl> + . . note : : <nl> + an empty dict is assumed have type ` ` Dict [ str , Tensor ] ` ` . <nl> + The types of other dict literals are derived from the type of the members . <nl> + <nl> Arithmetic Operators <nl> ` ` a + b ` ` <nl> ` ` a - b ` ` <nl>
|
Add dict to docs
|
pytorch/pytorch
|
1fea60be25d06e64d218dae8200a0fe7c8b11493
|
2019-02-22T01:45:24Z
|
mmm a / code / search / binary_search / binary_search . cpp <nl> ppp b / code / search / binary_search / binary_search . cpp <nl> <nl> # include < iostream > <nl> # include < vector > <nl> - <nl> + # include < deque > <nl> using namespace std ; <nl> <nl> - / * <nl> - * Part of Cosmos by OpenGenus Foundation <nl> - * / <nl> - int recursiveBinarySearch ( vector < int > arr , int l , int r , int x ) <nl> - { <nl> - if ( r > = l ) <nl> - { <nl> - int mid = l + ( r - l ) / 2 ; <nl> - <nl> - if ( arr [ mid ] = = x ) <nl> + struct binary_search_tag { } ; <nl> + struct recursive_binary_search_tag : public binary_search_tag { } ; <nl> + struct iterative_binary_search_tag : public binary_search_tag { } ; <nl> + <nl> + template < typename _Container > <nl> + ptrdiff_t binarySearch ( const _Container & arr <nl> + , ptrdiff_t l <nl> + , ptrdiff_t r <nl> + , const typename _Container : : value_type & find <nl> + , random_access_iterator_tag <nl> + , recursive_binary_search_tag ) { <nl> + if ( r > = l ) <nl> + { <nl> + ptrdiff_t mid = l + ( r - l ) / 2 ; <nl> + <nl> + if ( arr [ mid ] = = find ) <nl> return mid ; <nl> - if ( arr [ mid ] > x ) <nl> - return recursiveBinarySearch ( arr , l , mid - 1 , x ) ; <nl> - <nl> - return recursiveBinarySearch ( arr , mid + 1 , r , x ) ; <nl> - } <nl> - return - 1 ; <nl> + <nl> + if ( arr [ mid ] > find ) <nl> + return binarySearch ( arr , l , mid - 1 , find <nl> + , random_access_iterator_tag ( ) <nl> + , recursive_binary_search_tag ( ) ) ; <nl> + else <nl> + return binarySearch ( arr , mid + 1 , r , find <nl> + , random_access_iterator_tag ( ) <nl> + , recursive_binary_search_tag ( ) ) ; <nl> + } <nl> + return - 1 ; <nl> } <nl> <nl> - int binarySearch ( vector < int > arr , int l , int r , int x ) <nl> - { <nl> - while ( l < = r ) <nl> - { <nl> - int mid = l + ( r - l ) / 2 ; <nl> + template < typename _Container > <nl> + ptrdiff_t binarySearch ( const _Container & arr <nl> + , ptrdiff_t l <nl> + , ptrdiff_t r <nl> + , const typename _Container : : value_type & find <nl> + , random_access_iterator_tag <nl> + , iterative_binary_search_tag ) { <nl> + while ( l < = r ) <nl> + { <nl> + ptrdiff_t mid = l + ( r - l ) / 2 ; <nl> + <nl> + if ( arr [ mid ] = = find ) <nl> + return mid ; <nl> + <nl> + if ( arr [ mid ] > find ) <nl> + r = mid - 1 ; <nl> + else <nl> + l = mid + 1 ; <nl> + } <nl> + return - 1 ; <nl> + } <nl> <nl> - if ( arr [ mid ] = = x ) <nl> - return mid ; <nl> + template < typename _Container > <nl> + ptrdiff_t binarySearch ( const _Container & arr <nl> + , const typename _Container : : value_type & find ) { <nl> + if ( arr . empty ( ) ) <nl> + return - 1 ; <nl> + <nl> + typedef recursive_binary_search_tag binary_search_category ; <nl> + typedef typename _Container : : iterator _Container_Iter ; <nl> + typedef typename iterator_traits < _Container_Iter > : : iterator_category tag ; <nl> + <nl> + return binarySearch ( arr , 0 , arr . size ( ) , find , tag ( ) <nl> + , binary_search_category ( ) ) ; <nl> + } <nl> <nl> - if ( arr [ mid ] < x ) <nl> - l = mid + 1 ; <nl> + template < typename _Ty > <nl> + ptrdiff_t binarySearch ( const _Ty * arr <nl> + , const size_t & sz <nl> + , const _Ty & find ) { <nl> + if ( sz = = 0 ) <nl> + return - 1 ; <nl> + <nl> + return binarySearch ( deque < _Ty > { arr , arr + sz } , find ) ; <nl> + } <nl> <nl> - else <nl> - r = mid - 1 ; <nl> - } <nl> - return - 1 ; <nl> + template < typename _Ty > <nl> + void my_assert ( string message , _Ty a , _Ty b ) { <nl> + if ( a ! = b ) cout < < message < < endl ; <nl> } <nl> - <nl> + <nl> + void test ( ) { <nl> + int plain_arr1 [ 0 ] ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr1 , 0 , 3 ) <nl> + , ( ptrdiff_t ) - 1 ) ; <nl> + <nl> + int plain_arr2 [ 2 ] ; <nl> + for ( int i = 0 ; i < 2 ; + + i ) plain_arr2 [ i ] = i ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr2 <nl> + , sizeof ( plain_arr2 ) / sizeof ( plain_arr2 [ 0 ] ) <nl> + , 0 ) <nl> + , ( ptrdiff_t ) 0 ) ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr2 <nl> + , sizeof ( plain_arr2 ) / sizeof ( plain_arr2 [ 0 ] ) <nl> + , 1 ) <nl> + , ( ptrdiff_t ) 1 ) ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr2 <nl> + , sizeof ( plain_arr2 ) / sizeof ( plain_arr2 [ 0 ] ) <nl> + , - 1 ) <nl> + , ( ptrdiff_t ) - 1 ) ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr2 <nl> + , sizeof ( plain_arr2 ) / sizeof ( plain_arr2 [ 0 ] ) <nl> + , 2 ) <nl> + , ( ptrdiff_t ) - 1 ) ; <nl> + <nl> + int plain_arr3 [ 3 ] ; <nl> + for ( int i = 0 ; i < 3 ; + + i ) plain_arr3 [ i ] = i ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr3 <nl> + , sizeof ( plain_arr3 ) / sizeof ( plain_arr3 [ 0 ] ) <nl> + , 0 ) <nl> + , ( ptrdiff_t ) 0 ) ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr3 <nl> + , sizeof ( plain_arr3 ) / sizeof ( plain_arr3 [ 0 ] ) <nl> + , 2 ) <nl> + , ( ptrdiff_t ) 2 ) ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr3 <nl> + , sizeof ( plain_arr3 ) / sizeof ( plain_arr3 [ 0 ] ) <nl> + , - 1 ) <nl> + , ( ptrdiff_t ) - 1 ) ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr3 <nl> + , sizeof ( plain_arr3 ) / sizeof ( plain_arr3 [ 0 ] ) <nl> + , 3 ) <nl> + , ( ptrdiff_t ) - 1 ) ; <nl> + <nl> + int plain_arr4 [ 100 ] ; <nl> + for ( int i = 0 ; i < 100 ; + + i ) plain_arr4 [ i ] = i ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr4 <nl> + , sizeof ( plain_arr4 ) / sizeof ( plain_arr4 [ 0 ] ) <nl> + , 0 ) <nl> + , ( ptrdiff_t ) 0 ) ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr4 <nl> + , sizeof ( plain_arr4 ) / sizeof ( plain_arr4 [ 0 ] ) <nl> + , 99 ) <nl> + , ( ptrdiff_t ) 99 ) ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr4 <nl> + , sizeof ( plain_arr4 ) / sizeof ( plain_arr4 [ 0 ] ) <nl> + , - 1 ) <nl> + , ( ptrdiff_t ) - 1 ) ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr4 <nl> + , sizeof ( plain_arr4 ) / sizeof ( plain_arr4 [ 0 ] ) <nl> + , 100 ) <nl> + , ( ptrdiff_t ) - 1 ) ; <nl> + <nl> + int plain_arr5 [ 101 ] ; <nl> + for ( int i = 0 ; i < 101 ; + + i ) plain_arr5 [ i ] = i ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr5 <nl> + , sizeof ( plain_arr5 ) / sizeof ( plain_arr5 [ 0 ] ) <nl> + , 0 ) <nl> + , ( ptrdiff_t ) 0 ) ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr5 <nl> + , sizeof ( plain_arr5 ) / sizeof ( plain_arr5 [ 0 ] ) <nl> + , 100 ) <nl> + , ( ptrdiff_t ) 100 ) ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr5 <nl> + , sizeof ( plain_arr5 ) / sizeof ( plain_arr5 [ 0 ] ) <nl> + , - 1 ) <nl> + , ( ptrdiff_t ) - 1 ) ; <nl> + my_assert ( " empty plain array error : " + to_string ( __LINE__ ) <nl> + , binarySearch ( plain_arr5 <nl> + , sizeof ( plain_arr5 ) / sizeof ( plain_arr5 [ 0 ] ) <nl> + , 101 ) <nl> + , ( ptrdiff_t ) - 1 ) ; <nl> + } <nl> + <nl> int main ( void ) <nl> { <nl> - vector < int > arr { 1 , 2 , 3 , 5 } ; <nl> - int find = 3 ; <nl> - cout < < " Position of " < < find < < " is " < < recursiveBinarySearch ( arr , 0 , arr . size ( ) - 1 , find ) < < endl ; <nl> - cout < < " Position of " < < find < < " is " < < binarySearch ( arr , 0 , arr . size ( ) - 1 , find ) < < endl ; <nl> - return 0 ; <nl> + test ( ) ; <nl> + <nl> + return 0 ; <nl> } <nl> \ No newline at end of file <nl>
|
change : generalization
|
OpenGenus/cosmos
|
3a3b89509a2ee27b457aef68bdbc90fe16767b16
|
2017-10-12T07:03:49Z
|
mmm a / jstests / multiVersion / genericSetFCVUsage / setFCV_collmod_transaction_rollback . js <nl> ppp b / jstests / multiVersion / genericSetFCVUsage / setFCV_collmod_transaction_rollback . js <nl> <nl> assert . commandFailedWithCode ( <nl> adminDB . runCommand ( <nl> { " collMod " : collName , " index " : { " name " : " index1 " , " expireAfterSeconds " : 100 } } ) , <nl> - 50968 ) ; <nl> + 50970 ) ; <nl> <nl> const index = coll . getIndexes ( ) ; <nl> var ttlAfterRollback = index [ 1 ] . expireAfterSeconds ; <nl> <nl> assert . writeOK ( coll . insert ( { _id : 0 , a : 1 } ) ) ; <nl> <nl> assert . commandFailedWithCode ( adminDB . adminCommand ( { setFeatureCompatibilityVersion : latestFCV } ) , <nl> - 50969 ) ; <nl> + 50971 ) ; <nl> <nl> MongoRunner . stopMongod ( conn ) ; <nl> } ) ( ) ; <nl> mmm a / src / mongo / db / catalog / coll_mod . cpp <nl> ppp b / src / mongo / db / catalog / coll_mod . cpp <nl> Status _collModInternal ( OperationContext * opCtx , <nl> <nl> if ( MONGO_FAIL_POINT ( assertAfterIndexUpdate ) ) { <nl> log ( ) < < " collMod - assertAfterIndexUpdate fail point enabled . " ; <nl> - uasserted ( 50968 , " trigger rollback after the index update " ) ; <nl> + uasserted ( 50970 , " trigger rollback after the index update " ) ; <nl> } <nl> } <nl> <nl> Status _collModInternal ( OperationContext * opCtx , <nl> <nl> if ( MONGO_FAIL_POINT ( assertAfterIndexUpdate ) ) { <nl> log ( ) < < " collMod - assertAfterIndexUpdate fail point enabled . " ; <nl> - uasserted ( 50969 , " trigger rollback for unique index update " ) ; <nl> + uasserted ( 50971 , " trigger rollback for unique index update " ) ; <nl> } <nl> } <nl> } <nl>
|
SERVER - 37555 Fix the error code in the uassert .
|
mongodb/mongo
|
44c2055cba5221732a319c27210025ce7ccab71e
|
2018-10-16T02:20:06Z
|
mmm a / README . md <nl> ppp b / README . md <nl> <nl> + < img style = " width : 100 % ; " src = " / github - banner . png " > <nl> + <nl> [ RethinkDB ] ( http : / / www . rethinkdb . com ) <nl> = = = = = = = = = = = = = = = = = <nl> <nl> - < img align = " right " src = " / thinker - standing - computer . png " > <nl> - <nl> RethinkDB is the first open - source scalable database built for realtime applications . It exposes a new database access model - - instead of polling for changes , the developer can tell the database to continuously push updated query results to applications in realtime . RethinkDB allows developers to build scalable realtime apps in a fraction of the time with less effort . <nl> <nl> To learn more , check out [ rethinkdb . com ] ( http : / / rethinkdb . com ) . <nl> Besides our three official drivers , we also have many [ third - party drivers ] ( http <nl> * * * Elixir : * * [ rethinkdb - elixir ] ( https : / / github . com / hamiltop / rethinkdb - elixir ) <nl> * * * Go : * * [ GoRethink ] ( https : / / github . com / dancannon / gorethink ) <nl> * * * Haskell : * * [ haskell - rethinkdb ] ( https : / / github . com / atnnn / haskell - rethinkdb ) <nl> - * * * PHP : * * [ php - rql ] ( https : / / github . com / danielmewes / php - rql ) <nl> - * * * Scala : * * [ rethink - scala ] ( https : / / github . com / kclay / rethink - scala ) <nl> + * * * PHP : * * [ php - rql ] ( https : / / github . com / danielmewes / php - rql ) <nl> + * * * Scala : * * [ rethink - scala ] ( https : / / github . com / kclay / rethink - scala ) <nl> <nl> Looking to explore what else RethinkDB offers or the specifics of ReQL ? Check out [ our RethinkDB docs ] ( http : / / rethinkdb . com / docs / ) and [ ReQL API ] ( http : / / rethinkdb . com / api / ) . <nl> <nl> new file mode 100644 <nl> index 00000000000 . . 64a976b0132 <nl> Binary files / dev / null and b / github - banner . png differ <nl>
|
Removing Thinker : - 1 : adding new RethinkDB Banner : + 1 :
|
rethinkdb/rethinkdb
|
3a46894dd6ad5035b2499fff7d803eb301117c51
|
2015-08-17T17:54:08Z
|
mmm a / java / rocksjni / write_batch . cc <nl> ppp b / java / rocksjni / write_batch . cc <nl> jbyteArray Java_org_rocksdb_WriteBatchTest_getContents ( <nl> options . memtable_factory = factory ; <nl> rocksdb : : MemTable * mem = new rocksdb : : MemTable ( <nl> cmp , rocksdb : : ImmutableCFOptions ( options ) , <nl> - rocksdb : : MemTableOptions ( options ) ) ; <nl> + rocksdb : : MemTableOptions ( rocksdb : : MutableCFOptions ( options ) , options ) ) ; <nl> mem - > Ref ( ) ; <nl> std : : string state ; <nl> rocksdb : : ColumnFamilyMemTablesDefault cf_mems_default ( mem , & options ) ; <nl>
|
Merge pull request from ankgup87 / master
|
facebook/rocksdb
|
e17bc65c75efb34277c683efdfad3a1b63f5deb6
|
2014-09-19T05:15:31Z
|
mmm a / src / objects / objects . cc <nl> ppp b / src / objects / objects . cc <nl> Handle < String > AsStringOrEmpty ( Isolate * isolate , Handle < Object > object ) { <nl> } <nl> <nl> Handle < String > NoSideEffectsErrorToString ( Isolate * isolate , <nl> - Handle < Object > input ) { <nl> - Handle < JSReceiver > receiver = Handle < JSReceiver > : : cast ( input ) ; <nl> - <nl> + Handle < JSReceiver > error ) { <nl> Handle < Name > name_key = isolate - > factory ( ) - > name_string ( ) ; <nl> - Handle < Object > name = JSReceiver : : GetDataProperty ( receiver , name_key ) ; <nl> + Handle < Object > name = JSReceiver : : GetDataProperty ( error , name_key ) ; <nl> Handle < String > name_str = AsStringOrEmpty ( isolate , name ) ; <nl> <nl> Handle < Name > msg_key = isolate - > factory ( ) - > message_string ( ) ; <nl> - Handle < Object > msg = JSReceiver : : GetDataProperty ( receiver , msg_key ) ; <nl> + Handle < Object > msg = JSReceiver : : GetDataProperty ( error , msg_key ) ; <nl> Handle < String > msg_str = AsStringOrEmpty ( isolate , msg ) ; <nl> <nl> if ( name_str - > length ( ) = = 0 ) return msg_str ; <nl> Handle < String > NoSideEffectsErrorToString ( Isolate * isolate , <nl> IncrementalStringBuilder builder ( isolate ) ; <nl> builder . AppendString ( name_str ) ; <nl> builder . AppendCString ( " : " ) ; <nl> - builder . AppendString ( msg_str ) ; <nl> + <nl> + if ( builder . Length ( ) + msg_str - > length ( ) < = String : : kMaxLength ) { <nl> + builder . AppendString ( msg_str ) ; <nl> + } else { <nl> + builder . AppendCString ( " < a very large string > " ) ; <nl> + } <nl> <nl> return builder . Finish ( ) . ToHandleChecked ( ) ; <nl> } <nl> Handle < String > Object : : NoSideEffectsToString ( Isolate * isolate , <nl> / / When internally formatting error objects , use a side - effects - free <nl> / / version of Error . prototype . toString independent of the actually <nl> / / installed toString method . <nl> - return NoSideEffectsErrorToString ( isolate , input ) ; <nl> + return NoSideEffectsErrorToString ( isolate , <nl> + Handle < JSReceiver > : : cast ( input ) ) ; <nl> } else if ( * to_string = = * isolate - > object_to_string ( ) ) { <nl> Handle < Object > ctor = JSReceiver : : GetDataProperty ( <nl> receiver , isolate - > factory ( ) - > constructor_string ( ) ) ; <nl>
|
Make NoSideEffectsToString gracefully handle huge msgs on error objects
|
v8/v8
|
b0ebfabc0c05dc944941b34df4e05a2db493d6b8
|
2020-01-15T11:36:53Z
|
mmm a / configure . ac <nl> ppp b / configure . ac <nl> echo " $ sudo make install " <nl> # echo " $ sudo make install LANGS = \ " eng ara deu \ " " <nl> # echo " Or : " <nl> # echo " $ sudo make install - langs " <nl> + echo " " <nl> <nl> AM_COND_IF ( [ ENABLE_TRAINING ] , <nl> - [ echo " " <nl> - echo " Training tools can be build and installed ( after building of $ PACKAGE_NAME ) with : " <nl> + [ <nl> + echo " Training tools can be built and installed with : " <nl> echo " " <nl> echo " $ make training " <nl> echo " $ sudo make training - install " <nl> echo " " ] , <nl> - [ echo " " <nl> + [ <nl> echo " You can not build training tools because of missing dependency . " <nl> echo " Check configure output for details . " <nl> echo " " ] <nl>
|
Merge pull request from stweil / text
|
tesseract-ocr/tesseract
|
de98a68dd0eff33f91fb43f737d5298d978f9886
|
2017-08-19T20:32:32Z
|
mmm a / src / wallet / wallet . h <nl> ppp b / src / wallet / wallet . h <nl> class CWallet final : public CCryptoKeyStore , public CValidationInterface <nl> { <nl> private : <nl> static std : : atomic < bool > fFlushScheduled ; <nl> - std : : atomic < bool > fAbortRescan ; <nl> - std : : atomic < bool > fScanningWallet ; / / controlled by WalletRescanReserver <nl> + std : : atomic < bool > fAbortRescan { false } ; <nl> + std : : atomic < bool > fScanningWallet { false } ; / / controlled by WalletRescanReserver <nl> std : : mutex mutexScanning ; <nl> friend class WalletRescanReserver ; <nl> <nl> - CWalletDB * pwalletdbEncryption ; <nl> + CWalletDB * pwalletdbEncryption = nullptr ; <nl> <nl> / / ! the current wallet version : clients below this version are not able to load the wallet <nl> - int nWalletVersion ; <nl> + int nWalletVersion = FEATURE_BASE ; <nl> <nl> / / ! the maximum wallet format version : memory - only variable that specifies to what version this wallet may be upgraded <nl> - int nWalletMaxVersion ; <nl> + int nWalletMaxVersion = FEATURE_BASE ; <nl> <nl> - int64_t nNextResend ; <nl> - int64_t nLastResend ; <nl> - bool fBroadcastTransactions ; <nl> + int64_t nNextResend = 0 ; <nl> + int64_t nLastResend = 0 ; <nl> + bool fBroadcastTransactions = false ; <nl> <nl> / * * <nl> * Used to keep track of spent outpoints , and <nl> class CWallet final : public CCryptoKeyStore , public CValidationInterface <nl> <nl> std : : set < int64_t > setInternalKeyPool ; <nl> std : : set < int64_t > setExternalKeyPool ; <nl> - int64_t m_max_keypool_index ; <nl> + int64_t m_max_keypool_index = 0 ; <nl> std : : map < CKeyID , int64_t > m_pool_key_to_index ; <nl> <nl> - int64_t nTimeFirstKey ; <nl> + int64_t nTimeFirstKey = 0 ; <nl> <nl> / * * <nl> * Private version of AddWatchOnly method which does not accept a <nl> class CWallet final : public CCryptoKeyStore , public CValidationInterface <nl> * <nl> * Protected by cs_main ( see BlockUntilSyncedToCurrentChain ) <nl> * / <nl> - const CBlockIndex * m_last_block_processed ; <nl> + const CBlockIndex * m_last_block_processed = nullptr ; <nl> <nl> public : <nl> / * <nl> class CWallet final : public CCryptoKeyStore , public CValidationInterface <nl> <nl> typedef std : : map < unsigned int , CMasterKey > MasterKeyMap ; <nl> MasterKeyMap mapMasterKeys ; <nl> - unsigned int nMasterKeyMaxID ; <nl> + unsigned int nMasterKeyMaxID = 0 ; <nl> <nl> / * * Construct wallet with specified name and database implementation . * / <nl> CWallet ( std : : string name , std : : unique_ptr < CWalletDBWrapper > dbw ) : m_name ( std : : move ( name ) ) , dbw ( std : : move ( dbw ) ) <nl> { <nl> - SetNull ( ) ; <nl> } <nl> <nl> ~ CWallet ( ) <nl> class CWallet final : public CCryptoKeyStore , public CValidationInterface <nl> pwalletdbEncryption = nullptr ; <nl> } <nl> <nl> - void SetNull ( ) <nl> - { <nl> - nWalletVersion = FEATURE_BASE ; <nl> - nWalletMaxVersion = FEATURE_BASE ; <nl> - nMasterKeyMaxID = 0 ; <nl> - pwalletdbEncryption = nullptr ; <nl> - nOrderPosNext = 0 ; <nl> - nAccountingEntryNumber = 0 ; <nl> - nNextResend = 0 ; <nl> - nLastResend = 0 ; <nl> - m_max_keypool_index = 0 ; <nl> - nTimeFirstKey = 0 ; <nl> - fBroadcastTransactions = false ; <nl> - nRelockTime = 0 ; <nl> - fAbortRescan = false ; <nl> - fScanningWallet = false ; <nl> - } <nl> - <nl> std : : map < uint256 , CWalletTx > mapWallet ; <nl> std : : list < CAccountingEntry > laccentries ; <nl> <nl> class CWallet final : public CCryptoKeyStore , public CValidationInterface <nl> typedef std : : multimap < int64_t , TxPair > TxItems ; <nl> TxItems wtxOrdered ; <nl> <nl> - int64_t nOrderPosNext ; <nl> - uint64_t nAccountingEntryNumber ; <nl> + int64_t nOrderPosNext = 0 ; <nl> + uint64_t nAccountingEntryNumber = 0 ; <nl> std : : map < uint256 , int > mapRequestCount ; <nl> <nl> std : : map < CTxDestination , CAddressBookData > mapAddressBook ; <nl> class CWallet final : public CCryptoKeyStore , public CValidationInterface <nl> bool LoadWatchOnly ( const CScript & dest ) ; <nl> <nl> / / ! Holds a timestamp at which point the wallet is scheduled ( externally ) to be relocked . Caller must arrange for actual relocking to occur via Lock ( ) . <nl> - int64_t nRelockTime ; <nl> + int64_t nRelockTime = 0 ; <nl> <nl> bool Unlock ( const SecureString & strWalletPassphrase ) ; <nl> bool ChangeWalletPassphrase ( const SecureString & strOldWalletPassphrase , const SecureString & strNewWalletPassphrase ) ; <nl>
|
wallet : Initialize m_last_block_processed to nullptr . Initialize fields where defined .
|
bitcoin/bitcoin
|
f63bc5e06310ea25051e2bf89c231f6096dda169
|
2018-04-05T13:49:30Z
|
mmm a / AirLib / include / api / RpcLibClientBase . hpp <nl> ppp b / AirLib / include / api / RpcLibClientBase . hpp <nl> class RpcLibClientBase { <nl> int simGetSegmentationObjectID ( const std : : string & mesh_name ) const ; <nl> void simPrintLogMessage ( const std : : string & message , std : : string message_param = " " , unsigned char severity = 0 ) ; <nl> <nl> + void simPlotPoints ( const vector < Vector3r > & points , const vector < float > & color_rgba , float size , float duration , bool is_persistent ) ; <nl> + void simPlotLineStrip ( const vector < Vector3r > & points , const vector < float > & color_rgba , float thickness , float duration , bool is_persistent ) ; <nl> + void simPlotLineList ( const vector < Vector3r > & points , const vector < float > & color_rgba , float thickness , float duration , bool is_persistent ) ; <nl> + void simPlotArrowList ( const vector < Vector3r > & points_start , const vector < Vector3r > & points_end , const vector < float > & color_rgba , float thickness , float arrow_size , float duration , bool is_persistent ) ; <nl> + void simPlotTransform ( const vector < Pose > & poses , float scale , float thickness , float duration , bool is_persistent ) ; <nl> + / / void simPlotTransformAndName ( const vector < Pose > & poses , const vector < std : : string > & names , float tf_scale , float text_scale , const vector < float > & text_color , float duration , bool is_persistent ) ; <nl> + void simPlotStrings ( const vector < Vector3r > & positions , const vector < std : : string > & strings , float scale , const vector < float > & color_rgba , float duration , bool is_persistent ) ; <nl> + / / void simPlotStringOnActor ( const vector < Pose > & pose , const std : : string < std : : string > & strings , const std : : string actor_name , float scale , const vector < float > & color_rgba , float duration , bool is_persistent ) ; <nl> <nl> bool armDisarm ( bool arm , const std : : string & vehicle_name = " " ) ; <nl> bool isApiControlEnabled ( const std : : string & vehicle_name = " " ) const ; <nl> mmm a / AirLib / include / api / WorldSimApiBase . hpp <nl> ppp b / AirLib / include / api / WorldSimApiBase . hpp <nl> class WorldSimApiBase { <nl> virtual void printLogMessage ( const std : : string & message , <nl> const std : : string & message_param = " " , unsigned char severity = 0 ) = 0 ; <nl> <nl> + / / mmmmmmmmm - - Plotting APIs mmmmmmmmm - / <nl> + virtual void simPlotPoints ( const std : : vector < Vector3r > & points , const vector < float > & color_rgba , float size , float duration , bool is_persistent ) = 0 ; <nl> + virtual void simPlotLineStrip ( const std : : vector < Vector3r > & points , const vector < float > & color_rgba , float thickness , float duration , bool is_persistent ) = 0 ; <nl> + virtual void simPlotLineList ( const std : : vector < Vector3r > & points , const vector < float > & color_rgba , float thickness , float duration , bool is_persistent ) = 0 ; <nl> + virtual void simPlotArrowList ( const std : : vector < Vector3r > & points_start , const std : : vector < Vector3r > & points_end , const vector < float > & color_rgba , float thickness , float arrow_size , float duration , bool is_persistent ) = 0 ; <nl> + virtual void simPlotTransform ( const std : : vector < Pose > & poses , float scale , float thickness , float duration , bool is_persistent ) = 0 ; <nl> + / / virtual void simPlotTransformAndName ( const std : : vector < Pose > & poses , const std : : vector < std : : string > & names , float tf_scale , float text_scale , const vector < float > & text_color , float duration , bool is_persistent ) = 0 ; <nl> + virtual void simPlotStrings ( const std : : vector < Vector3r > & position , const std : : vector < std : : string > & strings , float scale , const vector < float > & color_rgba , float duration , bool is_persistent ) = 0 ; <nl> + / / virtual void simPlotStringOnActor ( const std : : vector < Pose > & pose , const std : : string < std : : string > & strings , const std : : string actor_name , float scale , const vector < float > & color_rgba , float duration , bool is_persistent ) = 0 ; <nl> + <nl> virtual std : : vector < std : : string > listSceneObjects ( const std : : string & name_regex ) const = 0 ; <nl> virtual Pose getObjectPose ( const std : : string & object_name ) const = 0 ; <nl> virtual bool setObjectPose ( const std : : string & object_name , const Pose & pose , bool teleport ) = 0 ; <nl> mmm a / AirLib / src / api / RpcLibClientBase . cpp <nl> ppp b / AirLib / src / api / RpcLibClientBase . cpp <nl> void RpcLibClientBase : : simPrintLogMessage ( const std : : string & message , std : : strin <nl> pimpl_ - > client . call ( " simPrintLogMessage " , message , message_param , severity ) ; <nl> } <nl> <nl> + void RpcLibClientBase : : simPlotPoints ( const vector < Vector3r > & points , const vector < float > & color_rgba , float size , float duration , bool is_persistent ) <nl> + { <nl> + vector < RpcLibAdapatorsBase : : Vector3r > conv_points ; <nl> + RpcLibAdapatorsBase : : from ( points , conv_points ) ; <nl> + pimpl_ - > client . call ( " simPlotPoints " , conv_points , color_rgba , size , duration , is_persistent ) ; <nl> + } <nl> + <nl> + void RpcLibClientBase : : simPlotLineStrip ( const vector < Vector3r > & points , const vector < float > & color_rgba , float thickness , float duration , bool is_persistent ) <nl> + { <nl> + vector < RpcLibAdapatorsBase : : Vector3r > conv_points ; <nl> + RpcLibAdapatorsBase : : from ( points , conv_points ) ; <nl> + pimpl_ - > client . call ( " simPlotLineStrip " , conv_points , color_rgba , thickness , duration , is_persistent ) ; <nl> + } <nl> + <nl> + void RpcLibClientBase : : simPlotLineList ( const vector < Vector3r > & points , const vector < float > & color_rgba , float thickness , float duration , bool is_persistent ) <nl> + { <nl> + vector < RpcLibAdapatorsBase : : Vector3r > conv_points ; <nl> + RpcLibAdapatorsBase : : from ( points , conv_points ) ; <nl> + pimpl_ - > client . call ( " simPlotLineList " , conv_points , color_rgba , thickness , duration , is_persistent ) ; <nl> + } <nl> + <nl> + void RpcLibClientBase : : simPlotArrowList ( const vector < Vector3r > & points_start , const vector < Vector3r > & points_end , const vector < float > & color_rgba , float thickness , float arrow_size , float duration , bool is_persistent ) <nl> + { <nl> + vector < RpcLibAdapatorsBase : : Vector3r > conv_points_start ; <nl> + RpcLibAdapatorsBase : : from ( points_start , conv_points_start ) ; <nl> + vector < RpcLibAdapatorsBase : : Vector3r > conv_points_end ; <nl> + RpcLibAdapatorsBase : : from ( points_end , conv_points_end ) ; <nl> + pimpl_ - > client . call ( " simPlotArrowList " , conv_points_start , conv_points_end , color_rgba , thickness , arrow_size , duration , is_persistent ) ; <nl> + <nl> + } <nl> + <nl> + void RpcLibClientBase : : simPlotTransform ( const vector < Pose > & poses , float scale , float thickness , float duration , bool is_persistent ) <nl> + { <nl> + vector < RpcLibAdapatorsBase : : Pose > conv_poses ; <nl> + RpcLibAdapatorsBase : : from ( poses , conv_poses ) ; <nl> + pimpl_ - > client . call ( " simPlotTransform " , conv_poses , scale , thickness , duration , is_persistent ) ; <nl> + } <nl> + <nl> + / / void RpcLibClientBase : : simPlotTransformAndNames ( const vector < Pose > & poses , const vector < std : : string > & names , float tf_scale , float text_scale , const vector < float > & text_color , float duration , bool is_persistent ) <nl> + / / { <nl> + <nl> + / / } <nl> + <nl> + void RpcLibClientBase : : simPlotStrings ( const vector < Vector3r > & positions , const vector < std : : string > & strings , float scale , const vector < float > & color_rgba , float duration , bool is_persistent ) <nl> + { <nl> + vector < RpcLibAdapatorsBase : : Vector3r > conv_positions ; <nl> + RpcLibAdapatorsBase : : from ( positions , conv_positions ) ; <nl> + pimpl_ - > client . call ( " simPlotStrings " , conv_positions , strings , scale , color_rgba , duration , is_persistent ) ; <nl> + } <nl> + <nl> + / / void RpcLibClientBase : : simPlotStringOnActor ( const vector < Pose > & pose , const std : : string < std : : string > & strings , const std : : string actor_name , float scale , const vector < float > & color_rgba , float duration , bool is_persistent ) <nl> + / / { <nl> + <nl> + / / } <nl> + <nl> bool RpcLibClientBase : : simIsPaused ( ) const <nl> { <nl> return pimpl_ - > client . call ( " simIsPaused " ) . as < bool > ( ) ; <nl> mmm a / AirLib / src / api / RpcLibServerBase . cpp <nl> ppp b / AirLib / src / api / RpcLibServerBase . cpp <nl> RpcLibServerBase : : RpcLibServerBase ( ApiProvider * api_provider , const std : : string & <nl> return getWorldSimApi ( ) - > setObjectPose ( object_name , pose . to ( ) , teleport ) ; <nl> } ) ; <nl> <nl> + pimpl_ - > server . bind ( " simPlotPoints " , [ & ] ( const std : : vector < RpcLibAdapatorsBase : : Vector3r > & points , const vector < float > & color_rgba , float size , float duration , bool is_persistent ) - > void { <nl> + vector < Vector3r > conv_points ; <nl> + RpcLibAdapatorsBase : : to ( points , conv_points ) ; <nl> + getWorldSimApi ( ) - > simPlotPoints ( conv_points , color_rgba , size , duration , is_persistent ) ; <nl> + } ) ; <nl> + pimpl_ - > server . bind ( " simPlotLineStrip " , [ & ] ( const std : : vector < RpcLibAdapatorsBase : : Vector3r > & points , const vector < float > & color_rgba , float thickness , float duration , bool is_persistent ) - > void { <nl> + vector < Vector3r > conv_points ; <nl> + RpcLibAdapatorsBase : : to ( points , conv_points ) ; <nl> + getWorldSimApi ( ) - > simPlotLineStrip ( conv_points , color_rgba , thickness , duration , is_persistent ) ; <nl> + } ) ; <nl> + pimpl_ - > server . bind ( " simPlotLineList " , [ & ] ( const std : : vector < RpcLibAdapatorsBase : : Vector3r > & points , const vector < float > & color_rgba , float thickness , float duration , bool is_persistent ) - > void { <nl> + vector < Vector3r > conv_points ; <nl> + RpcLibAdapatorsBase : : to ( points , conv_points ) ; <nl> + getWorldSimApi ( ) - > simPlotLineList ( conv_points , color_rgba , thickness , duration , is_persistent ) ; <nl> + } ) ; <nl> + pimpl_ - > server . bind ( " simPlotArrowList " , [ & ] ( const std : : vector < RpcLibAdapatorsBase : : Vector3r > & points_start , const std : : vector < RpcLibAdapatorsBase : : Vector3r > & points_end , const vector < float > & color_rgba , float thickness , float arrow_size , float duration , bool is_persistent ) - > void { <nl> + vector < Vector3r > conv_points_start ; <nl> + RpcLibAdapatorsBase : : to ( points_start , conv_points_start ) ; <nl> + vector < Vector3r > conv_points_end ; <nl> + RpcLibAdapatorsBase : : to ( points_end , conv_points_end ) ; <nl> + getWorldSimApi ( ) - > simPlotArrowList ( conv_points_start , conv_points_end , color_rgba , thickness , arrow_size , duration , is_persistent ) ; <nl> + } ) ; <nl> + pimpl_ - > server . bind ( " simPlotTransform " , [ & ] ( const std : : vector < RpcLibAdapatorsBase : : Pose > & poses , float scale , float thickness , float duration , bool is_persistent ) - > void { <nl> + vector < Pose > conv_poses ; <nl> + RpcLibAdapatorsBase : : to ( poses , conv_poses ) ; <nl> + getWorldSimApi ( ) - > simPlotTransform ( conv_poses , scale , thickness , duration , is_persistent ) ; <nl> + } ) ; <nl> + / / pimpl_ - > server . bind ( " simPlotTransformAndNames " , [ & ] ( const std : : vector < RpcLibAdapatorsBase : : Pose > & poses , const std : : vector < std : : string > names , float tf_scale , float text_scale , const vector < float > & text_color , float duration , bool is_persistent ) - > void { <nl> + / / vector < Pose > conv_poses ; <nl> + / / RpcLibAdapatorsBase : : to ( poses , conv_poses ) ; <nl> + / / getWorldSimApi ( ) - > simPlotTransformAndNames ( conv_poses , names , tf_scale , text_scale , text_color , duration , is_persistent ) ; <nl> + / / } ) ; <nl> + pimpl_ - > server . bind ( " simPlotStrings " , [ & ] ( const std : : vector < RpcLibAdapatorsBase : : Vector3r > & positions , const std : : vector < std : : string > strings , float scale , const vector < float > & color_rgba , float duration , bool is_persistent ) - > void { <nl> + vector < Vector3r > conv_positions ; <nl> + RpcLibAdapatorsBase : : to ( positions , conv_positions ) ; <nl> + getWorldSimApi ( ) - > simPlotStrings ( conv_positions , strings , scale , color_rgba , duration , is_persistent ) ; <nl> + } ) ; <nl> + / / pimpl_ - > server . bind ( " simPlotStringOnActor " , [ & ] ( const std : : vector < RpcLibAdapatorsBase : : Vector3r > & positions , const std : : vector < std : : string > strings , const std : : string actor_name , float scale , const vector < float > & color_rgba , float duration , bool is_persistent ) - > void { <nl> + / / vector < Vector3r > conv_positions ; <nl> + / / RpcLibAdapatorsBase : : to ( positions , conv_positions ) ; <nl> + / / getWorldSimApi ( ) - > simPlotStringOnActor ( conv_positions , strings , scale , color_rgba , duration , is_persistent ) ; <nl> + / / } ) ; <nl> pimpl_ - > server . bind ( " simGetGroundTruthKinematics " , [ & ] ( const std : : string & vehicle_name ) - > RpcLibAdapatorsBase : : KinematicsState { <nl> const Kinematics : : State & result = * getVehicleSimApi ( vehicle_name ) - > getGroundTruthKinematics ( ) ; <nl> return RpcLibAdapatorsBase : : KinematicsState ( result ) ; <nl> mmm a / PythonClient / airsim / client . py <nl> ppp b / PythonClient / airsim / client . py <nl> def getLidarData ( self , lidar_name = ' ' , vehicle_name = ' ' ) : <nl> def simGetLidarSegmentation ( self , lidar_name = ' ' , vehicle_name = ' ' ) : <nl> return self . client . call ( ' simGetLidarSegmentation ' , lidar_name , vehicle_name ) <nl> <nl> + # Plotting APIs <nl> + def simPlotPoints ( self , points , color_rgba = [ 1 . 0 , 0 . 0 , 0 . 0 , 0 . 4 ] , size = 10 , duration = - 1 . 0 , is_persistent = False ) : <nl> + return self . client . call ( ' simPlotPoints ' , points , color_rgba , size , duration , is_persistent ) <nl> + <nl> + def simPlotLineStrip ( self , points , color_rgba = [ 1 . 0 , 0 . 0 , 0 . 0 , 0 . 4 ] , thickness = 5 , duration = - 1 . 0 , is_persistent = False ) : <nl> + return self . client . call ( ' simPlotLineStrip ' , points , color_rgba , thickness , duration , is_persistent ) <nl> + <nl> + def simPlotLineList ( self , points , color_rgba = [ 1 . 0 , 0 . 0 , 0 . 0 , 0 . 4 ] , thickness = 5 , duration = - 1 . 0 , is_persistent = False ) : <nl> + return self . client . call ( ' simPlotLineList ' , points , color_rgba , thickness , duration , is_persistent ) <nl> + <nl> + def simPlotArrowList ( self , points_start , points_end , color_rgba = [ 1 . 0 , 0 . 0 , 0 . 0 , 0 . 4 ] , thickness = 5 , arrow_size = 2 , duration = - 1 . 0 , is_persistent = False ) : <nl> + return self . client . call ( ' simPlotArrowList ' , points_start , points_end , color_rgba , thickness , arrow_size , duration , is_persistent ) <nl> + <nl> + def simPlotTransform ( self , poses , scale = 5 , thickness = 5 , duration = - 1 . 0 , is_persistent = False ) : <nl> + return self . client . call ( ' simPlotTransform ' , poses , scale , thickness , duration , is_persistent ) <nl> + <nl> + # def simPlotTransformAndNames ( self , poses , names , tf_scale = 5 , text_scale = 10 , text_color = [ 1 . 0 , 0 . 0 , 0 . 0 , 0 . 4 ] , thickness = 5 , duration = - 1 . 0 , is_persistent = False ) : <nl> + # return self . client . call ( ' simPlotTransformAndNames ' , poses , names , tf_scale , text_scale , duration , is_persistent ) <nl> + <nl> + def simPlotStrings ( self , positions , strings = [ " Microsoft " , " AirSim " ] , scale = 5 , color_rgba = [ 1 . 0 , 0 . 0 , 0 . 0 , 0 . 4 ] , duration = - 1 . 0 , is_persistent = False ) : <nl> + return self . client . call ( ' simPlotStrings ' , positions , strings , scale , color_rgba , duration , is_persistent ) <nl> + <nl> + # def simPlotStringOnActor ( self , positions , strings = [ " Microsoft " , " AirSim " ] , actor_name = " " , scale = 5 , color_rgba = [ 1 . 0 , 0 . 0 , 0 . 0 , 0 . 4 ] , duration = - 1 . 0 , is_persistent = False ) : <nl> + # return self . client . call ( ' simPlotStringOnActor ' , positions , strings , scale , actor_name , color_rgba , duration , is_persistent ) <nl> + <nl> # mmmmmmmmm - - APIs to control ACharacter in scene mmmmmmmmm - / <nl> def simCharSetFaceExpression ( self , expression_name , value , character_name = " " ) : <nl> self . client . call ( ' simCharSetFaceExpression ' , expression_name , value , character_name ) <nl> new file mode 100644 <nl> index 000000000 . . 65c2829e1 <nl> mmm / dev / null <nl> ppp b / PythonClient / computer_vision / plot_markers . py <nl> <nl> + import setup_path <nl> + import airsim <nl> + from airsim import Vector3r <nl> + import numpy as np <nl> + <nl> + client = airsim . VehicleClient ( ) <nl> + client . confirmConnection ( ) <nl> + <nl> + # plot 2 red arrows for 3 seconds <nl> + arrow_1_start , arrow_2_start = Vector3r ( 0 , 0 , - 1 ) , Vector3r ( 0 , 0 , - 3 ) <nl> + arrow_1_end , arrow_2_end = Vector3r ( 1 , 1 , - 1 ) , Vector3r ( 2 , 2 , - 3 ) <nl> + client . simPlotArrowList ( points_start = [ arrow_1_start , arrow_2_start ] , points_end = [ arrow_1_end , arrow_2_end ] , <nl> + color_rgba = [ 1 . 0 , 0 . 0 , 1 . 0 , 1 . 0 ] , duration = 3 . 0 , arrow_size = 20 , thickness = 4 ) <nl> + <nl> + # plot 2 yellow arrows for 4 seconds <nl> + arrow_1_start , arrow_2_start = Vector3r ( 0 , 1 , - 1 ) , Vector3r ( 0 , 1 , - 3 ) <nl> + arrow_1_end , arrow_2_end = Vector3r ( 4 , 5 , - 1 ) , Vector3r ( 2 , 3 , - 3 ) <nl> + client . simPlotArrowList ( points_start = [ arrow_1_start , arrow_2_start ] , points_end = [ arrow_1_end , arrow_2_end ] , <nl> + color_rgba = [ 1 . 0 , 1 . 0 , 0 . 0 , 1 . 0 ] , duration = 4 . 0 , arrow_size = 20 , thickness = 3 ) <nl> + <nl> + # plot 2 red arrows for 5 seconds <nl> + arrow_1_start , arrow_2_start = Vector3r ( 1 , 1 , - 2 ) , Vector3r ( 1 , 1 , - 4 ) <nl> + arrow_1_end , arrow_2_end = Vector3r ( - 4 , - 4 , - 2 ) , Vector3r ( - 2 , - 2 , - 4 ) <nl> + client . simPlotArrowList ( points_start = [ arrow_1_start , arrow_2_start ] , points_end = [ arrow_1_end , arrow_2_end ] , <nl> + color_rgba = [ 1 . 0 , 0 . 0 , 0 . 0 , 1 . 0 ] , duration = 5 . 0 , arrow_size = 20 , thickness = 2 ) <nl> + <nl> + # plot 2 white arrows which are persistent <nl> + arrow_1_start , arrow_2_start = Vector3r ( 2 , 2 , - 2 ) , Vector3r ( 0 , 1 , - 4 ) <nl> + arrow_1_end , arrow_2_end = Vector3r ( 2 , 3 , - 2 ) , Vector3r ( 2 , 4 , - 4 ) <nl> + client . simPlotArrowList ( points_start = [ arrow_1_start , arrow_2_start ] , points_end = [ arrow_1_end , arrow_2_end ] , <nl> + color_rgba = [ 1 . 0 , 1 . 0 , 1 . 0 , 1 . 0 ] , duration = 5 . 0 , arrow_size = 20 , thickness = 10 , is_persistent = True ) <nl> + <nl> + # plot points <nl> + client . simPlotPoints ( points = [ Vector3r ( x , y , - 2 ) for x , y in zip ( np . linspace ( 0 , 10 , 20 ) , np . linspace ( 0 , 20 , 20 ) ) ] , color_rgba = [ 1 . 0 , 0 . 0 , 0 . 0 , 1 . 0 ] , size = 20 , duration = 20 . 0 , is_persistent = False ) <nl> + client . simPlotPoints ( points = [ Vector3r ( x , y , z ) for x , y , z in zip ( np . linspace ( 0 , - 10 , 20 ) , np . linspace ( 0 , - 20 , 20 ) , np . linspace ( 0 , - 5 , 20 ) ) ] , color_rgba = [ 0 . 0 , 0 . 0 , 1 . 0 , 1 . 0 ] , size = 10 , duration = 20 . 0 , is_persistent = False ) <nl> + client . simPlotPoints ( points = [ Vector3r ( x , y , z ) for x , y , z in zip ( np . linspace ( 0 , 10 , 20 ) , np . linspace ( 0 , - 20 , 20 ) , np . linspace ( 0 , - 7 , 20 ) ) ] , color_rgba = [ 1 . 0 , 0 . 0 , 1 . 0 , 1 . 0 ] , size = 15 , duration = 20 . 0 , is_persistent = False ) <nl> mmm a / Unreal / Plugins / AirSim / Source / WorldSimApi . cpp <nl> ppp b / Unreal / Plugins / AirSim / Source / WorldSimApi . cpp <nl> <nl> # include " TextureShuffleActor . h " <nl> # include " common / common_utils / Utils . hpp " <nl> # include " Weather / WeatherLib . h " <nl> + # include " DrawDebugHelpers . h " <nl> <nl> WorldSimApi : : WorldSimApi ( ASimModeBase * simmode ) <nl> : simmode_ ( simmode ) <nl> void WorldSimApi : : enableWeather ( bool enable ) <nl> { <nl> UWeatherLib : : setWeatherEnabled ( simmode_ - > GetWorld ( ) , enable ) ; <nl> } <nl> + <nl> void WorldSimApi : : setWeatherParameter ( WeatherParameter param , float val ) <nl> { <nl> unsigned char param_n = static_cast < unsigned char > ( msr : : airlib : : Utils : : toNumeric < WeatherParameter > ( param ) ) ; <nl> std : : unique_ptr < std : : vector < std : : string > > WorldSimApi : : swapTextures ( const std : : s <nl> } , true ) ; <nl> return swappedObjectNames ; <nl> } <nl> + / / mmmmmmmmm - - Plotting APIs mmmmmmmmm - / <nl> + void WorldSimApi : : simPlotPoints ( const std : : vector < Vector3r > & points , const vector < float > & color_rgba , float size , float duration , bool is_persistent ) <nl> + { <nl> + FLinearColor color { color_rgba [ 0 ] , color_rgba [ 1 ] , color_rgba [ 2 ] , color_rgba [ 3 ] } ; <nl> + for ( const auto & point : points ) <nl> + { <nl> + DrawDebugPoint ( simmode_ - > GetWorld ( ) , simmode_ - > getGlobalNedTransform ( ) . fromGlobalNed ( point ) , size , color . ToFColor ( true ) , is_persistent , duration ) ; <nl> + } <nl> + } <nl> + <nl> + / / plot line for points 0 - 1 , 1 - 2 , 2 - 3 <nl> + void WorldSimApi : : simPlotLineStrip ( const std : : vector < Vector3r > & points , const vector < float > & color_rgba , float thickness , float duration , bool is_persistent ) <nl> + { <nl> + FLinearColor color { color_rgba [ 0 ] , color_rgba [ 1 ] , color_rgba [ 2 ] , color_rgba [ 3 ] } ; <nl> + for ( size_t idx = 0 ; idx ! = points . size ( ) - 1 ; idx + + ) <nl> + { <nl> + DrawDebugLine ( simmode_ - > GetWorld ( ) , simmode_ - > getGlobalNedTransform ( ) . fromGlobalNed ( points [ idx ] ) , simmode_ - > getGlobalNedTransform ( ) . fromGlobalNed ( points [ idx + 1 ] ) , color . ToFColor ( true ) , is_persistent , duration , 0 , thickness ) ; <nl> + } <nl> + } <nl> + <nl> + / / plot line for points 0 - 1 , 2 - 3 , 4 - 5 . . . must be even number of points <nl> + void WorldSimApi : : simPlotLineList ( const std : : vector < Vector3r > & points , const vector < float > & color_rgba , float thickness , float duration , bool is_persistent ) <nl> + { <nl> + if ( points . size ( ) % 2 ) <nl> + { <nl> + <nl> + } <nl> + <nl> + FLinearColor color { color_rgba [ 0 ] , color_rgba [ 1 ] , color_rgba [ 2 ] , color_rgba [ 3 ] } ; <nl> + for ( int idx = 0 ; idx < points . size ( ) ; idx + = 2 ) <nl> + { <nl> + DrawDebugLine ( simmode_ - > GetWorld ( ) , simmode_ - > getGlobalNedTransform ( ) . fromGlobalNed ( points [ idx ] ) , simmode_ - > getGlobalNedTransform ( ) . fromGlobalNed ( points [ idx + 1 ] ) , color . ToFColor ( true ) , is_persistent , duration , 0 , thickness ) ; <nl> + } <nl> + } <nl> + <nl> + void WorldSimApi : : simPlotArrowList ( const std : : vector < Vector3r > & points_start , const std : : vector < Vector3r > & points_end , const vector < float > & color_rgba , float thickness , float arrow_size , float duration , bool is_persistent ) <nl> + { <nl> + / / assert points_start . size ( ) = = poinst_end . size ( ) <nl> + FLinearColor color { color_rgba [ 0 ] , color_rgba [ 1 ] , color_rgba [ 2 ] , color_rgba [ 3 ] } ; <nl> + for ( int idx = 0 ; idx < points_start . size ( ) ; idx + = 1 ) <nl> + { <nl> + DrawDebugDirectionalArrow ( simmode_ - > GetWorld ( ) , simmode_ - > getGlobalNedTransform ( ) . fromGlobalNed ( points_start [ idx ] ) , simmode_ - > getGlobalNedTransform ( ) . fromGlobalNed ( points_end [ idx ] ) , arrow_size , color . ToFColor ( true ) , is_persistent , duration , 0 , thickness ) ; <nl> + } <nl> + } <nl> + <nl> + void WorldSimApi : : simPlotTransform ( const std : : vector < Pose > & poses , float scale , float thickness , float duration , bool is_persistent ) <nl> + { <nl> + for ( const auto & pose : poses ) <nl> + { <nl> + DrawDebugCoordinateSystem ( simmode_ - > GetWorld ( ) , simmode_ - > getGlobalNedTransform ( ) . fromGlobalNed ( pose ) . GetLocation ( ) , simmode_ - > getGlobalNedTransform ( ) . fromGlobalNed ( pose ) . Rotator ( ) , scale , is_persistent , duration , 0 , thickness ) ; <nl> + } <nl> + } <nl> + / / void WorldSimApi : : simPlotTransformAndName ( const std : : vector < Pose > & poses , const std : : vector < std : : string > & names , float tf_scale , float text_scale , const vector < float > & text_color , float duration , bool is_persistent ) ; <nl> + void WorldSimApi : : simPlotStrings ( const std : : vector < Vector3r > & positions , const std : : vector < std : : string > & strings , float scale , const vector < float > & color_rgba , float duration , bool is_persistent ) <nl> + { <nl> + / / assert positions . size ( ) = = strings . size ( ) <nl> + FLinearColor color { color_rgba [ 0 ] , color_rgba [ 1 ] , color_rgba [ 2 ] , color_rgba [ 3 ] } ; <nl> + for ( int idx = 0 ; idx < positions . size ( ) ; idx + = 1 ) <nl> + { <nl> + DrawDebugString ( simmode_ - > GetWorld ( ) , simmode_ - > getGlobalNedTransform ( ) . fromGlobalNed ( positions [ idx ] ) , FString ( strings [ idx ] . c_str ( ) ) , NULL , color . ToFColor ( true ) , duration , false , scale ) ; <nl> + } <nl> + } <nl> + / / void WorldSimApi : : simPlotStringOnActor ( const std : : vector < Pose > & pose , const std : : vector < std : : string > & strings , const std : : vector < std : : string > & actor_name , float scale , const vector < float > & color_rgba , float duration , bool is_persistent ) ; <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - Char APIs mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - / <nl> <nl> mmm a / Unreal / Plugins / AirSim / Source / WorldSimApi . h <nl> ppp b / Unreal / Plugins / AirSim / Source / WorldSimApi . h <nl> class WorldSimApi : public msr : : airlib : : WorldSimApiBase { <nl> virtual Pose getObjectPose ( const std : : string & object_name ) const override ; <nl> virtual bool setObjectPose ( const std : : string & object_name , const Pose & pose , bool teleport ) override ; <nl> <nl> + / / mmmmmmmmm - - Plotting APIs mmmmmmmmm - / <nl> + virtual void simPlotPoints ( const std : : vector < Vector3r > & points , const vector < float > & color_rgba , float size , float duration , bool is_persistent ) override ; <nl> + virtual void simPlotLineStrip ( const std : : vector < Vector3r > & points , const vector < float > & color_rgba , float thickness , float duration , bool is_persistent ) override ; <nl> + virtual void simPlotLineList ( const std : : vector < Vector3r > & points , const vector < float > & color_rgba , float thickness , float duration , bool is_persistent ) override ; <nl> + virtual void simPlotArrowList ( const std : : vector < Vector3r > & points_start , const std : : vector < Vector3r > & points_end , const vector < float > & color_rgba , float thickness , float arrow_size , float duration , bool is_persistent ) override ; <nl> + virtual void simPlotTransform ( const std : : vector < Pose > & poses , float scale , float thickness , float duration , bool is_persistent ) override ; <nl> + / / virtual void simPlotTransformAndName ( const std : : vector < Pose > & poses , const std : : vector < std : : string > & names , float tf_scale , float text_scale , const vector < float > & text_color , float duration , bool is_persistent ) override ; <nl> + virtual void simPlotStrings ( const std : : vector < Vector3r > & position , const std : : vector < std : : string > & strings , float scale , const vector < float > & color_rgba , float duration , bool is_persistent ) override ; <nl> + / / virtual void simPlotStringOnActor ( const std : : vector < Pose > & pose , const std : : string < std : : string > & strings , std : : string actor_name , float scale , const vector < float > & color_rgba , float duration , bool is_persistent ) override ; <nl> + <nl> / / mmmmmmmmm - - APIs to control ACharacter in scene mmmmmmmmm - / <nl> virtual void charSetFaceExpression ( const std : : string & expression_name , float value , const std : : string & character_name ) override ; <nl> virtual float charGetFaceExpression ( const std : : string & expression_name , const std : : string & character_name ) const override ; <nl>
|
[ plotting ] add RViz like plot APIs for debugging
|
microsoft/AirSim
|
c5bd0a386ab83119d14dc4a6022cc694623869c1
|
2020-03-26T05:52:32Z
|
mmm a / YogaKit / Source / UIView + Yoga . h <nl> ppp b / YogaKit / Source / UIView + Yoga . h <nl> typedef void ( ^ YGLayoutConfigurationBlock ) ( YGLayout * ) ; <nl> The YGLayout that is attached to this view . It is lazily created . <nl> * / <nl> @ property ( nonatomic , readonly , strong ) YGLayout * yoga ; <nl> + / * * <nl> + Indicates whether or not Yoga is enabled <nl> + * / <nl> + @ property ( nonatomic , readonly , assign ) BOOL isYogaEnabled ; <nl> <nl> / * * <nl> In ObjC land , every time you access ` view . yoga . * ` you are adding another ` objc_msgSend ` <nl> mmm a / YogaKit / Source / UIView + Yoga . m <nl> ppp b / YogaKit / Source / UIView + Yoga . m <nl> - ( YGLayout * ) yoga <nl> return yoga ; <nl> } <nl> <nl> + - ( BOOL ) isYogaEnabled <nl> + { <nl> + return objc_getAssociatedObject ( self , kYGYogaAssociatedKey ) ! = nil ; <nl> + } <nl> + <nl> - ( void ) configureLayoutWithBlock : ( YGLayoutConfigurationBlock ) block <nl> { <nl> if ( block ! = nil ) { <nl>
|
Add ' useYoga ' property to indicate whether UIView uses Yoga for layout or not
|
facebook/yoga
|
58328d01efa7ad30f89761f510ae4131796d7f4a
|
2017-09-21T17:18:52Z
|
mmm a / tools / jenkins - scripts / emptytest - post - build . py <nl> ppp b / tools / jenkins - scripts / emptytest - post - build . py <nl> <nl> target_url = os . environ [ ' BUILD_URL ' ] <nl> build_number = int ( os . environ [ ' BUILD_NUMBER ' ] ) <nl> data = { } <nl> - access_token = os . environ [ ' GITHUB_ACCESS_TOKEN ' ] <nl> + access_token = os . environ [ ' GITHUB_COMMENT_ACCESS_TOKEN ' ] <nl> Headers = { " Authorization " : " token " + access_token } <nl> <nl> result = J [ os . environ [ ' JOB_NAME ' ] ] . get_build ( build_number ) . get_status ( ) <nl>
|
[ Jenkins ] [ ci skip ] Change ' GITHUB_ACCESS_TOKEN ' to ' GITHUB_COMMENT_ACCESS_TOKEN '
|
cocos2d/cocos2d-x
|
008bdba373ded0a1d29a6232210abb032c152210
|
2014-04-17T01:57:55Z
|
mmm a / src / arm / ic - arm . cc <nl> ppp b / src / arm / ic - arm . cc <nl> bool LoadIC : : PatchInlinedLoad ( Address address , Object * map , int offset ) { <nl> } <nl> <nl> <nl> + bool LoadIC : : PatchInlinedContextualLoad ( Address address , <nl> + Object * map , <nl> + Object * cell ) { <nl> + / / TODO ( < bug # > ) : implement this . <nl> + return false ; <nl> + } <nl> + <nl> + <nl> bool StoreIC : : PatchInlinedStore ( Address address , Object * map , int offset ) { <nl> / / Find the end of the inlined code for the store if there is an <nl> / / inlined version of the store . <nl> mmm a / src / arm / stub - cache - arm . cc <nl> ppp b / src / arm / stub - cache - arm . cc <nl> Object * LoadStubCompiler : : CompileLoadGlobal ( JSObject * object , <nl> } <nl> <nl> __ mov ( r0 , r4 ) ; <nl> - __ IncrementCounter ( & Counters : : named_load_global_inline , 1 , r1 , r3 ) ; <nl> + __ IncrementCounter ( & Counters : : named_load_global_stub , 1 , r1 , r3 ) ; <nl> __ Ret ( ) ; <nl> <nl> __ bind ( & miss ) ; <nl> - __ IncrementCounter ( & Counters : : named_load_global_inline_miss , 1 , r1 , r3 ) ; <nl> + __ IncrementCounter ( & Counters : : named_load_global_stub_miss , 1 , r1 , r3 ) ; <nl> GenerateLoadMiss ( masm ( ) , Code : : LOAD_IC ) ; <nl> <nl> / / Return the generated code . <nl> mmm a / src / frames . h <nl> ppp b / src / frames . h <nl> class PcToCodeCache : AllStatic { <nl> static PcToCodeCacheEntry * GetCacheEntry ( Address pc ) ; <nl> <nl> private : <nl> - static const int kPcToCodeCacheSize = 256 ; <nl> + static const int kPcToCodeCacheSize = 1024 ; <nl> static PcToCodeCacheEntry cache_ [ kPcToCodeCacheSize ] ; <nl> } ; <nl> <nl> mmm a / src / ia32 / codegen - ia32 . cc <nl> ppp b / src / ia32 / codegen - ia32 . cc <nl> class DeferredReferenceGetNamedValue : public DeferredCode { <nl> public : <nl> DeferredReferenceGetNamedValue ( Register dst , <nl> Register receiver , <nl> - Handle < String > name ) <nl> - : dst_ ( dst ) , receiver_ ( receiver ) , name_ ( name ) { <nl> - set_comment ( " [ DeferredReferenceGetNamedValue " ) ; <nl> + Handle < String > name , <nl> + bool is_contextual ) <nl> + : dst_ ( dst ) , <nl> + receiver_ ( receiver ) , <nl> + name_ ( name ) , <nl> + is_contextual_ ( is_contextual ) { <nl> + set_comment ( is_contextual <nl> + ? " [ DeferredReferenceGetNamedValue ( contextual ) " <nl> + : " [ DeferredReferenceGetNamedValue " ) ; <nl> } <nl> <nl> virtual void Generate ( ) ; <nl> class DeferredReferenceGetNamedValue : public DeferredCode { <nl> Register dst_ ; <nl> Register receiver_ ; <nl> Handle < String > name_ ; <nl> + bool is_contextual_ ; <nl> } ; <nl> <nl> <nl> void DeferredReferenceGetNamedValue : : Generate ( ) { <nl> } <nl> __ Set ( ecx , Immediate ( name_ ) ) ; <nl> Handle < Code > ic ( Builtins : : builtin ( Builtins : : LoadIC_Initialize ) ) ; <nl> - __ call ( ic , RelocInfo : : CODE_TARGET ) ; <nl> - / / The call must be followed by a test eax instruction to indicate <nl> - / / that the inobject property case was inlined . <nl> + RelocInfo : : Mode mode = is_contextual_ <nl> + ? RelocInfo : : CODE_TARGET_CONTEXT <nl> + : RelocInfo : : CODE_TARGET ; <nl> + __ call ( ic , mode ) ; <nl> + / / The call must be followed by : <nl> + / / - a test eax instruction to indicate that the inobject property <nl> + / / case was inlined . <nl> + / / - a mov ecx instruction to indicate that the contextual property <nl> + / / load was inlined . <nl> / / <nl> / / Store the delta to the map check instruction here in the test <nl> / / instruction . Use masm_ - > instead of the __ macro since the <nl> void DeferredReferenceGetNamedValue : : Generate ( ) { <nl> int delta_to_patch_site = masm_ - > SizeOfCodeGeneratedSince ( patch_site ( ) ) ; <nl> / / Here we use masm_ - > instead of the __ macro because this is the <nl> / / instruction that gets patched and coverage code gets in the way . <nl> - masm_ - > test ( eax , Immediate ( - delta_to_patch_site ) ) ; <nl> - __ IncrementCounter ( & Counters : : named_load_inline_miss , 1 ) ; <nl> + if ( is_contextual_ ) { <nl> + masm_ - > mov ( ecx , - delta_to_patch_site ) ; <nl> + __ IncrementCounter ( & Counters : : named_load_global_inline_miss , 1 ) ; <nl> + } else { <nl> + masm_ - > test ( eax , Immediate ( - delta_to_patch_site ) ) ; <nl> + __ IncrementCounter ( & Counters : : named_load_inline_miss , 1 ) ; <nl> + } <nl> <nl> if ( ! dst_ . is ( eax ) ) __ mov ( dst_ , eax ) ; <nl> } <nl> Result CodeGenerator : : EmitNamedLoad ( Handle < String > name , bool is_contextual ) { <nl> # ifdef DEBUG <nl> int original_height = frame ( ) - > height ( ) ; <nl> # endif <nl> + <nl> + bool contextual_load_in_builtin = <nl> + is_contextual & & <nl> + ( Bootstrapper : : IsActive ( ) | | <nl> + ( ! info_ - > closure ( ) . is_null ( ) & & info_ - > closure ( ) - > IsBuiltin ( ) ) ) ; <nl> + <nl> Result result ; <nl> - / / Do not inline the inobject property case for loads from the global <nl> - / / object . Also do not inline for unoptimized code . This saves time in <nl> - / / the code generator . Unoptimized code is toplevel code or code that is <nl> - / / not in a loop . <nl> - if ( is_contextual | | scope ( ) - > is_global_scope ( ) | | loop_nesting ( ) = = 0 ) { <nl> + / / Do not inline in the global code or when not in loop . <nl> + if ( scope ( ) - > is_global_scope ( ) | | <nl> + loop_nesting ( ) = = 0 | | <nl> + contextual_load_in_builtin ) { <nl> Comment cmnt ( masm ( ) , " [ Load from named Property " ) ; <nl> frame ( ) - > Push ( name ) ; <nl> <nl> Result CodeGenerator : : EmitNamedLoad ( Handle < String > name , bool is_contextual ) { <nl> / / instruction here . <nl> __ nop ( ) ; <nl> } else { <nl> - / / Inline the inobject property case . <nl> - Comment cmnt ( masm ( ) , " [ Inlined named property load " ) ; <nl> + / / Inline the property load . <nl> + Comment cmnt ( masm ( ) , is_contextual <nl> + ? " [ Inlined contextual property load " <nl> + : " [ Inlined named property load " ) ; <nl> Result receiver = frame ( ) - > Pop ( ) ; <nl> receiver . ToRegister ( ) ; <nl> <nl> result = allocator ( ) - > Allocate ( ) ; <nl> ASSERT ( result . is_valid ( ) ) ; <nl> DeferredReferenceGetNamedValue * deferred = <nl> - new DeferredReferenceGetNamedValue ( result . reg ( ) , receiver . reg ( ) , name ) ; <nl> + new DeferredReferenceGetNamedValue ( result . reg ( ) , <nl> + receiver . reg ( ) , <nl> + name , <nl> + is_contextual ) ; <nl> <nl> - / / Check that the receiver is a heap object . <nl> - __ test ( receiver . reg ( ) , Immediate ( kSmiTagMask ) ) ; <nl> - deferred - > Branch ( zero ) ; <nl> + if ( ! is_contextual ) { <nl> + / / Check that the receiver is a heap object . <nl> + __ test ( receiver . reg ( ) , Immediate ( kSmiTagMask ) ) ; <nl> + deferred - > Branch ( zero ) ; <nl> + } <nl> <nl> __ bind ( deferred - > patch_site ( ) ) ; <nl> / / This is the map check instruction that will be patched ( so we can ' t <nl> Result CodeGenerator : : EmitNamedLoad ( Handle < String > name , bool is_contextual ) { <nl> / / which allows the assert below to succeed and patching to work . <nl> deferred - > Branch ( not_equal ) ; <nl> <nl> - / / The delta from the patch label to the load offset must be statically <nl> - / / known . <nl> + / / The delta from the patch label to the actual load must be <nl> + / / statically known . <nl> ASSERT ( masm ( ) - > SizeOfCodeGeneratedSince ( deferred - > patch_site ( ) ) = = <nl> LoadIC : : kOffsetToLoadInstruction ) ; <nl> - / / The initial ( invalid ) offset has to be large enough to force a 32 - bit <nl> - / / instruction encoding to allow patching with an arbitrary offset . Use <nl> - / / kMaxInt ( minus kHeapObjectTag ) . <nl> - int offset = kMaxInt ; <nl> - masm ( ) - > mov ( result . reg ( ) , FieldOperand ( receiver . reg ( ) , offset ) ) ; <nl> <nl> - __ IncrementCounter ( & Counters : : named_load_inline , 1 ) ; <nl> + if ( is_contextual ) { <nl> + / / Load the ( initialy invalid ) cell and get its value . <nl> + masm ( ) - > mov ( result . reg ( ) , Factory : : null_value ( ) ) ; <nl> + if ( FLAG_debug_code ) { <nl> + __ cmp ( FieldOperand ( result . reg ( ) , HeapObject : : kMapOffset ) , <nl> + Factory : : global_property_cell_map ( ) ) ; <nl> + __ Assert ( equal , " Uninitialized inlined contextual load " ) ; <nl> + } <nl> + __ mov ( result . reg ( ) , <nl> + FieldOperand ( result . reg ( ) , JSGlobalPropertyCell : : kValueOffset ) ) ; <nl> + __ cmp ( result . reg ( ) , Factory : : the_hole_value ( ) ) ; <nl> + deferred - > Branch ( equal ) ; <nl> + __ IncrementCounter ( & Counters : : named_load_global_inline , 1 ) ; <nl> + } else { <nl> + / / The initial ( invalid ) offset has to be large enough to force a 32 - bit <nl> + / / instruction encoding to allow patching with an arbitrary offset . Use <nl> + / / kMaxInt ( minus kHeapObjectTag ) . <nl> + int offset = kMaxInt ; <nl> + masm ( ) - > mov ( result . reg ( ) , FieldOperand ( receiver . reg ( ) , offset ) ) ; <nl> + __ IncrementCounter ( & Counters : : named_load_inline , 1 ) ; <nl> + } <nl> + <nl> deferred - > BindExit ( ) ; <nl> } <nl> ASSERT ( frame ( ) - > height ( ) = = original_height - 1 ) ; <nl> mmm a / src / ia32 / ic - ia32 . cc <nl> ppp b / src / ia32 / ic - ia32 . cc <nl> bool LoadIC : : PatchInlinedLoad ( Address address , Object * map , int offset ) { <nl> } <nl> <nl> <nl> + / / One byte opcode for mov ecx , 0xXXXXXXXX . <nl> + static const byte kMovEcxByte = 0xB9 ; <nl> + <nl> + bool LoadIC : : PatchInlinedContextualLoad ( Address address , <nl> + Object * map , <nl> + Object * cell ) { <nl> + / / The address of the instruction following the call . <nl> + Address mov_instruction_address = <nl> + address + Assembler : : kCallTargetAddressOffset ; <nl> + / / If the instruction following the call is not a cmp eax , nothing <nl> + / / was inlined . <nl> + if ( * mov_instruction_address ! = kMovEcxByte ) return false ; <nl> + <nl> + Address delta_address = mov_instruction_address + 1 ; <nl> + / / The delta to the start of the map check instruction . <nl> + int delta = * reinterpret_cast < int * > ( delta_address ) ; <nl> + <nl> + / / The map address is the last 4 bytes of the 7 - byte <nl> + / / operand - immediate compare instruction , so we add 3 to get the <nl> + / / offset to the last 4 bytes . <nl> + Address map_address = mov_instruction_address + delta + 3 ; <nl> + * ( reinterpret_cast < Object * * > ( map_address ) ) = map ; <nl> + <nl> + / / The cell is in the last 4 bytes of a five byte mov reg , imm32 <nl> + / / instruction , so we add 1 to get the offset to the last 4 bytes . <nl> + Address offset_address = <nl> + mov_instruction_address + delta + kOffsetToLoadInstruction + 1 ; <nl> + * reinterpret_cast < Object * * > ( offset_address ) = cell ; <nl> + return true ; <nl> + } <nl> + <nl> + <nl> bool StoreIC : : PatchInlinedStore ( Address address , Object * map , int offset ) { <nl> / / The address of the instruction following the call . <nl> Address test_instruction_address = <nl> mmm a / src / ia32 / stub - cache - ia32 . cc <nl> ppp b / src / ia32 / stub - cache - ia32 . cc <nl> Object * LoadStubCompiler : : CompileLoadGlobal ( JSObject * object , <nl> __ Check ( not_equal , " DontDelete cells can ' t contain the hole " ) ; <nl> } <nl> <nl> - __ IncrementCounter ( & Counters : : named_load_global_inline , 1 ) ; <nl> + __ IncrementCounter ( & Counters : : named_load_global_stub , 1 ) ; <nl> __ mov ( eax , ebx ) ; <nl> __ ret ( 0 ) ; <nl> <nl> __ bind ( & miss ) ; <nl> - __ IncrementCounter ( & Counters : : named_load_global_inline_miss , 1 ) ; <nl> + __ IncrementCounter ( & Counters : : named_load_global_stub_miss , 1 ) ; <nl> GenerateLoadMiss ( masm ( ) , Code : : LOAD_IC ) ; <nl> <nl> / / Return the generated code . <nl> mmm a / src / ic . cc <nl> ppp b / src / ic . cc <nl> void LoadIC : : ClearInlinedVersion ( Address address ) { <nl> / / present ) to guarantee failure by holding an invalid map ( the null <nl> / / value ) . The offset can be patched to anything . <nl> PatchInlinedLoad ( address , Heap : : null_value ( ) , 0 ) ; <nl> + PatchInlinedContextualLoad ( address , Heap : : null_value ( ) , Heap : : null_value ( ) ) ; <nl> } <nl> <nl> <nl> Object * KeyedCallIC : : LoadFunction ( State state , <nl> } <nl> <nl> <nl> + # ifdef DEBUG <nl> + # define TRACE_IC_NAMED ( msg , name ) \ <nl> + if ( FLAG_trace_ic ) PrintF ( msg , * ( name ) - > ToCString ( ) ) <nl> + # else <nl> + # define TRACE_IC_NAMED ( msg , name ) <nl> + # endif <nl> + <nl> + <nl> Object * LoadIC : : Load ( State state , Handle < Object > object , Handle < String > name ) { <nl> / / If the object is undefined or null it ' s illegal to try to get any <nl> / / of its properties ; throw a TypeError in that case . <nl> Object * LoadIC : : Load ( State state , Handle < Object > object , Handle < String > name ) { <nl> LOG ( SuspectReadEvent ( * name , * object ) ) ; <nl> } <nl> <nl> - bool can_be_inlined = <nl> + bool can_be_inlined_precheck = <nl> FLAG_use_ic & & <nl> - state = = PREMONOMORPHIC & & <nl> lookup . IsProperty ( ) & & <nl> lookup . IsCacheable ( ) & & <nl> lookup . holder ( ) = = * object & & <nl> - lookup . type ( ) = = FIELD & & <nl> ! object - > IsAccessCheckNeeded ( ) ; <nl> <nl> + bool can_be_inlined = <nl> + can_be_inlined_precheck & & <nl> + state = = PREMONOMORPHIC & & <nl> + lookup . type ( ) = = FIELD ; <nl> + <nl> + bool can_be_inlined_contextual = <nl> + can_be_inlined_precheck & & <nl> + state = = UNINITIALIZED & & <nl> + lookup . holder ( ) - > IsGlobalObject ( ) & & <nl> + lookup . type ( ) = = NORMAL ; <nl> + <nl> if ( can_be_inlined ) { <nl> Map * map = lookup . holder ( ) - > map ( ) ; <nl> / / Property ' s index in the properties array . If negative we have <nl> Object * LoadIC : : Load ( State state , Handle < Object > object , Handle < String > name ) { <nl> int offset = map - > instance_size ( ) + ( index * kPointerSize ) ; <nl> if ( PatchInlinedLoad ( address ( ) , map , offset ) ) { <nl> set_target ( megamorphic_stub ( ) ) ; <nl> - # ifdef DEBUG <nl> - if ( FLAG_trace_ic ) { <nl> - PrintF ( " [ LoadIC : inline patch % s ] \ n " , * name - > ToCString ( ) ) ; <nl> - } <nl> - # endif <nl> + TRACE_IC_NAMED ( " [ LoadIC : inline patch % s ] \ n " , name ) ; <nl> return lookup . holder ( ) - > FastPropertyAt ( lookup . GetFieldIndex ( ) ) ; <nl> - # ifdef DEBUG <nl> } else { <nl> - if ( FLAG_trace_ic ) { <nl> - PrintF ( " [ LoadIC : no inline patch % s ( patching failed ) ] \ n " , <nl> - * name - > ToCString ( ) ) ; <nl> - } <nl> + TRACE_IC_NAMED ( " [ LoadIC : no inline patch % s ( patching failed ) ] \ n " , <nl> + name ) ; <nl> } <nl> } else { <nl> - if ( FLAG_trace_ic ) { <nl> - PrintF ( " [ LoadIC : no inline patch % s ( not inobject ) ] \ n " , <nl> - * name - > ToCString ( ) ) ; <nl> - } <nl> + TRACE_IC_NAMED ( " [ LoadIC : no inline patch % s ( not inobject ) ] \ n " , name ) ; <nl> + } <nl> + } else if ( can_be_inlined_contextual ) { <nl> + Map * map = lookup . holder ( ) - > map ( ) ; <nl> + JSGlobalPropertyCell * cell = JSGlobalPropertyCell : : cast ( <nl> + lookup . holder ( ) - > property_dictionary ( ) - > ValueAt ( <nl> + lookup . GetDictionaryEntry ( ) ) ) ; <nl> + if ( PatchInlinedContextualLoad ( address ( ) , map , cell ) ) { <nl> + set_target ( megamorphic_stub ( ) ) ; <nl> + TRACE_IC_NAMED ( " [ LoadIC : inline contextual patch % s ] \ n " , name ) ; <nl> + ASSERT ( cell - > value ( ) ! = Heap : : the_hole_value ( ) ) ; <nl> + return cell - > value ( ) ; <nl> } <nl> } else { <nl> if ( FLAG_use_ic & & state = = PREMONOMORPHIC ) { <nl> - if ( FLAG_trace_ic ) { <nl> - PrintF ( " [ LoadIC : no inline patch % s ( not inlinable ) ] \ n " , <nl> - * name - > ToCString ( ) ) ; <nl> - # endif <nl> - } <nl> + TRACE_IC_NAMED ( " [ LoadIC : no inline patch % s ( not inlinable ) ] \ n " , name ) ; <nl> } <nl> } <nl> <nl> mmm a / src / ic . h <nl> ppp b / src / ic . h <nl> class LoadIC : public IC { <nl> <nl> static bool PatchInlinedLoad ( Address address , Object * map , int index ) ; <nl> <nl> + static bool PatchInlinedContextualLoad ( Address address , <nl> + Object * map , <nl> + Object * cell ) ; <nl> + <nl> friend class IC ; <nl> } ; <nl> <nl> mmm a / src / v8 - counters . h <nl> ppp b / src / v8 - counters . h <nl> namespace internal { <nl> SC ( named_load_inline_miss , V8 . NamedLoadInlineMiss ) \ <nl> SC ( named_load_global_inline , V8 . NamedLoadGlobalInline ) \ <nl> SC ( named_load_global_inline_miss , V8 . NamedLoadGlobalInlineMiss ) \ <nl> + SC ( named_load_global_stub , V8 . NamedLoadGlobalStub ) \ <nl> + SC ( named_load_global_stub_miss , V8 . NamedLoadGlobalStubMiss ) \ <nl> SC ( keyed_store_field , V8 . KeyedStoreField ) \ <nl> SC ( keyed_store_inline , V8 . KeyedStoreInline ) \ <nl> SC ( keyed_store_inline_miss , V8 . KeyedStoreInlineMiss ) \ <nl> mmm a / src / x64 / ic - x64 . cc <nl> ppp b / src / x64 / ic - x64 . cc <nl> bool LoadIC : : PatchInlinedLoad ( Address address , Object * map , int offset ) { <nl> } <nl> <nl> <nl> + bool LoadIC : : PatchInlinedContextualLoad ( Address address , <nl> + Object * map , <nl> + Object * cell ) { <nl> + / / TODO ( < bug # > ) : implement this . <nl> + return false ; <nl> + } <nl> + <nl> + <nl> / / The offset from the inlined patch site to the start of the inlined <nl> / / store instruction . <nl> const int StoreIC : : kOffsetToStoreInstruction = 20 ; <nl> mmm a / src / x64 / stub - cache - x64 . cc <nl> ppp b / src / x64 / stub - cache - x64 . cc <nl> Object * LoadStubCompiler : : CompileLoadGlobal ( JSObject * object , <nl> __ Check ( not_equal , " DontDelete cells can ' t contain the hole " ) ; <nl> } <nl> <nl> - __ IncrementCounter ( & Counters : : named_load_global_inline , 1 ) ; <nl> + __ IncrementCounter ( & Counters : : named_load_global_stub , 1 ) ; <nl> __ movq ( rax , rbx ) ; <nl> __ ret ( 0 ) ; <nl> <nl> __ bind ( & miss ) ; <nl> - __ IncrementCounter ( & Counters : : named_load_global_inline_miss , 1 ) ; <nl> + __ IncrementCounter ( & Counters : : named_load_global_stub_miss , 1 ) ; <nl> GenerateLoadMiss ( masm ( ) , Code : : LOAD_IC ) ; <nl> <nl> / / Return the generated code . <nl>
|
Generate inline code for contextual loads .
|
v8/v8
|
ceb9d79d73bf6160068221ea6407637634ba5458
|
2010-09-20T13:50:27Z
|
deleted file mode 100644 <nl> index 04e0937703 . . 0000000000 <nl> Binary files a / src / Icons / oxygen / draw - rectangle . png and / dev / null differ <nl> deleted file mode 100644 <nl> index 3c29299bb1 . . 0000000000 <nl> Binary files a / src / Icons / oxygen / draw - triangle2 . png and / dev / null differ <nl> new file mode 100644 <nl> index 0000000000 . . c400345522 <nl> Binary files / dev / null and b / src / Icons / skin / checkingDL . png differ <nl> new file mode 100644 <nl> index 0000000000 . . 3f1c6247b6 <nl> Binary files / dev / null and b / src / Icons / skin / checkingUP . png differ <nl> Binary files a / src / Icons / skin / downloading . png and b / src / Icons / skin / downloading . png differ <nl> new file mode 100644 <nl> index 0000000000 . . f72b4406c5 <nl> Binary files / dev / null and b / src / Icons / skin / filteractive . png differ <nl> new file mode 100644 <nl> index 0000000000 . . 69d2e56f29 <nl> Binary files / dev / null and b / src / Icons / skin / filterall . png differ <nl> new file mode 100644 <nl> index 0000000000 . . b0a44063b3 <nl> Binary files / dev / null and b / src / Icons / skin / filterinactive . png differ <nl> new file mode 100644 <nl> index 0000000000 . . 9b5a283f0b <nl> Binary files / dev / null and b / src / Icons / skin / pausedDL . png differ <nl> new file mode 100644 <nl> index 0000000000 . . d4e3939f44 <nl> Binary files / dev / null and b / src / Icons / skin / pausedUP . png differ <nl> new file mode 100644 <nl> index 0000000000 . . 272cb57093 <nl> Binary files / dev / null and b / src / Icons / skin / queuedDL . png differ <nl> new file mode 100644 <nl> index 0000000000 . . 94ed8268d0 <nl> Binary files / dev / null and b / src / Icons / skin / queuedUP . png differ <nl> new file mode 100644 <nl> index 0000000000 . . ef2438eb8d <nl> Binary files / dev / null and b / src / Icons / skin / stalledDL . png differ <nl> new file mode 100644 <nl> index 0000000000 . . dd487b4324 <nl> Binary files / dev / null and b / src / Icons / skin / stalledUP . png differ <nl> new file mode 100644 <nl> index 0000000000 . . e1ebf3f699 <nl> Binary files / dev / null and b / src / Icons / skin / uploading . png differ <nl> mmm a / src / icons . qrc <nl> ppp b / src / icons . qrc <nl> <nl> < file > Icons / sphere . png < / file > <nl> < file > Icons / uparrow . png < / file > <nl> < file > Icons / rss16 . png < / file > <nl> + < file > Icons / skin / checkingUP . png < / file > <nl> < file > Icons / skin / play . png < / file > <nl> < file > Icons / skin / qbittorrent22 . png < / file > <nl> + < file > Icons / skin / queuedDL . png < / file > <nl> < file > Icons / skin / new . png < / file > <nl> + < file > Icons / skin / queuedUP . png < / file > <nl> < file > Icons / skin / preview . png < / file > <nl> < file > Icons / skin / stalled . png < / file > <nl> < file > Icons / skin / delete . png < / file > <nl> < file > Icons / skin / url . png < / file > <nl> + < file > Icons / skin / stalledUP . png < / file > <nl> + < file > Icons / skin / filteractive . png < / file > <nl> < file > Icons / skin / connected . png < / file > <nl> + < file > Icons / skin / pausedDL . png < / file > <nl> < file > Icons / skin / mascot . png < / file > <nl> + < file > Icons / skin / pausedUP . png < / file > <nl> < file > Icons / skin / seeding . png < / file > <nl> < file > Icons / skin / increase . png < / file > <nl> < file > Icons / skin / qbittorrent32 . png < / file > <nl> < file > Icons / skin / paused . png < / file > <nl> + < file > Icons / skin / stalledDL . png < / file > <nl> < file > Icons / skin / qb_question . png < / file > <nl> < file > Icons / skin / open . png < / file > <nl> < file > Icons / skin / qbittorrent16 . png < / file > <nl> < file > Icons / skin / downloading . png < / file > <nl> + < file > Icons / skin / filterinactive . png < / file > <nl> < file > Icons / skin / pause_all . png < / file > <nl> < file > Icons / skin / play_all . png < / file > <nl> < file > Icons / skin / pause . png < / file > <nl> <nl> < file > Icons / skin / info . png < / file > <nl> < file > Icons / skin / tabs . gif < / file > <nl> < file > Icons / skin / delete_perm . png < / file > <nl> + < file > Icons / skin / checkingDL . png < / file > <nl> < file > Icons / skin / settings . png < / file > <nl> < file > Icons / skin / exit . png < / file > <nl> < file > Icons / skin / delete_all . png < / file > <nl> < file > Icons / skin / splash . png < / file > <nl> < file > Icons / skin / decrease . png < / file > <nl> + < file > Icons / skin / uploading . png < / file > <nl> + < file > Icons / skin / filterall . png < / file > <nl> < file > Icons / flags / czech . png < / file > <nl> < file > Icons / flags / serbia . png < / file > <nl> < file > Icons / flags / iceland . png < / file > <nl> <nl> < file > Icons / oxygen / download . png < / file > <nl> < file > Icons / oxygen / application - x - kgetlist - no . png < / file > <nl> < file > Icons / oxygen / gear . png < / file > <nl> - < file > Icons / oxygen / draw - triangle2 . png < / file > <nl> < file > Icons / oxygen / remove . png < / file > <nl> < file > Icons / oxygen / dialog - warning . png < / file > <nl> < file > Icons / oxygen / peer . png < / file > <nl> <nl> < file > Icons / oxygen / urlseed . png < / file > <nl> < file > Icons / oxygen / edit - cut . png < / file > <nl> < file > Icons / oxygen / unsubscribe . png < / file > <nl> - < file > Icons / oxygen / draw - rectangle . png < / file > <nl> < file > Icons / oxygen / subscribe16 . png < / file > <nl> < / qresource > <nl> < / RCC > <nl> \ No newline at end of file <nl> mmm a / src / transferlistfilterswidget . h <nl> ppp b / src / transferlistfilterswidget . h <nl> class TransferListFiltersWidget : public QListWidget { <nl> / / Add filters <nl> QListWidgetItem * all = new QListWidgetItem ( this ) ; <nl> all - > setData ( Qt : : DisplayRole , tr ( " All " ) + " ( 0 ) " ) ; <nl> - all - > setData ( Qt : : DecorationRole , QIcon ( " : / Icons / oxygen / folder - remote16 . png " ) ) ; <nl> + all - > setData ( Qt : : DecorationRole , QIcon ( " : / Icons / skin / filterall . png " ) ) ; <nl> QListWidgetItem * downloading = new QListWidgetItem ( this ) ; <nl> downloading - > setData ( Qt : : DisplayRole , tr ( " Downloading " ) + " ( 0 ) " ) ; <nl> downloading - > setData ( Qt : : DecorationRole , QIcon ( " : / Icons / skin / downloading . png " ) ) ; <nl> QListWidgetItem * completed = new QListWidgetItem ( this ) ; <nl> completed - > setData ( Qt : : DisplayRole , tr ( " Completed " ) + " ( 0 ) " ) ; <nl> - completed - > setData ( Qt : : DecorationRole , QIcon ( " : / Icons / skin / seeding . png " ) ) ; <nl> + completed - > setData ( Qt : : DecorationRole , QIcon ( " : / Icons / skin / uploading . png " ) ) ; <nl> QListWidgetItem * active = new QListWidgetItem ( this ) ; <nl> active - > setData ( Qt : : DisplayRole , tr ( " Active " ) + " ( 0 ) " ) ; <nl> - active - > setData ( Qt : : DecorationRole , QIcon ( " : / Icons / oxygen / draw - triangle2 . png " ) ) ; <nl> + active - > setData ( Qt : : DecorationRole , QIcon ( " : / Icons / skin / filteractive . png " ) ) ; <nl> QListWidgetItem * inactive = new QListWidgetItem ( this ) ; <nl> inactive - > setData ( Qt : : DisplayRole , tr ( " Inactive " ) + " ( 0 ) " ) ; <nl> - inactive - > setData ( Qt : : DecorationRole , QIcon ( " : / Icons / oxygen / draw - rectangle . png " ) ) ; <nl> + inactive - > setData ( Qt : : DecorationRole , QIcon ( " : / Icons / skin / filterinactive . png " ) ) ; <nl> <nl> / / SIGNAL / SLOT <nl> connect ( this , SIGNAL ( currentRowChanged ( int ) ) , transferList , SLOT ( applyFilter ( int ) ) ) ; <nl> mmm a / src / transferlistwidget . cpp <nl> ppp b / src / transferlistwidget . cpp <nl> void TransferListWidget : : addTorrent ( QTorrentHandle & h ) { <nl> listModel - > setData ( listModel - > index ( row , TR_HASH ) , QVariant ( h . hash ( ) ) ) ; <nl> / / Pause torrent if it is <nl> if ( h . is_paused ( ) ) { <nl> - listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / skin / paused . png " ) ) ) , Qt : : DecorationRole ) ; <nl> - if ( h . is_seed ( ) ) <nl> + if ( h . is_seed ( ) ) { <nl> listModel - > setData ( listModel - > index ( row , TR_STATUS ) , STATE_PAUSED_UP ) ; <nl> - else <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / skin / pausedUP . png " ) ) ) , Qt : : DecorationRole ) ; <nl> + } else { <nl> listModel - > setData ( listModel - > index ( row , TR_STATUS ) , STATE_PAUSED_DL ) ; <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / skin / pausedDL . png " ) ) ) , Qt : : DecorationRole ) ; <nl> + } <nl> / / setRowColor ( row , QString : : fromUtf8 ( " red " ) ) ; <nl> } else { <nl> if ( h . is_seed ( ) ) { <nl> - listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / skin / seeding . png " ) ) ) , Qt : : DecorationRole ) ; <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / skin / stalledUP . png " ) ) ) , Qt : : DecorationRole ) ; <nl> listModel - > setData ( listModel - > index ( row , TR_STATUS ) , STATE_STALLED_UP ) ; <nl> } else { <nl> - listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / skin / stalled . png " ) ) ) , Qt : : DecorationRole ) ; <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / skin / stalledDL . png " ) ) ) , Qt : : DecorationRole ) ; <nl> listModel - > setData ( listModel - > index ( row , TR_STATUS ) , STATE_STALLED_DL ) ; <nl> } <nl> / / setRowColor ( row , QString : : fromUtf8 ( " grey " ) ) ; <nl> void TransferListWidget : : pauseTorrent ( int row , bool refresh_list ) { <nl> listModel - > setData ( listModel - > index ( row , TR_DLSPEED ) , QVariant ( ( double ) 0 . 0 ) ) ; <nl> listModel - > setData ( listModel - > index ( row , TR_UPSPEED ) , QVariant ( ( double ) 0 . 0 ) ) ; <nl> listModel - > setData ( listModel - > index ( row , TR_ETA ) , QVariant ( ( qlonglong ) - 1 ) ) ; <nl> - listModel - > setData ( listModel - > index ( row , TR_NAME ) , QIcon ( QString : : fromUtf8 ( " : / Icons / skin / paused . png " ) ) , Qt : : DecorationRole ) ; <nl> if ( h . is_seed ( ) ) { <nl> listModel - > setData ( listModel - > index ( row , TR_STATUS ) , STATE_PAUSED_UP ) ; <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QIcon ( QString : : fromUtf8 ( " : / Icons / skin / pausedUP . png " ) ) , Qt : : DecorationRole ) ; <nl> } else { <nl> listModel - > setData ( listModel - > index ( row , TR_STATUS ) , STATE_PAUSED_DL ) ; <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QIcon ( QString : : fromUtf8 ( " : / Icons / skin / pausedDL . png " ) ) , Qt : : DecorationRole ) ; <nl> } <nl> listModel - > setData ( listModel - > index ( row , TR_SEEDS ) , QVariant ( 0 . 0 ) ) ; <nl> listModel - > setData ( listModel - > index ( row , TR_PEERS ) , QVariant ( 0 . 0 ) ) ; <nl> void TransferListWidget : : resumeTorrent ( int row , bool refresh_list ) { <nl> QTorrentHandle h = BTSession - > getTorrentHandle ( getHashFromRow ( row ) ) ; <nl> if ( ! h . is_valid ( ) ) return ; <nl> if ( h . is_seed ( ) ) { <nl> - listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( " : / Icons / skin / seeding . png " ) ) , Qt : : DecorationRole ) ; <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( " : / Icons / skin / stalledUP . png " ) ) , Qt : : DecorationRole ) ; <nl> listModel - > setData ( listModel - > index ( row , TR_STATUS ) , STATE_STALLED_UP ) ; <nl> } else { <nl> - listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( " : / Icons / skin / stalled . png " ) ) , Qt : : DecorationRole ) ; <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( " : / Icons / skin / stalledDL . png " ) ) , Qt : : DecorationRole ) ; <nl> listModel - > setData ( listModel - > index ( row , TR_STATUS ) , STATE_STALLED_DL ) ; <nl> } <nl> if ( refresh_list ) <nl> int TransferListWidget : : updateTorrent ( int row ) { <nl> listModel - > setData ( listModel - > index ( row , TR_PRIORITY ) , QVariant ( ( int ) h . queue_position ( ) ) ) ; <nl> if ( h . is_queued ( ) ) { <nl> if ( h . state ( ) = = torrent_status : : checking_files | | h . state ( ) = = torrent_status : : queued_for_checking ) { <nl> - listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / oxygen / run - build . png " ) ) ) , Qt : : DecorationRole ) ; <nl> listModel - > setData ( listModel - > index ( row , TR_PROGRESS ) , QVariant ( ( double ) h . progress ( ) ) ) ; <nl> - if ( h . is_seed ( ) ) <nl> + if ( h . is_seed ( ) ) { <nl> s = STATE_CHECKING_UP ; <nl> - else <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / skin / checkingUP . png " ) ) ) , Qt : : DecorationRole ) ; <nl> + } else { <nl> s = STATE_CHECKING_DL ; <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / skin / checkingDL . png " ) ) ) , Qt : : DecorationRole ) ; <nl> + } <nl> listModel - > setData ( listModel - > index ( row , TR_STATUS ) , s ) ; <nl> } else { <nl> - listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / oxygen / mail - queue . png " ) ) ) , Qt : : DecorationRole ) ; <nl> listModel - > setData ( listModel - > index ( row , TR_ETA ) , QVariant ( ( qlonglong ) - 1 ) ) ; <nl> - if ( h . is_seed ( ) ) <nl> - s = STATE_QUEUED_UP ; <nl> - else <nl> + if ( h . is_seed ( ) ) { <nl> + s = STATE_QUEUED_UP ; <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / skin / queuedUP . png " ) ) ) , Qt : : DecorationRole ) ; <nl> + } else { <nl> s = STATE_QUEUED_DL ; <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / skin / queuedDL . png " ) ) ) , Qt : : DecorationRole ) ; <nl> + } <nl> listModel - > setData ( listModel - > index ( row , TR_STATUS ) , s ) ; <nl> } <nl> / / Reset speeds and seeds / leech <nl> int TransferListWidget : : updateTorrent ( int row ) { <nl> case torrent_status : : checking_files : <nl> case torrent_status : : queued_for_checking : <nl> case torrent_status : : checking_resume_data : <nl> - listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / oxygen / run - build . png " ) ) ) , Qt : : DecorationRole ) ; <nl> - if ( h . is_seed ( ) ) <nl> + if ( h . is_seed ( ) ) { <nl> s = STATE_CHECKING_UP ; <nl> - else <nl> + <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / skin / checkingUP . png " ) ) ) , Qt : : DecorationRole ) ; <nl> + } else { <nl> s = STATE_CHECKING_DL ; <nl> + <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / skin / checkingDL . png " ) ) ) , Qt : : DecorationRole ) ; <nl> + } <nl> listModel - > setData ( listModel - > index ( row , TR_PROGRESS ) , QVariant ( ( double ) h . progress ( ) ) ) ; <nl> listModel - > setData ( listModel - > index ( row , TR_ETA ) , QVariant ( ( qlonglong ) - 1 ) ) ; <nl> / / setRowColor ( row , QString : : fromUtf8 ( " grey " ) ) ; <nl> int TransferListWidget : : updateTorrent ( int row ) { <nl> s = STATE_DOWNLOADING ; <nl> / / setRowColor ( row , QString : : fromUtf8 ( " green " ) ) ; <nl> } else { <nl> - listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / skin / stalled . png " ) ) ) , Qt : : DecorationRole ) ; <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " : / Icons / skin / stalledDL . png " ) ) ) , Qt : : DecorationRole ) ; <nl> listModel - > setData ( listModel - > index ( row , TR_ETA ) , QVariant ( ( qlonglong ) - 1 ) ) ; <nl> s = STATE_STALLED_DL ; <nl> / / setRowColor ( row , QApplication : : palette ( ) . color ( QPalette : : WindowText ) ) ; <nl> void TransferListWidget : : setFinished ( QTorrentHandle & h ) { <nl> row = getRowFromHash ( h . hash ( ) ) ; <nl> if ( row > = 0 ) { <nl> if ( h . is_paused ( ) ) { <nl> - listModel - > setData ( listModel - > index ( row , TR_NAME ) , QIcon ( " : / Icons / skin / paused . png " ) , Qt : : DecorationRole ) ; <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QIcon ( " : / Icons / skin / pausedUP . png " ) , Qt : : DecorationRole ) ; <nl> listModel - > setData ( listModel - > index ( row , TR_STATUS ) , STATE_PAUSED_UP ) ; <nl> / / setRowColor ( row , " red " ) ; <nl> } else { <nl> - listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( " : / Icons / skin / seeding . png " ) ) , Qt : : DecorationRole ) ; <nl> + listModel - > setData ( listModel - > index ( row , TR_NAME ) , QVariant ( QIcon ( " : / Icons / skin / stalledUP . png " ) ) , Qt : : DecorationRole ) ; <nl> listModel - > setData ( listModel - > index ( row , TR_STATUS ) , STATE_STALLED_UP ) ; <nl> / / setRowColor ( row , " orange " ) ; <nl> } <nl>
|
- New torrent status icons by Mateusz Tobola
|
qbittorrent/qBittorrent
|
3eeeb73af4f78c5ba9675939c13f210ad48c4f76
|
2009-11-23T16:33:43Z
|
mmm a / CHANGELOG <nl> ppp b / CHANGELOG <nl> v2 . 3 . 0 ( XXXX - XX - XX ) <nl> * front - end : fetching and filtering of documents , statistics , and query operations are now <nl> handled with asynchronous ajax calls . <nl> <nl> - * front - end : added process indicator if the front - end is waiting for a server operation . <nl> + * front - end : added progress indicator if the front - end is waiting for a server operation . <nl> <nl> * front - end : fixed wrong count of documents in the documents view of a collection . <nl> <nl> v2 . 3 . 0 ( XXXX - XX - XX ) <nl> storing JavaScript date objects in the database in a sensible manner . <nl> <nl> <nl> + v2 . 2 . 3 ( 2014 - XX - XX ) <nl> + mmmmmmmmmmmmmmmmmm - <nl> + <nl> + * added ` type ` option for HTTP API ` GET / _api / document ? collection = . . . ` <nl> + <nl> + This allows controlling the type of results to be returned . By default , paths to <nl> + documents will be returned , e . g . <nl> + <nl> + [ <nl> + ` / _api / document / test / mykey1 ` , <nl> + ` / _api / document / test / mykey2 ` , <nl> + . . . <nl> + ] <nl> + <nl> + To return a list of document ids instead of paths , the ` type ` URL parameter can be <nl> + set to ` id ` : <nl> + <nl> + [ <nl> + ` test / mykey1 ` , <nl> + ` test / mykey2 ` , <nl> + . . . <nl> + ] <nl> + <nl> + To return a list of document keys only , the ` type ` URL parameter can be set to ` key ` : <nl> + <nl> + [ <nl> + ` mykey1 ` , <nl> + ` mykey2 ` , <nl> + . . . <nl> + ] <nl> + <nl> + <nl> + * propery capitalize HTTP response header field names in case the ` x - arango - async ` <nl> + HTTP header was used in a request . <nl> + <nl> + * fixed several documentation issues <nl> + <nl> + * speed up for several general - graph functions , AQL functions starting with ` GRAPH_ ` <nl> + and traversals <nl> + <nl> + <nl> v2 . 2 . 2 ( 2014 - 08 - 08 ) <nl> mmmmmmmmmmmmmmmmmm - <nl> <nl> mmm a / UnitTests / HttpInterface / api - document - read - spec . rb <nl> ppp b / UnitTests / HttpInterface / api - document - read - spec . rb <nl> <nl> end <nl> <nl> it " get all documents of an empty collection " do <nl> - cmd = " / _api / document ? collection = # { @ cid } " <nl> - <nl> # get documents <nl> cmd = " / _api / document ? collection = # { @ cid } " <nl> doc = ArangoDB . log_get ( " # { prefix } - all - 0 " , cmd ) <nl> <nl> ArangoDB . size_collection ( @ cid ) . should eq ( 0 ) <nl> end <nl> <nl> + it " get all documents of an empty collection , using type = id " do <nl> + # get documents <nl> + cmd = " / _api / document ? collection = # { @ cid } & type = id " <nl> + doc = ArangoDB . log_get ( " # { prefix } - all - type - id " , cmd ) <nl> + <nl> + doc . code . should eq ( 200 ) <nl> + doc . headers [ ' content - type ' ] . should eq ( " application / json ; charset = utf - 8 " ) <nl> + <nl> + documents = doc . parsed_response [ ' documents ' ] <nl> + documents . should be_kind_of ( Array ) <nl> + documents . length . should eq ( 0 ) <nl> + <nl> + ArangoDB . size_collection ( @ cid ) . should eq ( 0 ) <nl> + end <nl> + <nl> it " create three documents and read them using the collection identifier " do <nl> cmd = " / _api / document ? collection = # { @ cid } " <nl> <nl> <nl> <nl> ArangoDB . size_collection ( @ cid ) . should eq ( 0 ) <nl> end <nl> + <nl> + it " create three documents and read them using the collection name , type = id " do <nl> + cmd = " / _api / document ? collection = # { @ cn } " <nl> + <nl> + location = [ ] <nl> + <nl> + for i in [ 1 , 2 , 3 ] <nl> + body = " { \ " Hallo \ " : \ " World - # { i } \ " } " <nl> + doc = ArangoDB . post ( cmd , : body = > body ) <nl> + <nl> + doc . code . should eq ( 201 ) <nl> + <nl> + location . push ( doc . headers [ ' location ' ] ) <nl> + end <nl> + <nl> + # get documents <nl> + cmd = " / _api / document ? collection = # { @ cn } & type = id " <nl> + doc = ArangoDB . log_get ( " # { prefix } - all - name " , cmd ) <nl> + <nl> + doc . code . should eq ( 200 ) <nl> + doc . headers [ ' content - type ' ] . should eq ( " application / json ; charset = utf - 8 " ) <nl> + <nl> + documents = doc . parsed_response [ ' documents ' ] <nl> + documents . should be_kind_of ( Array ) <nl> + documents . length . should eq ( 3 ) <nl> + <nl> + regex = Regexp . new ( ' ^ ' + @ cn + ' / \ d + $ ' ) ; <nl> + documents . each { | document | <nl> + document . should match ( regex ) <nl> + } <nl> + end <nl> + <nl> + it " create three documents and read them using the collection name , type = key " do <nl> + cmd = " / _api / document ? collection = # { @ cn } " <nl> + <nl> + location = [ ] <nl> + <nl> + for i in [ 1 , 2 , 3 ] <nl> + body = " { \ " Hallo \ " : \ " World - # { i } \ " } " <nl> + doc = ArangoDB . post ( cmd , : body = > body ) <nl> + <nl> + doc . code . should eq ( 201 ) <nl> + <nl> + location . push ( doc . headers [ ' location ' ] ) <nl> + end <nl> + <nl> + # get documents <nl> + cmd = " / _api / document ? collection = # { @ cn } & type = key " <nl> + doc = ArangoDB . log_get ( " # { prefix } - all - name " , cmd ) <nl> + <nl> + doc . code . should eq ( 200 ) <nl> + doc . headers [ ' content - type ' ] . should eq ( " application / json ; charset = utf - 8 " ) <nl> + <nl> + documents = doc . parsed_response [ ' documents ' ] <nl> + documents . should be_kind_of ( Array ) <nl> + documents . length . should eq ( 3 ) <nl> + <nl> + regex = Regexp . new ( ' ^ \ d + $ ' ) ; <nl> + documents . each { | document | <nl> + document . should match ( regex ) <nl> + } <nl> + end <nl> end <nl> <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> mmm a / arangod / Cluster / ClusterMethods . cpp <nl> ppp b / arangod / Cluster / ClusterMethods . cpp <nl> int getDocumentOnCoordinator ( <nl> int getAllDocumentsOnCoordinator ( <nl> string const & dbname , <nl> string const & collname , <nl> + string const & returnType , <nl> triagens : : rest : : HttpResponse : : HttpResponseCode & responseCode , <nl> string & contentType , <nl> string & resultBody ) { <nl> int getAllDocumentsOnCoordinator ( <nl> res = cc - > asyncRequest ( " " , coordTransactionID , " shard : " + it - > first , <nl> triagens : : rest : : HttpRequest : : HTTP_REQUEST_GET , <nl> " / _db / " + StringUtils : : urlEncode ( dbname ) + " / _api / document ? collection = " + <nl> - it - > first , 0 , false , headers , NULL , 3600 . 0 ) ; <nl> + it - > first + " & type = " + StringUtils : : urlEncode ( returnType ) , 0 , false , headers , NULL , 3600 . 0 ) ; <nl> delete res ; <nl> } <nl> / / Now listen to the results : <nl> mmm a / arangod / Cluster / ClusterMethods . h <nl> ppp b / arangod / Cluster / ClusterMethods . h <nl> namespace triagens { <nl> int getAllDocumentsOnCoordinator ( <nl> string const & dbname , <nl> string const & collname , <nl> + string const & returnType , <nl> triagens : : rest : : HttpResponse : : HttpResponseCode & responseCode , <nl> string & contentType , <nl> string & resultBody ) ; <nl> mmm a / arangod / RestHandler / RestDocumentHandler . cpp <nl> ppp b / arangod / RestHandler / RestDocumentHandler . cpp <nl> bool RestDocumentHandler : : getDocumentCoordinator ( <nl> / / / @ RESTQUERYPARAM { collection , string , required } <nl> / / / The name of the collection . <nl> / / / <nl> + / / / @ RESTQUERYPARAM { type , string , optional } <nl> + / / / The type of the result . The following values are allowed : <nl> + / / / <nl> + / / / - * id * : returns a list of document ids ( * _id * attributes ) <nl> + / / / - * key * : returns a list of document keys ( * _key * attributes ) <nl> + / / / - * path * : returns a list of document URI paths . This is the default . <nl> + / / / <nl> / / / @ RESTDESCRIPTION <nl> - / / / Returns a list of all URI for all documents from the collection identified <nl> - / / / by * collection * . <nl> + / / / Returns a list of all keys , ids , or URI paths for all documents in the <nl> + / / / collection identified by * collection * . The type of the result list is <nl> + / / / determined by the * type * attribute . <nl> + / / / <nl> + / / / Note that the results have no defined order and thus the order should <nl> + / / / not be relied on . <nl> / / / <nl> / / / @ RESTRETURNCODES <nl> / / / <nl> bool RestDocumentHandler : : getDocumentCoordinator ( <nl> / / / <nl> / / / @ EXAMPLES <nl> / / / <nl> - / / / Returns a all ids . <nl> + / / / Returns all document paths <nl> / / / <nl> - / / / @ EXAMPLE_ARANGOSH_RUN { RestDocumentHandlerReadDocumentAll } <nl> + / / / @ EXAMPLE_ARANGOSH_RUN { RestDocumentHandlerReadDocumentAllPath } <nl> / / / var cn = " products " ; <nl> / / / db . _drop ( cn ) ; <nl> / / / db . _create ( cn ) ; <nl> bool RestDocumentHandler : : getDocumentCoordinator ( <nl> / / / logJsonResponse ( response ) ; <nl> / / / @ END_EXAMPLE_ARANGOSH_RUN <nl> / / / <nl> + / / / Returns all document keys <nl> + / / / <nl> + / / / @ EXAMPLE_ARANGOSH_RUN { RestDocumentHandlerReadDocumentAllKey } <nl> + / / / var cn = " products " ; <nl> + / / / db . _drop ( cn ) ; <nl> + / / / db . _create ( cn ) ; <nl> + / / / <nl> + / / / db . products . save ( { " hello1 " : " world1 " } ) ; <nl> + / / / db . products . save ( { " hello2 " : " world1 " } ) ; <nl> + / / / db . products . save ( { " hello3 " : " world1 " } ) ; <nl> + / / / var url = " / _api / document / ? collection = " + cn + " & type = key " ; <nl> + / / / <nl> + / / / var response = logCurlRequest ( ' GET ' , url ) ; <nl> + / / / <nl> + / / / assert ( response . code = = = 200 ) ; <nl> + / / / <nl> + / / / logJsonResponse ( response ) ; <nl> + / / / @ END_EXAMPLE_ARANGOSH_RUN <nl> + / / / <nl> / / / Collection does not exist . <nl> / / / <nl> / / / @ EXAMPLE_ARANGOSH_RUN { RestDocumentHandlerReadDocumentAllCollectionDoesNotExist } <nl> bool RestDocumentHandler : : getDocumentCoordinator ( <nl> bool RestDocumentHandler : : readAllDocuments ( ) { <nl> bool found ; <nl> string collection = _request - > value ( " collection " , found ) ; <nl> + string returnType = _request - > value ( " type " , found ) ; <nl> + <nl> + if ( returnType . empty ( ) ) { <nl> + returnType = " path " ; <nl> + } <nl> <nl> if ( ServerState : : instance ( ) - > isCoordinator ( ) ) { <nl> - return getAllDocumentsCoordinator ( collection ) ; <nl> + return getAllDocumentsCoordinator ( collection , returnType ) ; <nl> } <nl> <nl> / / find and load collection given by name or identifier <nl> bool RestDocumentHandler : : readAllDocuments ( ) { <nl> <nl> res = trx . read ( ids ) ; <nl> <nl> - TRI_col_type_e typ = trx . documentCollection ( ) - > _info . _type ; <nl> + TRI_col_type_e type = trx . documentCollection ( ) - > _info . _type ; <nl> <nl> res = trx . finish ( res ) ; <nl> <nl> bool RestDocumentHandler : : readAllDocuments ( ) { <nl> <nl> bool first = true ; <nl> string prefix ; <nl> - if ( typ = = TRI_COL_TYPE_EDGE ) { <nl> - prefix = ' " ' + EDGE_PATH + ' / ' + trx . resolver ( ) - > getCollectionName ( cid ) + ' / ' ; <nl> + <nl> + if ( returnType = = " key " ) { <nl> + prefix = ' " ' ; <nl> + } <nl> + else if ( returnType = = " id " ) { <nl> + prefix = ' " ' + trx . resolver ( ) - > getCollectionName ( cid ) + " \ \ / " ; <nl> } <nl> else { <nl> - prefix = ' " ' + DOCUMENT_PATH + ' / ' + trx . resolver ( ) - > getCollectionName ( cid ) + ' / ' ; <nl> + / / default return type : paths to documents <nl> + if ( type = = TRI_COL_TYPE_EDGE ) { <nl> + prefix = ' " ' + EDGE_PATH + ' / ' + trx . resolver ( ) - > getCollectionName ( cid ) + ' / ' ; <nl> + } <nl> + else { <nl> + prefix = ' " ' + DOCUMENT_PATH + ' / ' + trx . resolver ( ) - > getCollectionName ( cid ) + ' / ' ; <nl> + } <nl> } <nl> <nl> - for ( vector < string > : : const_iterator i = ids . begin ( ) ; i ! = ids . end ( ) ; + + i ) { <nl> + for ( auto id : ids ) { <nl> / / collection names do not need to be JSON - escaped <nl> / / keys do not need to be JSON - escaped <nl> - result + = prefix + ( * i ) + ' " ' ; <nl> + result + = prefix + id + ' " ' ; <nl> <nl> if ( first ) { <nl> prefix = " , \ n " + prefix ; <nl> bool RestDocumentHandler : : readAllDocuments ( ) { <nl> / / / @ brief reads a single a document , coordinator case in a cluster <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - bool RestDocumentHandler : : getAllDocumentsCoordinator ( <nl> - string const & collname ) { <nl> + bool RestDocumentHandler : : getAllDocumentsCoordinator ( string const & collname , <nl> + string const & returnType ) { <nl> string const & dbname = _request - > databaseName ( ) ; <nl> <nl> triagens : : rest : : HttpResponse : : HttpResponseCode responseCode ; <nl> bool RestDocumentHandler : : getAllDocumentsCoordinator ( <nl> string resultBody ; <nl> <nl> int error = triagens : : arango : : getAllDocumentsOnCoordinator ( <nl> - dbname , collname , responseCode , contentType , resultBody ) ; <nl> + dbname , collname , returnType , responseCode , contentType , resultBody ) ; <nl> <nl> if ( error ! = TRI_ERROR_NO_ERROR ) { <nl> generateTransactionError ( collname , error ) ; <nl> mmm a / arangod / RestHandler / RestDocumentHandler . h <nl> ppp b / arangod / RestHandler / RestDocumentHandler . h <nl> namespace triagens { <nl> / / / @ brief read all documents , coordinator case in a cluster <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - bool getAllDocumentsCoordinator ( string const & collname ) ; <nl> + bool getAllDocumentsCoordinator ( string const & collname , <nl> + string const & returnType ) ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief read a single document , coordinator case in a cluster <nl>
|
added ` type ` option for ` GET / _api / document ? collection = . . . `
|
arangodb/arangodb
|
c0463a1797717474532cdb6d3ddf31aa76ff2982
|
2014-08-30T15:26:24Z
|
mmm a / ios / sdk / WeexSDK / Sources / Bridge / WXDebugLoggerBridge . m <nl> ppp b / ios / sdk / WeexSDK / Sources / Bridge / WXDebugLoggerBridge . m <nl> - ( void ) _executionMsgAry <nl> { <nl> if ( ! _isConnect ) return ; <nl> <nl> - for ( NSString * msg in _msgAry ) { <nl> + NSArray * templateContainers = [ NSArray arrayWithArray : _msgAry ] ; <nl> + for ( NSString * msg in templateContainers ) { <nl> [ _webSocket send : msg ] ; <nl> } <nl> [ _msgAry removeAllObjects ] ; <nl>
|
* [ ios ] fix debugLoggerBridge crash
|
apache/incubator-weex
|
bce9e0d32396836881834461be614387afd80830
|
2016-08-22T03:59:36Z
|
mmm a / fdbclient / FileBackupAgent . actor . cpp <nl> ppp b / fdbclient / FileBackupAgent . actor . cpp <nl> class FileBackupAgentImpl { <nl> oldRestore . clear ( tr ) ; <nl> } <nl> <nl> - for ( auto & restoreRange : restoreRanges ) { <nl> - KeyRange restoreIntoRange = KeyRangeRef ( restoreRange . begin , restoreRange . end ) . removePrefix ( removePrefix ) . withPrefix ( addPrefix ) ; <nl> + state int index ; <nl> + for ( index = 0 ; index < restoreRanges . size ( ) ; index + + ) { <nl> + KeyRange restoreIntoRange = KeyRangeRef ( restoreRanges [ index ] . begin , restoreRanges [ index ] . end ) . removePrefix ( removePrefix ) . withPrefix ( addPrefix ) ; <nl> Standalone < RangeResultRef > existingRows = wait ( tr - > getRange ( restoreIntoRange , 1 ) ) ; <nl> if ( existingRows . size ( ) > 0 ) { <nl> throw restore_destination_not_empty ( ) ; <nl>
|
Code refactor to fix windows msvc14 compiler errors .
|
apple/foundationdb
|
b9acc9a0e89e261626369ce9edd67c717dc761b7
|
2019-03-08T23:13:11Z
|
mmm a / IndexLinear . cu <nl> ppp b / IndexLinear . cu <nl> const int THREADS_PER_BLOCK = 256 ; <nl> const int THREADS_X = 32 ; <nl> const int THREADS_Y = THREADS_PER_BLOCK / THREADS_X ; <nl> const int REPEAT = 32 ; <nl> + const long NNZ_PER_BLOCK_MAX = 1024 ; <nl> <nl> / * sign MACRO * / <nl> # ifndef clamp <nl> # define clamp ( a , low , high ) max ( min ( ( a ) , ( high ) ) , ( low ) ) <nl> # endif <nl> <nl> - template < typename Ty > <nl> + # ifndef ATOMIC_REAL_MINMAX <nl> + # define ATOMIC_REAL_MINMAX ( func ) \ <nl> + __device__ void atomic_ # # func ( double * address , double val ) { \ <nl> + unsigned long long int * address_as_ull = ( unsigned long long int * ) address ; \ <nl> + unsigned long long int old = * address_as_ull ; \ <nl> + unsigned long long int assumed ; \ <nl> + do { \ <nl> + assumed = old ; \ <nl> + old = atomicCAS ( address_as_ull , assumed , \ <nl> + __double_as_longlong ( func ( val , __longlong_as_double ( assumed ) ) ) ) ; \ <nl> + } while ( assumed ! = old ) ; \ <nl> + } \ <nl> + __device__ void atomic_ # # func ( float * address , float val ) { \ <nl> + int * address_as_int = ( int * ) address ; \ <nl> + int old = * address_as_int ; \ <nl> + int assumed ; \ <nl> + do { \ <nl> + assumed = old ; \ <nl> + old = atomicCAS ( address_as_int , assumed , \ <nl> + __float_as_int ( func ( val , __int_as_float ( assumed ) ) ) ) ; \ <nl> + } while ( assumed ! = old ) ; \ <nl> + } \ <nl> + <nl> + ATOMIC_REAL_MINMAX ( max ) <nl> + ATOMIC_REAL_MINMAX ( min ) <nl> + # endif <nl> + <nl> + template < typename Ty , bool train > <nl> __global__ static <nl> void updateOutput ( <nl> Ty * output , <nl> + Ty * normalizedValues , <nl> const Ty * values , <nl> const long * cumSumSizes , <nl> const long * keys , <nl> void updateOutput ( <nl> const Ty * bias , <nl> const long weightStride , <nl> const long keysOffset , <nl> - int maxNormalize ) <nl> + const int maxNormalize , <nl> + const int nnzPerBlock ) <nl> { <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> - * Adopted from the following file in arrayfire <nl> - * https : / / github . com / arrayfire / arrayfire / blob / v3 . 4 . 1 / src / backend / opencl / kernel / csrmv . cl <nl> + * Adapted from the following file in arrayfire <nl> + * https : / / github . com / arrayfire / arrayfire / blob / v3 . 4 . 1 / src / backend / opencl / kernel / csrmm . cl <nl> * <nl> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> * Original copyright notice can be seen below : <nl> void updateOutput ( <nl> * http : / / arrayfire . com / licenses / BSD - 3 - Clause <nl> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> <nl> - const long goff = blockIdx . x * blockDim . x ; <nl> - const long gidx = goff + threadIdx . x ; <nl> - const long tid = threadIdx . x ; <nl> + const long tidx = threadIdx . x ; <nl> + const long tidy = threadIdx . y ; <nl> + const long tid = tidy * blockDim . x + tidx ; <nl> + const long gidx = blockIdx . x * blockDim . x + tidx ; <nl> + <nl> <nl> Ty * nWeight = weight ; <nl> / / Offset the number of elements specified by maxNormalize <nl> weight + = gidx + maxNormalize ; <nl> output + = gidx ; <nl> <nl> - <nl> bool within_N = ( gidx < outDim ) ; <nl> <nl> __shared__ Ty s_values [ THREADS_PER_BLOCK ] ; <nl> void updateOutput ( <nl> / / if ( rowId > = batchSize ) return ; <nl> <nl> / / Load the nonzero column offsets for current row <nl> - const long batchStart = rowId = = 0 ? 0 : cumSumSizes [ rowId - 1 ] ; <nl> - const long batchEnd = cumSumSizes [ rowId ] ; <nl> + const long batchStart = ( rowId = = 0 ? 0 : cumSumSizes [ rowId - 1 ] ) + blockIdx . z * nnzPerBlock ; <nl> + const long batchEnd = min ( batchStart + nnzPerBlock , cumSumSizes [ rowId ] ) ; <nl> + const long batchStride = blockDim . x * blockDim . y ; <nl> <nl> - Ty outval = 0 ; <nl> + Ty outVal = 0 ; <nl> / / Since the number of nonzero elements might be greater than local memory available , <nl> / / Load only part of the row into local memory , perform partial dot , repeat until done . <nl> - for ( long id = batchStart ; id < batchEnd ; id + = blockDim . x ) { <nl> + for ( long id = batchStart ; id < batchEnd ; id + = batchStride ) { <nl> / / Load the current chunk of the row into local memory <nl> - long lim = min ( batchEnd - id , ( long ) blockDim . x ) ; <nl> + long lim = min ( batchEnd - id , ( long ) batchStride ) ; <nl> <nl> - / / Subtract 1 from keys [ id + tid ] to convert base 1 to base 0 <nl> long key = tid < lim ? keys [ id + tid ] + keysOffset : - 1 ; <nl> Ty val = tid < lim ? values [ id + tid ] : 0 ; <nl> - <nl> - if ( maxNormalize & & tid < lim ) { <nl> - Ty * nWeightCurr = nWeight + key * weightStride ; <nl> - val = clamp ( val * nWeightCurr [ 1 ] , - 1 . 0 , 1 . 0 ) + nWeightCurr [ 3 ] ; <nl> + long nWeightOffset = key * weightStride ; <nl> + <nl> + if ( tid < lim & & maxNormalize ) { <nl> + Ty * nWeightCurr = nWeight + nWeightOffset ; <nl> + if ( train ) { <nl> + Ty absVal = fabs ( val ) ; <nl> + Ty maxVal = nWeight [ key * weightStride + 0 ] ; <nl> + if ( absVal > maxVal ) { <nl> + / / Updating maxVal and invMaxVal . Go hogwild ! <nl> + atomic_max ( nWeightCurr + 0 , absVal ) ; <nl> + atomic_min ( nWeightCurr + 1 , 1 . 0 / absVal ) ; <nl> + } <nl> + val = val * nWeightCurr [ 1 ] + nWeightCurr [ 3 ] ; <nl> + normalizedValues [ id + tid ] = val ; <nl> + } else { <nl> + val = clamp ( val * nWeightCurr [ 1 ] , - 1 . 0 , 1 . 0 ) + nWeightCurr [ 3 ] ; <nl> + } <nl> } <nl> <nl> s_keys [ tid ] = key ; <nl> void updateOutput ( <nl> __syncthreads ( ) ; <nl> <nl> / / Perform a single " dot " operation for each thread <nl> - for ( long idy = 0 ; within_N & & idy < lim ; idy + + ) { <nl> - outval + = s_values [ idy ] * weight [ weightStride * s_keys [ idy ] ] ; <nl> - } <nl> - __syncthreads ( ) ; <nl> - } <nl> - <nl> - if ( within_N ) { <nl> - output [ rowId * outDim ] = outval + bias [ gidx ] ; <nl> - } <nl> - } <nl> - <nl> - / / This kernel is launched with [ M x 1 ] blocks of size [ X x Y ] . <nl> - / / Each block writes X entries to the output for the given batchId . <nl> - template < typename Ty > <nl> - __global__ static <nl> - void updateOutputTrain ( <nl> - Ty * output , <nl> - Ty * normalizedValues , <nl> - const Ty * values , <nl> - const long * cumSumSizes , <nl> - const long * keys , <nl> - const long batchSize , <nl> - const long outDim , <nl> - Ty * weight , <nl> - const Ty * bias , <nl> - const long weightStride , <nl> - const long keysOffset , <nl> - int maxNormalize , <nl> - long batchId ) <nl> - { <nl> - const long tidx = threadIdx . x ; <nl> - const long tidy = threadIdx . y ; <nl> - const long tid = tidy * blockDim . x + tidx ; <nl> - const long gidx = blockIdx . x * blockDim . x + tidx ; <nl> - <nl> - const long batchStart = batchId = = 0 ? 0 : cumSumSizes [ batchId - 1 ] ; <nl> - const long batchEnd = cumSumSizes [ batchId ] ; <nl> - const long batchLimit = batchEnd - batchStart ; <nl> - <nl> - / / A dot operation is performed by a single block . <nl> - / / Calculate the number of iterations required to load all elements from current batch . <nl> - const long iters = divup ( batchLimit , blockDim . x * blockDim . y ) ; <nl> - <nl> - Ty * nWeight = weight ; <nl> - / / Offset to the current output id <nl> - weight + = maxNormalize + gidx ; <nl> - output + = batchId * outDim + gidx ; <nl> - <nl> - / / Offset to the current batch <nl> - keys + = batchStart ; <nl> - values + = batchStart ; <nl> - normalizedValues + = batchStart ; <nl> - <nl> - __shared__ Ty s_values [ THREADS_PER_BLOCK ] ; <nl> - __shared__ long s_keys [ THREADS_PER_BLOCK ] ; <nl> - <nl> - Ty outVal = 0 ; <nl> - / / Not bailing early because we need __syncthreads later <nl> - for ( long n = 0 ; n < iters ; n + + ) { <nl> - long off = n * blockDim . y * blockDim . x ; <nl> - long lim = min ( ( long ) blockDim . y * blockDim . x , batchLimit - off ) ; <nl> - <nl> - <nl> - / / Each block uses all of its threads to load data . <nl> - / / This ensures coalesced reads from global memory . <nl> - / / Each variable in shared memory is then used by all the threads in a warp . <nl> - if ( tid < lim ) { <nl> - Ty val = values [ off + tid ] ; <nl> - long key = keys [ off + tid ] + keysOffset ; <nl> - long nWeightOffset = key * weightStride ; <nl> - <nl> - Ty absVal = fabs ( val ) ; <nl> - Ty maxVal = nWeight [ key * weightStride + 0 ] ; <nl> - if ( absVal > maxVal ) { <nl> - / / Updating maxVal and invMaxVal <nl> - nWeight [ nWeightOffset + 0 ] = absVal ; <nl> - nWeight [ nWeightOffset + 1 ] = 1 . 0 / absVal ; <nl> - maxVal = absVal ; <nl> - } <nl> - <nl> - / / TODO : implement a smarter update scale following the CPU implementation . <nl> - nWeight [ nWeightOffset + 2 ] = 1 . 0 ; <nl> - s_values [ tid ] = val / maxVal + nWeight [ nWeightOffset + 3 ] ; <nl> - s_keys [ tid ] = key ; <nl> - normalizedValues [ off + tid ] = s_values [ tid ] ; <nl> - } <nl> - __syncthreads ( ) ; <nl> - <nl> - if ( gidx < outDim ) { <nl> - / / Performing the partial dot operation for each thread <nl> - for ( long id = tidy ; id < lim ; id + = blockDim . y ) { <nl> - outVal + = s_values [ id ] * weight [ weightStride * s_keys [ id ] ] ; <nl> - } <nl> + for ( long idy = tidy ; within_N & & idy < lim ; idy + = blockDim . y ) { <nl> + outVal + = s_values [ idy ] * weight [ weightStride * s_keys [ idy ] ] ; <nl> } <nl> __syncthreads ( ) ; <nl> } <nl> void updateOutputTrain ( <nl> if ( tidy < y ) s_values [ tid ] = s_values [ tid ] + s_values [ tid + y * blockDim . x ] ; <nl> } <nl> <nl> - / / Writing the final value from the first lane into the output . <nl> - if ( gidx < outDim & & tidy = = 0 ) { <nl> - * output = s_values [ tid ] + bias [ gidx ] ; <nl> + if ( within_N & & tidy = = 0 ) { <nl> + Ty val = s_values [ tid ] + ( blockIdx . z = = 0 ? bias [ gidx ] : 0 ) ; <nl> + if ( gridDim . z = = 1 ) { <nl> + output [ rowId * outDim ] = val ; <nl> + } else { <nl> + atomicAdd ( output + rowId * outDim , val ) ; <nl> + } <nl> } <nl> } <nl> <nl> mmm a / generic / IndexLinear . cu <nl> ppp b / generic / IndexLinear . cu <nl> void THNN_ ( IndexLinear_updateOutput ) ( <nl> long weightStride = weight - > stride [ 0 ] ; <nl> int maxNormalize = wDim - outDim ; <nl> long keysSize = keys - > size [ 0 ] ; <nl> + long nnzPerRow = divup ( keysSize , batchSize ) ; <nl> <nl> THCTensor_ ( resize2d ) ( state , output , batchSize , outDim ) ; <nl> long * keysData = THCudaLongTensor_data ( state , keys ) ; <nl> void THNN_ ( IndexLinear_updateOutput ) ( <nl> real * outData = THCTensor_ ( data ) ( state , output ) ; <nl> <nl> cudaStream_t stream = THCState_getCurrentStream ( state ) ; <nl> + dim3 threads ( THREADS_X , THREADS_Y ) ; <nl> + int blocks_x = divup ( outDim , threads . x ) ; <nl> + int blocks_y = batchSize ; <nl> + int nnzPerBlock = ( ( outDim = = 1 | | batchSize = = 1 ) ? THREADS_X : NNZ_PER_BLOCK_MAX ) ; <nl> + int blocks_z = divup ( nnzPerRow , nnzPerBlock ) ; <nl> + <nl> + dim3 blocks ( blocks_x , blocks_y , blocks_z ) ; <nl> + <nl> + if ( blocks_z > 1 ) { <nl> + THCudaCheck ( cudaMemsetAsync ( outData , 0 , outDim * batchSize * sizeof ( real ) , stream ) ) ; <nl> + } <nl> <nl> + real * normalizedValuesData = NULL ; <nl> if ( maxNormalize & & train ) { <nl> THCTensor_ ( resize1d ) ( state , normalizedValues , keysSize ) ; <nl> - real * normalizedValuesData = THCTensor_ ( data ) ( state , normalizedValues ) ; <nl> - dim3 threads ( THREADS_X , THREADS_Y ) ; <nl> - int blocks_x = divup ( outDim , threads . x ) ; <nl> - int blocks_y = 1 ; <nl> - dim3 blocks ( blocks_x , blocks_y ) ; <nl> - for ( long batchId = 0 ; batchId < batchSize ; batchId + + ) { <nl> - updateOutputTrain < real > < < < blocks , threads , 0 , stream > > > <nl> - ( outData , normalizedValuesData , valuesData , cumSumSizesData , keysData , <nl> - batchSize , outDim , weightData , biasData , weightStride , keysOffset , <nl> - maxNormalize , batchId ) ; <nl> - } <nl> + normalizedValuesData = THCTensor_ ( data ) ( state , normalizedValues ) ; <nl> + updateOutput < real , true > < < < blocks , threads , 0 , stream > > > <nl> + ( outData , normalizedValuesData , valuesData , cumSumSizesData , keysData , <nl> + batchSize , outDim , weightData , biasData , weightStride , keysOffset , maxNormalize , nnzPerBlock ) ; <nl> } else { <nl> - int threads = THREADS_PER_BLOCK ; <nl> - int blocks_x = divup ( outDim , threads ) ; <nl> - int blocks_y = batchSize ; <nl> - dim3 blocks ( blocks_x , blocks_y ) ; <nl> - updateOutput < real > < < < blocks , threads , 0 , stream > > > <nl> - ( outData , valuesData , cumSumSizesData , keysData , batchSize , outDim , <nl> - weightData , biasData , weightStride , keysOffset , maxNormalize ) ; <nl> + updateOutput < real , false > < < < blocks , threads , 0 , stream > > > <nl> + ( outData , normalizedValuesData , valuesData , cumSumSizesData , keysData , <nl> + batchSize , outDim , weightData , biasData , weightStride , keysOffset , maxNormalize , nnzPerBlock ) ; <nl> } <nl> } <nl> <nl>
|
Improving the performance of IndexLinear : updateOutput
|
pytorch/pytorch
|
1461709ea0ae56230cf2c4ae081f426470161450
|
2017-03-24T23:34:31Z
|
mmm a / tensorflow / core / BUILD <nl> ppp b / tensorflow / core / BUILD <nl> tf_cuda_only_cc_test ( <nl> " : test " , <nl> " : test_main " , <nl> " / / third_party / eigen3 " , <nl> - ] , <nl> + ] + if_mkl ( <nl> + [ <nl> + " / / third_party / mkl : intel_binary_blob " , <nl> + ] , <nl> + ) , <nl> ) <nl> <nl> tf_cc_test_gpu ( <nl>
|
Fixing util_cuda_kernel_helper_test_gpu when building with MKL enabled ( )
|
tensorflow/tensorflow
|
2c133de38ea8ac0493265fe3bea267ec28ba8ecb
|
2018-05-10T18:37:19Z
|
mmm a / doc / guide . md <nl> ppp b / doc / guide . md <nl> To run the examples locally , you will need to build them with ` ` ` make ` ` ` . <nl> * [ Fault Tolerance ] ( # fault - tolerance ) <nl> <nl> What is Allreduce <nl> - = = = = = = = = = = = = = = = = = <nl> + mmmmmmmmmmmmmmm - - <nl> The main methods provided by rabit are Allreduce and Broadcast . Allreduce performs reduction across different computation nodes , <nl> and returns the result to every node . To understand the behavior of the function , consider the following example in [ basic . cc ] ( https : / / github . com / dmlc / rabit / blob / master / guide / basic . cc ) ( there is a python example right after this if you are more familiar with python ) . <nl> ` ` ` c + + <nl> rabit . finalize ( ) <nl> ` ` ` <nl> <nl> Common Use Case <nl> - = = = = = <nl> + mmmmmmmmmmmmmmm <nl> Many distributed machine learning algorithms involve splitting the data into different nodes , <nl> computing statistics locally , and finally aggregating them . Such workflow is usually done repetitively through many iterations before the algorithm converges . Allreduce naturally meets the structure of such programs , <nl> common use cases include : <nl> common use cases include : <nl> Rabit is a reliable and portable library for distributed machine learning programs , that allow programs to run reliably on different platforms . <nl> <nl> Use Rabit API <nl> - = = = = <nl> + mmmmmmmmmmmm - <nl> This section introduces topics about how to use rabit API . <nl> You can always refer to [ API Documentation ] ( http : / / homes . cs . washington . edu / ~ tqchen / rabit / doc ) for definition of each functions . <nl> This section trys to gives examples of different aspectes of rabit API . <nl> improve the efficiency of the program . <nl> <nl> <nl> Compile Programs with Rabit <nl> - = = = = <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> Rabit is a portable library , to use it , you only need to include the rabit header file . <nl> * You will need to add the path to [ . . / include ] ( . . / include ) to the header search path of the compiler <nl> - Solution 1 : add ` ` ` - I / path / to / rabit / include ` ` ` to the compiler flag in gcc or clang <nl> For example , consider the following script in the test case <nl> - Note that ndeath = 1 means this will happen only if node 1 died once , which is our case <nl> <nl> Running Rabit Jobs <nl> - = = = = <nl> + mmmmmmmmmmmmmmmmmm <nl> Rabit is a portable library that can run on multiple platforms . <nl> <nl> # # # # Running Rabit Locally <nl> Note that the current rabit tracker does not restart a worker when it dies , the <nl> - rabit - yarn provides such functionality in YARN <nl> <nl> Fault Tolerance <nl> - = = = = = <nl> + mmmmmmmmmmmmmmm <nl> This section introduces how fault tolerance works in rabit . <nl> The following figure shows how rabit deals with failures . <nl> <nl>
|
change to subtitle
|
dmlc/xgboost
|
800198349f0e1be276981427ffa3cadd25706aca
|
2015-07-27T03:54:10Z
|
mmm a / ChangeLog <nl> ppp b / ChangeLog <nl> <nl> + 2010 - 01 - 17 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net > <nl> + <nl> + Added - - human - readable option . This option , when true is given , <nl> + prints sizes and speed in human readable format ( e . g . , 1 . 2Ki , <nl> + 3 . 4Mi ) in the console readout . The default value is true and it <nl> + looks exactly the same as aria2 - 1 . 8 . 0 . So the ' new feature ' <nl> + appears when false is given . In this case , sizes and speed are <nl> + printed without in bytes . No Ki , Mi units conversion is used . <nl> + This may be useful for a program to parse the output of aria2 . <nl> + * doc / aria2c . 1 . txt <nl> + * src / ConsoleStatCalc . cc <nl> + * src / ConsoleStatCalc . h <nl> + * src / OptionHandlerFactory . cc <nl> + * src / main . cc <nl> + * src / prefs . cc <nl> + * src / prefs . h <nl> + * src / usage_text . h <nl> + <nl> 2010 - 01 - 15 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net > <nl> <nl> Now - - all - proxy , - - http - proxy , - - https - proxy and - - ftp - proxy <nl> mmm a / doc / aria2c . 1 <nl> ppp b / doc / aria2c . 1 <nl> <nl> . \ " Title : aria2c <nl> . \ " Author : [ FIXME : author ] [ see http : / / docbook . sf . net / el / author ] <nl> . \ " Generator : DocBook XSL Stylesheets v1 . 75 . 2 < http : / / docbook . sf . net / > <nl> - . \ " Date : 01 / 15 / 2010 <nl> + . \ " Date : 01 / 17 / 2010 <nl> . \ " Manual : Aria2 Manual <nl> . \ " Source : Aria2 <nl> . \ " Language : English <nl> . \ " <nl> - . TH " ARIA2C " " 1 " " 01 / 15 / 2010 " " Aria2 " " Aria2 Manual " <nl> + . TH " ARIA2C " " 1 " " 01 / 17 / 2010 " " Aria2 " " Aria2 Manual " <nl> . \ " mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> . \ " * Define some portability stuff <nl> . \ " mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> Default : <nl> \ fIprealloc \ fR <nl> . RE <nl> . PP <nl> + \ fB \ - \ - human \ - readable \ fR [ = \ fItrue \ fR | \ fIfalse \ fR ] <nl> + . RS 4 <nl> + Print sizes and speed in human readable format ( e \ & . g \ & . , 1 \ & . 2Ki , 3 \ & . 4Mi ) in the console readout \ & . Default : <nl> + \ fItrue \ fR <nl> + . RE <nl> + . PP <nl> \ fB \ - \ - interface \ fR = INTERFACE <nl> . RS 4 <nl> Bind sockets to given interface \ & . You can specify interface name , IP address and hostname \ & . Possible Values : interface , IP address , hostname <nl> mmm a / doc / aria2c . 1 . html <nl> ppp b / doc / aria2c . 1 . html <nl> < h3 id = " _advanced_options " > Advanced Options < / h3 > < div style = " clear : left " > < / div > <nl> < / p > <nl> < / dd > <nl> < dt class = " hdlist1 " > <nl> + < strong > - - human - readable < / strong > [ = < em > true < / em > | < em > false < / em > ] <nl> + < / dt > <nl> + < dd > <nl> + < p > <nl> + Print sizes and speed in human readable format ( e . g . , 1 . 2Ki , 3 . 4Mi ) <nl> + in the console readout . Default : < em > true < / em > <nl> + < / p > <nl> + < / dd > <nl> + < dt class = " hdlist1 " > <nl> < strong > - - interface < / strong > = INTERFACE <nl> < / dt > <nl> < dd > <nl> < h2 id = " _copyright " > COPYRIGHT < / h2 > <nl> < div id = " footnotes " > < hr / > < / div > <nl> < div id = " footer " > <nl> < div id = " footer - text " > <nl> - Last updated 2010 - 01 - 15 17 : 58 : 00 JST <nl> + Last updated 2010 - 01 - 17 16 : 21 : 53 JST <nl> < / div > <nl> < / div > <nl> < / body > <nl> mmm a / doc / aria2c . 1 . txt <nl> ppp b / doc / aria2c . 1 . txt <nl> Advanced Options <nl> Possible Values : ' none ' , ' prealloc ' , ' falloc ' <nl> Default : ' prealloc ' <nl> <nl> + * - - human - readable * [ = ' true ' | ' false ' ] : : <nl> + <nl> + Print sizes and speed in human readable format ( e . g . , 1 . 2Ki , 3 . 4Mi ) <nl> + in the console readout . Default : ' true ' <nl> + <nl> * - - interface * = INTERFACE : : <nl> <nl> Bind sockets to given interface . You can specify interface name , IP <nl> mmm a / src / ConsoleStatCalc . cc <nl> ppp b / src / ConsoleStatCalc . cc <nl> <nl> namespace aria2 { <nl> <nl> static void printProgress <nl> - ( std : : ostream & o , const SharedHandle < RequestGroup > & rg , const DownloadEngine * e ) <nl> + ( std : : ostream & o , const SharedHandle < RequestGroup > & rg , const DownloadEngine * e , <nl> + const SizeFormatter & sizeFormatter ) <nl> { <nl> TransferStat stat = rg - > calculateStat ( ) ; <nl> unsigned int eta = 0 ; <nl> static void printProgress <nl> # endif / / ENABLE_BITTORRENT <nl> { <nl> o < < " SIZE : " <nl> - < < util : : abbrevSize ( rg - > getCompletedLength ( ) ) <nl> + < < sizeFormatter ( rg - > getCompletedLength ( ) ) <nl> < < " B " <nl> < < " / " <nl> - < < util : : abbrevSize ( rg - > getTotalLength ( ) ) <nl> + < < sizeFormatter ( rg - > getTotalLength ( ) ) <nl> < < " B " ; <nl> if ( rg - > getTotalLength ( ) > 0 ) { <nl> o < < " ( " <nl> static void printProgress <nl> if ( ! rg - > downloadFinished ( ) ) { <nl> o < < " " <nl> < < " SPD : " <nl> - < < util : : abbrevSize ( stat . getDownloadSpeed ( ) ) < < " Bs " ; <nl> + < < sizeFormatter ( stat . getDownloadSpeed ( ) ) < < " Bs " ; <nl> } <nl> if ( stat . getSessionUploadLength ( ) > 0 ) { <nl> o < < " " <nl> < < " UP : " <nl> - < < util : : abbrevSize ( stat . getUploadSpeed ( ) ) < < " Bs " <nl> - < < " ( " < < util : : abbrevSize ( stat . getAllTimeUploadLength ( ) ) < < " B ) " ; <nl> + < < sizeFormatter ( stat . getUploadSpeed ( ) ) < < " Bs " <nl> + < < " ( " < < sizeFormatter ( stat . getAllTimeUploadLength ( ) ) < < " B ) " ; <nl> } <nl> if ( eta > 0 ) { <nl> o < < " " <nl> class PrintSummary <nl> private : <nl> size_t _cols ; <nl> const DownloadEngine * _e ; <nl> + const SizeFormatter & _sizeFormatter ; <nl> public : <nl> - PrintSummary ( size_t cols , const DownloadEngine * e ) : _cols ( cols ) , _e ( e ) { } <nl> + PrintSummary <nl> + ( size_t cols , const DownloadEngine * e , <nl> + const SizeFormatter & sizeFormatter ) : <nl> + _cols ( cols ) , _e ( e ) , _sizeFormatter ( sizeFormatter ) { } <nl> <nl> void operator ( ) ( const SharedHandle < RequestGroup > & rg ) <nl> { <nl> const char SEP_CHAR = ' - ' ; <nl> - printProgress ( std : : cout , rg , _e ) ; <nl> + printProgress ( std : : cout , rg , _e , _sizeFormatter ) ; <nl> const std : : vector < SharedHandle < FileEntry > > & fileEntries = <nl> rg - > getDownloadContext ( ) - > getFileEntries ( ) ; <nl> std : : cout < < " \ n " <nl> class PrintSummary <nl> <nl> static void printProgressSummary <nl> ( const std : : deque < SharedHandle < RequestGroup > > & groups , size_t cols , <nl> - const DownloadEngine * e ) <nl> + const DownloadEngine * e , <nl> + const SizeFormatter & sizeFormatter ) <nl> { <nl> const char SEP_CHAR = ' = ' ; <nl> time_t now ; <nl> static void printProgressSummary <nl> } <nl> std : : cout < < " * * * " < < " \ n " <nl> < < std : : setfill ( SEP_CHAR ) < < std : : setw ( cols ) < < SEP_CHAR < < " \ n " ; <nl> - std : : for_each ( groups . begin ( ) , groups . end ( ) , PrintSummary ( cols , e ) ) ; <nl> + std : : for_each ( groups . begin ( ) , groups . end ( ) , <nl> + PrintSummary ( cols , e , sizeFormatter ) ) ; <nl> } <nl> <nl> - ConsoleStatCalc : : ConsoleStatCalc ( time_t summaryInterval ) : <nl> + ConsoleStatCalc : : ConsoleStatCalc ( time_t summaryInterval , bool humanReadable ) : <nl> _summaryInterval ( summaryInterval ) <nl> - { } <nl> + { <nl> + if ( humanReadable ) { <nl> + _sizeFormatter . reset ( new AbbrevSizeFormatter ( ) ) ; <nl> + } else { <nl> + _sizeFormatter . reset ( new PlainSizeFormatter ( ) ) ; <nl> + } <nl> + } <nl> <nl> void <nl> ConsoleStatCalc : : calculateStat ( const DownloadEngine * e ) <nl> ConsoleStatCalc : : calculateStat ( const DownloadEngine * e ) <nl> return ; <nl> } <nl> _cp . reset ( ) ; <nl> - <nl> + const SizeFormatter & sizeFormatter = * _sizeFormatter . get ( ) ; <nl> bool isTTY = isatty ( STDOUT_FILENO ) = = 1 ; <nl> unsigned short int cols = 80 ; <nl> # ifdef __MINGW32__ <nl> ConsoleStatCalc : : calculateStat ( const DownloadEngine * e ) <nl> if ( ( _summaryInterval > 0 ) & & <nl> _lastSummaryNotified . elapsed ( _summaryInterval ) ) { <nl> _lastSummaryNotified . reset ( ) ; <nl> - printProgressSummary ( e - > _requestGroupMan - > getRequestGroups ( ) , cols , e ) ; <nl> + printProgressSummary ( e - > _requestGroupMan - > getRequestGroups ( ) , cols , e , <nl> + sizeFormatter ) ; <nl> std : : cout < < " \ n " ; <nl> } <nl> <nl> RequestGroupHandle firstRequestGroup = e - > _requestGroupMan - > getRequestGroup ( 0 ) ; <nl> <nl> - printProgress ( o , firstRequestGroup , e ) ; <nl> + printProgress ( o , firstRequestGroup , e , sizeFormatter ) ; <nl> <nl> if ( e - > _requestGroupMan - > countRequestGroup ( ) > 1 ) { <nl> o < < " ( " <nl> ConsoleStatCalc : : calculateStat ( const DownloadEngine * e ) <nl> TransferStat stat = e - > _requestGroupMan - > calculateStat ( ) ; <nl> o < < " " <nl> < < " [ TOTAL SPD : " <nl> - < < util : : abbrevSize ( stat . getDownloadSpeed ( ) ) < < " Bs " < < " ] " ; <nl> + < < sizeFormatter ( stat . getDownloadSpeed ( ) ) < < " Bs " < < " ] " ; <nl> } <nl> <nl> { <nl> ConsoleStatCalc : : calculateStat ( const DownloadEngine * e ) <nl> o < < " " <nl> < < " [ FileAlloc : " <nl> < < " # " < < entry - > getRequestGroup ( ) - > getGID ( ) < < " " <nl> - < < util : : abbrevSize ( entry - > getCurrentLength ( ) ) <nl> + < < sizeFormatter ( entry - > getCurrentLength ( ) ) <nl> < < " B " <nl> < < " / " <nl> - < < util : : abbrevSize ( entry - > getTotalLength ( ) ) <nl> + < < sizeFormatter ( entry - > getTotalLength ( ) ) <nl> < < " B " <nl> < < " ( " ; <nl> if ( entry - > getTotalLength ( ) > 0 ) { <nl> ConsoleStatCalc : : calculateStat ( const DownloadEngine * e ) <nl> o < < " " <nl> < < " [ Checksum : " <nl> < < " # " < < entry - > getRequestGroup ( ) - > getGID ( ) < < " " <nl> - < < util : : abbrevSize ( entry - > getCurrentLength ( ) ) <nl> + < < sizeFormatter ( entry - > getCurrentLength ( ) ) <nl> < < " B " <nl> < < " / " <nl> - < < util : : abbrevSize ( entry - > getTotalLength ( ) ) <nl> + < < sizeFormatter ( entry - > getTotalLength ( ) ) <nl> < < " B " <nl> < < " ( " <nl> < < 100 * entry - > getCurrentLength ( ) / entry - > getTotalLength ( ) <nl> mmm a / src / ConsoleStatCalc . h <nl> ppp b / src / ConsoleStatCalc . h <nl> <nl> <nl> # include " StatCalc . h " <nl> # include " TimeA2 . h " <nl> + # include " util . h " <nl> <nl> namespace aria2 { <nl> <nl> + class SizeFormatter : public std : : unary_function < int64_t , std : : string > { <nl> + protected : <nl> + virtual std : : string format ( int64_t size ) const = 0 ; <nl> + public : <nl> + virtual ~ SizeFormatter ( ) { } <nl> + <nl> + std : : string operator ( ) ( int64_t size ) const <nl> + { <nl> + return format ( size ) ; <nl> + } <nl> + } ; <nl> + <nl> + class AbbrevSizeFormatter : public SizeFormatter { <nl> + protected : <nl> + virtual std : : string format ( int64_t size ) const <nl> + { <nl> + return util : : abbrevSize ( size ) ; <nl> + } <nl> + } ; <nl> + <nl> + class PlainSizeFormatter : public SizeFormatter { <nl> + protected : <nl> + virtual std : : string format ( int64_t size ) const <nl> + { <nl> + return util : : itos ( size ) ; <nl> + } <nl> + } ; <nl> + <nl> class ConsoleStatCalc : public StatCalc <nl> { <nl> private : <nl> class ConsoleStatCalc : public StatCalc <nl> Time _lastSummaryNotified ; <nl> <nl> time_t _summaryInterval ; <nl> + <nl> + SharedHandle < SizeFormatter > _sizeFormatter ; <nl> public : <nl> - ConsoleStatCalc ( time_t summaryInterval ) ; <nl> + ConsoleStatCalc ( time_t summaryInterval , bool humanReadable = true ) ; <nl> <nl> virtual ~ ConsoleStatCalc ( ) { } <nl> <nl> mmm a / src / OptionHandlerFactory . cc <nl> ppp b / src / OptionHandlerFactory . cc <nl> OptionHandlers OptionHandlerFactory : : createOptionHandlers ( ) <nl> op - > addTag ( TAG_BASIC ) ; <nl> handlers . push_back ( op ) ; <nl> } <nl> + { <nl> + SharedHandle < OptionHandler > op ( new BooleanOptionHandler <nl> + ( PREF_HUMAN_READABLE , <nl> + TEXT_HUMAN_READABLE , <nl> + V_TRUE , <nl> + OptionHandler : : OPT_ARG ) ) ; <nl> + op - > addTag ( TAG_ADVANCED ) ; <nl> + handlers . push_back ( op ) ; <nl> + } <nl> { <nl> SharedHandle < OptionHandler > op ( new DefaultOptionHandler <nl> ( PREF_INPUT_FILE , <nl> mmm a / src / main . cc <nl> ppp b / src / main . cc <nl> SharedHandle < StatCalc > getStatCalc ( const SharedHandle < Option > & op ) <nl> if ( op - > getAsBool ( PREF_QUIET ) ) { <nl> statCalc . reset ( new NullStatCalc ( ) ) ; <nl> } else { <nl> - statCalc . reset ( new ConsoleStatCalc ( op - > getAsInt ( PREF_SUMMARY_INTERVAL ) ) ) ; <nl> + statCalc . reset ( new ConsoleStatCalc ( op - > getAsInt ( PREF_SUMMARY_INTERVAL ) , <nl> + op - > getAsBool ( PREF_HUMAN_READABLE ) ) ) ; <nl> } <nl> return statCalc ; <nl> } <nl> mmm a / src / prefs . cc <nl> ppp b / src / prefs . cc <nl> const std : : string PREF_XML_RPC_LISTEN_ALL ( " xml - rpc - listen - all " ) ; <nl> const std : : string PREF_INTERFACE ( " interface " ) ; <nl> / / value : true | false <nl> const std : : string PREF_DISABLE_IPV6 ( " disable - ipv6 " ) ; <nl> + / / value : true | false <nl> + const std : : string PREF_HUMAN_READABLE ( " human - readable " ) ; <nl> <nl> / * * <nl> * FTP related preferences <nl> mmm a / src / prefs . h <nl> ppp b / src / prefs . h <nl> extern const std : : string PREF_XML_RPC_LISTEN_ALL ; <nl> extern const std : : string PREF_INTERFACE ; <nl> / / value : true | false <nl> extern const std : : string PREF_DISABLE_IPV6 ; <nl> + / / value : true | false <nl> + extern const std : : string PREF_HUMAN_READABLE ; <nl> <nl> / * * <nl> * FTP related preferences <nl> mmm a / src / usage_text . h <nl> ppp b / src / usage_text . h <nl> <nl> " in metadata will not be downloaded . This option \ n " \ <nl> " has effect only when BitTorrent Magnet URI is \ n " \ <nl> " used . See also - - bt - save - metadata option . " ) <nl> + # define TEXT_HUMAN_READABLE \ <nl> + _ ( " - - human - readable [ = true | false ] Print sizes and speed in human readable format \ n " \ <nl> + " ( e . g . , 1 . 2Ki , 3 . 4Mi ) in the console readout . " ) <nl>
|
2010 - 01 - 17 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net >
|
aria2/aria2
|
c0308e1ea4c6be54ff9c07c33613140e8a3ea4ec
|
2010-01-17T07:23:53Z
|
mmm a / emscripten . py <nl> ppp b / emscripten . py <nl> def math_fix ( g ) : <nl> } ; <nl> ' ' ' for s in exported_implemented_functions if s not in [ ' _malloc ' , ' _free ' , ' _memcpy ' , ' _memset ' ] ] ) <nl> <nl> - receiving + = ' ; \ n ' . join ( [ ' var ' + s + ' = Module [ " ' + s + ' " ] = asm [ " ' + s + ' " ] ' for s in exported_implemented_functions + function_tables ] ) <nl> + if not settings [ ' SWAPPABLE_ASM_MODULE ' ] : <nl> + receiving + = ' ; \ n ' . join ( [ ' var ' + s + ' = Module [ " ' + s + ' " ] = asm [ " ' + s + ' " ] ' for s in exported_implemented_functions + function_tables ] ) <nl> + else : <nl> + receiving + = ' Module [ " asm " ] = asm ; \ n ' + ' ; \ n ' . join ( [ ' var ' + s + ' = Module [ " ' + s + ' " ] = function ( ) { return Module [ " asm " ] [ " ' + s + ' " ] } ' for s in exported_implemented_functions + function_tables ] ) <nl> <nl> # finalize <nl> <nl> mmm a / src / settings . js <nl> ppp b / src / settings . js <nl> var FINALIZE_ASM_JS = 1 ; / / If 1 , will finalize the final emitted code , includin <nl> / / that prevent later js optimizer passes from running , like <nl> / / converting + 5 into 5 . 0 ( the js optimizer sees 5 . 0 as just 5 ) . <nl> <nl> + var SWAPPABLE_ASM_MODULE = 0 ; / / If 1 , then all exports from the asm . js module will be accessed <nl> + / / indirectly , which allow the asm module to be swapped later . <nl> + <nl> var PGO = 0 ; / / Enables profile - guided optimization in the form of runtime checks for <nl> / / which functions are actually called . Emits a list during shutdown that you <nl> / / can pass to DEAD_FUNCTIONS ( you can also emit the list manually by <nl> mmm a / tools / distill_asm . py <nl> ppp b / tools / distill_asm . py <nl> <nl> <nl> if extra = = = ' swap - in ' : <nl> # we do | var asm = | just like the original codebase , so that gets overridden anyhow ( assuming global scripts ) . <nl> - # pass in the same arguments , fire the callback if requested <nl> - # TODO : fix up the asm exports <nl> extra = r ' ' ' <nl> ( Module . asmGlobalArg , Module . asmLibraryArg , Module [ ' buffer ' ] ) ; <nl> + / / special fixups <nl> + asm . stackRestore ( Module [ ' asm ' ] . stackSave ( ) ) ; <nl> + / / Finish swap <nl> + Module [ ' asm ' ] = asm ; <nl> if ( Module [ ' onAsmSwap ' ] ) Module [ ' onAsmSwap ' ] ( ) ; <nl> ' ' ' <nl> <nl>
|
SWAPPABLE_ASM_MODULE option , and finish distill
|
emscripten-core/emscripten
|
2b692e14cb057744e3de8c3a8aa537dda066a527
|
2014-10-13T21:21:35Z
|
mmm a / tensorflow / core / ops / compat / ops_history . v1 . pbtxt <nl> ppp b / tensorflow / core / ops / compat / ops_history . v1 . pbtxt <nl> op { <nl> minimum : 1 <nl> } <nl> } <nl> + op { <nl> + name : " DatasetToSingleElement " <nl> + input_arg { <nl> + name : " dataset " <nl> + type : DT_VARIANT <nl> + } <nl> + output_arg { <nl> + name : " components " <nl> + type_list_attr : " output_types " <nl> + } <nl> + attr { <nl> + name : " output_types " <nl> + type : " list ( type ) " <nl> + has_minimum : true <nl> + minimum : 1 <nl> + } <nl> + attr { <nl> + name : " output_shapes " <nl> + type : " list ( shape ) " <nl> + has_minimum : true <nl> + minimum : 1 <nl> + } <nl> + is_stateful : true <nl> + } <nl> op { <nl> name : " DebugGradientIdentity " <nl> input_arg { <nl> op { <nl> type : DT_STRING <nl> } <nl> } <nl> + op { <nl> + name : " ExperimentalDatasetToTFRecord " <nl> + input_arg { <nl> + name : " input_dataset " <nl> + type : DT_VARIANT <nl> + } <nl> + input_arg { <nl> + name : " filename " <nl> + type : DT_STRING <nl> + } <nl> + input_arg { <nl> + name : " compression_type " <nl> + type : DT_STRING <nl> + } <nl> + is_stateful : true <nl> + } <nl> op { <nl> name : " ExperimentalDenseToSparseBatchDataset " <nl> input_arg { <nl> op { <nl> } <nl> } <nl> } <nl> + op { <nl> + name : " ReduceDataset " <nl> + input_arg { <nl> + name : " input_dataset " <nl> + type : DT_VARIANT <nl> + } <nl> + input_arg { <nl> + name : " initial_state " <nl> + type_list_attr : " Tstate " <nl> + } <nl> + input_arg { <nl> + name : " other_arguments " <nl> + type_list_attr : " Targuments " <nl> + } <nl> + output_arg { <nl> + name : " components " <nl> + type_list_attr : " output_types " <nl> + } <nl> + attr { <nl> + name : " f " <nl> + type : " func " <nl> + } <nl> + attr { <nl> + name : " Tstate " <nl> + type : " list ( type ) " <nl> + has_minimum : true <nl> + minimum : 1 <nl> + } <nl> + attr { <nl> + name : " Targuments " <nl> + type : " list ( type ) " <nl> + has_minimum : true <nl> + } <nl> + attr { <nl> + name : " output_types " <nl> + type : " list ( type ) " <nl> + has_minimum : true <nl> + minimum : 1 <nl> + } <nl> + attr { <nl> + name : " output_shapes " <nl> + type : " list ( shape ) " <nl> + has_minimum : true <nl> + minimum : 1 <nl> + } <nl> + attr { <nl> + name : " use_inter_op_parallelism " <nl> + type : " bool " <nl> + default_value { <nl> + b : true <nl> + } <nl> + } <nl> + is_stateful : true <nl> + } <nl> op { <nl> name : " ReduceJoin " <nl> input_arg { <nl> op { <nl> } <nl> } <nl> } <nl> + op { <nl> + name : " TridiagonalSolve " <nl> + input_arg { <nl> + name : " diagonals " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " rhs " <nl> + type_attr : " T " <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> + type_attr : " T " <nl> + } <nl> + attr { <nl> + name : " T " <nl> + type : " type " <nl> + allowed_values { <nl> + list { <nl> + type : DT_DOUBLE <nl> + type : DT_FLOAT <nl> + type : DT_COMPLEX64 <nl> + type : DT_COMPLEX128 <nl> + } <nl> + } <nl> + } <nl> + } <nl> op { <nl> name : " TruncateDiv " <nl> input_arg { <nl> mmm a / tensorflow / core / ops / ops . pbtxt <nl> ppp b / tensorflow / core / ops / ops . pbtxt <nl> op { <nl> has_minimum : true <nl> minimum : 1 <nl> } <nl> + is_stateful : true <nl> } <nl> op { <nl> name : " DebugGradientIdentity " <nl> op { <nl> name : " compression_type " <nl> type : DT_STRING <nl> } <nl> + is_stateful : true <nl> } <nl> op { <nl> name : " ExperimentalDenseToSparseBatchDataset " <nl> op { <nl> b : true <nl> } <nl> } <nl> + is_stateful : true <nl> } <nl> op { <nl> name : " ReduceJoin " <nl> op { <nl> } <nl> } <nl> } <nl> + op { <nl> + name : " TridiagonalSolve " <nl> + input_arg { <nl> + name : " diagonals " <nl> + type_attr : " T " <nl> + } <nl> + input_arg { <nl> + name : " rhs " <nl> + type_attr : " T " <nl> + } <nl> + output_arg { <nl> + name : " output " <nl> + type_attr : " T " <nl> + } <nl> + attr { <nl> + name : " T " <nl> + type : " type " <nl> + allowed_values { <nl> + list { <nl> + type : DT_DOUBLE <nl> + type : DT_FLOAT <nl> + type : DT_COMPLEX64 <nl> + type : DT_COMPLEX128 <nl> + } <nl> + } <nl> + } <nl> + } <nl> op { <nl> name : " TruncateDiv " <nl> input_arg { <nl>
|
Update ops - related pbtxt files .
|
tensorflow/tensorflow
|
380629f7ff991038f31acc0d7d0c5b74cc9f3d3a
|
2019-02-13T03:21:17Z
|
deleted file mode 100644 <nl> index ec9adf91bc . . 0000000000 <nl> mmm a / vnpy / api / xtp / vnxtp / include / autocxxpy / utils / extract . hpp <nl> ppp / dev / null <nl> <nl> - # pragma once <nl> - <nl> - # include " type_traits . hpp " <nl> - # include " algorithm . hpp " <nl> - <nl> - namespace <nl> - { <nl> - <nl> - template < class . . . > <nl> - struct extractable { } ; <nl> - <nl> - template < template < class . . . args > class extract_seq , class . . . Ts > <nl> - inline constexpr size_t extract_size ( ) noexcept ; <nl> - <nl> - template < template < class . . . args > class extract_seq , class . . . Ts > <nl> - inline constexpr size_t extract_size_extract ( extractable < Ts . . . > ) noexcept <nl> - { <nl> - return extract_size < extract_seq , Ts . . . > ( ) ; <nl> - } <nl> - <nl> - template < template < class . . . args > class extract_seq , class T > <nl> - inline constexpr size_t extract_size_single ( ) noexcept <nl> - { <nl> - using nocvref = remove_cvref_t < T > ; <nl> - if constexpr ( is_specialization_of_v < nocvref , extract_seq > ) <nl> - return extract_size_extract < extract_seq > ( brigand : : wrap < nocvref , extractable > { } ) ; <nl> - else <nl> - return 1 ; <nl> - } <nl> - <nl> - template < template < class . . . args > class extract_seq = std : : tuple , class . . . Ts , int . . . idx > <nl> - inline constexpr size_t extract_size_multiple ( std : : index_sequence < idx . . . > ) noexcept <nl> - { <nl> - using seq = brigand : : list < Ts . . . > ; <nl> - return tsum ( <nl> - extract_size_single < extract_seq , <nl> - brigand : : at < seq , brigand : : integral_constant < int , idx > > <nl> - > ( ) . . . <nl> - ) ; <nl> - } <nl> - <nl> - template < template < class . . . args > class extract_seq , class . . . Ts > <nl> - inline constexpr size_t extract_size ( ) noexcept <nl> - { <nl> - return extract_size_multiple < extract_seq , Ts . . . > ( std : : index_sequence_for < Ts . . . > { } ) ; <nl> - } <nl> - <nl> - template < template < class . . . args > class extract_seq , class T > <nl> - inline constexpr size_t extract_size ( const T & ) noexcept <nl> - { <nl> - return extract_size_single < extract_seq , T > ( ) ; <nl> - } <nl> - <nl> - template < class T > <nl> - inline constexpr size_t extract_tuple_size ( const T & ) noexcept { return extract_size_single < std : : tuple , remove_cvref < T > > ( ) ; } <nl> - <nl> - namespace _assert <nl> - { <nl> - using namespace std ; <nl> - static_assert ( extract_size < tuple , tuple < int , int , tuple < int , int , int > , tuple < > > > ( ) = = 5 ) ; <nl> - static_assert ( extract_size < pair , int , tuple < > > ( ) = = 2 ) ; <nl> - static_assert ( extract_size < tuple > ( 1 ) = = 1 ) ; <nl> - static_assert ( extract_size < tuple > ( tuple < int , int , tuple < int , int , int > , tuple < > > { } ) = = 5 ) ; <nl> - static_assert ( extract_size < tuple > ( tuple < int , int > { } ) = = 2 ) ; <nl> - static_assert ( extract_size < tuple , int , int > ( ) = = 2 ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - template < size_t idx , size_t skip = 0 , template < class . . . args > class extract_seq , class . . . Ts , template < class . . . args > class seq > <nl> - inline constexpr auto & extract_get_impl ( const seq < Ts . . . > & t ) noexcept <nl> - { <nl> - constexpr auto size = extract_size < extract_seq , decltype ( t ) > ( ) ; <nl> - static_assert ( idx < size , " extract_get : index out of sequence bound " ) ; <nl> - static_assert ( size ! = 0 , " trying get element of empty tuple " ) ; <nl> - <nl> - if constexpr ( idx < size & & size ! = 0 ) <nl> - { <nl> - auto & a0 = std : : get < skip > ( t ) ; <nl> - constexpr auto a0len = extract_size < extract_seq , decltype ( a0 ) > ( ) ; <nl> - constexpr bool a0_is_seq = is_specialization_of_v < remove_cvref_t < decltype ( a0 ) > , extract_seq > ; <nl> - <nl> - if constexpr ( idx = = 0 & & ! a0_is_seq ) <nl> - { <nl> - return a0 ; <nl> - } <nl> - else if constexpr ( a0_is_seq & & idx < a0len ) <nl> - { / / extract and go into it <nl> - return extract_get_impl < idx , 0 , extract_seq > ( a0 ) ; <nl> - } <nl> - else if constexpr ( a0_is_seq ) <nl> - { / / result is in the rest , skip this one <nl> - return extract_get_impl < idx - a0len , skip + 1 , extract_seq > ( t ) ; <nl> - } <nl> - else / / if constexpr ( idx ! = 0 ) <nl> - { / / a0 is not a extract , just skip 1 element <nl> - return extract_get_impl < idx - 1 , skip + 1 , extract_seq > ( t ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - <nl> - template < size_t idx , template < class . . . args > class extract_seq , class . . . Ts , template < class . . . args > class seq > <nl> - inline constexpr auto & extract_get ( const seq < Ts . . . > & t ) noexcept <nl> - { <nl> - return extract_get_impl < idx , 0 , extract_seq > ( t ) ; <nl> - } <nl> - <nl> - namespace _assert <nl> - { <nl> - using namespace std ; <nl> - struct s { } ; <nl> - static_assert ( extract_get < 0 , tuple > ( make_tuple ( 1 ) ) = = 1 ) ; <nl> - static_assert ( extract_get < 1 , tuple > ( make_tuple ( 0 , 1 ) ) = = 1 ) ; <nl> - static_assert ( extract_get < 1 , tuple > ( make_tuple ( 0 , make_tuple ( 1 ) ) ) = = 1 ) ; <nl> - static_assert ( extract_get < 15 , tuple > ( make_tuple ( make_tuple ( 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ) , make_tuple ( 8 ) , make_tuple ( 9 ) , 0 , 1 , 2 , 3 , 4 , 5 ) ) = = 5 ) ; <nl> - static_assert ( extract_get < 1 , tuple > ( make_tuple ( make_tuple ( ) , make_tuple ( ) , make_tuple ( 0 ) , make_tuple ( 1 ) ) ) = = 1 ) ; <nl> - static_assert ( extract_get < 1 , tuple > ( make_tuple ( 0 , make_tuple ( 1 ) , make_tuple ( make_tuple ( 2 ) ) ) ) = = 1 ) ; <nl> - static_assert ( extract_get < 1 , tuple > ( make_tuple ( 0 , make_tuple ( 1 ) , make_tuple ( ) , make_tuple ( 2 ) ) ) = = 1 ) ; <nl> - static_assert ( extract_get < 1 , tuple > ( make_tuple ( 0 , make_tuple ( 2 ) , make_tuple ( ) , make_tuple ( s { } ) ) ) = = 2 ) ; <nl> - static_assert ( extract_get < 1 , tuple > ( make_tuple ( 0 , make_tuple ( 1 ) , make_tuple ( ) , make_tuple ( s { } ) ) ) ! = 2 ) ; <nl> - static_assert ( extract_get < 1 , tuple > ( make_tuple ( 0 , make_tuple ( ) , make_tuple ( 1 ) ) ) = = 1 ) ; <nl> - <nl> - static_assert ( extract_get < 1 , tuple > ( make_tuple ( s { } , pair ( 0 , 1 ) ) ) . first = = 0 ) ; <nl> - static_assert ( std : : get < 1 > ( extract_get < 0 , pair > ( make_tuple ( make_tuple ( 0 , 1 ) ) ) ) = = 1 ) ; <nl> - <nl> - } <nl> - <nl> - template < size_t idx , class . . . Ts , template < class . . . args > class seq > <nl> - inline constexpr auto & extract_tuple_get ( const seq < Ts . . . > & t ) <nl> - { <nl> - return extract_get < idx , std : : tuple > ( t ) ; <nl> - } <nl> - <nl> - } <nl> \ No newline at end of file <nl>
|
Delete extract . hpp
|
vnpy/vnpy
|
7bc503248625a31283b46cab63463d8b01ba3f31
|
2020-02-24T13:44:55Z
|
mmm a / hphp / runtime / base / runtime - option . cpp <nl> ppp b / hphp / runtime / base / runtime - option . cpp <nl> int RuntimeOption : : ServerBacklog = 128 ; <nl> int RuntimeOption : : ServerConnectionLimit = 0 ; <nl> int RuntimeOption : : ServerThreadCount = 50 ; <nl> int RuntimeOption : : ServerQueueCount = 50 ; <nl> + int RuntimeOption : : ServerHighQueueingThreshold = 60 ; <nl> bool RuntimeOption : : ServerLegacyBehavior = true ; <nl> int RuntimeOption : : ServerHugeThreadCount = 0 ; <nl> int RuntimeOption : : ServerHugeStackKb = 384 ; <nl> mmm a / hphp / runtime / base / runtime - option . h <nl> ppp b / hphp / runtime / base / runtime - option . h <nl> struct RuntimeOption { <nl> static int ServerConnectionLimit ; <nl> static int ServerThreadCount ; <nl> static int ServerQueueCount ; <nl> + static int ServerHighQueueingThreshold ; <nl> static bool ServerLegacyBehavior ; <nl> / / Number of worker threads with stack partially on huge pages . <nl> static int ServerHugeThreadCount ; <nl> mmm a / hphp / runtime / server / http - server . cpp <nl> ppp b / hphp / runtime / server / http - server . cpp <nl> HttpServer : : HttpServer ( ) { <nl> [ this ] ( std : : map < std : : string , int64_t > & counters ) { <nl> counters [ " ev_connections " ] = m_pageServer - > getLibEventConnectionCount ( ) ; <nl> counters [ " inflight_requests " ] = m_pageServer - > getActiveWorker ( ) ; <nl> - counters [ " queued_requests " ] = m_pageServer - > getQueuedJobs ( ) ; <nl> + auto queued_requests = m_pageServer - > getQueuedJobs ( ) ; <nl> + counters [ " queued_requests " ] = queued_requests ; <nl> + counters [ " queued_requests_high " ] = <nl> + queued_requests > RuntimeOption : : ServerHighQueueingThreshold ; <nl> + <nl> <nl> auto const sat_requests = getSatelliteRequestCount ( ) ; <nl> counters [ " satellite_inflight_requests " ] = sat_requests . first ; <nl>
|
Add a counter for high server queueing
|
facebook/hhvm
|
8512760b08f0fbc658a35dd9f0c54e2adac98d7a
|
2020-05-19T00:41:27Z
|
mmm a / tensorflow / contrib / lite / toco / graph_transformations / resolve_batch_to_space_nd_attributes . cc <nl> ppp b / tensorflow / contrib / lite / toco / graph_transformations / resolve_batch_to_space_nd_attributes . cc <nl> bool ResolveBatchToSpaceNDAttributes : : Run ( Model * model , std : : size_t op_index ) { <nl> / / will delete this op . <nl> return false ; <nl> } <nl> - std : : vector < int > crops_buffer = <nl> + const std : : vector < int > & crops_buffer = <nl> crops_array . GetBuffer < ArrayDataType : : kInt32 > ( ) . data ; <nl> for ( int i = 0 ; i < crops_dims [ 0 ] ; + + i ) { <nl> op - > before_crops . push_back ( crops_buffer [ i * 2 ] ) ; <nl> bool ResolveBatchToSpaceNDAttributes : : Run ( Model * model , std : : size_t op_index ) { <nl> if ( ! block_shape_array . has_shape ( ) ) return false ; <nl> const std : : vector < int > & block_shape_dims = block_shape_array . shape ( ) . dims ( ) ; <nl> CHECK_EQ ( block_shape_dims . size ( ) , 1 ) ; <nl> - std : : vector < int > block_shape_buffer = <nl> + const std : : vector < int > & block_shape_buffer = <nl> block_shape_array . GetBuffer < ArrayDataType : : kInt32 > ( ) . data ; <nl> for ( int i = 0 ; i < block_shape_dims [ 0 ] ; + + i ) { <nl> op - > block_shape . push_back ( block_shape_buffer [ i ] ) ; <nl> mmm a / tensorflow / contrib / lite / toco / graph_transformations / resolve_space_to_batch_nd_attributes . cc <nl> ppp b / tensorflow / contrib / lite / toco / graph_transformations / resolve_space_to_batch_nd_attributes . cc <nl> bool ResolveSpaceToBatchNDAttributes : : Run ( Model * model , std : : size_t op_index ) { <nl> / / will delete this op . <nl> return false ; <nl> } <nl> - std : : vector < int > paddings_buffer = <nl> + const std : : vector < int > & paddings_buffer = <nl> paddings_array . GetBuffer < ArrayDataType : : kInt32 > ( ) . data ; <nl> for ( int i = 0 ; i < paddings_dims [ 0 ] ; + + i ) { <nl> op - > before_paddings . push_back ( paddings_buffer [ i * 2 ] ) ; <nl> bool ResolveSpaceToBatchNDAttributes : : Run ( Model * model , std : : size_t op_index ) { <nl> if ( ! block_shape_array . has_shape ( ) ) return false ; <nl> const std : : vector < int > & block_shape_dims = block_shape_array . shape ( ) . dims ( ) ; <nl> CHECK_EQ ( block_shape_dims . size ( ) , 1 ) ; <nl> - std : : vector < int > block_shape_buffer = <nl> + const std : : vector < int > & block_shape_buffer = <nl> block_shape_array . GetBuffer < ArrayDataType : : kInt32 > ( ) . data ; <nl> for ( int i = 0 ; i < block_shape_dims [ 0 ] ; + + i ) { <nl> op - > block_shape . push_back ( block_shape_buffer [ i ] ) ; <nl>
|
Minor changes in SpaceToBatchND / BatchToSpaceND
|
tensorflow/tensorflow
|
c89a8a377805c1191d4d34f16f60a737d4b30627
|
2018-06-29T04:37:43Z
|
mmm a / tensorflow / compiler / xla / service / executable . cc <nl> ppp b / tensorflow / compiler / xla / service / executable . cc <nl> Status Executable : : DumpSessionModule ( ) { <nl> * session_module_ ) ; <nl> } <nl> <nl> + / / Removes illegal characters from filenames . <nl> + static void SanitizeFilename ( string * name ) { <nl> + for ( char & c : * name ) { <nl> + if ( c = = ' / ' | | c = = ' \ \ ' ) { <nl> + c = ' _ ' ; <nl> + } <nl> + } <nl> + } <nl> + <nl> / * static * / Status Executable : : DumpToDirectory ( <nl> - const string & directory_path , const string & filename , <nl> + const string & directory_path , string filename , <nl> const SessionModule & session_module ) { <nl> tensorflow : : Env * env = tensorflow : : Env : : Default ( ) ; <nl> if ( ! env - > IsDirectory ( directory_path ) . ok ( ) ) { <nl> TF_RETURN_IF_ERROR ( env - > CreateDir ( directory_path ) ) ; <nl> } <nl> + SanitizeFilename ( & filename ) ; <nl> string file_path = tensorflow : : io : : JoinPath ( directory_path , filename ) ; <nl> return tensorflow : : WriteBinaryProto ( env , file_path , session_module ) ; <nl> } <nl> mmm a / tensorflow / compiler / xla / service / executable . h <nl> ppp b / tensorflow / compiler / xla / service / executable . h <nl> class Executable { <nl> Status DumpSessionModule ( ) ; <nl> <nl> / / Dump session_module to directory_path / filename . <nl> - static Status DumpToDirectory ( const string & directory_path , <nl> - const string & filename , <nl> + static Status DumpToDirectory ( const string & directory_path , string filename , <nl> const SessionModule & session_module ) ; <nl> <nl> protected : <nl> mmm a / tensorflow / compiler / xla / service / local_service . cc <nl> ppp b / tensorflow / compiler / xla / service / local_service . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / types . h " <nl> # include " tensorflow / compiler / xla / util . h " <nl> # include " tensorflow / core / lib / gtl / cleanup . h " <nl> + # include " tensorflow / core / lib / strings / strcat . h " <nl> # include " tensorflow / core / platform / logging . h " <nl> # include " tensorflow / core / platform / stream_executor_no_cuda . h " <nl> <nl> LocalService : : CompileAheadOfTime ( <nl> VersionedComputationHandle versioned_handle = <nl> user_computation - > GetVersionedHandle ( ) ; <nl> <nl> + / / Dump computation proto state if flag is set . <nl> + legacy_flags : : ServiceFlags * flags = legacy_flags : : GetServiceFlags ( ) ; <nl> + const string & directory_path = flags - > xla_dump_computations_to ; <nl> + if ( ! directory_path . empty ( ) ) { <nl> + TF_ASSIGN_OR_RETURN ( <nl> + std : : unique_ptr < SessionModule > session_module , <nl> + computation_tracker_ . SnapshotComputation ( versioned_handle . handle ) ) ; <nl> + string filename = tensorflow : : strings : : StrCat ( <nl> + " computation_ " , versioned_handle . handle . handle ( ) , " __ " , <nl> + session_module - > entry ( ) . name ( ) , " __version_ " , <nl> + versioned_handle . version ) ; <nl> + TF_RETURN_IF_ERROR ( Executable : : DumpToDirectory ( directory_path , filename , <nl> + * session_module ) ) ; <nl> + } <nl> + <nl> TF_ASSIGN_OR_RETURN ( std : : unique_ptr < HloModule > hlo_module , <nl> computation_tracker_ . BuildHloModule ( <nl> versioned_handle , <nl>
|
[ XLA ] Add support for dumping computations during CompileAheadOfTime . Remove ' / ' and ' \ ' characters from path names of dumped graphs .
|
tensorflow/tensorflow
|
70096fcdf81cb19e6b59311bab3d227bd7bd6175
|
2017-03-15T20:24:58Z
|
mmm a / hphp / runtime / ext / gd / libgd / php_compat . h <nl> ppp b / hphp / runtime / ext / gd / libgd / php_compat . h <nl> inline void php_verror ( const char * docref , const char * params , int type , <nl> } <nl> inline void php_error_docref ( const char * docref , int type , <nl> const char * format , . . . ) { <nl> - va_list args ; <nl> - va_start ( args , format ) ; <nl> + va_list args ; <nl> + va_start ( args , format ) ; <nl> php_verror ( docref , " " , type , format , args ) ; <nl> - va_end ( args ) ; <nl> + va_end ( args ) ; <nl> } <nl> + <nl> + / / Force gdhelpers . h to run with thread safety . <nl> + # define ZTS <nl> + # define MUTEX_T pthread_mutex_t <nl> + <nl> + / / This abomination is required because of what happens in gdhelpers . h . <nl> + / / They steal ( x ) away from us , so we just looked up the one place <nl> + / / which used it and hard - coded it in here . Yep . <nl> + # define tsrm_mutex_alloc ( x ) gdFontCacheMutex ; \ <nl> + pthread_mutex_init ( & gdFontCacheMutex , 0 ) <nl> + <nl> + # define tsrm_mutex_free ( x ) pthread_mutex_destroy ( & x ) <nl> + # define tsrm_mutex_lock ( x ) pthread_mutex_lock ( & x ) <nl> + # define tsrm_mutex_unlock ( x ) pthread_mutex_unlock ( & x ) <nl> + <nl> # endif / / incl_HPHP_LIBGD_COMPAT_H_ <nl>
|
Force use of pthread_mutex_ * for thread safety in libgd ; de - tabify
|
facebook/hhvm
|
6afa4fe96e7ca936139aeafa1533e990026cd773
|
2014-01-30T03:48:37Z
|
mmm a / src / qt / macnotificationhandler . h <nl> ppp b / src / qt / macnotificationhandler . h <nl> <nl> <nl> # include < QObject > <nl> <nl> - / * * Macintosh - specific notification handler ( supports UserNotificationCenter and Growl ) . <nl> + / * * Macintosh - specific notification handler ( supports UserNotificationCenter ) . <nl> * / <nl> class MacNotificationHandler : public QObject <nl> { <nl> Q_OBJECT <nl> <nl> public : <nl> - / * * shows a 10 . 8 + UserNotification in the UserNotificationCenter <nl> + / * * shows a macOS 10 . 8 + UserNotification in the UserNotificationCenter <nl> * / <nl> void showNotification ( const QString & title , const QString & text ) ; <nl> <nl> - / * * executes AppleScript * / <nl> - void sendAppleScript ( const QString & script ) ; <nl> - <nl> / * * check if OS can handle UserNotifications * / <nl> bool hasUserNotificationCenterSupport ( void ) ; <nl> static MacNotificationHandler * instance ( ) ; <nl> mmm a / src / qt / macnotificationhandler . mm <nl> ppp b / src / qt / macnotificationhandler . mm <nl> - ( NSString * ) __bundleIdentifier <nl> } <nl> } <nl> <nl> - / / sendAppleScript just take a QString and executes it as apple script <nl> - void MacNotificationHandler : : sendAppleScript ( const QString & script ) <nl> - { <nl> - QByteArray utf8 = script . toUtf8 ( ) ; <nl> - char * cString = ( char * ) utf8 . constData ( ) ; <nl> - NSString * scriptApple = [ [ NSString alloc ] initWithUTF8String : cString ] ; <nl> - <nl> - NSAppleScript * as = [ [ NSAppleScript alloc ] initWithSource : scriptApple ] ; <nl> - NSDictionary * err = nil ; <nl> - [ as executeAndReturnError : & err ] ; <nl> - [ as release ] ; <nl> - [ scriptApple release ] ; <nl> - } <nl> - <nl> bool MacNotificationHandler : : hasUserNotificationCenterSupport ( void ) <nl> { <nl> Class possibleClass = NSClassFromString ( @ " NSUserNotificationCenter " ) ; <nl> mmm a / src / qt / notificator . cpp <nl> ppp b / src / qt / notificator . cpp <nl> Notificator : : Notificator ( const QString & _programName , QSystemTrayIcon * _trayIcon <nl> if ( MacNotificationHandler : : instance ( ) - > hasUserNotificationCenterSupport ( ) ) { <nl> mode = UserNotificationCenter ; <nl> } <nl> - else { <nl> - / / Check if Growl is installed ( based on Qt ' s tray icon implementation ) <nl> - CFURLRef cfurl ; <nl> - OSStatus status = LSGetApplicationForInfo ( kLSUnknownType , kLSUnknownCreator , CFSTR ( " growlTicket " ) , kLSRolesAll , 0 , & cfurl ) ; <nl> - if ( status ! = kLSApplicationNotFoundErr ) { <nl> - CFBundleRef bundle = CFBundleCreate ( 0 , cfurl ) ; <nl> - if ( CFStringCompare ( CFBundleGetIdentifier ( bundle ) , CFSTR ( " com . Growl . GrowlHelperApp " ) , kCFCompareCaseInsensitive | kCFCompareBackwards ) = = kCFCompareEqualTo ) { <nl> - if ( CFStringHasSuffix ( CFURLGetString ( cfurl ) , CFSTR ( " / Growl . app / " ) ) ) <nl> - mode = Growl13 ; <nl> - else <nl> - mode = Growl12 ; <nl> - } <nl> - CFRelease ( cfurl ) ; <nl> - CFRelease ( bundle ) ; <nl> - } <nl> - } <nl> # endif <nl> } <nl> <nl> void Notificator : : notifySystray ( Class cls , const QString & title , const QString & <nl> <nl> / / Based on Qt ' s tray icon implementation <nl> # ifdef Q_OS_MAC <nl> - void Notificator : : notifyGrowl ( Class cls , const QString & title , const QString & text , const QIcon & icon ) <nl> - { <nl> - const QString script ( <nl> - " tell application \ " % 5 \ " \ n " <nl> - " set the allNotificationsList to { \ " Notification \ " } \ n " / / - - Make a list of all the notification types ( all ) <nl> - " set the enabledNotificationsList to { \ " Notification \ " } \ n " / / - - Make a list of the notifications ( enabled ) <nl> - " register as application \ " % 1 \ " all notifications allNotificationsList default notifications enabledNotificationsList \ n " / / - - Register our script with Growl <nl> - " notify with name \ " Notification \ " title \ " % 2 \ " description \ " % 3 \ " application name \ " % 1 \ " % 4 \ n " / / - - Send a Notification <nl> - " end tell " <nl> - ) ; <nl> - <nl> - QString notificationApp ( QApplication : : applicationName ( ) ) ; <nl> - if ( notificationApp . isEmpty ( ) ) <nl> - notificationApp = " Application " ; <nl> - <nl> - QPixmap notificationIconPixmap ; <nl> - if ( icon . isNull ( ) ) { / / If no icon specified , set icon based on class <nl> - QStyle : : StandardPixmap sicon = QStyle : : SP_MessageBoxQuestion ; <nl> - switch ( cls ) <nl> - { <nl> - case Information : sicon = QStyle : : SP_MessageBoxInformation ; break ; <nl> - case Warning : sicon = QStyle : : SP_MessageBoxWarning ; break ; <nl> - case Critical : sicon = QStyle : : SP_MessageBoxCritical ; break ; <nl> - } <nl> - notificationIconPixmap = QApplication : : style ( ) - > standardPixmap ( sicon ) ; <nl> - } <nl> - else { <nl> - QSize size = icon . actualSize ( QSize ( 48 , 48 ) ) ; <nl> - notificationIconPixmap = icon . pixmap ( size ) ; <nl> - } <nl> - <nl> - QString notificationIcon ; <nl> - QTemporaryFile notificationIconFile ; <nl> - if ( ! notificationIconPixmap . isNull ( ) & & notificationIconFile . open ( ) ) { <nl> - QImageWriter writer ( & notificationIconFile , " PNG " ) ; <nl> - if ( writer . write ( notificationIconPixmap . toImage ( ) ) ) <nl> - notificationIcon = QString ( " image from location \ " file : / / % 1 \ " " ) . arg ( notificationIconFile . fileName ( ) ) ; <nl> - } <nl> - <nl> - QString quotedTitle ( title ) , quotedText ( text ) ; <nl> - quotedTitle . replace ( " \ \ " , " \ \ \ \ " ) . replace ( " \ " " , " \ \ " ) ; <nl> - quotedText . replace ( " \ \ " , " \ \ \ \ " ) . replace ( " \ " " , " \ \ " ) ; <nl> - QString growlApp ( this - > mode = = Notificator : : Growl13 ? " Growl " : " GrowlHelperApp " ) ; <nl> - MacNotificationHandler : : instance ( ) - > sendAppleScript ( script . arg ( notificationApp , quotedTitle , quotedText , notificationIcon , growlApp ) ) ; <nl> - } <nl> - <nl> void Notificator : : notifyMacUserNotificationCenter ( Class cls , const QString & title , const QString & text , const QIcon & icon ) { <nl> / / icon is not supported by the user notification center yet . OSX will use the app icon . <nl> MacNotificationHandler : : instance ( ) - > showNotification ( title , text ) ; <nl> void Notificator : : notify ( Class cls , const QString & title , const QString & text , c <nl> case UserNotificationCenter : <nl> notifyMacUserNotificationCenter ( cls , title , text , icon ) ; <nl> break ; <nl> - case Growl12 : <nl> - case Growl13 : <nl> - notifyGrowl ( cls , title , text , icon ) ; <nl> - break ; <nl> # endif <nl> default : <nl> if ( cls = = Critical ) <nl> mmm a / src / qt / notificator . h <nl> ppp b / src / qt / notificator . h <nl> public Q_SLOTS : <nl> None , / * * < Ignore informational notifications , and show a modal pop - up dialog for Critical notifications . * / <nl> Freedesktop , / * * < Use DBus org . freedesktop . Notifications * / <nl> QSystemTray , / * * < Use QSystemTray : : showMessage * / <nl> - Growl12 , / * * < Use the Growl 1 . 2 notification system ( Mac only ) * / <nl> - Growl13 , / * * < Use the Growl 1 . 3 notification system ( Mac only ) * / <nl> UserNotificationCenter / * * < Use the 10 . 8 + User Notification Center ( Mac only ) * / <nl> } ; <nl> QString programName ; <nl> public Q_SLOTS : <nl> # endif <nl> void notifySystray ( Class cls , const QString & title , const QString & text , const QIcon & icon , int millisTimeout ) ; <nl> # ifdef Q_OS_MAC <nl> - void notifyGrowl ( Class cls , const QString & title , const QString & text , const QIcon & icon ) ; <nl> void notifyMacUserNotificationCenter ( Class cls , const QString & title , const QString & text , const QIcon & icon ) ; <nl> # endif <nl> } ; <nl>
|
Merge : [ macOS ] remove Growl support , remove unused code
|
bitcoin/bitcoin
|
31e72b284ef54c4c221015c8d700946c6143fb7a
|
2017-09-11T19:42:43Z
|
mmm a / src / python / grpcio / commands . py <nl> ppp b / src / python / grpcio / commands . py <nl> <nl> import setuptools <nl> from setuptools . command import build_py <nl> from setuptools . command import test <nl> - <nl> - # Because we need to support building without Cython but simultaneously need to <nl> - # subclass its command class when we need to and because distutils requires a <nl> - # special hook to acquire a command class , we attempt to import Cython ' s <nl> - # build_ext , and if that fails we import setuptools ' . <nl> - try : <nl> - # Due to the strange way Cython ' s Distutils module re - imports build_ext , we <nl> - # import the build_ext class directly . <nl> - from Cython . Distutils . build_ext import build_ext <nl> - except ImportError : <nl> - from setuptools . command . build_ext import build_ext <nl> + from setuptools . command import build_ext <nl> <nl> PYTHON_STEM = os . path . dirname ( os . path . abspath ( __file__ ) ) <nl> <nl> def run ( self ) : <nl> build_py . build_py . run ( self ) <nl> <nl> <nl> - class BuildExt ( build_ext ) : <nl> + class BuildExt ( build_ext . build_ext ) : <nl> " " " Custom build_ext command to enable compiler - specific flags . " " " <nl> <nl> C_OPTIONS = { <nl> def build_extensions ( self ) : <nl> if compiler in BuildExt . LINK_OPTIONS : <nl> for extension in self . extensions : <nl> extension . extra_link_args + = list ( BuildExt . LINK_OPTIONS [ compiler ] ) <nl> - build_ext . build_extensions ( self ) <nl> + build_ext . build_ext . build_extensions ( self ) <nl> <nl> <nl> class Gather ( setuptools . Command ) : <nl>
|
Fix broken Python package builds
|
grpc/grpc
|
14a0a93c79fab24f2fcc41aae5014bd0a5cbedf2
|
2016-01-22T04:13:24Z
|
new file mode 100644 <nl> index 000000000000 . . 866705e8427a <nl> mmm / dev / null <nl> ppp b / validation - test / Sema / type_checker_perf_failing / rdar25866240 . swift . gyb <nl> <nl> + / / RUN : not % scale - test - - begin 1 - - end 5 - - step 1 - - select incrementScopeCounter % s <nl> + / / REQUIRES : OS = macosx <nl> + / / REQUIRES : asserts <nl> + <nl> + func f ( ) { <nl> + % for i in range ( N ) : <nl> + let collection $ { i } = [ String ] ( ) <nl> + % end <nl> + <nl> + _ = $ { ' + ' . join ( " collection % s " % i for i in range ( N ) ) } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . fa34279fb6ef <nl> mmm / dev / null <nl> ppp b / validation - test / Sema / type_checker_perf_failing / rdar26939465 . swift . gyb <nl> <nl> + / / RUN : not % scale - test - - begin 1 - - end 6 - - step 1 - - select incrementScopeCounter % s <nl> + / / REQUIRES : OS = macosx <nl> + / / REQUIRES : asserts <nl> + <nl> + class NSNumber { <nl> + init ( value : Bool ) { } <nl> + init ( value : Int8 ) { } <nl> + init ( value : Double ) { } <nl> + init ( value : Float ) { } <nl> + init ( value : Int32 ) { } <nl> + init ( value : Int ) { } <nl> + init ( value : Int64 ) { } <nl> + init ( value : Int16 ) { } <nl> + init ( value : UInt8 ) { } <nl> + init ( value : UInt32 ) { } <nl> + init ( value : UInt ) { } <nl> + init ( value : UInt64 ) { } <nl> + init ( value : UInt16 ) { } <nl> + } <nl> + let oops = [ $ { ' , ' . join ( ' NSNumber ( value : false ) ' for _ in range ( N ) ) } ] <nl> new file mode 100644 <nl> index 000000000000 . . 0c2fdbca4544 <nl> mmm / dev / null <nl> ppp b / validation - test / Sema / type_checker_perf_failing / rdar30596744_1 . swift . gyb <nl> <nl> + / / RUN : not % scale - test - - begin 1 - - end 5 - - step 1 - - select incrementScopeCounter % s - - expected - exit - code 1 <nl> + / / REQUIRES : OS = macosx <nl> + / / REQUIRES : asserts <nl> + <nl> + % enum_cases = N <nl> + % array_elements = 3 <nl> + <nl> + % array = str ( list ( range ( array_elements ) ) ) <nl> + enum E { <nl> + % for i in range ( enum_cases ) : <nl> + case x $ { i } <nl> + % end <nl> + } <nl> + <nl> + let a = [ <nl> + % for i in range ( enum_cases ) : <nl> + . x $ { i } : $ { array } , <nl> + % end <nl> + ] <nl> new file mode 100644 <nl> index 000000000000 . . 8cbea71d436c <nl> mmm / dev / null <nl> ppp b / validation - test / Sema / type_checker_perf_failing / rdar30596744_2 . swift . gyb <nl> <nl> + / / RUN : not % scale - test - - begin 1 - - end 5 - - step 1 - - select incrementScopeCounter % s - - expected - exit - code 1 <nl> + / / REQUIRES : OS = macosx <nl> + / / REQUIRES : asserts <nl> + <nl> + % enum_cases = 3 <nl> + % array_elements = N <nl> + <nl> + % array = str ( list ( range ( array_elements ) ) ) <nl> + enum E { <nl> + % for i in range ( enum_cases ) : <nl> + case x $ { i } <nl> + % end <nl> + } <nl> + <nl> + let a = [ <nl> + % for i in range ( enum_cases ) : <nl> + . x $ { i } : $ { array } , <nl> + % end <nl> + ] <nl>
|
Merge remote - tracking branch ' origin / master ' into master - next
|
apple/swift
|
19237f86d84651e44af62b6b242c953f58fab041
|
2017-08-16T04:28:59Z
|
mmm a / aten / src / ATen / NamedTensor . cpp <nl> ppp b / aten / src / ATen / NamedTensor . cpp <nl> void internal_set_names_inplace ( TensorImpl * impl , std : : vector < Dimname > & & names , <nl> } <nl> } <nl> <nl> - optional < DimnameList > get_names ( TensorImpl * impl ) { <nl> + optional < DimnameList > get_opt_names ( TensorImpl * impl ) { <nl> const auto * meta = get_named_tensor_meta ( impl ) ; <nl> if ( meta = = nullptr ) { <nl> return nullopt ; <nl> mmm a / aten / src / ATen / NamedTensor . h <nl> ppp b / aten / src / ATen / NamedTensor . h <nl> namespace impl { <nl> / / XXX : Ideally these would exist as methods on TensorImpl <nl> CAFFE2_API void internal_set_names_inplace ( TensorImpl * impl , optional < DimnameList > names ) ; <nl> CAFFE2_API void internal_set_names_inplace ( TensorImpl * impl , std : : vector < Dimname > & & names , bool validate_names ) ; <nl> - CAFFE2_API optional < DimnameList > get_names ( TensorImpl * impl ) ; <nl> + CAFFE2_API optional < DimnameList > get_opt_names ( TensorImpl * impl ) ; <nl> CAFFE2_API bool has_names ( TensorImpl * impl ) ; <nl> <nl> <nl> mmm a / aten / src / ATen / NamedTensorUtils . cpp <nl> ppp b / aten / src / ATen / NamedTensorUtils . cpp <nl> namespace at { <nl> static std : : string toDimnameRepr ( const Tensor & tensor ) { <nl> std : : ostringstream os ; <nl> os < < " Tensor " ; <nl> - if ( tensor . names ( ) = = nullopt ) { <nl> + if ( tensor . opt_names ( ) = = nullopt ) { <nl> os < < " [ " ; <nl> for ( auto i = 0 ; i < tensor . dim ( ) ; i + + ) { <nl> if ( i ! = 0 ) os < < " , " ; <nl> static std : : string toDimnameRepr ( const Tensor & tensor ) { <nl> } <nl> os < < " ] " ; <nl> } else { <nl> - os < < * tensor . names ( ) ; <nl> + os < < * tensor . opt_names ( ) ; <nl> } <nl> return os . str ( ) ; <nl> } <nl> static std : : string toDimnameRepr ( const Tensor & tensor ) { <nl> int64_t dimname_to_position ( const Tensor & tensor , Dimname dim ) { <nl> TORCH_CHECK ( dim . type ( ) ! = NameType : : WILDCARD , <nl> " Please look up dimensions by name , got : name = None . " ) ; <nl> - TORCH_CHECK ( tensor . names ( ) . has_value ( ) , <nl> + TORCH_CHECK ( tensor . opt_names ( ) . has_value ( ) , <nl> " Name " , dim , " not found in " , toDimnameRepr ( tensor ) , " . " ) ; <nl> - const auto names = * tensor . names ( ) ; <nl> + const auto names = * tensor . opt_names ( ) ; <nl> <nl> const auto it = std : : find_if ( <nl> names . begin ( ) , names . end ( ) , <nl> static void assert_names_equal ( DimnameList a , DimnameList b ) { <nl> } <nl> <nl> void propagate_names ( TensorImpl * result , optional < DimnameList > names ) { <nl> - if ( ! impl : : get_names ( result ) . has_value ( ) & & ! names . has_value ( ) ) { <nl> + if ( ! impl : : get_opt_names ( result ) . has_value ( ) & & ! names . has_value ( ) ) { <nl> return ; <nl> } <nl> if ( ! impl : : has_names ( result ) ) { <nl> void propagate_names ( TensorImpl * result , optional < DimnameList > names ) { <nl> return ; <nl> } <nl> assert_names_equal ( <nl> - * impl : : get_names ( result ) , <nl> + * impl : : get_opt_names ( result ) , <nl> names . value_or ( default_names ( result - > dim ( ) ) ) ) ; <nl> } <nl> <nl> void propagate_names ( TensorImpl * result , std : : vector < Dimname > & & names , bool vali <nl> impl : : internal_set_names_inplace ( result , std : : move ( names ) , validate_names ) ; <nl> return ; <nl> } <nl> - assert_names_equal ( * impl : : get_names ( result ) , names ) ; <nl> + assert_names_equal ( * impl : : get_opt_names ( result ) , names ) ; <nl> } <nl> <nl> void propagate_names ( Tensor & result , optional < DimnameList > names ) { <nl> void propagate_names ( Tensor & result , std : : vector < Dimname > & & names , bool validate <nl> } <nl> <nl> void propagate_names_except ( Tensor & result , const Tensor & src , IntArrayRef excluded_idxs ) { <nl> - auto src_names = src . names ( ) ; <nl> + auto src_names = src . opt_names ( ) ; <nl> if ( ! src_names . has_value ( ) ) { <nl> return ; <nl> } <nl> void propagate_names ( TensorImpl * result , TensorImpl * src ) { <nl> if ( result = = src ) { <nl> return ; <nl> } <nl> - propagate_names ( result , impl : : get_names ( src ) ) ; <nl> + propagate_names ( result , impl : : get_opt_names ( src ) ) ; <nl> } <nl> <nl> } / / namespace namedinference <nl> mmm a / aten / src / ATen / core / Tensor . h <nl> ppp b / aten / src / ATen / core / Tensor . h <nl> class CAFFE2_API Tensor { <nl> return impl_ - > strides ( ) ; <nl> } <nl> # ifdef BUILD_NAMEDTENSOR <nl> - optional < DimnameList > names ( ) const { <nl> - return impl : : get_names ( unsafeGetTensorImpl ( ) ) ; <nl> + optional < DimnameList > opt_names ( ) const { <nl> + return impl : : get_opt_names ( unsafeGetTensorImpl ( ) ) ; <nl> } <nl> # endif <nl> int64_t ndimension ( ) const { <nl> mmm a / aten / src / ATen / native / Copy . cpp <nl> ppp b / aten / src / ATen / native / Copy . cpp <nl> void copy_same_type_transpose_ ( Tensor & self , const Tensor & src ) { <nl> } <nl> } ) ; <nl> # ifdef BUILD_NAMEDTENSOR <nl> - auto outnames = unify_from_right ( self . names ( ) , src . names ( ) ) ; <nl> + auto outnames = unify_from_right ( self . opt_names ( ) , src . opt_names ( ) ) ; <nl> if ( outnames . has_value ( ) ) { <nl> namedinference : : propagate_names ( self , * outnames ) ; <nl> } else { <nl> mmm a / aten / src / ATen / native / NamedTensor . cpp <nl> ppp b / aten / src / ATen / native / NamedTensor . cpp <nl> static std : : vector < int64_t > aligned_size ( <nl> / / 2 ) torch . align_tensors ( [ tensor , other ] ) ( is_aligning_two_tensors = true ) <nl> static Tensor align ( const Tensor & tensor , DimnameList names , bool is_aligning_two_tensors ) { <nl> std : : vector < int64_t > expanded_sizes ; <nl> - if ( tensor . names ( ) . has_value ( ) ) { <nl> + if ( tensor . opt_names ( ) . has_value ( ) ) { <nl> expanded_sizes = aligned_size ( <nl> - tensor . sizes ( ) , * tensor . names ( ) , names , is_aligning_two_tensors ) ; <nl> + tensor . sizes ( ) , * tensor . opt_names ( ) , names , is_aligning_two_tensors ) ; <nl> } else { <nl> auto tensor_sizes = tensor . sizes ( ) ; <nl> expanded_sizes = aligned_size ( <nl> Tensor align_to ( const Tensor & tensor , DimnameList names ) { <nl> TORCH_CHECK ( <nl> names . size ( ) > = tensor . dim ( ) , <nl> " Cannot align tensor with dims " , <nl> - tensor . names ( ) ? tensor . names ( ) . value ( ) : default_names ( tensor . dim ( ) ) , <nl> + tensor . opt_names ( ) ? tensor . opt_names ( ) . value ( ) : default_names ( tensor . dim ( ) ) , <nl> " to a shorter list of dims " , names , " . " ) ; <nl> return align ( tensor , names , / * aligning_two_tensors = * / false ) ; <nl> } <nl> std : : vector < Tensor > align_tensors ( TensorList tensors ) { <nl> [ ] ( const Tensor & a , const Tensor & b ) { <nl> return a . dim ( ) < b . dim ( ) ; <nl> } ) ; <nl> - auto longest_names = longest_dim - > names ( ) ; <nl> + auto longest_names = longest_dim - > opt_names ( ) ; <nl> if ( longest_names . has_value ( ) ) { <nl> return align_tensors_to ( tensors , * longest_names ) ; <nl> } else { <nl> mmm a / aten / src / ATen / native / TensorFactories . cpp <nl> ppp b / aten / src / ATen / native / TensorFactories . cpp <nl> Tensor empty_like ( <nl> } <nl> <nl> # ifdef BUILD_NAMEDTENSOR <nl> - return at : : empty ( self . sizes ( ) , self . names ( ) , options , use_memory_format ) ; <nl> + return at : : empty ( self . sizes ( ) , self . opt_names ( ) , options , use_memory_format ) ; <nl> # else <nl> return at : : empty ( self . sizes ( ) , options , use_memory_format ) ; <nl> # endif <nl> mmm a / aten / src / ATen / native / TensorIterator . cpp <nl> ppp b / aten / src / ATen / native / TensorIterator . cpp <nl> void TensorIterator : : propagate_names_to_outputs ( ) { <nl> if ( ! op . tensor . has_names ( ) ) { <nl> continue ; <nl> } <nl> - auto tensor_names = * op . tensor . names ( ) ; <nl> + auto tensor_names = * op . tensor . opt_names ( ) ; <nl> if ( names . empty ( ) ) { <nl> names = tensor_names ; <nl> } else { <nl> mmm a / aten / src / ATen / native / TensorShape . cpp <nl> ppp b / aten / src / ATen / native / TensorShape . cpp <nl> Tensor select ( const Tensor & self , int64_t dim , int64_t index ) { <nl> auto size = self . size ( dim ) ; <nl> if ( index < - size | | index > = size ) { <nl> # ifdef BUILD_NAMEDTENSOR <nl> - if ( self . names ( ) . has_value ( ) ) { <nl> + if ( self . opt_names ( ) . has_value ( ) ) { <nl> AT_INDEX_ERROR ( " select ( ) : index " , index , " out of range for tensor of size " , <nl> - self . sizes ( ) , " at dimension " , self . names ( ) - > at ( dim ) ) ; <nl> + self . sizes ( ) , " at dimension " , self . opt_names ( ) - > at ( dim ) ) ; <nl> } <nl> # endif <nl> AT_INDEX_ERROR ( " select ( ) : index " , index , " out of range for tensor of size " , <nl> static Tensor & propagate_transposed_names ( <nl> const Tensor & other , <nl> int64_t dim0 , <nl> int64_t dim1 ) { <nl> - if ( other . names ( ) ) { <nl> - auto names = other . names ( ) - > vec ( ) ; <nl> + if ( other . opt_names ( ) ) { <nl> + auto names = other . opt_names ( ) - > vec ( ) ; <nl> std : : swap ( names [ dim0 ] , names [ dim1 ] ) ; <nl> namedinference : : propagate_names ( result , names ) ; <nl> } <nl> mmm a / aten / src / ATen / templates / Tensor . h <nl> ppp b / aten / src / ATen / templates / Tensor . h <nl> class CAFFE2_API Tensor { <nl> return impl_ - > strides ( ) ; <nl> } <nl> # ifdef BUILD_NAMEDTENSOR <nl> - optional < DimnameList > names ( ) const { <nl> - return impl : : get_names ( unsafeGetTensorImpl ( ) ) ; <nl> + optional < DimnameList > opt_names ( ) const { <nl> + return impl : : get_opt_names ( unsafeGetTensorImpl ( ) ) ; <nl> } <nl> # endif <nl> int64_t ndimension ( ) const { <nl> mmm a / aten / src / ATen / test / NamedTensor_test . cpp <nl> ppp b / aten / src / ATen / test / NamedTensor_test . cpp <nl> TEST ( NamedTensorTest , internalSetNamesInplace ) { <nl> <nl> / / Set names <nl> at : : internal_set_names_inplace ( tensor , names ) ; <nl> - const auto retrieved_names = tensor . names ( ) . value ( ) ; <nl> + const auto retrieved_names = tensor . opt_names ( ) . value ( ) ; <nl> ASSERT_TRUE ( dimnames_equal ( retrieved_names , names ) ) ; <nl> <nl> / / Drop names <nl> at : : internal_set_names_inplace ( tensor , at : : nullopt ) ; <nl> ASSERT_TRUE ( tensor . get_named_tensor_meta ( ) = = nullptr ) ; <nl> - ASSERT_TRUE ( tensor . names ( ) = = at : : nullopt ) ; <nl> + ASSERT_TRUE ( tensor . opt_names ( ) = = at : : nullopt ) ; <nl> } <nl> <nl> TEST ( NamedTensorTest , empty ) { <nl> TEST ( NamedTensorTest , empty ) { <nl> std : : vector < Dimname > names = { N , C , H , W } ; <nl> <nl> auto tensor = at : : empty ( { } ) ; <nl> - ASSERT_EQ ( tensor . names ( ) , at : : nullopt ) ; <nl> + ASSERT_EQ ( tensor . opt_names ( ) , at : : nullopt ) ; <nl> <nl> tensor = at : : empty ( { 1 , 2 , 3 } ) ; <nl> - ASSERT_EQ ( tensor . names ( ) , at : : nullopt ) ; <nl> + ASSERT_EQ ( tensor . opt_names ( ) , at : : nullopt ) ; <nl> <nl> tensor = at : : empty ( { 1 , 2 , 3 , 4 } , names ) ; <nl> - ASSERT_TRUE ( dimnames_equal ( tensor . names ( ) . value ( ) , names ) ) ; <nl> + ASSERT_TRUE ( dimnames_equal ( tensor . opt_names ( ) . value ( ) , names ) ) ; <nl> <nl> ASSERT_THROW ( at : : empty ( { 1 , 2 , 3 } , names ) , c10 : : Error ) ; <nl> } <nl> TEST ( NamedTensorTest , alias ) { <nl> <nl> auto tensor = at : : empty ( { 2 , 3 } , std : : vector < Dimname > { N , C } ) ; <nl> auto aliased = tensor . alias ( ) ; <nl> - ASSERT_TRUE ( dimnames_equal ( tensor . names ( ) . value ( ) , aliased . names ( ) . value ( ) ) ) ; <nl> + ASSERT_TRUE ( dimnames_equal ( tensor . opt_names ( ) . value ( ) , aliased . opt_names ( ) . value ( ) ) ) ; <nl> } <nl> <nl> TEST ( NamedTensorTest , NoNamesGuard ) { <nl> TEST ( NamedTensorTest , NoNamesGuard ) { <nl> { <nl> at : : NoNamesGuard guard ; <nl> ASSERT_FALSE ( at : : NamesMode : : is_enabled ( ) ) ; <nl> - ASSERT_FALSE ( tensor . names ( ) ) ; <nl> - ASSERT_FALSE ( at : : impl : : get_names ( tensor . unsafeGetTensorImpl ( ) ) ) ; <nl> + ASSERT_FALSE ( tensor . opt_names ( ) ) ; <nl> + ASSERT_FALSE ( at : : impl : : get_opt_names ( tensor . unsafeGetTensorImpl ( ) ) ) ; <nl> } <nl> ASSERT_TRUE ( at : : NamesMode : : is_enabled ( ) ) ; <nl> } <nl> mmm a / torch / csrc / autograd / python_variable . cpp <nl> ppp b / torch / csrc / autograd / python_variable . cpp <nl> PyObject * THPVariable_get_names ( THPVariable * self ) <nl> return tuple . release ( ) ; <nl> } <nl> <nl> - const auto dimnames = self - > cdata . names ( ) . value ( ) ; <nl> + const auto dimnames = self - > cdata . opt_names ( ) . value ( ) ; <nl> for ( size_t i = 0 ; i < size ; + + i ) { <nl> PyObject * str = Py_None ; <nl> if ( dimnames [ i ] . type ( ) ! = at : : NameType : : WILDCARD ) { <nl>
|
Rename Tensor : : names ( ) to Tensor : : opt_names ( ) ( )
|
pytorch/pytorch
|
530db2c7c293f49a065d82c51de4e2d944746b24
|
2019-08-23T21:32:11Z
|
mmm a / modules / imgproc / src / demosaicing . cpp <nl> ppp b / modules / imgproc / src / demosaicing . cpp <nl> class SIMDBayerStubInterpolator_ <nl> { <nl> return 0 ; <nl> } <nl> - <nl> + <nl> int bayer2RGBA ( const T * , int , T * , int , int ) const <nl> { <nl> return 0 ; <nl> class SIMDBayerInterpolator_8u <nl> return ( int ) ( bayer - ( bayer_end - width ) ) ; <nl> } <nl> <nl> - int bayer2RGBA ( const uchar * bayer , int bayer_step , uchar * dst , int width , int blue ) const <nl> + int bayer2RGBA ( const uchar * , int , uchar * , int , int ) const <nl> { <nl> return 0 ; <nl> } <nl> class SIMDBayerInterpolator_8u <nl> vst1_u8 ( dst , p . val [ 0 ] ) ; <nl> vst1_u8 ( dst + 8 , p . val [ 1 ] ) ; <nl> } <nl> - <nl> + <nl> return ( int ) ( bayer - ( bayer_end - width ) ) ; <nl> } <nl> <nl> class SIMDBayerInterpolator_8u <nl> <nl> return ( int ) ( bayer - ( bayer_end - width ) ) ; <nl> } <nl> - <nl> + <nl> int bayer2RGBA ( const uchar * bayer , int bayer_step , uchar * dst , int width , int blue ) const <nl> { <nl> / * <nl> class SIMDBayerInterpolator_8u <nl> <nl> vst4q_u8 ( dst - 1 , pix ) ; <nl> } <nl> - <nl> + <nl> return ( int ) ( bayer - ( bayer_end - width ) ) ; <nl> } <nl> <nl> - int bayer2RGB_EA ( const uchar * bayer , int bayer_step , uchar * dst , int width , int blue ) const <nl> + int bayer2RGB_EA ( const uchar * , int , uchar * , int , int ) const <nl> { <nl> return 0 ; <nl> } <nl> class Bayer2RGB_Invoker : <nl> } <nl> <nl> / / simd optimization only for dcn = = 3 <nl> - int delta = dcn = = 4 ? <nl> + int delta = dcn = = 4 ? <nl> vecOp . bayer2RGBA ( bayer , bayer_step , dst , size . width , blue ) : <nl> vecOp . bayer2RGB ( bayer , bayer_step , dst , size . width , blue ) ; <nl> bayer + = delta ; <nl>
|
fixed compile warnings and removed extra whitespaces
|
opencv/opencv
|
4255746c0090408ad43d7073ad64bbe0e38d3a1a
|
2014-07-28T11:20:25Z
|
mmm a / test / unittest / valuetest . cpp <nl> ppp b / test / unittest / valuetest . cpp <nl> TEST ( Value , DefaultConstructor ) { <nl> / / Value y = x ; <nl> / / } <nl> <nl> + # if RAPIDJSON_HAS_CXX11_RVALUE_REFS <nl> + TEST ( Value , MoveConstructor ) { <nl> + typedef GenericValue < UTF8 < > , CrtAllocator > Value ; <nl> + Value : : AllocatorType allocator ; <nl> + <nl> + Value x ( ( Value ( kArrayType ) ) ) ; <nl> + x . Reserve ( 4u , allocator ) ; <nl> + x . PushBack ( 1 , allocator ) . PushBack ( 2 , allocator ) . PushBack ( 3 , allocator ) . PushBack ( 4 , allocator ) ; <nl> + EXPECT_TRUE ( x . IsArray ( ) ) ; <nl> + EXPECT_EQ ( 4u , x . Size ( ) ) ; <nl> + <nl> + / / Value y ( x ) ; / / should not compile <nl> + Value y ( std : : move ( x ) ) ; <nl> + EXPECT_TRUE ( x . IsNull ( ) ) ; <nl> + EXPECT_TRUE ( y . IsArray ( ) ) ; <nl> + EXPECT_EQ ( 4u , y . Size ( ) ) ; <nl> + <nl> + / / Value z = y ; / / should not compile <nl> + Value z = std : : move ( y ) ; <nl> + EXPECT_TRUE ( y . IsNull ( ) ) ; <nl> + EXPECT_TRUE ( z . IsArray ( ) ) ; <nl> + EXPECT_EQ ( 4u , z . Size ( ) ) ; <nl> + } <nl> + # endif / / RAPIDJSON_HAS_CXX11_RVALUE_REFS <nl> + <nl> TEST ( Value , AssignmentOperator ) { <nl> Value x ( 1234 ) ; <nl> Value y ; <nl> TEST ( Value , AssignmentOperator ) { <nl> y = StringRef ( mstr ) ; <nl> EXPECT_TRUE ( y . IsString ( ) ) ; <nl> EXPECT_EQ ( y . GetString ( ) , mstr ) ; <nl> + <nl> + # if RAPIDJSON_HAS_CXX11_RVALUE_REFS <nl> + / / C + + 11 move assignment <nl> + x = Value ( " World " ) ; <nl> + EXPECT_TRUE ( x . IsString ( ) ) ; <nl> + EXPECT_STREQ ( " World " , x . GetString ( ) ) ; <nl> + <nl> + x = std : : move ( y ) ; <nl> + EXPECT_TRUE ( y . IsNull ( ) ) ; <nl> + EXPECT_TRUE ( x . IsString ( ) ) ; <nl> + EXPECT_EQ ( x . GetString ( ) , mstr ) ; <nl> + <nl> + y = std : : move ( Value ( ) . SetInt ( 1234 ) ) ; <nl> + EXPECT_TRUE ( y . IsInt ( ) ) ; <nl> + EXPECT_EQ ( 1234 , y ) ; <nl> + # endif / / RAPIDJSON_HAS_CXX11_RVALUE_REFS <nl> } <nl> <nl> template < typename A , typename B > <nl> TEST ( Value , Array ) { <nl> EXPECT_TRUE ( y [ 4u ] . IsString ( ) ) ; <nl> EXPECT_STREQ ( " foo " , y [ 4u ] . GetString ( ) ) ; <nl> <nl> + # if RAPIDJSON_HAS_CXX11_RVALUE_REFS <nl> + / / PushBack ( GenericValue & & , Allocator & ) ; <nl> + { <nl> + Value y ( kArrayType ) ; <nl> + y . PushBack ( Value ( true ) , allocator ) ; <nl> + y . PushBack ( std : : move ( Value ( kArrayType ) . PushBack ( Value ( 1 ) , allocator ) . PushBack ( " foo " , allocator ) ) , allocator ) ; <nl> + EXPECT_EQ ( 2u , y . Size ( ) ) ; <nl> + EXPECT_TRUE ( y [ 0u ] . IsTrue ( ) ) ; <nl> + EXPECT_TRUE ( y [ 1u ] . IsArray ( ) ) ; <nl> + EXPECT_EQ ( 2u , y [ 1u ] . Size ( ) ) ; <nl> + EXPECT_TRUE ( y [ 1u ] [ 0u ] . IsInt ( ) ) ; <nl> + EXPECT_TRUE ( y [ 1u ] [ 1u ] . IsString ( ) ) ; <nl> + } <nl> + # endif <nl> + <nl> / / iterator <nl> Value : : ValueIterator itr = x . Begin ( ) ; <nl> EXPECT_TRUE ( itr ! = x . End ( ) ) ; <nl> TEST ( Value , Array ) { <nl> } <nl> <nl> / / Working in gcc without C + + 11 , but VS2013 cannot compile . To be diagnosed . <nl> - # if 0 <nl> / / http : / / en . wikipedia . org / wiki / Erase - remove_idiom <nl> x . Clear ( ) ; <nl> for ( int i = 0 ; i < 10 ; i + + ) <nl> TEST ( Value , Array ) { <nl> else <nl> x . PushBack ( Value ( kNullType ) . Move ( ) , allocator ) ; <nl> <nl> - x . Erase ( std : : remove ( x . Begin ( ) , x . End ( ) , Value ( kNullType ) ) , x . End ( ) ) ; <nl> + const Value null ( kNullType ) ; <nl> + x . Erase ( std : : remove ( x . Begin ( ) , x . End ( ) , null ) , x . End ( ) ) ; <nl> EXPECT_EQ ( 5u , x . Size ( ) ) ; <nl> for ( int i = 0 ; i < 5 ; i + + ) <nl> EXPECT_EQ ( i * 2 , x [ i ] ) ; <nl> - # endif <nl> <nl> / / SetArray ( ) <nl> Value z ; <nl> TEST ( Value , Object ) { <nl> EXPECT_EQ ( 8u , o . MemberCount ( ) ) ; <nl> } <nl> <nl> + # if RAPIDJSON_HAS_CXX11_RVALUE_REFS <nl> + / / AddMember ( GenericValue & & , . . . ) variants <nl> + { <nl> + Value o ( kObjectType ) ; <nl> + o . AddMember ( Value ( " true " ) , Value ( true ) , allocator ) ; <nl> + o . AddMember ( Value ( " false " ) , Value ( false ) . Move ( ) , allocator ) ; / / value is lvalue ref <nl> + o . AddMember ( Value ( " int " ) . Move ( ) , Value ( - 1 ) , allocator ) ; / / name is lvalue ref <nl> + o . AddMember ( " uint " , std : : move ( Value ( ) . SetUint ( 1u ) ) , allocator ) ; / / name is literal , value is rvalue <nl> + EXPECT_TRUE ( o [ " true " ] . GetBool ( ) ) ; <nl> + EXPECT_FALSE ( o [ " false " ] . GetBool ( ) ) ; <nl> + EXPECT_EQ ( - 1 , o [ " int " ] . GetInt ( ) ) ; <nl> + EXPECT_EQ ( 1u , o [ " uint " ] . GetUint ( ) ) ; <nl> + EXPECT_EQ ( 4u , o . MemberCount ( ) ) ; <nl> + } <nl> + # endif <nl> + <nl> / / Tests a member with null character <nl> Value name ; <nl> const Value C0D ( " C \ 0D " , 3 ) ; <nl>
|
valuetest : add tests for rvalue references , reenable erase / remove pattern
|
Tencent/rapidjson
|
36031b1b6f12b38a0e92cd6fc8293f66725dc465
|
2014-08-31T15:32:31Z
|
mmm a / scripts / generate_apache_release . sh <nl> ppp b / scripts / generate_apache_release . sh <nl> rsync - rvv - - include - from = scripts / release_files . rules . / $ dest <nl> <nl> # repackage <nl> find $ dest / android / sdk / src - type f - name ' * . java ' - exec sed - i ' ' ' s / com \ . taobao \ . weex / org \ . apache \ . weex / g ' { } \ ; <nl> + find $ dest / android / sdk / src - type f - name ' AndroidManifest . xml ' - exec sed - i ' ' ' s / com \ . taobao \ . weex / org \ . apache \ . weex / g ' { } \ ; <nl> <nl> mkdir - p $ dest / android / sdk / src / main / java / org <nl> mkdir - p $ dest / android / sdk / src / main / java / org / apache <nl>
|
[ WEEX - 342 ] [ android ] update release build tool , use right package name
|
apache/incubator-weex
|
c60016f358109f1d7f48b900891ae6646b06528a
|
2018-06-14T03:26:00Z
|
mmm a / data / widgets / main_window . xml <nl> ppp b / data / widgets / main_window . xml <nl> <nl> < vbox noborders = " true " id = " main_box " > <nl> < hbox noborders = " true " id = " menubar " / > <nl> < hbox noborders = " true " id = " tabsbar " / > <nl> - < hbox noborders = " true " expansive = " true " > <nl> - < splitter id = " colorbarsplitter " <nl> + < splitter id = " colorbarsplitter " <nl> horizontal = " true " expansive = " true " <nl> by = " pixel " position = " 52 " > <nl> < vbox noborders = " true " id = " colorbar " / > <nl> < vbox noborders = " true " expansive = " true " > <nl> < vbox noborders = " true " id = " contextbar " / > <nl> - < splitter id = " timelinesplitter " <nl> - vertical = " true " expansive = " true " <nl> - by = " percetage " position = " 100 " > <nl> - < hbox noborders = " true " id = " workspace " expansive = " true " / > <nl> - < vbox noborders = " true " id = " timeline " expansive = " true " / > <nl> - < / splitter > <nl> + < hbox noborders = " true " expansive = " true " > <nl> + < splitter id = " timelinesplitter " <nl> + vertical = " true " expansive = " true " <nl> + by = " percetage " position = " 100 " > <nl> + < hbox noborders = " true " id = " workspace " expansive = " true " / > <nl> + < vbox noborders = " true " id = " timeline " expansive = " true " / > <nl> + < / splitter > <nl> + < vbox noborders = " true " id = " toolbar " / > <nl> + < / hbox > <nl> < / vbox > <nl> - < / splitter > <nl> - < vbox noborders = " true " id = " toolbar " / > <nl> - < / hbox > <nl> + < / splitter > <nl> < hbox noborders = " true " id = " statusbar " / > <nl> < / vbox > <nl> < / gui > <nl>
|
main_window . xml : Give more space to the ContextBar
|
aseprite/aseprite
|
5567e3dfc5b3913150ce2fd530d0b6a91a22b99c
|
2014-04-13T19:35:11Z
|
mmm a / BUILD . gn <nl> ppp b / BUILD . gn <nl> config ( " grpc_config " ) { <nl> " src / core / lib / iomgr / buffer_list . h " , <nl> " src / core / lib / iomgr / call_combiner . cc " , <nl> " src / core / lib / iomgr / call_combiner . h " , <nl> + " src / core / lib / iomgr / cfstream_handle . cc " , <nl> + " src / core / lib / iomgr / cfstream_handle . h " , <nl> " src / core / lib / iomgr / closure . h " , <nl> " src / core / lib / iomgr / combiner . cc " , <nl> " src / core / lib / iomgr / combiner . h " , <nl> " src / core / lib / iomgr / dynamic_annotations . h " , <nl> " src / core / lib / iomgr / endpoint . cc " , <nl> " src / core / lib / iomgr / endpoint . h " , <nl> + " src / core / lib / iomgr / endpoint_cfstream . cc " , <nl> + " src / core / lib / iomgr / endpoint_cfstream . h " , <nl> " src / core / lib / iomgr / endpoint_pair . h " , <nl> " src / core / lib / iomgr / endpoint_pair_posix . cc " , <nl> " src / core / lib / iomgr / endpoint_pair_uv . cc " , <nl> " src / core / lib / iomgr / endpoint_pair_windows . cc " , <nl> " src / core / lib / iomgr / error . cc " , <nl> " src / core / lib / iomgr / error . h " , <nl> + " src / core / lib / iomgr / error_cfstream . cc " , <nl> + " src / core / lib / iomgr / error_cfstream . h " , <nl> " src / core / lib / iomgr / error_internal . h " , <nl> " src / core / lib / iomgr / ev_epoll1_linux . cc " , <nl> " src / core / lib / iomgr / ev_epoll1_linux . h " , <nl> config ( " grpc_config " ) { <nl> " src / core / lib / iomgr / iomgr_internal . h " , <nl> " src / core / lib / iomgr / iomgr_posix . cc " , <nl> " src / core / lib / iomgr / iomgr_posix . h " , <nl> + " src / core / lib / iomgr / iomgr_posix_cfstream . cc " , <nl> " src / core / lib / iomgr / iomgr_uv . cc " , <nl> " src / core / lib / iomgr / iomgr_windows . cc " , <nl> " src / core / lib / iomgr / is_epollexclusive_available . cc " , <nl> config ( " grpc_config " ) { <nl> " src / core / lib / iomgr / sys_epoll_wrapper . h " , <nl> " src / core / lib / iomgr / tcp_client . cc " , <nl> " src / core / lib / iomgr / tcp_client . h " , <nl> + " src / core / lib / iomgr / tcp_client_cfstream . cc " , <nl> " src / core / lib / iomgr / tcp_client_custom . cc " , <nl> " src / core / lib / iomgr / tcp_client_posix . cc " , <nl> " src / core / lib / iomgr / tcp_client_posix . h " , <nl> config ( " grpc_config " ) { <nl> " src / core / lib / iomgr / block_annotate . h " , <nl> " src / core / lib / iomgr / buffer_list . h " , <nl> " src / core / lib / iomgr / call_combiner . h " , <nl> + " src / core / lib / iomgr / cfstream_handle . h " , <nl> " src / core / lib / iomgr / closure . h " , <nl> " src / core / lib / iomgr / combiner . h " , <nl> " src / core / lib / iomgr / dynamic_annotations . h " , <nl> " src / core / lib / iomgr / endpoint . h " , <nl> + " src / core / lib / iomgr / endpoint_cfstream . h " , <nl> " src / core / lib / iomgr / endpoint_pair . h " , <nl> " src / core / lib / iomgr / error . h " , <nl> + " src / core / lib / iomgr / error_cfstream . h " , <nl> " src / core / lib / iomgr / error_internal . h " , <nl> " src / core / lib / iomgr / ev_epoll1_linux . h " , <nl> " src / core / lib / iomgr / ev_epollex_linux . h " , <nl> mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> add_library ( grpc <nl> src / core / lib / http / parser . cc <nl> src / core / lib / iomgr / buffer_list . cc <nl> src / core / lib / iomgr / call_combiner . cc <nl> + src / core / lib / iomgr / cfstream_handle . cc <nl> src / core / lib / iomgr / combiner . cc <nl> src / core / lib / iomgr / endpoint . cc <nl> + src / core / lib / iomgr / endpoint_cfstream . cc <nl> src / core / lib / iomgr / endpoint_pair_posix . cc <nl> src / core / lib / iomgr / endpoint_pair_uv . cc <nl> src / core / lib / iomgr / endpoint_pair_windows . cc <nl> src / core / lib / iomgr / error . cc <nl> + src / core / lib / iomgr / error_cfstream . cc <nl> src / core / lib / iomgr / ev_epoll1_linux . cc <nl> src / core / lib / iomgr / ev_epollex_linux . cc <nl> src / core / lib / iomgr / ev_poll_posix . cc <nl> add_library ( grpc <nl> src / core / lib / iomgr / iomgr_custom . cc <nl> src / core / lib / iomgr / iomgr_internal . cc <nl> src / core / lib / iomgr / iomgr_posix . cc <nl> + src / core / lib / iomgr / iomgr_posix_cfstream . cc <nl> src / core / lib / iomgr / iomgr_uv . cc <nl> src / core / lib / iomgr / iomgr_windows . cc <nl> src / core / lib / iomgr / is_epollexclusive_available . cc <nl> add_library ( grpc <nl> src / core / lib / iomgr / socket_utils_windows . cc <nl> src / core / lib / iomgr / socket_windows . cc <nl> src / core / lib / iomgr / tcp_client . cc <nl> + src / core / lib / iomgr / tcp_client_cfstream . cc <nl> src / core / lib / iomgr / tcp_client_custom . cc <nl> src / core / lib / iomgr / tcp_client_posix . cc <nl> src / core / lib / iomgr / tcp_client_windows . cc <nl> add_library ( grpc_cronet <nl> src / core / lib / http / parser . cc <nl> src / core / lib / iomgr / buffer_list . cc <nl> src / core / lib / iomgr / call_combiner . cc <nl> + src / core / lib / iomgr / cfstream_handle . cc <nl> src / core / lib / iomgr / combiner . cc <nl> src / core / lib / iomgr / endpoint . cc <nl> + src / core / lib / iomgr / endpoint_cfstream . cc <nl> src / core / lib / iomgr / endpoint_pair_posix . cc <nl> src / core / lib / iomgr / endpoint_pair_uv . cc <nl> src / core / lib / iomgr / endpoint_pair_windows . cc <nl> src / core / lib / iomgr / error . cc <nl> + src / core / lib / iomgr / error_cfstream . cc <nl> src / core / lib / iomgr / ev_epoll1_linux . cc <nl> src / core / lib / iomgr / ev_epollex_linux . cc <nl> src / core / lib / iomgr / ev_poll_posix . cc <nl> add_library ( grpc_cronet <nl> src / core / lib / iomgr / iomgr_custom . cc <nl> src / core / lib / iomgr / iomgr_internal . cc <nl> src / core / lib / iomgr / iomgr_posix . cc <nl> + src / core / lib / iomgr / iomgr_posix_cfstream . cc <nl> src / core / lib / iomgr / iomgr_uv . cc <nl> src / core / lib / iomgr / iomgr_windows . cc <nl> src / core / lib / iomgr / is_epollexclusive_available . cc <nl> add_library ( grpc_cronet <nl> src / core / lib / iomgr / socket_utils_windows . cc <nl> src / core / lib / iomgr / socket_windows . cc <nl> src / core / lib / iomgr / tcp_client . cc <nl> + src / core / lib / iomgr / tcp_client_cfstream . cc <nl> src / core / lib / iomgr / tcp_client_custom . cc <nl> src / core / lib / iomgr / tcp_client_posix . cc <nl> src / core / lib / iomgr / tcp_client_windows . cc <nl> add_library ( grpc_test_util <nl> src / core / lib / http / parser . cc <nl> src / core / lib / iomgr / buffer_list . cc <nl> src / core / lib / iomgr / call_combiner . cc <nl> + src / core / lib / iomgr / cfstream_handle . cc <nl> src / core / lib / iomgr / combiner . cc <nl> src / core / lib / iomgr / endpoint . cc <nl> + src / core / lib / iomgr / endpoint_cfstream . cc <nl> src / core / lib / iomgr / endpoint_pair_posix . cc <nl> src / core / lib / iomgr / endpoint_pair_uv . cc <nl> src / core / lib / iomgr / endpoint_pair_windows . cc <nl> src / core / lib / iomgr / error . cc <nl> + src / core / lib / iomgr / error_cfstream . cc <nl> src / core / lib / iomgr / ev_epoll1_linux . cc <nl> src / core / lib / iomgr / ev_epollex_linux . cc <nl> src / core / lib / iomgr / ev_poll_posix . cc <nl> add_library ( grpc_test_util <nl> src / core / lib / iomgr / iomgr_custom . cc <nl> src / core / lib / iomgr / iomgr_internal . cc <nl> src / core / lib / iomgr / iomgr_posix . cc <nl> + src / core / lib / iomgr / iomgr_posix_cfstream . cc <nl> src / core / lib / iomgr / iomgr_uv . cc <nl> src / core / lib / iomgr / iomgr_windows . cc <nl> src / core / lib / iomgr / is_epollexclusive_available . cc <nl> add_library ( grpc_test_util <nl> src / core / lib / iomgr / socket_utils_windows . cc <nl> src / core / lib / iomgr / socket_windows . cc <nl> src / core / lib / iomgr / tcp_client . cc <nl> + src / core / lib / iomgr / tcp_client_cfstream . cc <nl> src / core / lib / iomgr / tcp_client_custom . cc <nl> src / core / lib / iomgr / tcp_client_posix . cc <nl> src / core / lib / iomgr / tcp_client_windows . cc <nl> add_library ( grpc_test_util_unsecure <nl> src / core / lib / http / parser . cc <nl> src / core / lib / iomgr / buffer_list . cc <nl> src / core / lib / iomgr / call_combiner . cc <nl> + src / core / lib / iomgr / cfstream_handle . cc <nl> src / core / lib / iomgr / combiner . cc <nl> src / core / lib / iomgr / endpoint . cc <nl> + src / core / lib / iomgr / endpoint_cfstream . cc <nl> src / core / lib / iomgr / endpoint_pair_posix . cc <nl> src / core / lib / iomgr / endpoint_pair_uv . cc <nl> src / core / lib / iomgr / endpoint_pair_windows . cc <nl> src / core / lib / iomgr / error . cc <nl> + src / core / lib / iomgr / error_cfstream . cc <nl> src / core / lib / iomgr / ev_epoll1_linux . cc <nl> src / core / lib / iomgr / ev_epollex_linux . cc <nl> src / core / lib / iomgr / ev_poll_posix . cc <nl> add_library ( grpc_test_util_unsecure <nl> src / core / lib / iomgr / iomgr_custom . cc <nl> src / core / lib / iomgr / iomgr_internal . cc <nl> src / core / lib / iomgr / iomgr_posix . cc <nl> + src / core / lib / iomgr / iomgr_posix_cfstream . cc <nl> src / core / lib / iomgr / iomgr_uv . cc <nl> src / core / lib / iomgr / iomgr_windows . cc <nl> src / core / lib / iomgr / is_epollexclusive_available . cc <nl> add_library ( grpc_test_util_unsecure <nl> src / core / lib / iomgr / socket_utils_windows . cc <nl> src / core / lib / iomgr / socket_windows . cc <nl> src / core / lib / iomgr / tcp_client . cc <nl> + src / core / lib / iomgr / tcp_client_cfstream . cc <nl> src / core / lib / iomgr / tcp_client_custom . cc <nl> src / core / lib / iomgr / tcp_client_posix . cc <nl> src / core / lib / iomgr / tcp_client_windows . cc <nl> add_library ( grpc_unsecure <nl> src / core / lib / http / parser . cc <nl> src / core / lib / iomgr / buffer_list . cc <nl> src / core / lib / iomgr / call_combiner . cc <nl> + src / core / lib / iomgr / cfstream_handle . cc <nl> src / core / lib / iomgr / combiner . cc <nl> src / core / lib / iomgr / endpoint . cc <nl> + src / core / lib / iomgr / endpoint_cfstream . cc <nl> src / core / lib / iomgr / endpoint_pair_posix . cc <nl> src / core / lib / iomgr / endpoint_pair_uv . cc <nl> src / core / lib / iomgr / endpoint_pair_windows . cc <nl> src / core / lib / iomgr / error . cc <nl> + src / core / lib / iomgr / error_cfstream . cc <nl> src / core / lib / iomgr / ev_epoll1_linux . cc <nl> src / core / lib / iomgr / ev_epollex_linux . cc <nl> src / core / lib / iomgr / ev_poll_posix . cc <nl> add_library ( grpc_unsecure <nl> src / core / lib / iomgr / iomgr_custom . cc <nl> src / core / lib / iomgr / iomgr_internal . cc <nl> src / core / lib / iomgr / iomgr_posix . cc <nl> + src / core / lib / iomgr / iomgr_posix_cfstream . cc <nl> src / core / lib / iomgr / iomgr_uv . cc <nl> src / core / lib / iomgr / iomgr_windows . cc <nl> src / core / lib / iomgr / is_epollexclusive_available . cc <nl> add_library ( grpc_unsecure <nl> src / core / lib / iomgr / socket_utils_windows . cc <nl> src / core / lib / iomgr / socket_windows . cc <nl> src / core / lib / iomgr / tcp_client . cc <nl> + src / core / lib / iomgr / tcp_client_cfstream . cc <nl> src / core / lib / iomgr / tcp_client_custom . cc <nl> src / core / lib / iomgr / tcp_client_posix . cc <nl> src / core / lib / iomgr / tcp_client_windows . cc <nl> add_library ( grpc + + _cronet <nl> src / core / lib / http / parser . cc <nl> src / core / lib / iomgr / buffer_list . cc <nl> src / core / lib / iomgr / call_combiner . cc <nl> + src / core / lib / iomgr / cfstream_handle . cc <nl> src / core / lib / iomgr / combiner . cc <nl> src / core / lib / iomgr / endpoint . cc <nl> + src / core / lib / iomgr / endpoint_cfstream . cc <nl> src / core / lib / iomgr / endpoint_pair_posix . cc <nl> src / core / lib / iomgr / endpoint_pair_uv . cc <nl> src / core / lib / iomgr / endpoint_pair_windows . cc <nl> src / core / lib / iomgr / error . cc <nl> + src / core / lib / iomgr / error_cfstream . cc <nl> src / core / lib / iomgr / ev_epoll1_linux . cc <nl> src / core / lib / iomgr / ev_epollex_linux . cc <nl> src / core / lib / iomgr / ev_poll_posix . cc <nl> add_library ( grpc + + _cronet <nl> src / core / lib / iomgr / iomgr_custom . cc <nl> src / core / lib / iomgr / iomgr_internal . cc <nl> src / core / lib / iomgr / iomgr_posix . cc <nl> + src / core / lib / iomgr / iomgr_posix_cfstream . cc <nl> src / core / lib / iomgr / iomgr_uv . cc <nl> src / core / lib / iomgr / iomgr_windows . cc <nl> src / core / lib / iomgr / is_epollexclusive_available . cc <nl> add_library ( grpc + + _cronet <nl> src / core / lib / iomgr / socket_utils_windows . cc <nl> src / core / lib / iomgr / socket_windows . cc <nl> src / core / lib / iomgr / tcp_client . cc <nl> + src / core / lib / iomgr / tcp_client_cfstream . cc <nl> src / core / lib / iomgr / tcp_client_custom . cc <nl> src / core / lib / iomgr / tcp_client_posix . cc <nl> src / core / lib / iomgr / tcp_client_windows . cc <nl> mmm a / Makefile <nl> ppp b / Makefile <nl> LIBGRPC_SRC = \ <nl> src / core / lib / http / parser . cc \ <nl> src / core / lib / iomgr / buffer_list . cc \ <nl> src / core / lib / iomgr / call_combiner . cc \ <nl> + src / core / lib / iomgr / cfstream_handle . cc \ <nl> src / core / lib / iomgr / combiner . cc \ <nl> src / core / lib / iomgr / endpoint . cc \ <nl> + src / core / lib / iomgr / endpoint_cfstream . cc \ <nl> src / core / lib / iomgr / endpoint_pair_posix . cc \ <nl> src / core / lib / iomgr / endpoint_pair_uv . cc \ <nl> src / core / lib / iomgr / endpoint_pair_windows . cc \ <nl> src / core / lib / iomgr / error . cc \ <nl> + src / core / lib / iomgr / error_cfstream . cc \ <nl> src / core / lib / iomgr / ev_epoll1_linux . cc \ <nl> src / core / lib / iomgr / ev_epollex_linux . cc \ <nl> src / core / lib / iomgr / ev_poll_posix . cc \ <nl> LIBGRPC_SRC = \ <nl> src / core / lib / iomgr / iomgr_custom . cc \ <nl> src / core / lib / iomgr / iomgr_internal . cc \ <nl> src / core / lib / iomgr / iomgr_posix . cc \ <nl> + src / core / lib / iomgr / iomgr_posix_cfstream . cc \ <nl> src / core / lib / iomgr / iomgr_uv . cc \ <nl> src / core / lib / iomgr / iomgr_windows . cc \ <nl> src / core / lib / iomgr / is_epollexclusive_available . cc \ <nl> LIBGRPC_SRC = \ <nl> src / core / lib / iomgr / socket_utils_windows . cc \ <nl> src / core / lib / iomgr / socket_windows . cc \ <nl> src / core / lib / iomgr / tcp_client . cc \ <nl> + src / core / lib / iomgr / tcp_client_cfstream . cc \ <nl> src / core / lib / iomgr / tcp_client_custom . cc \ <nl> src / core / lib / iomgr / tcp_client_posix . cc \ <nl> src / core / lib / iomgr / tcp_client_windows . cc \ <nl> LIBGRPC_CRONET_SRC = \ <nl> src / core / lib / http / parser . cc \ <nl> src / core / lib / iomgr / buffer_list . cc \ <nl> src / core / lib / iomgr / call_combiner . cc \ <nl> + src / core / lib / iomgr / cfstream_handle . cc \ <nl> src / core / lib / iomgr / combiner . cc \ <nl> src / core / lib / iomgr / endpoint . cc \ <nl> + src / core / lib / iomgr / endpoint_cfstream . cc \ <nl> src / core / lib / iomgr / endpoint_pair_posix . cc \ <nl> src / core / lib / iomgr / endpoint_pair_uv . cc \ <nl> src / core / lib / iomgr / endpoint_pair_windows . cc \ <nl> src / core / lib / iomgr / error . cc \ <nl> + src / core / lib / iomgr / error_cfstream . cc \ <nl> src / core / lib / iomgr / ev_epoll1_linux . cc \ <nl> src / core / lib / iomgr / ev_epollex_linux . cc \ <nl> src / core / lib / iomgr / ev_poll_posix . cc \ <nl> LIBGRPC_CRONET_SRC = \ <nl> src / core / lib / iomgr / iomgr_custom . cc \ <nl> src / core / lib / iomgr / iomgr_internal . cc \ <nl> src / core / lib / iomgr / iomgr_posix . cc \ <nl> + src / core / lib / iomgr / iomgr_posix_cfstream . cc \ <nl> src / core / lib / iomgr / iomgr_uv . cc \ <nl> src / core / lib / iomgr / iomgr_windows . cc \ <nl> src / core / lib / iomgr / is_epollexclusive_available . cc \ <nl> LIBGRPC_CRONET_SRC = \ <nl> src / core / lib / iomgr / socket_utils_windows . cc \ <nl> src / core / lib / iomgr / socket_windows . cc \ <nl> src / core / lib / iomgr / tcp_client . cc \ <nl> + src / core / lib / iomgr / tcp_client_cfstream . cc \ <nl> src / core / lib / iomgr / tcp_client_custom . cc \ <nl> src / core / lib / iomgr / tcp_client_posix . cc \ <nl> src / core / lib / iomgr / tcp_client_windows . cc \ <nl> LIBGRPC_TEST_UTIL_SRC = \ <nl> src / core / lib / http / parser . cc \ <nl> src / core / lib / iomgr / buffer_list . cc \ <nl> src / core / lib / iomgr / call_combiner . cc \ <nl> + src / core / lib / iomgr / cfstream_handle . cc \ <nl> src / core / lib / iomgr / combiner . cc \ <nl> src / core / lib / iomgr / endpoint . cc \ <nl> + src / core / lib / iomgr / endpoint_cfstream . cc \ <nl> src / core / lib / iomgr / endpoint_pair_posix . cc \ <nl> src / core / lib / iomgr / endpoint_pair_uv . cc \ <nl> src / core / lib / iomgr / endpoint_pair_windows . cc \ <nl> src / core / lib / iomgr / error . cc \ <nl> + src / core / lib / iomgr / error_cfstream . cc \ <nl> src / core / lib / iomgr / ev_epoll1_linux . cc \ <nl> src / core / lib / iomgr / ev_epollex_linux . cc \ <nl> src / core / lib / iomgr / ev_poll_posix . cc \ <nl> LIBGRPC_TEST_UTIL_SRC = \ <nl> src / core / lib / iomgr / iomgr_custom . cc \ <nl> src / core / lib / iomgr / iomgr_internal . cc \ <nl> src / core / lib / iomgr / iomgr_posix . cc \ <nl> + src / core / lib / iomgr / iomgr_posix_cfstream . cc \ <nl> src / core / lib / iomgr / iomgr_uv . cc \ <nl> src / core / lib / iomgr / iomgr_windows . cc \ <nl> src / core / lib / iomgr / is_epollexclusive_available . cc \ <nl> LIBGRPC_TEST_UTIL_SRC = \ <nl> src / core / lib / iomgr / socket_utils_windows . cc \ <nl> src / core / lib / iomgr / socket_windows . cc \ <nl> src / core / lib / iomgr / tcp_client . cc \ <nl> + src / core / lib / iomgr / tcp_client_cfstream . cc \ <nl> src / core / lib / iomgr / tcp_client_custom . cc \ <nl> src / core / lib / iomgr / tcp_client_posix . cc \ <nl> src / core / lib / iomgr / tcp_client_windows . cc \ <nl> LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ <nl> src / core / lib / http / parser . cc \ <nl> src / core / lib / iomgr / buffer_list . cc \ <nl> src / core / lib / iomgr / call_combiner . cc \ <nl> + src / core / lib / iomgr / cfstream_handle . cc \ <nl> src / core / lib / iomgr / combiner . cc \ <nl> src / core / lib / iomgr / endpoint . cc \ <nl> + src / core / lib / iomgr / endpoint_cfstream . cc \ <nl> src / core / lib / iomgr / endpoint_pair_posix . cc \ <nl> src / core / lib / iomgr / endpoint_pair_uv . cc \ <nl> src / core / lib / iomgr / endpoint_pair_windows . cc \ <nl> src / core / lib / iomgr / error . cc \ <nl> + src / core / lib / iomgr / error_cfstream . cc \ <nl> src / core / lib / iomgr / ev_epoll1_linux . cc \ <nl> src / core / lib / iomgr / ev_epollex_linux . cc \ <nl> src / core / lib / iomgr / ev_poll_posix . cc \ <nl> LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ <nl> src / core / lib / iomgr / iomgr_custom . cc \ <nl> src / core / lib / iomgr / iomgr_internal . cc \ <nl> src / core / lib / iomgr / iomgr_posix . cc \ <nl> + src / core / lib / iomgr / iomgr_posix_cfstream . cc \ <nl> src / core / lib / iomgr / iomgr_uv . cc \ <nl> src / core / lib / iomgr / iomgr_windows . cc \ <nl> src / core / lib / iomgr / is_epollexclusive_available . cc \ <nl> LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ <nl> src / core / lib / iomgr / socket_utils_windows . cc \ <nl> src / core / lib / iomgr / socket_windows . cc \ <nl> src / core / lib / iomgr / tcp_client . cc \ <nl> + src / core / lib / iomgr / tcp_client_cfstream . cc \ <nl> src / core / lib / iomgr / tcp_client_custom . cc \ <nl> src / core / lib / iomgr / tcp_client_posix . cc \ <nl> src / core / lib / iomgr / tcp_client_windows . cc \ <nl> LIBGRPC_UNSECURE_SRC = \ <nl> src / core / lib / http / parser . cc \ <nl> src / core / lib / iomgr / buffer_list . cc \ <nl> src / core / lib / iomgr / call_combiner . cc \ <nl> + src / core / lib / iomgr / cfstream_handle . cc \ <nl> src / core / lib / iomgr / combiner . cc \ <nl> src / core / lib / iomgr / endpoint . cc \ <nl> + src / core / lib / iomgr / endpoint_cfstream . cc \ <nl> src / core / lib / iomgr / endpoint_pair_posix . cc \ <nl> src / core / lib / iomgr / endpoint_pair_uv . cc \ <nl> src / core / lib / iomgr / endpoint_pair_windows . cc \ <nl> src / core / lib / iomgr / error . cc \ <nl> + src / core / lib / iomgr / error_cfstream . cc \ <nl> src / core / lib / iomgr / ev_epoll1_linux . cc \ <nl> src / core / lib / iomgr / ev_epollex_linux . cc \ <nl> src / core / lib / iomgr / ev_poll_posix . cc \ <nl> LIBGRPC_UNSECURE_SRC = \ <nl> src / core / lib / iomgr / iomgr_custom . cc \ <nl> src / core / lib / iomgr / iomgr_internal . cc \ <nl> src / core / lib / iomgr / iomgr_posix . cc \ <nl> + src / core / lib / iomgr / iomgr_posix_cfstream . cc \ <nl> src / core / lib / iomgr / iomgr_uv . cc \ <nl> src / core / lib / iomgr / iomgr_windows . cc \ <nl> src / core / lib / iomgr / is_epollexclusive_available . cc \ <nl> LIBGRPC_UNSECURE_SRC = \ <nl> src / core / lib / iomgr / socket_utils_windows . cc \ <nl> src / core / lib / iomgr / socket_windows . cc \ <nl> src / core / lib / iomgr / tcp_client . cc \ <nl> + src / core / lib / iomgr / tcp_client_cfstream . cc \ <nl> src / core / lib / iomgr / tcp_client_custom . cc \ <nl> src / core / lib / iomgr / tcp_client_posix . cc \ <nl> src / core / lib / iomgr / tcp_client_windows . cc \ <nl> LIBGRPC + + _CRONET_SRC = \ <nl> src / core / lib / http / parser . cc \ <nl> src / core / lib / iomgr / buffer_list . cc \ <nl> src / core / lib / iomgr / call_combiner . cc \ <nl> + src / core / lib / iomgr / cfstream_handle . cc \ <nl> src / core / lib / iomgr / combiner . cc \ <nl> src / core / lib / iomgr / endpoint . cc \ <nl> + src / core / lib / iomgr / endpoint_cfstream . cc \ <nl> src / core / lib / iomgr / endpoint_pair_posix . cc \ <nl> src / core / lib / iomgr / endpoint_pair_uv . cc \ <nl> src / core / lib / iomgr / endpoint_pair_windows . cc \ <nl> src / core / lib / iomgr / error . cc \ <nl> + src / core / lib / iomgr / error_cfstream . cc \ <nl> src / core / lib / iomgr / ev_epoll1_linux . cc \ <nl> src / core / lib / iomgr / ev_epollex_linux . cc \ <nl> src / core / lib / iomgr / ev_poll_posix . cc \ <nl> LIBGRPC + + _CRONET_SRC = \ <nl> src / core / lib / iomgr / iomgr_custom . cc \ <nl> src / core / lib / iomgr / iomgr_internal . cc \ <nl> src / core / lib / iomgr / iomgr_posix . cc \ <nl> + src / core / lib / iomgr / iomgr_posix_cfstream . cc \ <nl> src / core / lib / iomgr / iomgr_uv . cc \ <nl> src / core / lib / iomgr / iomgr_windows . cc \ <nl> src / core / lib / iomgr / is_epollexclusive_available . cc \ <nl> LIBGRPC + + _CRONET_SRC = \ <nl> src / core / lib / iomgr / socket_utils_windows . cc \ <nl> src / core / lib / iomgr / socket_windows . cc \ <nl> src / core / lib / iomgr / tcp_client . cc \ <nl> + src / core / lib / iomgr / tcp_client_cfstream . cc \ <nl> src / core / lib / iomgr / tcp_client_custom . cc \ <nl> src / core / lib / iomgr / tcp_client_posix . cc \ <nl> src / core / lib / iomgr / tcp_client_windows . cc \ <nl> mmm a / build . yaml <nl> ppp b / build . yaml <nl> filegroups : <nl> - src / core / lib / http / parser . cc <nl> - src / core / lib / iomgr / buffer_list . cc <nl> - src / core / lib / iomgr / call_combiner . cc <nl> + - src / core / lib / iomgr / cfstream_handle . cc <nl> - src / core / lib / iomgr / combiner . cc <nl> - src / core / lib / iomgr / endpoint . cc <nl> + - src / core / lib / iomgr / endpoint_cfstream . cc <nl> - src / core / lib / iomgr / endpoint_pair_posix . cc <nl> - src / core / lib / iomgr / endpoint_pair_uv . cc <nl> - src / core / lib / iomgr / endpoint_pair_windows . cc <nl> - src / core / lib / iomgr / error . cc <nl> + - src / core / lib / iomgr / error_cfstream . cc <nl> - src / core / lib / iomgr / ev_epoll1_linux . cc <nl> - src / core / lib / iomgr / ev_epollex_linux . cc <nl> - src / core / lib / iomgr / ev_poll_posix . cc <nl> filegroups : <nl> - src / core / lib / iomgr / iomgr_custom . cc <nl> - src / core / lib / iomgr / iomgr_internal . cc <nl> - src / core / lib / iomgr / iomgr_posix . cc <nl> + - src / core / lib / iomgr / iomgr_posix_cfstream . cc <nl> - src / core / lib / iomgr / iomgr_uv . cc <nl> - src / core / lib / iomgr / iomgr_windows . cc <nl> - src / core / lib / iomgr / is_epollexclusive_available . cc <nl> filegroups : <nl> - src / core / lib / iomgr / socket_utils_windows . cc <nl> - src / core / lib / iomgr / socket_windows . cc <nl> - src / core / lib / iomgr / tcp_client . cc <nl> + - src / core / lib / iomgr / tcp_client_cfstream . cc <nl> - src / core / lib / iomgr / tcp_client_custom . cc <nl> - src / core / lib / iomgr / tcp_client_posix . cc <nl> - src / core / lib / iomgr / tcp_client_windows . cc <nl> filegroups : <nl> - src / core / lib / iomgr / block_annotate . h <nl> - src / core / lib / iomgr / buffer_list . h <nl> - src / core / lib / iomgr / call_combiner . h <nl> + - src / core / lib / iomgr / cfstream_handle . h <nl> - src / core / lib / iomgr / closure . h <nl> - src / core / lib / iomgr / combiner . h <nl> - src / core / lib / iomgr / dynamic_annotations . h <nl> - src / core / lib / iomgr / endpoint . h <nl> + - src / core / lib / iomgr / endpoint_cfstream . h <nl> - src / core / lib / iomgr / endpoint_pair . h <nl> - src / core / lib / iomgr / error . h <nl> + - src / core / lib / iomgr / error_cfstream . h <nl> - src / core / lib / iomgr / error_internal . h <nl> - src / core / lib / iomgr / ev_epoll1_linux . h <nl> - src / core / lib / iomgr / ev_epollex_linux . h <nl> filegroups : <nl> uses : <nl> - grpc_codegen <nl> - grpc_trace_headers <nl> - - name : grpc_cfstream <nl> - headers : <nl> - - src / core / lib / iomgr / cfstream_handle . h <nl> - - src / core / lib / iomgr / endpoint_cfstream . h <nl> - - src / core / lib / iomgr / error_cfstream . h <nl> - src : <nl> - - src / core / lib / iomgr / cfstream_handle . cc <nl> - - src / core / lib / iomgr / endpoint_cfstream . cc <nl> - - src / core / lib / iomgr / error_cfstream . cc <nl> - - src / core / lib / iomgr / iomgr_posix_cfstream . cc <nl> - - src / core / lib / iomgr / tcp_client_cfstream . cc <nl> - uses : <nl> - - grpc_base_headers <nl> - - gpr_base_headers <nl> - name : grpc_client_authority_filter <nl> headers : <nl> - src / core / ext / filters / http / client_authority_filter . h <nl> mmm a / config . m4 <nl> ppp b / config . m4 <nl> if test " $ PHP_GRPC " ! = " no " ; then <nl> src / core / lib / http / parser . cc \ <nl> src / core / lib / iomgr / buffer_list . cc \ <nl> src / core / lib / iomgr / call_combiner . cc \ <nl> + src / core / lib / iomgr / cfstream_handle . cc \ <nl> src / core / lib / iomgr / combiner . cc \ <nl> src / core / lib / iomgr / endpoint . cc \ <nl> + src / core / lib / iomgr / endpoint_cfstream . cc \ <nl> src / core / lib / iomgr / endpoint_pair_posix . cc \ <nl> src / core / lib / iomgr / endpoint_pair_uv . cc \ <nl> src / core / lib / iomgr / endpoint_pair_windows . cc \ <nl> src / core / lib / iomgr / error . cc \ <nl> + src / core / lib / iomgr / error_cfstream . cc \ <nl> src / core / lib / iomgr / ev_epoll1_linux . cc \ <nl> src / core / lib / iomgr / ev_epollex_linux . cc \ <nl> src / core / lib / iomgr / ev_poll_posix . cc \ <nl> if test " $ PHP_GRPC " ! = " no " ; then <nl> src / core / lib / iomgr / iomgr_custom . cc \ <nl> src / core / lib / iomgr / iomgr_internal . cc \ <nl> src / core / lib / iomgr / iomgr_posix . cc \ <nl> + src / core / lib / iomgr / iomgr_posix_cfstream . cc \ <nl> src / core / lib / iomgr / iomgr_uv . cc \ <nl> src / core / lib / iomgr / iomgr_windows . cc \ <nl> src / core / lib / iomgr / is_epollexclusive_available . cc \ <nl> if test " $ PHP_GRPC " ! = " no " ; then <nl> src / core / lib / iomgr / socket_utils_windows . cc \ <nl> src / core / lib / iomgr / socket_windows . cc \ <nl> src / core / lib / iomgr / tcp_client . cc \ <nl> + src / core / lib / iomgr / tcp_client_cfstream . cc \ <nl> src / core / lib / iomgr / tcp_client_custom . cc \ <nl> src / core / lib / iomgr / tcp_client_posix . cc \ <nl> src / core / lib / iomgr / tcp_client_windows . cc \ <nl> mmm a / config . w32 <nl> ppp b / config . w32 <nl> if ( PHP_GRPC ! = " no " ) { <nl> " src \ \ core \ \ lib \ \ http \ \ parser . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ buffer_list . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ call_combiner . cc " + <nl> + " src \ \ core \ \ lib \ \ iomgr \ \ cfstream_handle . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ combiner . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ endpoint . cc " + <nl> + " src \ \ core \ \ lib \ \ iomgr \ \ endpoint_cfstream . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ endpoint_pair_posix . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ endpoint_pair_uv . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ endpoint_pair_windows . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ error . cc " + <nl> + " src \ \ core \ \ lib \ \ iomgr \ \ error_cfstream . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ ev_epoll1_linux . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ ev_epollex_linux . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ ev_poll_posix . cc " + <nl> if ( PHP_GRPC ! = " no " ) { <nl> " src \ \ core \ \ lib \ \ iomgr \ \ iomgr_custom . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ iomgr_internal . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ iomgr_posix . cc " + <nl> + " src \ \ core \ \ lib \ \ iomgr \ \ iomgr_posix_cfstream . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ iomgr_uv . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ iomgr_windows . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ is_epollexclusive_available . cc " + <nl> if ( PHP_GRPC ! = " no " ) { <nl> " src \ \ core \ \ lib \ \ iomgr \ \ socket_utils_windows . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ socket_windows . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ tcp_client . cc " + <nl> + " src \ \ core \ \ lib \ \ iomgr \ \ tcp_client_cfstream . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ tcp_client_custom . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ tcp_client_posix . cc " + <nl> " src \ \ core \ \ lib \ \ iomgr \ \ tcp_client_windows . cc " + <nl> mmm a / gRPC - C + + . podspec <nl> ppp b / gRPC - C + + . podspec <nl> Pod : : Spec . new do | s | <nl> ' src / core / lib / iomgr / block_annotate . h ' , <nl> ' src / core / lib / iomgr / buffer_list . h ' , <nl> ' src / core / lib / iomgr / call_combiner . h ' , <nl> + ' src / core / lib / iomgr / cfstream_handle . h ' , <nl> ' src / core / lib / iomgr / closure . h ' , <nl> ' src / core / lib / iomgr / combiner . h ' , <nl> ' src / core / lib / iomgr / dynamic_annotations . h ' , <nl> ' src / core / lib / iomgr / endpoint . h ' , <nl> + ' src / core / lib / iomgr / endpoint_cfstream . h ' , <nl> ' src / core / lib / iomgr / endpoint_pair . h ' , <nl> ' src / core / lib / iomgr / error . h ' , <nl> + ' src / core / lib / iomgr / error_cfstream . h ' , <nl> ' src / core / lib / iomgr / error_internal . h ' , <nl> ' src / core / lib / iomgr / ev_epoll1_linux . h ' , <nl> ' src / core / lib / iomgr / ev_epollex_linux . h ' , <nl> Pod : : Spec . new do | s | <nl> ' src / core / lib / iomgr / block_annotate . h ' , <nl> ' src / core / lib / iomgr / buffer_list . h ' , <nl> ' src / core / lib / iomgr / call_combiner . h ' , <nl> + ' src / core / lib / iomgr / cfstream_handle . h ' , <nl> ' src / core / lib / iomgr / closure . h ' , <nl> ' src / core / lib / iomgr / combiner . h ' , <nl> ' src / core / lib / iomgr / dynamic_annotations . h ' , <nl> ' src / core / lib / iomgr / endpoint . h ' , <nl> + ' src / core / lib / iomgr / endpoint_cfstream . h ' , <nl> ' src / core / lib / iomgr / endpoint_pair . h ' , <nl> ' src / core / lib / iomgr / error . h ' , <nl> + ' src / core / lib / iomgr / error_cfstream . h ' , <nl> ' src / core / lib / iomgr / error_internal . h ' , <nl> ' src / core / lib / iomgr / ev_epoll1_linux . h ' , <nl> ' src / core / lib / iomgr / ev_epollex_linux . h ' , <nl> mmm a / gRPC - Core . podspec <nl> ppp b / gRPC - Core . podspec <nl> Pod : : Spec . new do | s | <nl> ' src / core / lib / iomgr / block_annotate . h ' , <nl> ' src / core / lib / iomgr / buffer_list . h ' , <nl> ' src / core / lib / iomgr / call_combiner . h ' , <nl> + ' src / core / lib / iomgr / cfstream_handle . h ' , <nl> ' src / core / lib / iomgr / closure . h ' , <nl> ' src / core / lib / iomgr / combiner . h ' , <nl> ' src / core / lib / iomgr / dynamic_annotations . h ' , <nl> ' src / core / lib / iomgr / endpoint . h ' , <nl> + ' src / core / lib / iomgr / endpoint_cfstream . h ' , <nl> ' src / core / lib / iomgr / endpoint_pair . h ' , <nl> ' src / core / lib / iomgr / error . h ' , <nl> + ' src / core / lib / iomgr / error_cfstream . h ' , <nl> ' src / core / lib / iomgr / error_internal . h ' , <nl> ' src / core / lib / iomgr / ev_epoll1_linux . h ' , <nl> ' src / core / lib / iomgr / ev_epollex_linux . h ' , <nl> Pod : : Spec . new do | s | <nl> ' src / core / lib / http / parser . cc ' , <nl> ' src / core / lib / iomgr / buffer_list . cc ' , <nl> ' src / core / lib / iomgr / call_combiner . cc ' , <nl> + ' src / core / lib / iomgr / cfstream_handle . cc ' , <nl> ' src / core / lib / iomgr / combiner . cc ' , <nl> ' src / core / lib / iomgr / endpoint . cc ' , <nl> + ' src / core / lib / iomgr / endpoint_cfstream . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_posix . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_uv . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_windows . cc ' , <nl> ' src / core / lib / iomgr / error . cc ' , <nl> + ' src / core / lib / iomgr / error_cfstream . cc ' , <nl> ' src / core / lib / iomgr / ev_epoll1_linux . cc ' , <nl> ' src / core / lib / iomgr / ev_epollex_linux . cc ' , <nl> ' src / core / lib / iomgr / ev_poll_posix . cc ' , <nl> Pod : : Spec . new do | s | <nl> ' src / core / lib / iomgr / iomgr_custom . cc ' , <nl> ' src / core / lib / iomgr / iomgr_internal . cc ' , <nl> ' src / core / lib / iomgr / iomgr_posix . cc ' , <nl> + ' src / core / lib / iomgr / iomgr_posix_cfstream . cc ' , <nl> ' src / core / lib / iomgr / iomgr_uv . cc ' , <nl> ' src / core / lib / iomgr / iomgr_windows . cc ' , <nl> ' src / core / lib / iomgr / is_epollexclusive_available . cc ' , <nl> Pod : : Spec . new do | s | <nl> ' src / core / lib / iomgr / socket_utils_windows . cc ' , <nl> ' src / core / lib / iomgr / socket_windows . cc ' , <nl> ' src / core / lib / iomgr / tcp_client . cc ' , <nl> + ' src / core / lib / iomgr / tcp_client_cfstream . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_custom . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_posix . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_windows . cc ' , <nl> Pod : : Spec . new do | s | <nl> ' src / core / ext / filters / http / client_authority_filter . cc ' , <nl> ' src / core / ext / filters / workarounds / workaround_cronet_compression_filter . cc ' , <nl> ' src / core / ext / filters / workarounds / workaround_utils . cc ' , <nl> - ' src / core / plugin_registry / grpc_plugin_registry . cc ' , <nl> - ' src / core / lib / iomgr / cfstream_handle . cc ' , <nl> - ' src / core / lib / iomgr / endpoint_cfstream . cc ' , <nl> - ' src / core / lib / iomgr / error_cfstream . cc ' , <nl> - ' src / core / lib / iomgr / iomgr_posix_cfstream . cc ' , <nl> - ' src / core / lib / iomgr / tcp_client_cfstream . cc ' , <nl> - ' src / core / lib / iomgr / cfstream_handle . h ' , <nl> - ' src / core / lib / iomgr / endpoint_cfstream . h ' , <nl> - ' src / core / lib / iomgr / error_cfstream . h ' <nl> + ' src / core / plugin_registry / grpc_plugin_registry . cc ' <nl> <nl> ss . private_header_files = ' src / core / lib / gpr / alloc . h ' , <nl> ' src / core / lib / gpr / arena . h ' , <nl> Pod : : Spec . new do | s | <nl> ' src / core / lib / iomgr / block_annotate . h ' , <nl> ' src / core / lib / iomgr / buffer_list . h ' , <nl> ' src / core / lib / iomgr / call_combiner . h ' , <nl> + ' src / core / lib / iomgr / cfstream_handle . h ' , <nl> ' src / core / lib / iomgr / closure . h ' , <nl> ' src / core / lib / iomgr / combiner . h ' , <nl> ' src / core / lib / iomgr / dynamic_annotations . h ' , <nl> ' src / core / lib / iomgr / endpoint . h ' , <nl> + ' src / core / lib / iomgr / endpoint_cfstream . h ' , <nl> ' src / core / lib / iomgr / endpoint_pair . h ' , <nl> ' src / core / lib / iomgr / error . h ' , <nl> + ' src / core / lib / iomgr / error_cfstream . h ' , <nl> ' src / core / lib / iomgr / error_internal . h ' , <nl> ' src / core / lib / iomgr / ev_epoll1_linux . h ' , <nl> ' src / core / lib / iomgr / ev_epollex_linux . h ' , <nl> Pod : : Spec . new do | s | <nl> ' src / core / ext / filters / message_size / message_size_filter . h ' , <nl> ' src / core / ext / filters / http / client_authority_filter . h ' , <nl> ' src / core / ext / filters / workarounds / workaround_cronet_compression_filter . h ' , <nl> - ' src / core / ext / filters / workarounds / workaround_utils . h ' , <nl> - ' src / core / lib / iomgr / cfstream_handle . h ' , <nl> - ' src / core / lib / iomgr / endpoint_cfstream . h ' , <nl> - ' src / core / lib / iomgr / error_cfstream . h ' <nl> + ' src / core / ext / filters / workarounds / workaround_utils . h ' <nl> end <nl> <nl> # CFStream is now default . Leaving this subspec only for compatibility purpose . <nl> mmm a / grpc . gemspec <nl> ppp b / grpc . gemspec <nl> Gem : : Specification . new do | s | <nl> s . files + = % w ( src / core / lib / iomgr / block_annotate . h ) <nl> s . files + = % w ( src / core / lib / iomgr / buffer_list . h ) <nl> s . files + = % w ( src / core / lib / iomgr / call_combiner . h ) <nl> + s . files + = % w ( src / core / lib / iomgr / cfstream_handle . h ) <nl> s . files + = % w ( src / core / lib / iomgr / closure . h ) <nl> s . files + = % w ( src / core / lib / iomgr / combiner . h ) <nl> s . files + = % w ( src / core / lib / iomgr / dynamic_annotations . h ) <nl> s . files + = % w ( src / core / lib / iomgr / endpoint . h ) <nl> + s . files + = % w ( src / core / lib / iomgr / endpoint_cfstream . h ) <nl> s . files + = % w ( src / core / lib / iomgr / endpoint_pair . h ) <nl> s . files + = % w ( src / core / lib / iomgr / error . h ) <nl> + s . files + = % w ( src / core / lib / iomgr / error_cfstream . h ) <nl> s . files + = % w ( src / core / lib / iomgr / error_internal . h ) <nl> s . files + = % w ( src / core / lib / iomgr / ev_epoll1_linux . h ) <nl> s . files + = % w ( src / core / lib / iomgr / ev_epollex_linux . h ) <nl> Gem : : Specification . new do | s | <nl> s . files + = % w ( src / core / lib / http / parser . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / buffer_list . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / call_combiner . cc ) <nl> + s . files + = % w ( src / core / lib / iomgr / cfstream_handle . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / combiner . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / endpoint . cc ) <nl> + s . files + = % w ( src / core / lib / iomgr / endpoint_cfstream . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / endpoint_pair_posix . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / endpoint_pair_uv . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / endpoint_pair_windows . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / error . cc ) <nl> + s . files + = % w ( src / core / lib / iomgr / error_cfstream . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / ev_epoll1_linux . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / ev_epollex_linux . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / ev_poll_posix . cc ) <nl> Gem : : Specification . new do | s | <nl> s . files + = % w ( src / core / lib / iomgr / iomgr_custom . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / iomgr_internal . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / iomgr_posix . cc ) <nl> + s . files + = % w ( src / core / lib / iomgr / iomgr_posix_cfstream . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / iomgr_uv . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / iomgr_windows . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / is_epollexclusive_available . cc ) <nl> Gem : : Specification . new do | s | <nl> s . files + = % w ( src / core / lib / iomgr / socket_utils_windows . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / socket_windows . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / tcp_client . cc ) <nl> + s . files + = % w ( src / core / lib / iomgr / tcp_client_cfstream . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / tcp_client_custom . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / tcp_client_posix . cc ) <nl> s . files + = % w ( src / core / lib / iomgr / tcp_client_windows . cc ) <nl> mmm a / grpc . gyp <nl> ppp b / grpc . gyp <nl> <nl> ' src / core / lib / http / parser . cc ' , <nl> ' src / core / lib / iomgr / buffer_list . cc ' , <nl> ' src / core / lib / iomgr / call_combiner . cc ' , <nl> + ' src / core / lib / iomgr / cfstream_handle . cc ' , <nl> ' src / core / lib / iomgr / combiner . cc ' , <nl> ' src / core / lib / iomgr / endpoint . cc ' , <nl> + ' src / core / lib / iomgr / endpoint_cfstream . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_posix . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_uv . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_windows . cc ' , <nl> ' src / core / lib / iomgr / error . cc ' , <nl> + ' src / core / lib / iomgr / error_cfstream . cc ' , <nl> ' src / core / lib / iomgr / ev_epoll1_linux . cc ' , <nl> ' src / core / lib / iomgr / ev_epollex_linux . cc ' , <nl> ' src / core / lib / iomgr / ev_poll_posix . cc ' , <nl> <nl> ' src / core / lib / iomgr / iomgr_custom . cc ' , <nl> ' src / core / lib / iomgr / iomgr_internal . cc ' , <nl> ' src / core / lib / iomgr / iomgr_posix . cc ' , <nl> + ' src / core / lib / iomgr / iomgr_posix_cfstream . cc ' , <nl> ' src / core / lib / iomgr / iomgr_uv . cc ' , <nl> ' src / core / lib / iomgr / iomgr_windows . cc ' , <nl> ' src / core / lib / iomgr / is_epollexclusive_available . cc ' , <nl> <nl> ' src / core / lib / iomgr / socket_utils_windows . cc ' , <nl> ' src / core / lib / iomgr / socket_windows . cc ' , <nl> ' src / core / lib / iomgr / tcp_client . cc ' , <nl> + ' src / core / lib / iomgr / tcp_client_cfstream . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_custom . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_posix . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_windows . cc ' , <nl> <nl> ' src / core / lib / http / parser . cc ' , <nl> ' src / core / lib / iomgr / buffer_list . cc ' , <nl> ' src / core / lib / iomgr / call_combiner . cc ' , <nl> + ' src / core / lib / iomgr / cfstream_handle . cc ' , <nl> ' src / core / lib / iomgr / combiner . cc ' , <nl> ' src / core / lib / iomgr / endpoint . cc ' , <nl> + ' src / core / lib / iomgr / endpoint_cfstream . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_posix . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_uv . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_windows . cc ' , <nl> ' src / core / lib / iomgr / error . cc ' , <nl> + ' src / core / lib / iomgr / error_cfstream . cc ' , <nl> ' src / core / lib / iomgr / ev_epoll1_linux . cc ' , <nl> ' src / core / lib / iomgr / ev_epollex_linux . cc ' , <nl> ' src / core / lib / iomgr / ev_poll_posix . cc ' , <nl> <nl> ' src / core / lib / iomgr / iomgr_custom . cc ' , <nl> ' src / core / lib / iomgr / iomgr_internal . cc ' , <nl> ' src / core / lib / iomgr / iomgr_posix . cc ' , <nl> + ' src / core / lib / iomgr / iomgr_posix_cfstream . cc ' , <nl> ' src / core / lib / iomgr / iomgr_uv . cc ' , <nl> ' src / core / lib / iomgr / iomgr_windows . cc ' , <nl> ' src / core / lib / iomgr / is_epollexclusive_available . cc ' , <nl> <nl> ' src / core / lib / iomgr / socket_utils_windows . cc ' , <nl> ' src / core / lib / iomgr / socket_windows . cc ' , <nl> ' src / core / lib / iomgr / tcp_client . cc ' , <nl> + ' src / core / lib / iomgr / tcp_client_cfstream . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_custom . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_posix . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_windows . cc ' , <nl> <nl> ' src / core / lib / http / parser . cc ' , <nl> ' src / core / lib / iomgr / buffer_list . cc ' , <nl> ' src / core / lib / iomgr / call_combiner . cc ' , <nl> + ' src / core / lib / iomgr / cfstream_handle . cc ' , <nl> ' src / core / lib / iomgr / combiner . cc ' , <nl> ' src / core / lib / iomgr / endpoint . cc ' , <nl> + ' src / core / lib / iomgr / endpoint_cfstream . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_posix . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_uv . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_windows . cc ' , <nl> ' src / core / lib / iomgr / error . cc ' , <nl> + ' src / core / lib / iomgr / error_cfstream . cc ' , <nl> ' src / core / lib / iomgr / ev_epoll1_linux . cc ' , <nl> ' src / core / lib / iomgr / ev_epollex_linux . cc ' , <nl> ' src / core / lib / iomgr / ev_poll_posix . cc ' , <nl> <nl> ' src / core / lib / iomgr / iomgr_custom . cc ' , <nl> ' src / core / lib / iomgr / iomgr_internal . cc ' , <nl> ' src / core / lib / iomgr / iomgr_posix . cc ' , <nl> + ' src / core / lib / iomgr / iomgr_posix_cfstream . cc ' , <nl> ' src / core / lib / iomgr / iomgr_uv . cc ' , <nl> ' src / core / lib / iomgr / iomgr_windows . cc ' , <nl> ' src / core / lib / iomgr / is_epollexclusive_available . cc ' , <nl> <nl> ' src / core / lib / iomgr / socket_utils_windows . cc ' , <nl> ' src / core / lib / iomgr / socket_windows . cc ' , <nl> ' src / core / lib / iomgr / tcp_client . cc ' , <nl> + ' src / core / lib / iomgr / tcp_client_cfstream . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_custom . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_posix . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_windows . cc ' , <nl> <nl> ' src / core / lib / http / parser . cc ' , <nl> ' src / core / lib / iomgr / buffer_list . cc ' , <nl> ' src / core / lib / iomgr / call_combiner . cc ' , <nl> + ' src / core / lib / iomgr / cfstream_handle . cc ' , <nl> ' src / core / lib / iomgr / combiner . cc ' , <nl> ' src / core / lib / iomgr / endpoint . cc ' , <nl> + ' src / core / lib / iomgr / endpoint_cfstream . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_posix . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_uv . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_windows . cc ' , <nl> ' src / core / lib / iomgr / error . cc ' , <nl> + ' src / core / lib / iomgr / error_cfstream . cc ' , <nl> ' src / core / lib / iomgr / ev_epoll1_linux . cc ' , <nl> ' src / core / lib / iomgr / ev_epollex_linux . cc ' , <nl> ' src / core / lib / iomgr / ev_poll_posix . cc ' , <nl> <nl> ' src / core / lib / iomgr / iomgr_custom . cc ' , <nl> ' src / core / lib / iomgr / iomgr_internal . cc ' , <nl> ' src / core / lib / iomgr / iomgr_posix . cc ' , <nl> + ' src / core / lib / iomgr / iomgr_posix_cfstream . cc ' , <nl> ' src / core / lib / iomgr / iomgr_uv . cc ' , <nl> ' src / core / lib / iomgr / iomgr_windows . cc ' , <nl> ' src / core / lib / iomgr / is_epollexclusive_available . cc ' , <nl> <nl> ' src / core / lib / iomgr / socket_utils_windows . cc ' , <nl> ' src / core / lib / iomgr / socket_windows . cc ' , <nl> ' src / core / lib / iomgr / tcp_client . cc ' , <nl> + ' src / core / lib / iomgr / tcp_client_cfstream . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_custom . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_posix . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_windows . cc ' , <nl> mmm a / package . xml <nl> ppp b / package . xml <nl> <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / block_annotate . h " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / buffer_list . h " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / call_combiner . h " role = " src " / > <nl> + < file baseinstalldir = " / " name = " src / core / lib / iomgr / cfstream_handle . h " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / closure . h " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / combiner . h " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / dynamic_annotations . h " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / endpoint . h " role = " src " / > <nl> + < file baseinstalldir = " / " name = " src / core / lib / iomgr / endpoint_cfstream . h " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / endpoint_pair . h " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / error . h " role = " src " / > <nl> + < file baseinstalldir = " / " name = " src / core / lib / iomgr / error_cfstream . h " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / error_internal . h " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / ev_epoll1_linux . h " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / ev_epollex_linux . h " role = " src " / > <nl> <nl> < file baseinstalldir = " / " name = " src / core / lib / http / parser . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / buffer_list . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / call_combiner . cc " role = " src " / > <nl> + < file baseinstalldir = " / " name = " src / core / lib / iomgr / cfstream_handle . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / combiner . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / endpoint . cc " role = " src " / > <nl> + < file baseinstalldir = " / " name = " src / core / lib / iomgr / endpoint_cfstream . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / endpoint_pair_posix . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / endpoint_pair_uv . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / endpoint_pair_windows . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / error . cc " role = " src " / > <nl> + < file baseinstalldir = " / " name = " src / core / lib / iomgr / error_cfstream . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / ev_epoll1_linux . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / ev_epollex_linux . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / ev_poll_posix . cc " role = " src " / > <nl> <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / iomgr_custom . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / iomgr_internal . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / iomgr_posix . cc " role = " src " / > <nl> + < file baseinstalldir = " / " name = " src / core / lib / iomgr / iomgr_posix_cfstream . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / iomgr_uv . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / iomgr_windows . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / is_epollexclusive_available . cc " role = " src " / > <nl> <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / socket_utils_windows . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / socket_windows . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / tcp_client . cc " role = " src " / > <nl> + < file baseinstalldir = " / " name = " src / core / lib / iomgr / tcp_client_cfstream . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / tcp_client_custom . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / tcp_client_posix . cc " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / iomgr / tcp_client_windows . cc " role = " src " / > <nl> mmm a / src / python / grpcio / grpc_core_dependencies . py <nl> ppp b / src / python / grpcio / grpc_core_dependencies . py <nl> <nl> ' src / core / lib / http / parser . cc ' , <nl> ' src / core / lib / iomgr / buffer_list . cc ' , <nl> ' src / core / lib / iomgr / call_combiner . cc ' , <nl> + ' src / core / lib / iomgr / cfstream_handle . cc ' , <nl> ' src / core / lib / iomgr / combiner . cc ' , <nl> ' src / core / lib / iomgr / endpoint . cc ' , <nl> + ' src / core / lib / iomgr / endpoint_cfstream . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_posix . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_uv . cc ' , <nl> ' src / core / lib / iomgr / endpoint_pair_windows . cc ' , <nl> ' src / core / lib / iomgr / error . cc ' , <nl> + ' src / core / lib / iomgr / error_cfstream . cc ' , <nl> ' src / core / lib / iomgr / ev_epoll1_linux . cc ' , <nl> ' src / core / lib / iomgr / ev_epollex_linux . cc ' , <nl> ' src / core / lib / iomgr / ev_poll_posix . cc ' , <nl> <nl> ' src / core / lib / iomgr / iomgr_custom . cc ' , <nl> ' src / core / lib / iomgr / iomgr_internal . cc ' , <nl> ' src / core / lib / iomgr / iomgr_posix . cc ' , <nl> + ' src / core / lib / iomgr / iomgr_posix_cfstream . cc ' , <nl> ' src / core / lib / iomgr / iomgr_uv . cc ' , <nl> ' src / core / lib / iomgr / iomgr_windows . cc ' , <nl> ' src / core / lib / iomgr / is_epollexclusive_available . cc ' , <nl> <nl> ' src / core / lib / iomgr / socket_utils_windows . cc ' , <nl> ' src / core / lib / iomgr / socket_windows . cc ' , <nl> ' src / core / lib / iomgr / tcp_client . cc ' , <nl> + ' src / core / lib / iomgr / tcp_client_cfstream . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_custom . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_posix . cc ' , <nl> ' src / core / lib / iomgr / tcp_client_windows . cc ' , <nl> mmm a / templates / gRPC - Core . podspec . template <nl> ppp b / templates / gRPC - Core . podspec . template <nl> <nl> excl = grpc_private_files ( libs ) <nl> return [ file for file in out if not file in excl ] <nl> <nl> - def cfstream_private_headers ( libs ) : <nl> - out = grpc_lib_files ( libs , ( " grpc_cfstream " , ) , ( " own_headers " , ) ) <nl> - return out <nl> - <nl> - def cfstream_private_files ( libs ) : <nl> - out = grpc_lib_files ( libs , ( " grpc_cfstream " , ) , ( " own_src " , " own_headers " ) ) <nl> - return out <nl> - <nl> def ruby_multiline_list ( files , indent ) : <nl> return ( ' , \ n ' + indent * ' ' ) . join ( ' \ ' % s \ ' ' % f for f in files ) <nl> % > <nl> <nl> ss . compiler_flags = ' - DGRPC_SHADOW_BORINGSSL_SYMBOLS ' <nl> <nl> # To save you from scrolling , this is the last part of the podspec . <nl> - ss . source_files = $ { ruby_multiline_list ( grpc_private_files ( libs ) + cfstream_private_files ( filegroups ) , 22 ) } <nl> + ss . source_files = $ { ruby_multiline_list ( grpc_private_files ( libs ) , 22 ) } <nl> <nl> - ss . private_header_files = $ { ruby_multiline_list ( grpc_private_headers ( libs ) + cfstream_private_headers ( filegroups ) , 30 ) } <nl> + ss . private_header_files = $ { ruby_multiline_list ( grpc_private_headers ( libs ) , 30 ) } <nl> end <nl> <nl> # CFStream is now default . Leaving this subspec only for compatibility purpose . <nl> mmm a / tools / doxygen / Doxyfile . c + + . internal <nl> ppp b / tools / doxygen / Doxyfile . c + + . internal <nl> src / core / lib / http / parser . h \ <nl> src / core / lib / iomgr / block_annotate . h \ <nl> src / core / lib / iomgr / buffer_list . h \ <nl> src / core / lib / iomgr / call_combiner . h \ <nl> + src / core / lib / iomgr / cfstream_handle . h \ <nl> src / core / lib / iomgr / closure . h \ <nl> src / core / lib / iomgr / combiner . h \ <nl> src / core / lib / iomgr / dynamic_annotations . h \ <nl> src / core / lib / iomgr / endpoint . h \ <nl> + src / core / lib / iomgr / endpoint_cfstream . h \ <nl> src / core / lib / iomgr / endpoint_pair . h \ <nl> src / core / lib / iomgr / error . h \ <nl> + src / core / lib / iomgr / error_cfstream . h \ <nl> src / core / lib / iomgr / error_internal . h \ <nl> src / core / lib / iomgr / ev_epoll1_linux . h \ <nl> src / core / lib / iomgr / ev_epollex_linux . h \ <nl> mmm a / tools / doxygen / Doxyfile . core . internal <nl> ppp b / tools / doxygen / Doxyfile . core . internal <nl> src / core / lib / iomgr / buffer_list . cc \ <nl> src / core / lib / iomgr / buffer_list . h \ <nl> src / core / lib / iomgr / call_combiner . cc \ <nl> src / core / lib / iomgr / call_combiner . h \ <nl> + src / core / lib / iomgr / cfstream_handle . cc \ <nl> + src / core / lib / iomgr / cfstream_handle . h \ <nl> src / core / lib / iomgr / closure . h \ <nl> src / core / lib / iomgr / combiner . cc \ <nl> src / core / lib / iomgr / combiner . h \ <nl> src / core / lib / iomgr / dynamic_annotations . h \ <nl> src / core / lib / iomgr / endpoint . cc \ <nl> src / core / lib / iomgr / endpoint . h \ <nl> + src / core / lib / iomgr / endpoint_cfstream . cc \ <nl> + src / core / lib / iomgr / endpoint_cfstream . h \ <nl> src / core / lib / iomgr / endpoint_pair . h \ <nl> src / core / lib / iomgr / endpoint_pair_posix . cc \ <nl> src / core / lib / iomgr / endpoint_pair_uv . cc \ <nl> src / core / lib / iomgr / endpoint_pair_windows . cc \ <nl> src / core / lib / iomgr / error . cc \ <nl> src / core / lib / iomgr / error . h \ <nl> + src / core / lib / iomgr / error_cfstream . cc \ <nl> + src / core / lib / iomgr / error_cfstream . h \ <nl> src / core / lib / iomgr / error_internal . h \ <nl> src / core / lib / iomgr / ev_epoll1_linux . cc \ <nl> src / core / lib / iomgr / ev_epoll1_linux . h \ <nl> src / core / lib / iomgr / iomgr_internal . cc \ <nl> src / core / lib / iomgr / iomgr_internal . h \ <nl> src / core / lib / iomgr / iomgr_posix . cc \ <nl> src / core / lib / iomgr / iomgr_posix . h \ <nl> + src / core / lib / iomgr / iomgr_posix_cfstream . cc \ <nl> src / core / lib / iomgr / iomgr_uv . cc \ <nl> src / core / lib / iomgr / iomgr_windows . cc \ <nl> src / core / lib / iomgr / is_epollexclusive_available . cc \ <nl> src / core / lib / iomgr / socket_windows . h \ <nl> src / core / lib / iomgr / sys_epoll_wrapper . h \ <nl> src / core / lib / iomgr / tcp_client . cc \ <nl> src / core / lib / iomgr / tcp_client . h \ <nl> + src / core / lib / iomgr / tcp_client_cfstream . cc \ <nl> src / core / lib / iomgr / tcp_client_custom . cc \ <nl> src / core / lib / iomgr / tcp_client_posix . cc \ <nl> src / core / lib / iomgr / tcp_client_posix . h \ <nl> mmm a / tools / run_tests / generated / sources_and_headers . json <nl> ppp b / tools / run_tests / generated / sources_and_headers . json <nl> <nl> " src / core / lib / http / parser . cc " , <nl> " src / core / lib / iomgr / buffer_list . cc " , <nl> " src / core / lib / iomgr / call_combiner . cc " , <nl> + " src / core / lib / iomgr / cfstream_handle . cc " , <nl> " src / core / lib / iomgr / combiner . cc " , <nl> " src / core / lib / iomgr / endpoint . cc " , <nl> + " src / core / lib / iomgr / endpoint_cfstream . cc " , <nl> " src / core / lib / iomgr / endpoint_pair_posix . cc " , <nl> " src / core / lib / iomgr / endpoint_pair_uv . cc " , <nl> " src / core / lib / iomgr / endpoint_pair_windows . cc " , <nl> " src / core / lib / iomgr / error . cc " , <nl> + " src / core / lib / iomgr / error_cfstream . cc " , <nl> " src / core / lib / iomgr / ev_epoll1_linux . cc " , <nl> " src / core / lib / iomgr / ev_epollex_linux . cc " , <nl> " src / core / lib / iomgr / ev_poll_posix . cc " , <nl> <nl> " src / core / lib / iomgr / iomgr_custom . cc " , <nl> " src / core / lib / iomgr / iomgr_internal . cc " , <nl> " src / core / lib / iomgr / iomgr_posix . cc " , <nl> + " src / core / lib / iomgr / iomgr_posix_cfstream . cc " , <nl> " src / core / lib / iomgr / iomgr_uv . cc " , <nl> " src / core / lib / iomgr / iomgr_windows . cc " , <nl> " src / core / lib / iomgr / is_epollexclusive_available . cc " , <nl> <nl> " src / core / lib / iomgr / socket_utils_windows . cc " , <nl> " src / core / lib / iomgr / socket_windows . cc " , <nl> " src / core / lib / iomgr / tcp_client . cc " , <nl> + " src / core / lib / iomgr / tcp_client_cfstream . cc " , <nl> " src / core / lib / iomgr / tcp_client_custom . cc " , <nl> " src / core / lib / iomgr / tcp_client_posix . cc " , <nl> " src / core / lib / iomgr / tcp_client_windows . cc " , <nl> <nl> " src / core / lib / iomgr / block_annotate . h " , <nl> " src / core / lib / iomgr / buffer_list . h " , <nl> " src / core / lib / iomgr / call_combiner . h " , <nl> + " src / core / lib / iomgr / cfstream_handle . h " , <nl> " src / core / lib / iomgr / closure . h " , <nl> " src / core / lib / iomgr / combiner . h " , <nl> " src / core / lib / iomgr / dynamic_annotations . h " , <nl> " src / core / lib / iomgr / endpoint . h " , <nl> + " src / core / lib / iomgr / endpoint_cfstream . h " , <nl> " src / core / lib / iomgr / endpoint_pair . h " , <nl> " src / core / lib / iomgr / error . h " , <nl> + " src / core / lib / iomgr / error_cfstream . h " , <nl> " src / core / lib / iomgr / error_internal . h " , <nl> " src / core / lib / iomgr / ev_epoll1_linux . h " , <nl> " src / core / lib / iomgr / ev_epollex_linux . h " , <nl> <nl> " src / core / lib / iomgr / block_annotate . h " , <nl> " src / core / lib / iomgr / buffer_list . h " , <nl> " src / core / lib / iomgr / call_combiner . h " , <nl> + " src / core / lib / iomgr / cfstream_handle . h " , <nl> " src / core / lib / iomgr / closure . h " , <nl> " src / core / lib / iomgr / combiner . h " , <nl> " src / core / lib / iomgr / dynamic_annotations . h " , <nl> " src / core / lib / iomgr / endpoint . h " , <nl> + " src / core / lib / iomgr / endpoint_cfstream . h " , <nl> " src / core / lib / iomgr / endpoint_pair . h " , <nl> " src / core / lib / iomgr / error . h " , <nl> + " src / core / lib / iomgr / error_cfstream . h " , <nl> " src / core / lib / iomgr / error_internal . h " , <nl> " src / core / lib / iomgr / ev_epoll1_linux . h " , <nl> " src / core / lib / iomgr / ev_epollex_linux . h " , <nl> <nl> " third_party " : false , <nl> " type " : " filegroup " <nl> } , <nl> - { <nl> - " deps " : [ <nl> - " gpr " , <nl> - " gpr_base_headers " , <nl> - " grpc_base_headers " <nl> - ] , <nl> - " headers " : [ <nl> - " src / core / lib / iomgr / cfstream_handle . h " , <nl> - " src / core / lib / iomgr / endpoint_cfstream . h " , <nl> - " src / core / lib / iomgr / error_cfstream . h " <nl> - ] , <nl> - " is_filegroup " : true , <nl> - " language " : " c " , <nl> - " name " : " grpc_cfstream " , <nl> - " src " : [ <nl> - " src / core / lib / iomgr / cfstream_handle . cc " , <nl> - " src / core / lib / iomgr / cfstream_handle . h " , <nl> - " src / core / lib / iomgr / endpoint_cfstream . cc " , <nl> - " src / core / lib / iomgr / endpoint_cfstream . h " , <nl> - " src / core / lib / iomgr / error_cfstream . cc " , <nl> - " src / core / lib / iomgr / error_cfstream . h " , <nl> - " src / core / lib / iomgr / iomgr_posix_cfstream . cc " , <nl> - " src / core / lib / iomgr / tcp_client_cfstream . cc " <nl> - ] , <nl> - " third_party " : false , <nl> - " type " : " filegroup " <nl> - } , <nl> { <nl> " deps " : [ <nl> " gpr " , <nl>
|
Merge pull request from muxi / fix - cfstream - build - yaml
|
grpc/grpc
|
efbeb750ecdf7b340d208c975d878b19e3529682
|
2019-04-26T15:14:30Z
|
mmm a / tools / ubuntu_setup . sh <nl> ppp b / tools / ubuntu_setup . sh <nl> pipenv install - - system - - deploy <nl> pip install - r tools / requirements . txt <nl> <nl> # to make modeld work on PC with nvidia GPU <nl> - pip install tensorflow - gpu = = 2 . 1 <nl> + pip install tensorflow - gpu = = 2 . 2 <nl> <nl> # for loggerd to work on ubuntu <nl> # TODO : PC should log somewhere else <nl>
|
tensorflow - gpu = = 2 . 1 update ( )
|
commaai/openpilot
|
ce8b629fb0fc989d99fa38f49eb96e552dc6e728
|
2020-05-17T04:59:28Z
|
mmm a / tensorflow / lite / testing / BUILD <nl> ppp b / tensorflow / lite / testing / BUILD <nl> edgetpu_ops = [ <nl> " conv_relu1 " , <nl> " conv_relu6 " , <nl> " depthwiseconv " , # high error <nl> + " expand_dims " , <nl> " fully_connected " , <nl> " l2norm " , # high error <nl> " maximum " , <nl> mmm a / tensorflow / lite / testing / op_tests / expand_dims . py <nl> ppp b / tensorflow / lite / testing / op_tests / expand_dims . py <nl> def make_expand_dims_tests ( options ) : <nl> <nl> test_parameters = [ { <nl> " input_type " : [ tf . float32 , tf . int32 ] , <nl> - " input_shape " : [ [ 5 , 4 ] ] , <nl> + " input_shape " : [ [ 5 , 4 ] , [ 1 , 5 , 4 ] ] , <nl> " axis_value " : [ 0 , 1 , 2 , - 1 , - 2 , - 3 ] , <nl> " constant_axis " : [ True , False ] , <nl> + " fully_quantize " : [ False ] , <nl> + } , { <nl> + " input_type " : [ tf . float32 ] , <nl> + " input_shape " : [ [ 5 , 4 ] , [ 1 , 5 , 4 ] ] , <nl> + " axis_value " : [ 0 , 1 , 2 , - 1 , - 2 , - 3 ] , <nl> + " constant_axis " : [ True ] , <nl> + " fully_quantize " : [ True ] , <nl> } ] <nl> <nl> def build_graph ( parameters ) : <nl> def build_graph ( parameters ) : <nl> return inputs , [ out ] <nl> <nl> def build_inputs ( parameters , sess , inputs , outputs ) : <nl> + " " " Builds the inputs for expand_dims . " " " <nl> input_values = [ ] <nl> input_values . append ( <nl> - create_tensor_data ( parameters [ " input_type " ] , parameters [ " input_shape " ] ) ) <nl> + create_tensor_data ( <nl> + parameters [ " input_type " ] , <nl> + parameters [ " input_shape " ] , <nl> + min_value = - 1 , <nl> + max_value = 1 ) ) <nl> if not parameters [ " constant_axis " ] : <nl> input_values . append ( np . array ( [ parameters [ " axis_value " ] ] , dtype = np . int32 ) ) <nl> return input_values , sess . run ( <nl>
|
Add quantized test cases for expand_dims operator .
|
tensorflow/tensorflow
|
5ce881f411542508eb1de0a8abb021c166694e81
|
2020-02-03T21:55:17Z
|
mmm a / trunk / src / kernel / srs_kernel_utility . cpp <nl> ppp b / trunk / src / kernel / srs_kernel_utility . cpp <nl> int64_t srs_update_system_time_ms ( ) <nl> if ( _srs_system_time_us_cache < = 0 ) { <nl> _srs_system_time_us_cache = now_us ; <nl> _srs_system_time_startup_time = now_us ; <nl> - return _srs_system_time_us_cache ; <nl> + return _srs_system_time_us_cache / 1000 ; <nl> } <nl> <nl> / / use relative time . <nl> int64_t srs_update_system_time_ms ( ) <nl> srs_info ( " system time updated , startup = % " PRId64 " us , now = % " PRId64 " us " , <nl> _srs_system_time_startup_time , _srs_system_time_us_cache ) ; <nl> <nl> - return _srs_system_time_us_cache ; <nl> + return _srs_system_time_us_cache / 1000 ; <nl> } <nl> <nl> string srs_dns_resolve ( string host ) <nl>
|
refine the hls_on_notify , calc the spent time in ms .
|
ossrs/srs
|
d8988da0eaf1c2bde24462327460ed62afd2d03b
|
2015-04-10T04:32:34Z
|
mmm a / test / ClangImporter / MixedSource / Inputs / resolve - cross - language / Base - module . map <nl> ppp b / test / ClangImporter / MixedSource / Inputs / resolve - cross - language / Base - module . map <nl> <nl> module Base { <nl> header " Base . h " <nl> + export * <nl> } <nl> mmm a / test / ClangImporter / MixedSource / resolve - cross - language . swift <nl> ppp b / test / ClangImporter / MixedSource / resolve - cross - language . swift <nl> <nl> - / / REQUIRES : rdar42570029 <nl> / / RUN : % empty - directory ( % t ) <nl> <nl> / / RUN : % target - swift - frontend ( mock - sdk : % clang - importer - sdk - nosource ) - emit - module - enable - objc - interop - emit - objc - header - o % t % S / Inputs / resolve - cross - language / Base . swift - disable - objc - attr - requires - foundation - module <nl>
|
[ test ] Tweak resolve - cross - language . swift to avoid a Clang bug ( )
|
apple/swift
|
480ac06c95d122c89ef039ac7b3f370cfcf9a1a3
|
2018-07-31T20:31:14Z
|
mmm a / tensorflow / python / framework / test_util . py <nl> ppp b / tensorflow / python / framework / test_util . py <nl> def checkedThread ( self , target , args = None , kwargs = None ) : <nl> return ret <nl> # pylint : enable = invalid - name <nl> <nl> - def assertNear ( self , f1 , f2 , err ) : <nl> + def assertNear ( self , f1 , f2 , err , msg = None ) : <nl> " " " Asserts that two floats are near each other . <nl> <nl> Checks that | f1 - f2 | < err and asserts a test failure <nl> if not . <nl> <nl> Args : <nl> - f1 : a float value . <nl> - f2 : a float value . <nl> - err : a float value . <nl> + f1 : A float value . <nl> + f2 : A float value . <nl> + err : A float value . <nl> + msg : An optional string message to append to the failure message . <nl> " " " <nl> - self . assertTrue ( math . fabs ( f1 - f2 ) < err ) <nl> + self . assertTrue ( math . fabs ( f1 - f2 ) < = err , <nl> + " % f ! = % f + / - % f % s " % ( <nl> + f1 , f2 , err , " ( % s ) " % msg if msg is not None else " " ) ) <nl> <nl> def assertArrayNear ( self , farray1 , farray2 , err ) : <nl> " " " Asserts that two float arrays are near each other . <nl>
|
Adding more helpful error messages to assertNear in tf . test . TestCase .
|
tensorflow/tensorflow
|
68b02dae12f74ff07160d08f4993e6fe58806b47
|
2016-03-25T19:03:58Z
|
mmm a / apinotes / Foundation . apinotes <nl> ppp b / apinotes / Foundation . apinotes <nl> Classes : <nl> Methods : <nl> - Selector : ' notificationCenterForType : ' <nl> MethodKind : Class <nl> - FactoryAsInit : true <nl> + FactoryAsInit : C <nl> - Name : NSError <nl> Methods : <nl> - Selector : ' initWithDomain : code : userInfo : ' <nl> Classes : <nl> Methods : <nl> - Selector : ' processInfo ' <nl> MethodKind : Class <nl> - FactoryAsInit : true <nl> + FactoryAsInit : C <nl> - Name : NSScriptObjectSpecifier <nl> Methods : <nl> - Selector : ' initWithContainerClassDescription : containerSpecifier : key : ' <nl> mmm a / apinotes / NotificationCenter . apinotes <nl> ppp b / apinotes / NotificationCenter . apinotes <nl> Classes : <nl> Methods : <nl> - Selector : ' widgetController ' <nl> MethodKind : Class <nl> - FactoryAsInit : true <nl> + FactoryAsInit : C <nl> mmm a / lib / APINotes / APINotesYAMLCompiler . cpp <nl> ppp b / lib / APINotes / APINotesYAMLCompiler . cpp <nl> <nl> YAML Format specification . <nl> <nl> Nullability should be expressed using one of the following values : <nl> - O - Optional ( or Nullable ) <nl> - N - Not Optional <nl> - U - Unknown <nl> - S - Scalar <nl> + O - Optional ( or Nullable ) <nl> + N - Not Optional <nl> + S - Scalar <nl> + U - Unknown <nl> + Note , the API is considered ' audited ' when at least the return value or a <nl> + parameter has a nullability value . For ' audited ' APIs , we assume the default <nl> + nullability for any underspecified type . <nl> + <nl> + FactoryAsInit can have the following values : <nl> + C - Treat as class method . <nl> + I - Treat as initializer . <nl> + A - Automatically infer based on the name and type ( default ) . <nl> <nl> mmm <nl> Name : AppKit # The name of the framework <nl> <nl> <nl> AvailabilityMessage : " " <nl> <nl> - FactoryAsInit : false # Optional : Specifies if this method is a <nl> + FactoryAsInit : C # Optional : Specifies if this method is a <nl> # factory initializer ( false / true ) <nl> DesignatedInit : false # Optional : Specifies if this method is a <nl> # designated initializer ( false / true ) <nl> namespace { <nl> NullabilitySeq Nullability ; <nl> api_notes : : NullableKind NullabilityOfRet = api_notes : : NullableKind : : Unknown ; <nl> AvailabilityItem Availability ; <nl> - bool FactoryAsInit = false ; <nl> + api_notes : : FactoryAsInitKind FactoryAsInit <nl> + = api_notes : : FactoryAsInitKind : : Infer ; <nl> bool DesignatedInit = false ; <nl> } ; <nl> typedef std : : vector < Method > MethodsSeq ; <nl> namespace llvm { <nl> } <nl> } ; <nl> <nl> + template < > <nl> + struct ScalarEnumerationTraits < api_notes : : FactoryAsInitKind > { <nl> + static void enumeration ( IO & io , api_notes : : FactoryAsInitKind & value ) { <nl> + io . enumCase ( value , " A " , api_notes : : FactoryAsInitKind : : Infer ) ; <nl> + io . enumCase ( value , " C " , api_notes : : FactoryAsInitKind : : AsClassMethod ) ; <nl> + io . enumCase ( value , " I " , api_notes : : FactoryAsInitKind : : AsInitializer ) ; <nl> + } <nl> + } ; <nl> + <nl> template < > <nl> struct ScalarEnumerationTraits < MethodKind > { <nl> static void enumeration ( IO & io , MethodKind & value ) { <nl> namespace llvm { <nl> AbsentNullability ) ; <nl> io . mapOptional ( " Availability " , m . Availability . Mode ) ; <nl> io . mapOptional ( " AvailabilityMsg " , m . Availability . Msg ) ; <nl> - io . mapOptional ( " FactoryAsInit " , m . FactoryAsInit , false ) ; <nl> + io . mapOptional ( " FactoryAsInit " , m . FactoryAsInit , <nl> + api_notes : : FactoryAsInitKind : : Infer ) ; <nl> io . mapOptional ( " DesignatedInit " , m . DesignatedInit , false ) ; <nl> } <nl> } ; <nl> static bool writeMethod ( api_notes : : APINotesWriter & writer , <nl> <nl> / / Translate the initializer info . <nl> mInfo . DesignatedInit = meth . DesignatedInit ; <nl> - / / TODO : We should be able to express more in the YAML and / or need to <nl> - / / rename the yaml entry . <nl> - if ( meth . FactoryAsInit ) <nl> - mInfo . setFactoryAsInitKind ( FactoryAsInitKind : : AsClassMethod ) ; <nl> + if ( meth . FactoryAsInit ! = FactoryAsInitKind : : Infer ) <nl> + mInfo . setFactoryAsInitKind ( meth . FactoryAsInit ) ; <nl> <nl> / / Translate availability info . <nl> if ( translateAvailability ( meth . Availability , mInfo , meth . Selector ) ) <nl> bool api_notes : : decompileAPINotes ( std : : unique_ptr < llvm : : MemoryBuffer > input , <nl> handleNullability ( method . Nullability , method . NullabilityOfRet , info , <nl> selector . count ( ' : ' ) ) ; <nl> handleAvailability ( method . Availability , info ) ; <nl> - method . FactoryAsInit = info . FactoryAsInit ; <nl> + method . FactoryAsInit = info . getFactoryAsInitKind ( ) ; <nl> method . DesignatedInit = info . DesignatedInit ; <nl> <nl> auto known = knownContexts [ contextID . Value ] ; <nl> mmm a / test / APINotes / Inputs / Foundation . yaml <nl> ppp b / test / APINotes / Inputs / Foundation . yaml <nl> Classes : <nl> Methods : <nl> - Selector : ' notificationCenterForType : ' <nl> MethodKind : Class <nl> - FactoryAsInit : true <nl> + FactoryAsInit : C <nl> - Name : NSError <nl> Methods : <nl> - Selector : ' initWithDomain : code : userInfo : ' <nl> Classes : <nl> Methods : <nl> - Selector : ' processInfo ' <nl> MethodKind : Class <nl> - FactoryAsInit : true <nl> + FactoryAsInit : C <nl> - Name : NSScriptObjectSpecifier <nl> Methods : <nl> - Selector : ' initWithContainerClassDescription : containerSpecifier : key : ' <nl> mmm a / test / APINotes / Inputs / NotificationCenter . yaml <nl> ppp b / test / APINotes / Inputs / NotificationCenter . yaml <nl> Classes : <nl> Methods : <nl> - Selector : ' widgetController ' <nl> MethodKind : Class <nl> - FactoryAsInit : true <nl> + FactoryAsInit : C <nl>
|
API notes : turn FactoryAsInit into 3 - state on YAML side .
|
apple/swift
|
ddaa294eca57788d26a4ebc08eee89808c199dc9
|
2014-07-24T03:16:58Z
|
mmm a / test / mjsunit / mjsunit . status <nl> ppp b / test / mjsunit / mjsunit . status <nl> <nl> [ ' arch = = x87 ' , { <nl> # Turbofan will hit the known issue that x87 changes sNaN to qNaN by default . <nl> ' regress / regress - undefined - nan ' : [ SKIP ] , <nl> + ' regress / regress - crbug - 242924 ' : [ SKIP ] , <nl> } ] , # ' arch = = x87 ' <nl> <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl>
|
X87 : disable the regress - crbug - 242924 test case for x87 .
|
v8/v8
|
3e36babe38814844c1a10302772ebdb31e0d2250
|
2016-02-18T09:37:46Z
|
mmm a / emcc . py <nl> ppp b / emcc . py <nl> class OFormat ( Enum ) : <nl> <nl> class EmccOptions ( object ) : <nl> def __init__ ( self ) : <nl> + self . compiler_wrapper = None <nl> self . oformat = None <nl> self . requested_debug = ' ' <nl> self . profiling = False <nl> def run ( args ) : <nl> ' ' ' % ( shared . EMSCRIPTEN_VERSION , revision ) ) <nl> return 0 <nl> <nl> - CXX = [ shared . CLANG_CXX ] <nl> - CC = [ shared . CLANG_CC ] <nl> - if shared . COMPILER_WRAPPER : <nl> - logger . debug ( ' using compiler wrapper : % s ' , shared . COMPILER_WRAPPER ) <nl> - CXX . insert ( 0 , shared . COMPILER_WRAPPER ) <nl> - CC . insert ( 0 , shared . COMPILER_WRAPPER ) <nl> - <nl> if run_via_emxx : <nl> clang = shared . CLANG_CXX <nl> else : <nl> def need_llvm_debug_info ( ) : <nl> <nl> options , settings_changes , user_js_defines , newargs = parse_args ( newargs ) <nl> <nl> - if ' EMMAKEN_COMPILER ' in os . environ : <nl> - diagnostics . warning ( ' deprecated ' , ' ` EMMAKEN_COMPILER ` is deprecated . \ n ' <nl> - ' To use an alteranative LLVM build set ` LLVM_ROOT ` in the config file ( or ` EM_LLVM_ROOT ` env var ) . \ n ' <nl> - ' To wrap invocations of clang use the ` COMPILER_WRAPPER ` setting ( or ` EM_COMPILER_WRAPPER ` env var . \ n ' ) <nl> - CXX = [ os . environ [ ' EMMAKEN_COMPILER ' ] ] <nl> - CC = [ cxx_to_c_compiler ( os . environ [ ' EMMAKEN_COMPILER ' ] ) ] <nl> - <nl> if ' - print - search - dirs ' in newargs : <nl> - return run_process ( CC + [ ' - print - search - dirs ' ] , check = False ) . returncode <nl> + return run_process ( [ clang , ' - print - search - dirs ' ] , check = False ) . returncode <nl> <nl> if options . emrun : <nl> options . pre_js + = open ( shared . path_from_root ( ' src ' , ' emrun_prejs . js ' ) ) . read ( ) + ' \ n ' <nl> def is_link_flag ( flag ) : <nl> return True <nl> return flag . startswith ( ( ' - l ' , ' - L ' , ' - Wl , ' ) ) <nl> <nl> + CXX = [ shared . CLANG_CXX ] <nl> + CC = [ shared . CLANG_CC ] <nl> + if shared . COMPILER_WRAPPER : <nl> + logger . debug ( ' using compiler wrapper : % s ' , shared . COMPILER_WRAPPER ) <nl> + CXX . insert ( 0 , shared . COMPILER_WRAPPER ) <nl> + CC . insert ( 0 , shared . COMPILER_WRAPPER ) <nl> + <nl> + if ' EMMAKEN_COMPILER ' in os . environ : <nl> + diagnostics . warning ( ' deprecated ' , ' ` EMMAKEN_COMPILER ` is deprecated . \ n ' <nl> + ' To use an alteranative LLVM build set ` LLVM_ROOT ` in the config file ( or ` EM_LLVM_ROOT ` env var ) . \ n ' <nl> + ' To wrap invocations of clang use the ` COMPILER_WRAPPER ` setting ( or ` EM_COMPILER_WRAPPER ` env var . \ n ' ) <nl> + CXX = [ os . environ [ ' EMMAKEN_COMPILER ' ] ] <nl> + CC = [ cxx_to_c_compiler ( os . environ [ ' EMMAKEN_COMPILER ' ] ) ] <nl> + <nl> compile_args = [ a for a in newargs if a and not is_link_flag ( a ) ] <nl> <nl> if not building . can_inline ( ) : <nl> def consume_arg ( ) : <nl> options . extern_pre_js + = open ( consume_arg ( ) ) . read ( ) + ' \ n ' <nl> elif check_arg ( ' - - extern - post - js ' ) : <nl> options . extern_post_js + = open ( consume_arg ( ) ) . read ( ) + ' \ n ' <nl> + elif check_arg ( ' - - compiler - wrapper ' ) : <nl> + shared . COMPILER_WRAPPER = consume_arg ( ) <nl> elif check_arg ( ' - - oformat ' ) : <nl> formats = [ f . lower ( ) for f in OFormat . __members__ ] <nl> fmt = consume_arg ( ) <nl> mmm a / tests / test_other . py <nl> ppp b / tests / test_other . py <nl> def test_compiler_wrapper ( self ) : <nl> self . assertContained ( ' wrapping compiler call : ' , stdout ) <nl> self . assertExists ( ' test_hello_world . o ' ) <nl> <nl> + stdout = self . run_process ( [ EMCC , ' - c ' , path_from_root ( ' tests ' , ' core ' , ' test_hello_world . c ' ) , ' - - compiler - wrapper = . / wrapper . sh ' ] , stdout = PIPE ) . stdout <nl> + self . assertContained ( ' wrapping compiler call : ' , stdout ) <nl> + self . assertExists ( ' test_hello_world . o ' ) <nl> + <nl> def test_llvm_option_dash_o ( self ) : <nl> # emcc used to interpret - mllvm ' s option value as the output file if it <nl> # began with - o <nl>
|
Add - - compiler - wrapper command line flag ( )
|
emscripten-core/emscripten
|
693c656732c6eea557ee36e7f9a99fc8ac81e30b
|
2020-10-31T04:02:46Z
|
mmm a / lib / Sema / CSDiag . cpp <nl> ppp b / lib / Sema / CSDiag . cpp <nl> bool FailureDiagnosis : : diagnoseContextualConversionError ( Type exprType ) { <nl> Failure : : FailureKind failureKind ; <nl> switch ( foundConstraint - > getKind ( ) ) { <nl> default : assert ( 0 & & " This list out of sync with isConversionConstraint " ) ; <nl> - break ; <nl> + SWIFT_FALLTHROUGH ; <nl> case ConstraintKind : : ConformsTo : <nl> case ConstraintKind : : SelfObjectOfProtocol : <nl> diagnose ( expr - > getLoc ( ) , diag : : type_does_not_conform , <nl>
|
Fix bad warning suppression
|
apple/swift
|
1f39e3c4110fc77924226f6364bf5d509cf9fa96
|
2015-07-28T22:47:29Z
|
mmm a / tensorflow / python / keras / optimizer_v2 / rmsprop . py <nl> ppp b / tensorflow / python / keras / optimizer_v2 / rmsprop . py <nl> class RMSprop ( optimizer_v2 . OptimizerV2 ) : <nl> learning_rate : A ` Tensor ` , floating point value , or a schedule that is a <nl> ` tf . keras . optimizers . schedules . LearningRateSchedule ` , or a callable <nl> that takes no arguments and returns the actual value to use . The <nl> - learning rate . Defeaults to 0 . 001 . <nl> + learning rate . Defaults to 0 . 001 . <nl> rho : Discounting factor for the history / coming gradient . Defaults to 0 . 9 . <nl> momentum : A scalar or a scalar ` Tensor ` . Defaults to 0 . 0 . <nl> epsilon : A small constant for numerical stability . This epsilon is <nl> def __init__ ( self , <nl> learning_rate : A ` Tensor ` , floating point value , or a schedule that is a <nl> ` tf . keras . optimizers . schedules . LearningRateSchedule ` , or a callable <nl> that takes no arguments and returns the actual value to use . The <nl> - learning rate . Defeaults to 0 . 001 . <nl> + learning rate . Defaults to 0 . 001 . <nl> rho : Discounting factor for the history / coming gradient . Defaults to 0 . 9 . <nl> momentum : A scalar or a scalar ` Tensor ` . Defaults to 0 . 0 . <nl> epsilon : A small constant for numerical stability . This epsilon is <nl>
|
Merge pull request from Molkree : patch - 1
|
tensorflow/tensorflow
|
1b83992ade6141756cb5b72b998f02b90430ffd5
|
2020-09-02T20:22:41Z
|
mmm a / test / changefeeds / basic . test <nl> ppp b / test / changefeeds / basic . test <nl> class Changefeeds_Basic ( rdb_unittest . RdbTestCase ) : <nl> <nl> for _ in range ( 30 ) : <nl> self . table . get ( updateItemId ) . update ( { ' update ' : 1 } ) . run ( self . conn ) <nl> - self . assertRaises ( self . r . RqlTimeoutError , feed . next , wait = . 2 ) <nl> + self . assertRaises ( self . r . ReqlTimeoutError , feed . next , wait = . 2 ) <nl> <nl> # other changes should work <nl> <nl> class Changefeeds_Basic ( rdb_unittest . RdbTestCase ) : <nl> # the changefeed should have closed <nl> <nl> self . table . get ( updateItemId ) . update ( { ' update ' : 1 } ) . run ( conn ) <nl> - self . assertRaises ( self . r . RqlRuntimeError , changefeed . next , wait = . 2 ) <nl> + self . assertRaises ( self . r . ReqlRuntimeError , changefeed . next , wait = . 2 ) <nl> <nl> def test_secondary_failure ( self ) : <nl> ' ' ' Test when a secondary shardholder fails for a range ' ' ' <nl> class Changefeeds_Basic ( rdb_unittest . RdbTestCase ) : <nl> # check that we error <nl> <nl> self . table . insert ( { } ) . run ( stable_conn ) <nl> - self . assertRaises ( self . r . RqlDriverError , next , changefeed ) <nl> + self . assertRaises ( self . r . ReqlDriverError , next , changefeed ) <nl> <nl> # - generate the table drop tests <nl> <nl> for feed in [ <nl> try : <nl> while True : <nl> runningFeed . next ( wait = . 1 ) <nl> - except self . r . RqlTimeoutError : pass <nl> + except self . r . ReqlTimeoutError : pass <nl> <nl> # drop the table <nl> <nl> for feed in [ <nl> result = None <nl> try : <nl> result = runningFeed . next ( wait = . 2 ) <nl> - except self . r . RqlRuntimeError : <nl> + except self . r . ReqlRuntimeError : <nl> pass # expected result <nl> - except self . r . RqlTimeoutError : <nl> - raise AssertionError ( ' % s feed timed out rather than getting a RqlRuntimeError error ' % feed [ ' name ' ] ) <nl> + except self . r . ReqlTimeoutError : <nl> + raise AssertionError ( ' % s feed timed out rather than getting a ReqlRuntimeError error ' % feed [ ' name ' ] ) <nl> except Exception as e : <nl> - raise AssertionError ( ' expected RqlRuntimeError , but raised : % r ' % e ) <nl> + raise AssertionError ( ' expected ReqlRuntimeError , but raised : % r ' % e ) <nl> else : <nl> - raise AssertionError ( ' expected RqlRuntimeError , but got value : % r ' % result ) <nl> + raise AssertionError ( ' expected ReqlRuntimeError , but got value : % r ' % result ) <nl> return test <nl> testName = ' test_table_drop_ % s_feed ' % feed [ ' name ' ] <nl> setattr ( Changefeeds_Basic , testName , test_table_drop_test_generator ( feed ) ) <nl> mmm a / test / changefeeds / change_master . test <nl> ppp b / test / changefeeds / change_master . test <nl> class Changefeeds_Master ( rdb_unittest . RdbTestCase ) : <nl> <nl> self . table . get ( sampleA_ID ) . update ( { ' update ' : ' b ' } ) . run ( self . conn ) <nl> <nl> - self . assertRaises ( self . r . RqlRuntimeError , feedA1 . next , wait = . 2 ) <nl> - self . assertRaises ( self . r . RqlRuntimeError , feedA2 . next , wait = . 2 ) <nl> + self . assertRaises ( self . r . ReqlRuntimeError , feedA1 . next , wait = . 2 ) <nl> + self . assertRaises ( self . r . ReqlRuntimeError , feedA2 . next , wait = . 2 ) <nl> <nl> print ( " Check that feeds are also disconnected on an unchanged shard ( % . 2fs ) " % ( time . time ( ) - startTime ) ) <nl> <nl> self . table . get ( sampleB_ID ) . update ( { ' update ' : ' b ' } ) . run ( self . conn ) <nl> <nl> - self . assertRaises ( self . r . RqlRuntimeError , feedB . next , wait = . 2 ) <nl> - self . assertRaises ( self . r . RqlRuntimeError , pointFeed . next , wait = . 2 ) <nl> + self . assertRaises ( self . r . ReqlRuntimeError , feedB . next , wait = . 2 ) <nl> + self . assertRaises ( self . r . ReqlRuntimeError , pointFeed . next , wait = . 2 ) <nl> <nl> # = = = = = main <nl> <nl> mmm a / test / rdb_workloads / stress <nl> ppp b / test / rdb_workloads / stress <nl> class QueryThrottler : <nl> result = { " timestamp " : start_time } <nl> try : <nl> result . update ( self . workload . run ( conn ) ) <nl> - except ( r . RqlError , r . RqlDriverError ) as ex : <nl> + except ( r . ReqlError , r . ReqlDriverError ) as ex : <nl> result [ " errors " ] = result . get ( ' errors ' , [ ] ) + [ ex . message ] <nl> except ( IOError , OSError ) as ex : <nl> if ex . errno ! = errno . EINTR : <nl> mmm a / test / regression / issue_3038 . test <nl> ppp b / test / regression / issue_3038 . test <nl> with driver . Cluster ( initial_servers = 2 , console_output = True ) as cluster : <nl> try : <nl> next ( changefeed ) <nl> sys . exit ( ' Failure : did not get a exception on the changefeed as expected ! ' ) <nl> - except r . errors . RqlRuntimeError : <nl> + except r . errors . ReqlRuntimeError : <nl> pass <nl> <nl> # = = check that the first server can close gracefully <nl> mmm a / test / regression / issue_3051 . test <nl> ppp b / test / regression / issue_3051 . test <nl> if not ' test ' in r . db_list ( ) . run ( conn ) : <nl> <nl> try : <nl> r . db ( dbName ) . table_create ( tableName ) . run ( conn ) # should error because of the unicode <nl> - except r . RqlRuntimeError as e : <nl> + except r . ReqlRuntimeError as e : <nl> try : <nl> str ( e ) <nl> except UnicodeEncodeError : <nl> mmm a / test / regression / known_failures / issue_1774 . test <nl> ppp b / test / regression / known_failures / issue_1774 . test <nl> class WaitForTable ( utils . PerformContinuousAction ) : <nl> try : <nl> r . db ( dbName ) . table ( tableName ) . limit ( 1 ) . run ( self . connection ) <nl> break <nl> - except r . RqlRuntimeError : <nl> + except r . ReqlRuntimeError : <nl> pass <nl> except Exception as e : <nl> self . recordError ( e ) <nl> for errorMessage , errorCount in readTableProcess . errorSummary ( ) . items ( ) : <nl> try : <nl> r . db_list ( ) . run ( conn ) <nl> print ( ' Success : conection is still valid ' ) <nl> - except r . errors . RqlDriverError : <nl> + except r . errors . ReqlDriverError : <nl> allPassed = False <nl> sys . stderr . write ( ' Failure : The database connnection went stale \ n ' ) <nl> r . connect ( host = server . host , port = server . driver_port ) <nl> mmm a / test / rql_test / cfeed_union . rb <nl> ppp b / test / rql_test / cfeed_union . rb <nl> def mangle stream <nl> timeout ( 2 ) { <nl> $ lp1 . next <nl> } <nl> - rescue RethinkDB : : RqlRuntimeError = > e <nl> + rescue RethinkDB : : ReqlRuntimeError = > e <nl> $ errored = true <nl> end <nl> assert { $ errored } <nl> mmm a / test / rql_test / connections / cursor . py . test <nl> ppp b / test / rql_test / connections / cursor . py . test <nl> class TestRangeCursor ( unittest . TestCase ) : <nl> for i in cursor : <nl> count + = 1 <nl> return count <nl> - count = self . assertRaisesRegexp ( r . RqlRuntimeError , " Connection is closed . " , read_cursor , cursor ) <nl> + count = self . assertRaisesRegexp ( r . ReqlRuntimeError , " Connection is closed . " , read_cursor , cursor ) <nl> self . assertNotEqual ( count , 0 , " Did not get any cursor results " ) <nl> <nl> def test_cursor_after_cursor_close ( self ) : <nl> class TestCursorWait ( unittest . TestCase ) : <nl> else : <nl> cursors [ cursor_index ] . next ( wait = wait_time ) <nl> cursor_counts [ cursor_index ] + = 1 <nl> - except r . RqlTimeoutError : <nl> + except r . ReqlTimeoutError : <nl> cursor_timeouts [ cursor_index ] + = 1 <nl> <nl> # We need to get ahead of pre - fetching for this to get the error we want <nl> class TestChangefeedWait ( unittest . TestCase ) : <nl> r . db ( dbName ) . table_create ( tableName ) . run ( conn ) <nl> <nl> changes = r . db ( dbName ) . table ( tableName ) . changes ( ) . run ( conn ) <nl> - self . assertRaises ( r . RqlTimeoutError , changes . next , wait = 0 ) <nl> - self . assertRaises ( r . RqlTimeoutError , changes . next , wait = 0 . 2 ) <nl> - self . assertRaises ( r . RqlTimeoutError , changes . next , wait = 1 ) <nl> - self . assertRaises ( r . RqlTimeoutError , changes . next , wait = 5 ) <nl> + self . assertRaises ( r . ReqlTimeoutError , changes . next , wait = 0 ) <nl> + self . assertRaises ( r . ReqlTimeoutError , changes . next , wait = 0 . 2 ) <nl> + self . assertRaises ( r . ReqlTimeoutError , changes . next , wait = 1 ) <nl> + self . assertRaises ( r . ReqlTimeoutError , changes . next , wait = 5 ) <nl> res = r . db ( dbName ) . table ( tableName ) . insert ( { } ) . run ( conn ) <nl> self . assertEqual ( res [ ' inserted ' ] , 1 ) <nl> res = changes . next ( wait = 1 ) <nl> mmm a / test / rql_test / connections / cursor . rb <nl> ppp b / test / rql_test / connections / cursor . rb <nl> def test_cursor_after_connection_close ( conn ) <nl> read_cursor = - > { <nl> cursor . each { | i | count + = 1 } <nl> } <nl> - expect_error ( read_cursor , RethinkDB : : RqlRuntimeError , " Connection is closed . " ) <nl> + expect_error ( read_cursor , RethinkDB : : ReqlRuntimeError , " Connection is closed . " ) <nl> raise " Did not get any cursor results " if count = = 0 <nl> end <nl> <nl> def test_cursor_double_each ( conn ) <nl> } <nl> read_cursor . call ( ) <nl> expect_eq ( count , 10000 ) <nl> - expect_error ( read_cursor , RethinkDB : : RqlRuntimeError , " Can only iterate over a cursor once . " ) <nl> + expect_error ( read_cursor , RethinkDB : : ReqlRuntimeError , " Can only iterate over a cursor once . " ) <nl> expect_eq ( count , 10000 ) <nl> end <nl> <nl> mmm a / test / rql_test / connections / http . rb <nl> ppp b / test / rql_test / connections / http . rb <nl> def test_delete ( ) <nl> def test_redirects ( ) <nl> url = ' http : / / ' + $ httpbinAddress + ' / redirect / 2 ' <nl> expect_error ( r . http ( url , { : redirects = > 0 } ) , <nl> - RethinkDB : : RqlRuntimeError , err_string ( ' GET ' , url , ' status code 302 ' ) ) <nl> + RethinkDB : : ReqlRuntimeError , err_string ( ' GET ' , url , ' status code 302 ' ) ) <nl> expect_error ( r . http ( url , { : redirects = > 1 } ) , <nl> - RethinkDB : : RqlRuntimeError , err_string ( ' GET ' , url , ' Number of redirects hit maximum amount ' ) ) <nl> + RethinkDB : : ReqlRuntimeError , err_string ( ' GET ' , url , ' Number of redirects hit maximum amount ' ) ) <nl> res = r . http ( url , { : redirects = > 2 } ) . run ( ) <nl> expect_eq ( res [ ' headers ' ] [ ' Host ' ] , $ httpbinAddress ) <nl> end <nl> def test_gzip ( ) <nl> def test_failed_json_parse ( ) <nl> url = ' http : / / ' + $ httpbinAddress + ' / html ' <nl> expect_error ( r . http ( url , { : result_format = > ' json ' } ) , <nl> - RethinkDB : : RqlRuntimeError , err_string ( ' GET ' , url , ' failed to parse JSON response : Invalid value . ' ) ) <nl> + RethinkDB : : ReqlRuntimeError , err_string ( ' GET ' , url , ' failed to parse JSON response : Invalid value . ' ) ) <nl> end <nl> <nl> def test_basic_auth ( ) <nl> def test_basic_auth ( ) <nl> <nl> # Wrong password <nl> expect_error ( r . http ( url , { : auth = > { : type = > ' basic ' , : user = > ' azure ' , : pass = > ' wrong ' } } ) , <nl> - RethinkDB : : RqlRuntimeError , err_string ( ' GET ' , url , ' status code 401 ' ) ) <nl> + RethinkDB : : ReqlRuntimeError , err_string ( ' GET ' , url , ' status code 401 ' ) ) <nl> <nl> # Wrong username <nl> expect_error ( r . http ( url , { : auth = > { : type = > ' basic ' , : user = > ' fake ' , : pass = > ' hunter2 ' } } ) , <nl> - RethinkDB : : RqlRuntimeError , err_string ( ' GET ' , url , ' status code 401 ' ) ) <nl> + RethinkDB : : ReqlRuntimeError , err_string ( ' GET ' , url , ' status code 401 ' ) ) <nl> <nl> # Wrong authentication type <nl> expect_error ( r . http ( url , { : auth = > { : type = > ' digest ' , : user = > ' azure ' , : pass = > ' hunter2 ' } } ) , <nl> - RethinkDB : : RqlRuntimeError , err_string ( ' GET ' , url , ' status code 401 ' ) ) <nl> + RethinkDB : : ReqlRuntimeError , err_string ( ' GET ' , url , ' status code 401 ' ) ) <nl> <nl> # Correct credentials <nl> res = r . http ( url , { : auth = > { : type = > ' basic ' , : user = > ' azure ' , : pass = > ' hunter2 ' } } ) . run ( ) <nl> def test_digest_auth ( ) <nl> # Wrong password <nl> expect_error ( r . http ( url , { : redirects = > 5 , <nl> : auth = > { : type = > ' digest ' , : user = > ' azure ' , : pass = > ' wrong ' } } ) , <nl> - RethinkDB : : RqlRuntimeError , err_string ( ' GET ' , url , ' status code 401 ' ) ) <nl> + RethinkDB : : ReqlRuntimeError , err_string ( ' GET ' , url , ' status code 401 ' ) ) <nl> <nl> # Wrong username <nl> expect_error ( r . http ( url , { : redirects = > 5 , <nl> : auth = > { : type = > ' digest ' , : user = > ' fake ' , : pass = > ' hunter2 ' } } ) , <nl> - RethinkDB : : RqlRuntimeError , err_string ( ' GET ' , url , ' status code 401 ' ) ) <nl> + RethinkDB : : ReqlRuntimeError , err_string ( ' GET ' , url , ' status code 401 ' ) ) <nl> <nl> # Wrong authentication type <nl> expect_error ( r . http ( url , { : redirects = > 5 , <nl> : auth = > { : type = > ' basic ' , : user = > ' azure ' , : pass = > ' hunter2 ' } } ) , <nl> - RethinkDB : : RqlRuntimeError , err_string ( ' GET ' , url , ' status code 401 ' ) ) <nl> + RethinkDB : : ReqlRuntimeError , err_string ( ' GET ' , url , ' status code 401 ' ) ) <nl> <nl> # Correct credentials <nl> res = r . http ( url , { : redirects = > 5 , <nl> def test_digest_auth ( ) <nl> def test_verify ( ) <nl> def test_part ( url ) <nl> expect_error ( r . http ( url , { : method = > ' HEAD ' , : verify = > true , : redirects = > 5 } ) , <nl> - RethinkDB : : RqlRuntimeError , err_string ( ' HEAD ' , url , ' Peer certificate cannot be authenticated with given CA certificates ' ) ) <nl> + RethinkDB : : ReqlRuntimeError , err_string ( ' HEAD ' , url , ' Peer certificate cannot be authenticated with given CA certificates ' ) ) <nl> <nl> res = r . http ( url , { : method = > ' HEAD ' , : verify = > false , : redirects = > 5 } ) . run ( ) <nl> expect_eq ( res , nil ) <nl> mmm a / test / rql_test / drivers / driver . js <nl> ppp b / test / rql_test / drivers / driver . js <nl> function printTestFailure ( test , result ) { <nl> console . log ( " BACKTRACE : \ n < < < < < < < < < \ n " + result . stack . toString ( ) + " \ n > > > > > > > > " ) <nl> } <nl> if ( result . cmpMsg ) { <nl> - console . log ( " RAW RESULT : \ n < < < < < < < < < \ n " + result . msg . replace ( / ^ \ s + | \ s + $ / g , ' ' ) + " \ n > > > > > > > > " ) <nl> + console . log ( " RAW RESULT : \ n < < < < < < < < < \ n " + ( result . msg | | result . message ) . replace ( / ^ \ s + | \ s + $ / g , ' ' ) + " \ n > > > > > > > > " ) <nl> } <nl> console . log ( ' ' ) <nl> } <nl> function runTest ( ) { <nl> <nl> test . exp_fun = exp_fun ; <nl> <nl> - TRACE ( ' expected value : ' + stringValue ( test . exp_fun ) + ' from ' + stringValue ( test . expectedSrc ) ) <nl> + TRACE ( ' expected value : < < ' + stringValue ( test . exp_fun ) + ' > > from < < ' + stringValue ( test . expectedSrc ) + ' > > ' ) <nl> <nl> / / - evaluate the test <nl> <nl> function runTest ( ) { <nl> } <nl> } <nl> } catch ( result ) { <nl> - TRACE ( " querry error - " + stringValue ( result ) ) <nl> - TRACE ( " stack : " + String ( result . stack ) ) ; <nl> + TRACE ( " error result : " + stringValue ( result ) ) <nl> processResult ( result , null , test ) ; / / will go on to next test <nl> return ; <nl> } <nl> function err_predicate ( err_name , err_pred , err_frames , desc ) { <nl> var fun = function err_predicate_return ( other ) { <nl> if ( other instanceof Error ) { <nl> / / Strip out " offending object " from err message <nl> - other . cmpMsg = other . msg <nl> - other . cmpMsg = other . cmpMsg . replace ( / ^ ( [ ^ \ n ] * ) : \ n [ \ s \ S ] * $ / , ' $ 1 . ' ) ; <nl> + other . cmpMsg = other . msg | | other . message <nl> + other . cmpMsg = other . cmpMsg . replace ( / ^ ( [ ^ \ n ] * ? ) ( ? : in ) ? : \ n [ \ s \ S ] * $ / , ' $ 1 : ' ) ; <nl> other . cmpMsg = other . cmpMsg . replace ( / \ nFailed assertion : . * / , " " ) ; <nl> other . cmpMsg = other . cmpMsg . replace ( / \ nStack : \ n [ \ s \ S ] * $ / , " " ) ; <nl> + TRACE ( " Translate msg : < < " + ( other . message | | other . msg ) + " > > = > < < " + other . cmpMsg + " > > " ) <nl> } <nl> <nl> if ( ! ( other instanceof err_class ) ) return false ; <nl> mmm a / test / rql_test / drivers / driver . py <nl> ppp b / test / rql_test / drivers / driver . py <nl> <nl> from __future__ import print_function <nl> <nl> - import atexit , itertools , os , re , sys , time <nl> + import atexit , itertools , os , re , sys , time , warnings <nl> from datetime import datetime , tzinfo , timedelta <nl> <nl> stashedPath = sys . path <nl> def dst ( self , dt ) : <nl> <nl> def print_debug ( message ) : <nl> if DEBUG_ENABLED : <nl> - sys . stderr . write ( ' DEBUG ( % . 2f ) : \ t % s \ n ' % ( time . time ( ) - start_time , message . rstrip ( ) ) ) <nl> + print ( ' DEBUG ( % . 2f ) : \ t % s ' % ( time . time ( ) - start_time , message . rstrip ( ) ) ) <nl> <nl> DRIVER_PORT = int ( sys . argv [ 1 ] if len ( sys . argv ) > 1 else os . environ . get ( ' RDB_DRIVER_PORT ' ) ) <nl> print_debug ( ' Using driver port : % d ' % DRIVER_PORT ) <nl> def __repr__ ( self ) : <nl> return repr ( self . dct ) <nl> <nl> class Err : <nl> - inRegex = re . compile ( ' ^ ( ? P < message > [ ^ \ n ] * ? ) : \ n . * $ ' , flags = re . DOTALL ) <nl> + inRegex = re . compile ( ' ^ ( ? P < message > [ ^ \ n ] * ? ) ( ? : in ) ? : \ n . * $ ' , flags = re . DOTALL ) <nl> assertionRegex = re . compile ( ' ^ ( ? P < message > [ ^ \ n ] * ? ) \ nFailed assertion : . * $ ' , flags = re . DOTALL ) <nl> <nl> def __init__ ( self , err_type = None , message = None , err_frames = None , regex = False , * * kwargs ) : <nl> def __eq__ ( self , other ) : <nl> <nl> # - - message <nl> <nl> - otherMessage = str ( other . message ) <nl> - <nl> # Strip details from output message <nl> - otherMessage = re . sub ( self . inRegex , ' \ g < message > . ' , otherMessage ) <nl> + otherMessage = None <nl> + with warnings . catch_warnings ( ) : <nl> + warnings . simplefilter ( ' ignore ' ) <nl> + if hasattr ( other , ' message ' ) : <nl> + otherMessage = str ( other . message ) <nl> + else : <nl> + otherMessage = str ( other ) <nl> + otherMessage = re . sub ( self . inRegex , ' \ g < message > : ' , otherMessage ) <nl> otherMessage = re . sub ( self . assertionRegex , ' \ g < message > ' , otherMessage ) <nl> <nl> if self . regex : <nl> - if not re . match ( self . message , otherMessage ) : <nl> + if not re . match ( unicode ( self . message ) , otherMessage ) : <nl> return False <nl> else : <nl> if not self . message = = otherMessage : <nl> mmm a / test / rql_test / drivers / driver . rb <nl> ppp b / test / rql_test / drivers / driver . rb <nl> def show ( x ) <nl> message = String . new ( x . message ) <nl> message . sub ! ( / ^ ( ? < message > [ ^ \ n ] * ? ) \ nFailed assertion : . * $ / m , ' \ k < message > ' ) <nl> message . sub ! ( / ^ ( ? < message > [ ^ \ n ] * ? ) \ nBacktrace : \ n . * $ / m , ' \ k < message > ' ) <nl> - message . sub ! ( / ^ ( ? < message > [ ^ \ n ] * ? ) : \ n . * $ / m , ' \ k < message > . ' ) <nl> + message . sub ! ( / ^ ( ? < message > [ ^ \ n ] * ? ) : \ n . * $ / m , ' \ k < message > : ' ) <nl> return " # { x . class . name . sub ( / ^ RethinkDB : : / , " " ) } : # { message } " <nl> elsif x . is_a ? ( String ) <nl> return x <nl> def float_cmp ( value ) <nl> end <nl> <nl> def cmp_test ( expected , result , testopts = { } , partial = false ) <nl> - print_debug ( " \ tCompare - expected : # { show ( expected ) } ( # { expected . class } ) actual : # { show ( result ) } " ) <nl> + print_debug ( " \ tCompare - expected : < < # { show ( expected ) } > > ( # { expected . class } ) actual : < < # { show ( result ) } > > " ) <nl> <nl> if expected . object_id = = NoError . object_id <nl> if result . is_a ? ( Err ) <nl> def cmp_test ( expected , result , testopts = { } , partial = false ) <nl> if result . is_a ? ( String ) then <nl> result = result . sub ( / \ nFailed assertion : ( . | \ n ) * / , " " ) <nl> end <nl> - <nl> - case " # { expected . class } " <nl> - when " Err " <nl> + <nl> + case <nl> + when expected . is_a ? ( Err ) | | expected . is_a ? ( Exception ) <nl> if result . is_a ? ( expected . class ) <nl> - return show ( result ) . sub ( / ^ # { result . class . name . sub ( / ^ RethinkDB : : / , ' ' ) } : / , ' ' ) < = > expected . message <nl> + cmpMessage = show ( result ) . sub ( / ^ # { result . class . name . sub ( / ^ RethinkDB : : / , ' ' ) } : / , ' ' ) <nl> + if expected . message . is_a ? ( Regexp ) <nl> + return expected . message . match ( cmpMessage ) ? 0 : 1 <nl> + else <nl> + return cmpMessage < = > expected . message <nl> + end <nl> else <nl> return result . class . name < = > expected . class . name <nl> end <nl> <nl> - when " Array " <nl> + when expected . is_a ? ( Array ) <nl> if result . respond_to ? : to_a <nl> result = result . to_a <nl> end <nl> def cmp_test ( expected , result , testopts = { } , partial = false ) <nl> end <nl> return 0 <nl> <nl> - when " PartialHash " <nl> + when expected . is_a ? ( PartialHash ) <nl> return cmp_test ( expected . hash , result , testopts , true ) <nl> <nl> - when " Hash " <nl> + when expected . is_a ? ( Hash ) <nl> cmp = result . class . name < = > expected . class . name <nl> return cmp if cmp ! = 0 <nl> result = Hash [ result . map { | k , v | [ k . to_s , v ] } ] <nl> def cmp_test ( expected , result , testopts = { } , partial = false ) <nl> } <nl> return 0 <nl> <nl> - when " Bag " <nl> + when expected . is_a ? ( Bag ) <nl> return cmp_test ( <nl> expected . items . sort { | a , b | cmp_test ( a , b , testopts ) } , <nl> result . sort { | a , b | cmp_test ( a , b , testopts ) } , <nl> def cmp_test ( expected , result , testopts = { } , partial = false ) <nl> expected . partial <nl> ) <nl> <nl> - when " Float " , " Fixnum " , " Number " <nl> + when expected . is_a ? ( Float ) | | expected . is_a ? ( Fixnum ) | | expected . is_a ? ( Number ) <nl> if not ( result . kind_of ? Float or result . kind_of ? Fixnum ) <nl> cmp = result . class . name < = > expected . class . name <nl> return cmp if cmp ! = 0 <nl> def test ( src , expected , name , opthash = nil , testopts = nil ) <nl> end <nl> <nl> rescue StandardError , SyntaxError = > e <nl> - result = err ( e . class . name . sub ( / ^ RethinkDB : : / , " " ) , e . message . split ( " \ n " ) [ 0 ] , e . backtrace ) <nl> + result = e <nl> end <nl> <nl> if testopts & & testopts . key ? ( : noreply_wait ) & & testopts [ : noreply_wait ] <nl> def setup_table ( table_variable_name , table_name , db_name = " test " ) <nl> db_name , table_name = $ required_external_tables . pop <nl> begin <nl> r . db ( db_name ) . table ( table_name ) . info ( ) . run ( $ reql_conn ) <nl> - rescue RethinkDB : : RqlRuntimeError <nl> + rescue RethinkDB : : ReqlRuntimeError <nl> " External table # { db_name } . # { table_name } did not exist " <nl> end <nl> <nl> def check_result ( name , src , result , expected , testopts = { } ) <nl> if ( result . kind_of ? ( RethinkDB : : Cursor ) | | result . kind_of ? ( Enumerator ) ) & & expected ! = NoError <nl> begin <nl> result = result . to_a <nl> - rescue RethinkDB : : RqlError = > err <nl> + rescue RethinkDB : : ReqlError = > err <nl> result = err <nl> end <nl> end <nl> mmm a / test / rql_test / em . rb <nl> ppp b / test / rql_test / em . rb <nl> class DefaultHandler < RethinkDB : : Handler <nl> attr_accessor : state <nl> def initialize ; @ state = [ ] ; end <nl> def on_error ( err ) <nl> - if err ! = RethinkDB : : RqlRuntimeError . new ( " Connection is closed . " ) <nl> + if err ! = RethinkDB : : ReqlRuntimeError . new ( " Connection is closed . " ) <nl> @ state < < [ : err , err ] <nl> end <nl> end <nl> class ValTypeHandler < RethinkDB : : Handler <nl> attr_accessor : state <nl> def initialize ; @ state = [ ] ; end <nl> def on_error ( err ) <nl> - if err ! = RethinkDB : : RqlRuntimeError . new ( " Connection is closed . " ) <nl> + if err ! = RethinkDB : : ReqlRuntimeError . new ( " Connection is closed . " ) <nl> @ state < < [ : err , err ] <nl> end <nl> end <nl> class ChangeOnlyHandler < RethinkDB : : Handler <nl> attr_accessor : state <nl> def initialize ; @ state = [ ] ; end <nl> def on_error ( err ) <nl> - if err ! = RethinkDB : : RqlRuntimeError . new ( " Connection is closed . " ) <nl> + if err ! = RethinkDB : : ReqlRuntimeError . new ( " Connection is closed . " ) <nl> @ state < < [ : err , err ] <nl> end <nl> end <nl> def brun4 ( x , handler ) <nl> EM . run { <nl> $ lambda_state = [ ] <nl> $ lambda = lambda { | err , row | <nl> - if err ! = RethinkDB : : RqlRuntimeError . new ( " Connection is closed . " ) <nl> + if err ! = RethinkDB : : ReqlRuntimeError . new ( " Connection is closed . " ) <nl> $ lambda_state < < [ err , row ] <nl> end <nl> } <nl> mmm a / test / rql_test / em_stop . rb <nl> ppp b / test / rql_test / em_stop . rb <nl> def initialize <nl> @ opened = @ closed = 0 <nl> end <nl> def on_error ( err ) <nl> - if err ! = RethinkDB : : RqlRuntimeError . new ( " Connection is closed . " ) <nl> + if err ! = RethinkDB : : ReqlRuntimeError . new ( " Connection is closed . " ) <nl> raise err <nl> end <nl> end <nl> mmm a / test / rql_test / server_test . rb <nl> ppp b / test / rql_test / server_test . rb <nl> <nl> ARGV . clear <nl> $ c = r . connect ( port : $ port ) . repl <nl> <nl> - $ run_exc = RethinkDB : : RqlRuntimeError <nl> - $ comp_exc = RethinkDB : : RqlCompileError <nl> + $ run_exc = RethinkDB : : ReqlRuntimeError <nl> + $ comp_exc = RethinkDB : : ReqlCompileError <nl> <nl> $ s1 = r ( ( 0 . . . 10 ) . map { | i | { a : i , b : i % 2 , c : i % 3 , d : i % 5 } } ) <nl> $ tbl1 = r . db ( ' test ' ) . table ( ' 1 ' ) <nl> def dispatch ( msg , token ) <nl> end <nl> <nl> begin <nl> - assert_raises ( RethinkDB : : RqlDriverError ) { <nl> + assert_raises ( RethinkDB : : ReqlDriverError ) { <nl> $ dispatch_hook = lambda { | x | x . gsub ( ' [ ' , ' { ' ) } <nl> eq ( r ( 1 ) , 1 ) <nl> } <nl> - assert_raises ( RethinkDB : : RqlDriverError ) { <nl> + assert_raises ( RethinkDB : : ReqlDriverError ) { <nl> $ dispatch_hook = lambda { | x | x . gsub ( ' 1 ' , ' \ u0000 ' ) } <nl> eq ( r ( 1 ) , 1 ) <nl> } <nl> mmm a / test / rql_test / src / arity . yaml <nl> ppp b / test / rql_test / src / arity . yaml <nl> tests : <nl> - rb : db . table_list ( 1 ) <nl> ot : err ( " ReqlCompileError " , " Expected between 0 and 1 arguments but found 2 . " , [ ] ) <nl> <nl> - <nl> - ot : err ( " ReqlCompileError " , " Expected 1 argument but found 0 . " , [ ] ) <nl> cd : <nl> - r . db_create ( ) <nl> tests : <nl> <nl> - cd : r . expr ( ) <nl> ot : <nl> - py3 : err_regex ( ' TypeError ' , ' . * missing 1 required positional argument . * ' , [ ] ) <nl> - py3 . 0 : err_regex ( ' TypeError ' , ' . * takes at least 1 positional argument \ ( 0 given \ ) ' , [ ] ) <nl> - py3 . 1 : err_regex ( ' TypeError ' , ' . * takes at least 1 positional argument \ ( 0 given \ ) ' , [ ] ) <nl> - py3 . 2 : err_regex ( ' TypeError ' , ' . * takes at least 1 argument \ ( 0 given \ ) ' , [ ] ) <nl> - py : err_regex ( ' TypeError ' , " . * takes at least 1 argument \ ( 0 given \ ) " , [ ] ) <nl> + py3 . 3 : err_regex ( ' TypeError ' , ' . * missing 1 required positional argument . * ' , [ ] ) <nl> + py3 . 4 : err_regex ( ' TypeError ' , ' . * missing 1 required positional argument . * ' , [ ] ) <nl> + py : err_regex ( ' TypeError ' , " . * takes at least 1 ( ? : positional ) ? argument \ ( 0 given \ ) " , [ ] ) <nl> js : err ( " ReqlDriverError " , " Expected between 1 and 2 arguments but found 0 . " , [ ] ) <nl> - rb : err_regex ( " ArgumentError " , ' . * wrong number of arguments \ ( 0 for 1 . * \ ) ' , [ ] ) <nl> + rb : err ( " ArgumentError " , ' wrong number of arguments ( 0 for 1 ) ' , [ ] ) <nl> <nl> - ot : err ( " ReqlCompileError " , " Expected 2 arguments but found 1 . " , [ ] ) <nl> cd : <nl> tests : <nl> ot : err ( " ReqlCompileError " , " Expected between 0 and 1 arguments but found 2 . " , [ ] ) <nl> <nl> - cd : db . table_drop ( ) <nl> - ot : err ( " ReqlQueryLogicError " , " Expected type DATUM but found DATABASE . " , [ ] ) <nl> + ot : err ( " ReqlQueryLogicError " , " Expected type DATUM but found DATABASE : " , [ ] ) <nl> <nl> <nl> - cd : db . table_create ( ) <nl> ot : <nl> - cd : err ( " ReqlQueryLogicError " , " Expected type DATUM but found DATABASE . " , [ ] ) <nl> + cd : err ( " ReqlQueryLogicError " , " Expected type DATUM but found DATABASE : " , [ ] ) <nl> js : err ( " ReqlDriverError " , " Expected 1 argument ( not including options ) but found 0 . " , [ ] ) <nl> <nl> - cd : r . js ( 1 , 2 ) <nl> ot : <nl> - py : err ( " ReqlCompileError " , " Expected 1 argument but found 2 . " , [ ] ) <nl> - rb : err ( " ReqlCompileError " , " Expected 1 argument but found 2 . " , [ ] ) <nl> + cd : err ( " ReqlCompileError " , " Expected 1 argument but found 2 . " , [ ] ) <nl> js : err ( " ReqlDriverError " , " Expected 1 argument ( not including options ) but found 2 . " , [ ] ) <nl> <nl> - ot : err ( " ReqlCompileError " , " Expected 2 arguments but found 3 . " , [ ] ) <nl> tests : <nl> <nl> - cd : db . table_create ( 1 , 2 ) <nl> ot : <nl> - py : err ( " ReqlCompileError " , " Expected between 1 and 2 arguments but found 3 . " , [ ] ) <nl> - rb : err ( " ReqlCompileError " , " Expected between 1 and 2 arguments but found 3 . " , [ ] ) <nl> + cd : err ( " ReqlCompileError " , " Expected between 1 and 2 arguments but found 3 . " , [ ] ) <nl> js : err ( " ReqlDriverError " , " Expected 1 argument ( not including options ) but found 2 . " , [ ] ) <nl> <nl> - cd : tbl . count ( 1 , 2 ) <nl> tests : <nl> - tbl . update ( ) <nl> - tbl . replace ( ) <nl> - tbl . insert ( ) <nl> - # - db . table ( ) # TODO : theerror message for this in ruby is wrong <nl> + - db . table ( ) <nl> <nl> - cd : tbl . reduce ( ) <nl> ot : err ( " ReqlCompileError " , " Expected 2 arguments but found 1 . " , [ ] ) <nl> tests : <nl> - cd : <nl> - tbl . eq_join ( 1 ) <nl> ot : <nl> - py : err ( " ReqlCompileError " , " Expected 3 arguments but found 2 . " , [ ] ) <nl> - rb : err ( " ReqlCompileError " , " Expected 3 arguments but found 2 . " , [ ] ) <nl> + cd : err ( " ReqlCompileError " , " Expected 3 arguments but found 2 . " , [ ] ) <nl> js : err ( " ReqlDriverError " , " Expected 2 arguments ( not including options ) but found 1 . " , [ ] ) <nl> <nl> - ot : err ( " ReqlCompileError " , " Expected 3 arguments but found 2 . " , [ ] ) <nl> tests : <nl> <nl> - ot : err ( " ReqlDriverError " , " Expected 1 argument but found 2 . " , [ ] ) <nl> js : r . expr ( { } ) ( 1 , 2 ) <nl> - py : [ ] <nl> - rb : [ ] <nl> <nl> - - rb : tbl . insert ( ( 0 . . . 10 ) . map { | i | { : id = > i } } ) . get_field ( ' inserted ' ) <nl> - py : tbl . insert ( [ { ' id ' : i } for i in range ( 10 ) ] ) . get_field ( ' inserted ' ) <nl> - js : tbl . insert ( [ { ' id ' : 0 } , { ' id ' : 1 } , { ' id ' : 2 } , { ' id ' : 3 } , { ' id ' : 4 } , { ' id ' : 5 } , { ' id ' : 6 } , { ' id ' : 7 } , { ' id ' : 8 } , { ' id ' : 9 } , ] ) . get_field ( ' inserted ' ) <nl> + - cd : tbl . insert ( [ { ' id ' : 0 } , { ' id ' : 1 } , { ' id ' : 2 } , { ' id ' : 3 } , { ' id ' : 4 } , { ' id ' : 5 } , { ' id ' : 6 } , { ' id ' : 7 } , { ' id ' : 8 } , { ' id ' : 9 } ] ) . get_field ( ' inserted ' ) <nl> ot : 10 <nl> <nl> - cd : tbl . get_all ( 0 , 1 , 2 ) . get_field ( ' id ' ) <nl> tests : <nl> <nl> - rb : tbl . group { | row | row [ ' id ' ] % 2 } . count ( { ' id ' : 0 } ) . ungroup ( ) <nl> py : tbl . group ( lambda row : row [ ' id ' ] . mod ( 2 ) ) . count ( { ' id ' : 0 } ) . ungroup ( ) <nl> - js : [ ] # TODO <nl> + js : tbl . group ( r . row ( ' id ' ) . mod ( 2 ) ) . count ( { ' id ' : 0 } ) . ungroup ( ) <nl> ot : ( [ { ' group ' : 0 , ' reduction ' : 1 } ] ) <nl> <nl> - rb : tbl . group { | row | row [ ' id ' ] % 2 } . count ( r . args ( [ { ' id ' : 0 } ] ) ) . ungroup ( ) <nl> - py : tbl . group ( lambda row : row [ ' id ' ] . mod ( 2 ) ) . count ( r . args ( [ { ' id ' : 0 } ] ) ) . ungroup ( ) <nl> - js : [ ] # TODO <nl> + py : tbl . group ( r . row [ ' id ' ] . mod ( 2 ) ) . count ( r . args ( [ { ' id ' : 0 } ] ) ) . ungroup ( ) <nl> + js : tbl . group ( r . row ( ' id ' ) . mod ( 2 ) ) . count ( r . args ( [ { ' id ' : 0 } ] ) ) . ungroup ( ) <nl> ot : ( [ { ' group ' : 0 , ' reduction ' : 1 } ] ) <nl> <nl> # Make sure ` r . literal ` still works <nl> mmm a / test / rql_test / src / changefeeds / edge . yaml <nl> ppp b / test / rql_test / src / changefeeds / edge . yaml <nl> tests : <nl> ot : bag ( erroredres ) <nl> <nl> - cd : postmap_changes1 <nl> - ot : err ( ' ReqlNonExistenceError ' , " No attribute ` dummy ` in object . " ) <nl> + ot : err ( ' ReqlNonExistenceError ' , " No attribute ` dummy ` in object : " ) <nl> <nl> - cd : postmap_changes2 <nl> ot : err ( ' ReqlNonExistenceError ' , " Index out of bounds : " + " 1 " ) <nl> mmm a / test / rql_test / src / control . yaml <nl> ppp b / test / rql_test / src / control . yaml <nl> tests : <nl> ot : ( [ ] ) <nl> <nl> - cd : r . branch ( r . db ( ' test ' ) , 1 , 2 ) <nl> - ot : err ( " ReqlQueryLogicError " , " Expected type DATUM but found DATABASE . " , [ ] ) <nl> + ot : err ( " ReqlQueryLogicError " , " Expected type DATUM but found DATABASE : " , [ ] ) <nl> - cd : r . branch ( tbl , 1 , 2 ) <nl> - ot : err ( " ReqlQueryLogicError " , " Expected type DATUM but found TABLE . " , [ ] ) <nl> + ot : err ( " ReqlQueryLogicError " , " Expected type DATUM but found TABLE : " , [ ] ) <nl> - cd : r . branch ( r . error ( " a " ) , 1 , 2 ) <nl> ot : err ( " ReqlUserError " , " a " , [ ] ) <nl> <nl> tests : <nl> ot : ( [ 2 , 3 , 4 ] ) <nl> <nl> - cd : r . expr ( [ 1 , 2 , 3 ] ) . map ( r . js ( ' 1 ' ) ) <nl> - ot : err ( " ReqlQueryLogicError " , " Expected type FUNCTION but found DATUM . " , [ 0 ] ) <nl> + ot : err ( " ReqlQueryLogicError " , " Expected type FUNCTION but found DATUM : " , [ 0 ] ) <nl> <nl> - cd : r . expr ( [ 1 , 2 , 3 ] ) . filter ( r . js ( ' ( function ( a ) { } ) ' ) ) <nl> ot : err ( " ReqlQueryLogicError " , " Cannot convert javascript ` undefined ` to ql : : datum_t . " , [ 0 ] ) <nl> <nl> # What happens if we pass static values to things that expect functions <nl> - cd : r . expr ( [ 1 , 2 , 3 ] ) . map ( 1 ) <nl> - ot : err ( " ReqlQueryLogicError " , " Expected type FUNCTION but found DATUM . " , [ 0 ] ) <nl> + ot : err ( " ReqlQueryLogicError " , " Expected type FUNCTION but found DATUM : " , [ 0 ] ) <nl> <nl> - cd : r . expr ( [ 1 , 2 , 3 ] ) . filter ( ' foo ' ) <nl> ot : ( [ 1 , 2 , 3 ] ) <nl> mmm a / test / rql_test / src / datum / object . yaml <nl> ppp b / test / rql_test / src / datum / object . yaml <nl> tests : <nl> ot : [ [ ' a ' , 1 ] ] <nl> <nl> # Error cases <nl> - - py : r . expr ( { 12 : ' a ' } ) <nl> - rb : r ( { 12 = > ' a ' } ) <nl> - ot : err_regex ( " ReqlDriverError " , " Object keys must be strings " ) <nl> - <nl> - - py : r . expr ( { ' a ' : { 12 : ' b ' } } ) <nl> - rb : r ( { : a = > { 12 = > ' b ' } } ) <nl> - ot : err_regex ( " ReqlDriverError " , " Object keys must be strings " ) <nl> + - cd : r . expr ( { 12 : ' a ' } ) <nl> + js : r . expr ( { 12 : ' a ' } ) <nl> + ot : <nl> + cd : err_regex ( " ReqlDriverError " , " Object keys must be strings . * " ) <nl> + js : [ ] # our auto - translation is killing this # 4653 <nl> + <nl> + - cd : r . expr ( { ' a ' : { 12 : ' b ' } } ) <nl> + js : r . expr ( { ' a ' : { 12 : ' b ' } } ) <nl> + ot : <nl> + cd : err_regex ( " ReqlDriverError " , " Object keys must be strings . * " ) <nl> + js : [ ] # our auto - translation is killing this # 4653 <nl> <nl> - js : r ( { ' a ' : undefined } ) <nl> ot : err ( " ReqlDriverError " , " Object field ' a ' may not be undefined " ) <nl> tests : <nl> - js : r ( { ' a ' : { ' b ' : undefined } } ) <nl> ot : err ( " ReqlDriverError " , " Object field ' b ' may not be undefined " ) <nl> <nl> - - js : <nl> - cd : r . expr ( { } , " foo " ) <nl> - ot : err ( " ReqlDriverError " , " Second argument to ` r . expr ` must be a number or undefined . " ) <nl> - py : <nl> - cd : r . expr ( { } , " foo " ) <nl> - ot : err ( " ReqlDriverError " , " Second argument to ` r . expr ` must be a number . " ) <nl> + - cd : r . expr ( { } , " foo " ) <nl> + ot : <nl> + cd : err ( " ReqlDriverError " , " Second argument to ` r . expr ` must be a number . " ) <nl> + js : err ( " ReqlDriverError " , " Second argument to ` r . expr ` must be a number or undefined . " ) <nl> <nl> - js : r . expr ( { } , NaN ) <nl> ot : err ( " ReqlDriverError " , " Second argument to ` r . expr ` must be a number or undefined . " ) <nl> tests : <nl> ot : err ( " ReqlQueryLogicError " , " Duplicate key ` e ` in object . ( got ` 4 ` and ` 5 ` as values ) " , [ ] ) <nl> <nl> - cd : r . object ( ' g ' , r . db ( ' test ' ) ) <nl> - ot : err ( " ReqlQueryLogicError " , " Expected type DATUM but found DATABASE . " , [ ] ) <nl> + ot : err ( " ReqlQueryLogicError " , " Expected type DATUM but found DATABASE : " , [ ] ) <nl> mmm a / test / rql_test / src / default . yaml <nl> ppp b / test / rql_test / src / default . yaml <nl> tests : <nl> ot : ( null ) <nl> - cd : r . expr ( { } ) [ ' b ' ] . default ( r . error ( ) ) <nl> js : r . expr ( { } ) ( ' b ' ) . default ( r . error ( ) ) <nl> - ot : err ( " ReqlNonExistenceError " , " No attribute ` b ` in object . " , [ ] ) <nl> + ot : err ( " ReqlNonExistenceError " , " No attribute ` b ` in object : " , [ ] ) <nl> - rb : r . expr ( [ ] ) . reduce { | a , b | a + b } . default ( r . error ) <nl> py : r . expr ( [ ] ) . reduce ( lambda a , b : a + b ) . default ( r . error ) <nl> js : r . expr ( [ ] ) . reduce ( function ( a , b ) { return a + b } ) . default ( r . error ) <nl> tests : <nl> - cd : arr . filter ( : default = > r . error ) { | x | x [ ' a ' ] . eq ( 1 ) } <nl> py : arr . filter ( lambda x : x [ ' a ' ] . eq ( 1 ) , default = r . error ( ) ) <nl> js : arr . filter ( function ( x ) { return x ( ' a ' ) . eq ( 1 ) } , { ' default ' : r . error ( ) } ) <nl> - ot : err ( " ReqlNonExistenceError " , " No attribute ` a ` in object . " , [ ] ) <nl> + ot : err ( " ReqlNonExistenceError " , " No attribute ` a ` in object : " , [ ] ) <nl> <nl> - cd : r . expr ( false ) . do { | d | arr . filter ( : default = > d ) { | x | x [ ' a ' ] . eq ( 1 ) } } <nl> py : r . expr ( False ) . do ( lambda d : arr . filter ( lambda x : x [ ' a ' ] . eq ( 1 ) , default = d ) ) <nl> tests : <nl> - cd : arr . filter ( : default = > r . error ) { | x | x [ ' a ' ] . eq ( 1 ) . or ( x [ ' a ' ] [ ' b ' ] . eq ( 2 ) ) } <nl> py : arr . filter ( lambda x : r . or_ ( x [ ' a ' ] . eq ( 1 ) , x [ ' a ' ] [ ' b ' ] . eq ( 2 ) ) , default = r . error ( ) ) <nl> js : arr . filter ( function ( x ) { return x ( ' a ' ) . eq ( 1 ) . or ( x ( ' a ' ) ( ' b ' ) . eq ( 2 ) ) } , { default : r . error ( ) } ) <nl> - ot : err ( " ReqlNonExistenceError " , " No attribute ` a ` in object . " , [ ] ) <nl> + ot : err ( " ReqlNonExistenceError " , " No attribute ` a ` in object : " , [ ] ) <nl> <nl> - cd : r . table_create ( ' default_test ' ) <nl> ot : partial ( { ' tables_created ' : 1 } ) <nl> tests : <nl> - cd : tbl . filter ( : default = > r . error ) { | x | x [ ' a ' ] . eq ( 1 ) } <nl> py : tbl . filter ( lambda x : x [ ' a ' ] . eq ( 1 ) , default = r . error ( ) ) <nl> js : tbl . filter ( function ( x ) { return x ( ' a ' ) . eq ( 1 ) } , { ' default ' : r . error ( ) } ) <nl> - ot : err ( " ReqlNonExistenceError " , " No attribute ` a ` in object . " , [ ] ) <nl> + ot : err ( " ReqlNonExistenceError " , " No attribute ` a ` in object : " , [ ] ) <nl> <nl> - cd : r . expr ( false ) . do { | d | tbl . filter ( : default = > d ) { | x | x [ ' a ' ] . eq ( 1 ) } } <nl> py : r . expr ( False ) . do ( lambda d : tbl . filter ( lambda x : x [ ' a ' ] . eq ( 1 ) , default = d ) ) <nl> tests : <nl> - cd : tbl . filter ( : default = > r . error ) { | x | x [ ' a ' ] . eq ( 1 ) . or ( x [ ' a ' ] [ ' b ' ] . eq ( 2 ) ) } <nl> py : tbl . filter ( lambda x : r . or_ ( x [ ' a ' ] . eq ( 1 ) , x [ ' a ' ] [ ' b ' ] . eq ( 2 ) ) , default = r . error ( ) ) <nl> js : tbl . filter ( function ( x ) { return x ( ' a ' ) . eq ( 1 ) . or ( x ( ' a ' ) ( ' b ' ) . eq ( 2 ) ) } , { default : r . error ( ) } ) <nl> - ot : err ( " ReqlNonExistenceError " , " No attribute ` a ` in object . " , [ ] ) <nl> + ot : err ( " ReqlNonExistenceError " , " No attribute ` a ` in object : " , [ ] ) <nl> <nl> - cd : r . table_drop ( ' default_test ' ) <nl> ot : partial ( { ' tables_dropped ' : 1 } ) <nl> mmm a / test / rql_test / src / geo / geojson . yaml <nl> ppp b / test / rql_test / src / geo / geojson . yaml <nl> tests : <nl> - cd : r . geojson ( { ' coordinates ' : true , ' type ' : ' Point ' } ) <nl> ot : err ( ' ReqlQueryLogicError ' , ' Expected type ARRAY but found BOOL . ' , [ 0 ] ) <nl> - cd : r . geojson ( { ' type ' : ' Point ' } ) <nl> - ot : err ( ' ReqlNonExistenceError ' , ' No attribute ` coordinates ` in object . ' , [ 0 ] ) <nl> + ot : err ( ' ReqlNonExistenceError ' , ' No attribute ` coordinates ` in object : ' , [ 0 ] ) <nl> - cd : r . geojson ( { ' coordinates ' : [ 0 , 0 ] } ) <nl> - ot : err ( ' ReqlNonExistenceError ' , ' No attribute ` type ` in object . ' , [ 0 ] ) <nl> + ot : err ( ' ReqlNonExistenceError ' , ' No attribute ` type ` in object : ' , [ 0 ] ) <nl> - cd : r . geojson ( { ' coordinates ' : [ 0 , 0 ] , ' type ' : ' foo ' } ) <nl> ot : err ( ' ReqlQueryLogicError ' , ' Unrecognized GeoJSON type ` foo ` . ' , [ 0 ] ) <nl> - cd : r . geojson ( { ' coordinates ' : [ 0 , 0 ] , ' type ' : ' Point ' , ' foo ' : ' wrong ' } ) <nl> mmm a / test / rql_test / src / geo / indexing . yaml <nl> ppp b / test / rql_test / src / geo / indexing . yaml <nl> tests : <nl> rb : tbl . order_by ( : index = > ' g ' ) . count ( ) <nl> ot : err ( ' ReqlQueryLogicError ' , ' Index ` g ` is a geospatial index . Only get_nearest and get_intersecting can use a geospatial index . ' , [ 0 ] ) <nl> - js : tbl . between ( 0 , 1 ) . get_intersecting ( r . point ( 0 , 0 ) , { ' index ' : ' g ' } ) . count ( ) <nl> + py : tbl . between ( 0 , 1 ) . get_intersecting ( r . point ( 0 , 0 ) , index = ' g ' ) . count ( ) <nl> rb : tbl . between ( 0 , 1 ) . get_intersecting ( r . point ( 0 , 0 ) , : index = > ' g ' ) . count ( ) <nl> - ot : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE but found TABLE_SLICE . ' , [ 0 ] ) <nl> + ot : <nl> + cd : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE but found TABLE_SLICE : ' , [ 0 ] ) <nl> + py : err ( ' AttributeError ' , " ' Between ' object has no attribute ' get_intersecting ' " ) <nl> - js : tbl . get_all ( 0 ) . get_intersecting ( r . point ( 0 , 0 ) , { ' index ' : ' g ' } ) . count ( ) <nl> + py : tbl . get_all ( 0 ) . get_intersecting ( r . point ( 0 , 0 ) , index = ' g ' ) . count ( ) <nl> rb : tbl . get_all ( 0 ) . get_intersecting ( r . point ( 0 , 0 ) , : index = > ' g ' ) . count ( ) <nl> - ot : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE but found SELECTION . ' , [ 0 ] ) <nl> + ot : <nl> + cd : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE but found SELECTION : ' , [ 0 ] ) <nl> + py : err ( ' AttributeError ' , " ' GetAll ' object has no attribute ' get_intersecting ' " ) <nl> - js : tbl . order_by ( { ' index ' : ' id ' } ) . get_intersecting ( r . point ( 0 , 0 ) , { ' index ' : ' g ' } ) . count ( ) <nl> + py : tbl . order_by ( index = ' id ' ) . get_intersecting ( r . point ( 0 , 0 ) , index = ' g ' ) . count ( ) <nl> rb : tbl . order_by ( : index = > ' id ' ) . get_intersecting ( r . point ( 0 , 0 ) , : index = > ' g ' ) . count ( ) <nl> - ot : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE but found TABLE_SLICE . ' , [ 0 ] ) <nl> + ot : <nl> + cd : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE but found TABLE_SLICE : ' , [ 0 ] ) <nl> + py : err ( ' AttributeError ' , " ' OrderBy ' object has no attribute ' get_intersecting ' " ) <nl> - js : tbl . get_intersecting ( r . point ( 0 , 0 ) , { ' index ' : ' id ' } ) . count ( ) <nl> py : tbl . get_intersecting ( r . point ( 0 , 0 ) , index = ' id ' ) . count ( ) <nl> rb : tbl . get_intersecting ( r . point ( 0 , 0 ) , : index = > ' id ' ) . count ( ) <nl> tests : <nl> - cd : tbl . get_nearest ( r . point ( 0 , 0 ) ) <nl> ot : err ( ' ReqlQueryLogicError ' , ' get_nearest requires an index argument . ' , [ 0 ] ) <nl> - js : tbl . between ( 0 , 1 ) . get_nearest ( r . point ( 0 , 0 ) , { ' index ' : ' g ' } ) . count ( ) <nl> + py : tbl . between ( 0 , 1 ) . get_nearest ( r . point ( 0 , 0 ) , index = ' g ' ) . count ( ) <nl> rb : tbl . between ( 0 , 1 ) . get_nearest ( r . point ( 0 , 0 ) , : index = > ' g ' ) . count ( ) <nl> - ot : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE but found TABLE_SLICE . ' , [ 0 ] ) <nl> + ot : <nl> + cd : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE but found TABLE_SLICE : ' , [ 0 ] ) <nl> + py : err ( ' AttributeError ' , " ' Between ' object has no attribute ' get_nearest ' " ) <nl> - js : tbl . get_all ( 0 ) . get_nearest ( r . point ( 0 , 0 ) , { ' index ' : ' g ' } ) . count ( ) <nl> + py : tbl . get_all ( 0 ) . get_nearest ( r . point ( 0 , 0 ) , index = ' g ' ) . count ( ) <nl> rb : tbl . get_all ( 0 ) . get_nearest ( r . point ( 0 , 0 ) , : index = > ' g ' ) . count ( ) <nl> - ot : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE but found SELECTION . ' , [ 0 ] ) <nl> + ot : <nl> + cd : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE but found SELECTION : ' , [ 0 ] ) <nl> + py : err ( ' AttributeError ' , " ' GetAll ' object has no attribute ' get_nearest ' " ) <nl> - js : tbl . order_by ( { ' index ' : ' id ' } ) . get_nearest ( r . point ( 0 , 0 ) , { ' index ' : ' g ' } ) . count ( ) <nl> + py : tbl . order_by ( index = ' id ' ) . get_nearest ( r . point ( 0 , 0 ) , index = ' g ' ) . count ( ) <nl> rb : tbl . order_by ( : index = > ' id ' ) . get_nearest ( r . point ( 0 , 0 ) , : index = > ' g ' ) . count ( ) <nl> - ot : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE but found TABLE_SLICE . ' , [ 0 ] ) <nl> + ot : <nl> + cd : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE but found TABLE_SLICE : ' , [ 0 ] ) <nl> + py : err ( ' AttributeError ' , " ' OrderBy ' object has no attribute ' get_nearest ' " ) <nl> - js : tbl . get_nearest ( r . point ( 0 , 0 ) , { ' index ' : ' id ' } ) . count ( ) <nl> py : tbl . get_nearest ( r . point ( 0 , 0 ) , index = ' id ' ) . count ( ) <nl> rb : tbl . get_nearest ( r . point ( 0 , 0 ) , : index = > ' id ' ) . count ( ) <nl> mmm a / test / rql_test / src / math_logic / logic . yaml <nl> ppp b / test / rql_test / src / math_logic / logic . yaml <nl> tests : <nl> - py : r . expr ( r . expr ( ' a ' ) [ ' b ' ] ) . default ( 2 ) <nl> ot : err ( " ReqlQueryLogicError " , " Cannot perform bracket on a non - object non - sequence ` \ " a \ " ` . " , [ ] ) <nl> - py : r . expr ( r . expr ( True ) & r . expr ( False ) = = r . expr ( False ) | r . expr ( True ) ) <nl> - ot : err ( " ReqlDriverError " , " Calling ' = = ' on result of infix bitwise operator . " , [ ] ) <nl> + ot : err ( " ReqlDriverError " , " Calling ' = = ' on result of infix bitwise operator : " , [ ] ) <nl> - py : r . expr ( r . and_ ( True , False ) = = r . or_ ( False , True ) ) <nl> ot : False <nl> - rb : r . expr ( r . expr ( True ) & r . expr ( False ) > = r . expr ( False ) | r . expr ( True ) ) <nl> - ot : err ( " ReqlDriverError " , " Calling > = on result of infix bitwise operator . " , [ ] ) <nl> + ot : err ( " ReqlDriverError " , " Calling > = on result of infix bitwise operator : " , [ ] ) <nl> - rb : r . expr ( r . and ( True , False ) > = r . or ( False , True ) ) <nl> ot : False <nl> <nl> mmm a / test / rql_test / src / mutation / delete . yaml <nl> ppp b / test / rql_test / src / mutation / delete . yaml <nl> tests : <nl> <nl> # test deletion on a non - deletable object <nl> - cd : r . expr ( [ 1 , 2 ] ) . delete ( ) <nl> - ot : err ( ' ReqlQueryLogicError ' , ' Expected type SELECTION but found DATUM . ' , [ 0 ] ) <nl> + ot : err ( ' ReqlQueryLogicError ' , ' Expected type SELECTION but found DATUM : ' , [ 0 ] ) <nl> mmm a / test / rql_test / src / mutation / sync . yaml <nl> ppp b / test / rql_test / src / mutation / sync . yaml <nl> tests : <nl> <nl> # This is of type table , but sync should still fail ( because it makes little sense ) <nl> - cd : tbl . between ( 1 , 2 ) . sync ( ) <nl> - py : [ ] # Case handled by native python error <nl> - ot : err ( " ReqlQueryLogicError " , ' Expected type TABLE but found TABLE_SLICE . ' , [ 1 ] ) <nl> + ot : <nl> + cd : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE but found TABLE_SLICE : ' , [ 1 ] ) <nl> + py : err ( ' AttributeError ' , " ' Between ' object has no attribute ' sync ' " ) <nl> <nl> # These are not even a table . Sync should fail with a different error message <nl> - cd : r . expr ( 1 ) . sync ( ) <nl> - py : [ ] # Case handled by native python error <nl> - ot : err ( " ReqlQueryLogicError " , ' Expected type TABLE but found DATUM . ' , [ 1 ] ) <nl> + ot : <nl> + cd : err ( " ReqlQueryLogicError " , ' Expected type TABLE but found DATUM : ' , [ 1 ] ) <nl> + py : err ( ' AttributeError ' , " ' Datum ' object has no attribute ' sync ' " ) <nl> - js : tbl . order_by ( { index : ' x ' } ) . sync ( ) <nl> rb : tbl . order_by ( { : index = > ' soft ' } ) . sync ( ) <nl> - py : [ ] # Case handled by native python error <nl> - ot : err ( " ReqlQueryLogicError " , ' Expected type TABLE but found TABLE_SLICE . ' , [ 1 ] ) <nl> + ot : err ( " ReqlQueryLogicError " , ' Expected type TABLE but found TABLE_SLICE : ' , [ 1 ] ) <nl> <nl> # clean up <nl> - cd : r . db ( ' test ' ) . table_drop ( ' test1 ' ) <nl> mmm a / test / rql_test / src / regression / 453 . yaml <nl> ppp b / test / rql_test / src / regression / 453 . yaml <nl> tests : <nl> - js : tbl . map ( function ( x ) { return tbl ; } ) <nl> py : " tbl . map ( lambda x : tbl ) " <nl> rb : tbl . map { | x | tbl } <nl> - ot : err ( " ReqlQueryLogicError " , ' Expected type DATUM but found TABLE . ' , [ 0 ] ) <nl> + ot : err ( " ReqlQueryLogicError " , ' Expected type DATUM but found TABLE : ' , [ 0 ] ) <nl> <nl> - js : tbl . map ( function ( x ) { return tbl . coerceTo ( ' array ' ) ; } ) . count ( ) <nl> py : " tbl . map ( lambda x : tbl . coerce_to ( ' array ' ) ) . count ( ) " <nl> similarity index 98 % <nl> rename from test / rql_test / src / regression / 763 . yaml <nl> rename to test / rql_test / src / regression / 763 . js . yaml <nl> mmm a / test / rql_test / src / regression / 763 . yaml <nl> ppp b / test / rql_test / src / regression / 763 . js . yaml <nl> tests : <nl> ot : err ( " ReqlDriverError " , " Expected between 1 and 3 arguments but found 4 . " ) <nl> <nl> - js : tbl . indexCreate ( ' a ' , ' b ' ) <nl> - ot : err ( " ReqlQueryLogicError " , " Expected type FUNCTION but found DATUM . " ) <nl> + ot : err ( " ReqlQueryLogicError " , " Expected type FUNCTION but found DATUM : " ) <nl> <nl> - js : tbl . indexCreate ( ' a ' ) <nl> ot : ( { ' created ' : 1 } ) <nl> mmm a / test / rql_test / src / selection . yaml <nl> ppp b / test / rql_test / src / selection . yaml <nl> tests : <nl> ot : err ( " ReqlQueryLogicError " , ' Read mode ` fake ` unrecognized ( options are " majority " , " single " , and " outdated " ) . ' ) <nl> <nl> - cd : tbl . get ( 20 ) . count ( ) <nl> - py : [ ] # Handled by native Python error <nl> - ot : err ( " ReqlQueryLogicError " , ' Expected type SEQUENCE but found SINGLE_SELECTION . ' , [ 0 ] ) <nl> + ot : err ( " ReqlQueryLogicError " , ' Expected type SEQUENCE but found SINGLE_SELECTION : ' , [ 0 ] ) <nl> <nl> # Get a document that exists <nl> - cd : tbl . get ( 20 ) <nl> tests : <nl> <nl> # Make sure get only takes one arg ( since we used to be able to pass id ) <nl> - cd : tbl . get ( ) <nl> - py : [ ] # Handled by native Python error <nl> - rb : [ ] <nl> ot : err ( " ReqlCompileError " , ' Expected 2 arguments but found 1 . ' , [ 1 ] ) <nl> <nl> - cd : tbl . get ( 10 , 20 ) <nl> - py : [ ] # Handled by native Python error <nl> - rb : [ ] <nl> ot : err ( " ReqlCompileError " , ' Expected 2 arguments but found 3 . ' , [ 1 ] ) <nl> <nl> # Create a table with a non - id primary key <nl> tests : <nl> <nl> # Between shouldn ' t work on arrays <nl> - cd : r . expr ( [ 1 , 2 , 3 ] ) . between ( - 1 , 2 ) <nl> - ot : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE_SLICE but found DATUM . ' , [ 0 ] ) <nl> + ot : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE_SLICE but found DATUM : ' , [ 0 ] ) <nl> <nl> # test between on open intervals <nl> - cd : tbl . between ( r . minval , 2 ) . count ( ) <nl> tests : <nl> - py : r . expr ( 5 ) + tbl <nl> js : r . expr ( 5 ) . add ( tbl ) <nl> rb : r 5 + tbl <nl> - ot : err ( ' ReqlQueryLogicError ' , ' Expected type DATUM but found TABLE . ' , [ 0 ] ) <nl> + ot : err ( ' ReqlQueryLogicError ' , ' Expected type DATUM but found TABLE : ' , [ 0 ] ) <nl> <nl> - cd : tbl . has_fields ( ' field ' ) . type_of ( ) <nl> ot : ( " SELECTION < STREAM > " ) <nl> mmm a / test / rql_test / src / sindex / api . yaml <nl> ppp b / test / rql_test / src / sindex / api . yaml <nl> tests : <nl> - rb : tbl . get_all ( 1 , : index = > : bi ) . between ( 1 , 1 , : index = > : id ) . map { | x | x [ : id ] } <nl> py : tbl . get_all ( 1 , index = ' bi ' ) . between ( 1 , 1 , index = ' id ' ) . map ( lambda x : x [ ' id ' ] ) <nl> js : tbl . getAll ( 1 , { index : ' bi ' } ) . between ( 1 , 1 , { index : ' id ' } ) . map ( function ( x ) { return x ( ' id ' ) ; } ) <nl> - ot : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE_SLICE but found SELECTION . ' , [ 0 ] ) <nl> + ot : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE_SLICE but found SELECTION : ' , [ 0 ] ) <nl> - rb : tbl . get_all ( 1 , : index = > : ci ) . orderby ( : id ) . map { | x | x [ : id ] } <nl> py : tbl . get_all ( 1 , index = ' ci ' ) . order_by ( ' id ' ) . map ( lambda x : x [ ' id ' ] ) <nl> js : tbl . getAll ( 1 , { index : ' ci ' } ) . orderBy ( ' id ' ) . map ( function ( x ) { return x ( ' id ' ) ; } ) <nl> mmm a / test / rql_test / src / transformation . yaml <nl> ppp b / test / rql_test / src / transformation . yaml <nl> tests : <nl> - py : tbl . order_by ( ' a ' , index = ' id ' ) . between ( 5 , r . maxval , index = ' id ' ) [ 0 ] <nl> js : tbl . orderBy ( ' a ' , { index : ' id ' } ) . between ( 5 , r . maxval , { index : ' id ' } ) . nth ( 0 ) <nl> rb : tbl . order_by ( ' a ' , : index = > : id ) . between ( 5 , r . maxval , : index = > : id ) [ 0 ] <nl> - ot : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE_SLICE but found SELECTION . ' , [ 0 ] ) <nl> + ot : err ( ' ReqlQueryLogicError ' , ' Expected type TABLE_SLICE but found SELECTION : ' , [ 0 ] ) <nl> <nl> - py : " tbl . order_by ( lambda x : x [ ' id ' ] ) [ 0 ] " <nl> js : tbl . orderBy ( function ( x ) { return x ( ' id ' ) ; } ) . nth ( 0 ) <nl> tests : <nl> ot : [ 2 ] <nl> <nl> - cd : r . expr ( [ 1 ] ) . offsets_of ( tbl ) <nl> - ot : err ( ' ReqlQueryLogicError ' , ' Expected type DATUM but found TABLE . ' , [ ] ) <nl> + ot : err ( ' ReqlQueryLogicError ' , ' Expected type DATUM but found TABLE : ' , [ ] ) <nl> <nl> - py : " r . expr ( 1 ) . do ( lambda x : r . expr ( [ 2 , 1 , 0 ] ) . offsets_of ( x ) ) " <nl> js : r . expr ( 1 ) . do ( function ( x ) { return r . expr ( [ 2 , 1 , 0 ] ) . offsets_of ( x ) ; } ) <nl> mmm a / test / rql_test / test - runner <nl> ppp b / test / rql_test / test - runner <nl> class WorkerThread ( threading . Thread ) : <nl> self . reqlConnection = r . connect ( host = self . server . host , port = self . server . driver_port ) <nl> r . db_list ( ) . run ( self . reqlConnection ) <nl> <nl> - except ( RuntimeError , r . RqlDriverError ) : <nl> + except ( RuntimeError , r . ReqlDriverError ) : <nl> if self . existingServer : <nl> raise Exception ( ' External server stopped responding while testing ' ) # ToDo : make this a better error <nl> else : <nl>
|
merging testing error messages fixes
|
rethinkdb/rethinkdb
|
b14c9d6d42ee2e97b318e78f2990b703e524189d
|
2015-08-11T20:05:46Z
|
mmm a / lib / SILPasses / Devirtualizer . cpp <nl> ppp b / lib / SILPasses / Devirtualizer . cpp <nl> static bool insertInlineCaches ( ApplyInst * AI , ClassHierarchyAnalysis * CHA ) { <nl> if ( CMI - > isVolatile ( ) ) <nl> return false ; <nl> <nl> - SILValue ClassInstance = CMI - > getOperand ( ) ; <nl> - <nl> / / Strip any upcasts off of our ' self ' value , potentially leaving us <nl> / / with a value whose type is closer ( in the class hierarchy ) to the <nl> / / actual dynamic type . <nl> - auto SubTypeValue = ClassInstance . stripUpCasts ( ) ; <nl> + auto SubTypeValue = CMI - > getOperand ( ) . stripUpCasts ( ) ; <nl> SILType SubType = SubTypeValue . getType ( ) ; <nl> <nl> / / Bail if any generic types parameters of the class instance type are <nl> static bool insertInlineCaches ( ApplyInst * AI , ClassHierarchyAnalysis * CHA ) { <nl> if ( ! CD ) <nl> return false ; <nl> <nl> - if ( ClassInstance ! = SubTypeValue ) { <nl> - / / The implementation of a method to be invoked may actually <nl> - / / be defined by one of the superclasses . <nl> - if ( ClassInstance . getType ( ) . getAs < MetatypeType > ( ) ) { <nl> - auto & Module = AI - > getModule ( ) ; <nl> - if ( ! ClassInstance . getType ( ) . getMetatypeInstanceType ( Module ) . <nl> - isSuperclassOf ( SubType . getMetatypeInstanceType ( Module ) ) ) <nl> - return false ; <nl> - } else { <nl> - if ( ! ClassInstance . getType ( ) . isSuperclassOf ( SubType ) ) <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> if ( ! CHA - > hasKnownDirectSubclasses ( CD ) ) { <nl> / / If there is only one possible alternative for this method , <nl> / / try to devirtualize it completely . <nl>
|
Revert " Revert " Remove subtyping checks that can never actually fail . " "
|
apple/swift
|
b54c45b2012a6f30ca2e03f0a6e0250bfe8ea654
|
2015-03-10T21:45:16Z
|
mmm a / src / base / http / responsebuilder . cpp <nl> ppp b / src / base / http / responsebuilder . cpp <nl> void ResponseBuilder : : status ( const uint code , const QString & text ) <nl> m_response . status = { code , text } ; <nl> } <nl> <nl> - void ResponseBuilder : : header ( const Header & header ) <nl> + void ResponseBuilder : : setHeader ( const Header & header ) <nl> { <nl> m_response . headers [ header . name ] = header . value ; <nl> } <nl> mmm a / src / base / http / responsebuilder . h <nl> ppp b / src / base / http / responsebuilder . h <nl> namespace Http <nl> { <nl> public : <nl> void status ( uint code = 200 , const QString & text = QLatin1String ( " OK " ) ) ; <nl> - void header ( const Header & header ) ; <nl> + void setHeader ( const Header & header ) ; <nl> void print ( const QString & text , const QString & type = CONTENT_TYPE_HTML ) ; <nl> void print ( const QByteArray & data , const QString & type = CONTENT_TYPE_HTML ) ; <nl> void clear ( ) ; <nl> mmm a / src / webui / webapplication . cpp <nl> ppp b / src / webui / webapplication . cpp <nl> void WebApplication : : sendFile ( const QString & path ) <nl> const auto it = m_translatedFiles . constFind ( path ) ; <nl> if ( ( it ! = m_translatedFiles . constEnd ( ) ) & & ( lastModified < = it - > lastModified ) ) { <nl> print ( it - > data , it - > mimeType ) ; <nl> - header ( { Http : : HEADER_CACHE_CONTROL , getCachingInterval ( it - > mimeType ) } ) ; <nl> + setHeader ( { Http : : HEADER_CACHE_CONTROL , getCachingInterval ( it - > mimeType ) } ) ; <nl> return ; <nl> } <nl> <nl> void WebApplication : : sendFile ( const QString & path ) <nl> } <nl> <nl> print ( data , mimeType . name ( ) ) ; <nl> - header ( { Http : : HEADER_CACHE_CONTROL , getCachingInterval ( mimeType . name ( ) ) } ) ; <nl> + setHeader ( { Http : : HEADER_CACHE_CONTROL , getCachingInterval ( mimeType . name ( ) ) } ) ; <nl> } <nl> <nl> Http : : Response WebApplication : : processRequest ( const Http : : Request & request , const Http : : Environment & env ) <nl> Http : : Response WebApplication : : processRequest ( const Http : : Request & request , cons <nl> } <nl> <nl> for ( const Http : : Header & prebuiltHeader : asConst ( m_prebuiltHeaders ) ) <nl> - header ( prebuiltHeader ) ; <nl> + setHeader ( prebuiltHeader ) ; <nl> <nl> return response ( ) ; <nl> } <nl> void WebApplication : : sessionStart ( ) <nl> QByteArray cookieRawForm = cookie . toRawForm ( ) ; <nl> if ( m_isCSRFProtectionEnabled ) <nl> cookieRawForm . append ( " ; SameSite = Strict " ) ; <nl> - header ( { Http : : HEADER_SET_COOKIE , cookieRawForm } ) ; <nl> + setHeader ( { Http : : HEADER_SET_COOKIE , cookieRawForm } ) ; <nl> } <nl> <nl> void WebApplication : : sessionEnd ( ) <nl> void WebApplication : : sessionEnd ( ) <nl> delete m_sessions . take ( m_currentSession - > id ( ) ) ; <nl> m_currentSession = nullptr ; <nl> <nl> - header ( { Http : : HEADER_SET_COOKIE , cookie . toRawForm ( ) } ) ; <nl> + setHeader ( { Http : : HEADER_SET_COOKIE , cookie . toRawForm ( ) } ) ; <nl> } <nl> <nl> bool WebApplication : : isCrossSiteRequest ( const Http : : Request & request ) const <nl>
|
Rename function
|
qbittorrent/qBittorrent
|
d57b9be706e0916bbca13dec7ee36c180037fe0d
|
2020-05-09T18:53:32Z
|
mmm a / tools / wasm2c . py <nl> ppp b / tools / wasm2c . py <nl> <nl> from tools . shared import Settings , path_from_root , unsuffixed , NODE_JS , check_call , exit_with_error <nl> <nl> <nl> + # map an emscripten - style signature letter to a wasm2c C type <nl> + def s_to_c ( s ) : <nl> + if s = = ' v ' : <nl> + return ' void ' <nl> + elif s = = ' i ' : <nl> + return ' u32 ' <nl> + elif s = = ' j ' : <nl> + return ' u64 ' <nl> + elif s = = ' f ' : <nl> + return ' f32 ' <nl> + elif s = = ' d ' : <nl> + return ' f64 ' <nl> + else : <nl> + exit_with_error ( ' invalid sig element : ' + str ( s ) ) <nl> + <nl> + <nl> + # map a wasm2c C type to an emscripten - style signature letter <nl> + def c_to_s ( c ) : <nl> + if c = = ' WASM_RT_I32 ' : <nl> + return ' i ' <nl> + elif c = = ' WASM_RT_I64 ' : <nl> + return ' j ' <nl> + elif c = = ' WASM_RT_F32 ' : <nl> + return ' f ' <nl> + elif c = = ' WASM_RT_F64 ' : <nl> + return ' d ' <nl> + else : <nl> + exit_with_error ( ' invalid wasm2c type element : ' + str ( c ) ) <nl> + <nl> + <nl> + def get_func_types ( code ) : <nl> + ' ' ' <nl> + We look for this pattern : <nl> + <nl> + static void init_func_types ( void ) { <nl> + func_types [ 0 ] = wasm_rt_register_func_type ( 3 , 1 , WASM_RT_I32 , WASM_RT_I32 , WASM_RT_I32 , WASM_RT_I32 ) ; <nl> + func_types [ 1 ] = wasm_rt_register_func_type ( 1 , 1 , WASM_RT_I32 , WASM_RT_I32 ) ; <nl> + func_types [ 2 ] = wasm_rt_register_func_type ( 0 , 0 ) ; <nl> + } <nl> + <nl> + We return a map of signatures names to their index . <nl> + ' ' ' <nl> + init_func_types = re . search ( r ' static void init_func_types \ ( void \ ) { ( [ ^ } ] * ) } ' , code ) <nl> + if not init_func_types : <nl> + return { } <nl> + ret = { } <nl> + for entry in re . findall ( r ' func_types \ [ ( \ d + ) \ ] = wasm_rt_register_func_type \ ( ( \ d + ) , ( \ d + ) , ? ? ( [ ^ ) ] + ) ? \ ) ; ' , init_func_types [ 0 ] ) : <nl> + index , params , results , types = entry <nl> + index = int ( index ) <nl> + params = int ( params ) <nl> + results = int ( results ) <nl> + types = types . split ( ' , ' ) <nl> + sig = ' ' <nl> + for i in range ( params ) : <nl> + sig + = c_to_s ( types [ i ] ) <nl> + if results = = 0 : <nl> + sig = ' v ' + sig <nl> + else : <nl> + assert results = = 1 , ' no multivalue support ' <nl> + sig = c_to_s ( types [ - 1 ] ) + sig <nl> + ret [ sig ] = index <nl> + return ret <nl> + <nl> + <nl> def do_wasm2c ( infile ) : <nl> assert Settings . STANDALONE_WASM <nl> WASM2C = NODE_JS + [ path_from_root ( ' node_modules ' , ' wasm2c ' , ' wasm2c . js ' ) ] <nl> def bundle_file ( total , filename ) : <nl> # generate the necessary invokes <nl> invokes = [ ] <nl> for sig in re . findall ( r " \ / \ * import \ : ' env ' ' invoke_ ( \ w + ) ' \ * \ / " , total ) : <nl> - def s_to_c ( s ) : <nl> - if s = = ' v ' : <nl> - return ' void ' <nl> - elif s = = ' i ' : <nl> - return ' u32 ' <nl> - elif s = = ' j ' : <nl> - return ' u64 ' <nl> - elif s = = ' f ' : <nl> - return ' f32 ' <nl> - elif s = = ' d ' : <nl> - return ' f64 ' <nl> - else : <nl> - exit_with_error ( ' invalid sig element : ' + str ( s ) ) <nl> + all_func_types = get_func_types ( total ) <nl> <nl> def name ( i ) : <nl> return ' a ' + str ( i ) <nl> <nl> wabt_sig = sig [ 0 ] + ' i ' + sig [ 1 : ] <nl> - typed_args = [ ' u32 fptr ' ] + [ s_to_c ( sig [ i ] ) + ' ' + name ( i ) for i in range ( 1 , len ( sig ) ) ] <nl> - types = [ ' u32 ' ] + [ s_to_c ( sig [ i ] ) for i in range ( 1 , len ( sig ) ) ] <nl> - args = [ ' fptr ' ] + [ name ( i ) for i in range ( 1 , len ( sig ) ) ] <nl> - invokes . append ( <nl> - ' % s_INVOKE_IMPL ( % sZ_envZ_invoke_ % sZ_ % s , ( % s ) , ( % s ) , ( % s ) , Z_dynCall_ % sZ_ % s ) ; ' % ( <nl> - ' VOID ' if sig [ 0 ] = = ' v ' else ' RETURNING ' , <nl> - ( s_to_c ( sig [ 0 ] ) + ' , ' ) if sig [ 0 ] ! = ' v ' else ' ' , <nl> - sig , <nl> - wabt_sig , <nl> - ' , ' . join ( typed_args ) , <nl> - ' , ' . join ( types ) , <nl> - ' , ' . join ( args ) , <nl> - sig , <nl> - wabt_sig <nl> - ) ) <nl> + typed_args = [ s_to_c ( sig [ i ] ) + ' ' + name ( i ) for i in range ( 1 , len ( sig ) ) ] <nl> + full_typed_args = [ ' u32 fptr ' ] + typed_args <nl> + types = [ s_to_c ( sig [ i ] ) for i in range ( 1 , len ( sig ) ) ] <nl> + args = [ name ( i ) for i in range ( 1 , len ( sig ) ) ] <nl> + c_func_type = s_to_c ( sig [ 0 ] ) + ' ( * ) ( ' + ( ' , ' . join ( types ) if types else ' void ' ) + ' ) ' <nl> + if sig not in all_func_types : <nl> + exit_with_error ( ' could not find signature ' + sig + ' in function types ' + str ( all_func_types ) ) <nl> + type_index = all_func_types [ sig ] <nl> + <nl> + invokes . append ( r ' ' ' <nl> + IMPORT_IMPL ( % ( return_type ) s , Z_envZ_invoke_ % ( sig ) sZ_ % ( wabt_sig ) s , ( % ( full_typed_args ) s ) , { <nl> + VERBOSE_LOG ( " invoke \ n " ) ; / / waka <nl> + u32 sp = Z_stackSaveZ_iv ( ) ; <nl> + if ( next_setjmp > = MAX_SETJMP_STACK ) { <nl> + abort_with_message ( " too many nested setjmps " ) ; <nl> + } <nl> + u32 id = next_setjmp + + ; <nl> + int result = setjmp ( setjmp_stack [ id ] ) ; <nl> + % ( declare_return ) s <nl> + if ( result = = 0 ) { <nl> + % ( receive ) sCALL_INDIRECT ( w2c___indirect_function_table , % ( c_func_type ) s , % ( type_index ) s , fptr % ( args ) s ) ; <nl> + / * if we got here , no longjmp or exception happened , we returned normally * / <nl> + } else { <nl> + / * A longjmp or an exception took us here . * / <nl> + Z_stackRestoreZ_vi ( sp ) ; <nl> + Z_setThrewZ_vii ( 1 , 0 ) ; <nl> + } <nl> + next_setjmp - - ; <nl> + % ( return ) s <nl> + } ) ; <nl> + ' ' ' % { <nl> + ' return_type ' : s_to_c ( sig [ 0 ] ) if sig [ 0 ] ! = ' v ' else ' void ' , <nl> + ' sig ' : sig , <nl> + ' wabt_sig ' : wabt_sig , <nl> + ' full_typed_args ' : ' , ' . join ( full_typed_args ) , <nl> + ' type_index ' : type_index , <nl> + ' c_func_type ' : c_func_type , <nl> + ' args ' : ( ' , ' + ' , ' . join ( args ) ) if args else ' ' , <nl> + ' declare_return ' : ( s_to_c ( sig [ 0 ] ) + ' returned_value = 0 ; ' ) if sig [ 0 ] ! = ' v ' else ' ' , <nl> + ' receive ' : ' returned_value = ' if sig [ 0 ] ! = ' v ' else ' ' , <nl> + ' return ' : ' return returned_value ; ' if sig [ 0 ] ! = ' v ' else ' ' <nl> + } ) <nl> + <nl> total + = ' \ n ' . join ( invokes ) <nl> # write out the final file <nl> with open ( c_file , ' w ' ) as out : <nl> mmm a / tools / wasm2c / base . c <nl> ppp b / tools / wasm2c / base . c <nl> static jmp_buf setjmp_stack [ MAX_SETJMP_STACK ] ; <nl> <nl> static u32 next_setjmp = 0 ; <nl> <nl> - # define VOID_INVOKE_IMPL ( name , typed_args , types , args , dyncall ) \ <nl> - IMPORT_IMPL ( void , name , typed_args , { \ <nl> - VERBOSE_LOG ( " invoke " # name " " # dyncall " \ n " ) ; \ <nl> - u32 sp = Z_stackSaveZ_iv ( ) ; \ <nl> - if ( next_setjmp > = MAX_SETJMP_STACK ) { \ <nl> - abort_with_message ( " too many nested setjmps " ) ; \ <nl> - } \ <nl> - u32 id = next_setjmp + + ; \ <nl> - int result = setjmp ( setjmp_stack [ id ] ) ; \ <nl> - if ( result = = 0 ) { \ <nl> - ( * dyncall ) args ; \ <nl> - / * if we got here , no longjmp or exception happened , we returned normally * / \ <nl> - } else { \ <nl> - / * A longjmp or an exception took us here . * / \ <nl> - Z_stackRestoreZ_vi ( sp ) ; \ <nl> - Z_setThrewZ_vii ( 1 , 0 ) ; \ <nl> - } \ <nl> - next_setjmp - - ; \ <nl> - } ) ; <nl> - <nl> - # define RETURNING_INVOKE_IMPL ( ret , name , typed_args , types , args , dyncall ) \ <nl> - IMPORT_IMPL ( ret , name , typed_args , { \ <nl> - VERBOSE_LOG ( " invoke " # name " " # dyncall " \ n " ) ; \ <nl> - u32 sp = Z_stackSaveZ_iv ( ) ; \ <nl> - if ( next_setjmp > = MAX_SETJMP_STACK ) { \ <nl> - abort_with_message ( " too many nested setjmps " ) ; \ <nl> - } \ <nl> - u32 id = next_setjmp + + ; \ <nl> - int result = setjmp ( setjmp_stack [ id ] ) ; \ <nl> - ret returned_value = 0 ; \ <nl> - if ( result = = 0 ) { \ <nl> - returned_value = ( * dyncall ) args ; \ <nl> - / * if we got here , no longjmp or exception happened , we returned normally * / \ <nl> - } else { \ <nl> - / * A longjmp or an exception took us here . * / \ <nl> - Z_stackRestoreZ_vi ( sp ) ; \ <nl> - Z_setThrewZ_vii ( 1 , 0 ) ; \ <nl> - } \ <nl> - next_setjmp - - ; \ <nl> - return returned_value ; \ <nl> - } ) ; <nl> - <nl> / / Declare an export that may be needed and may not be . For example if longjmp <nl> / / is included then we need setThrew , but we must declare setThrew so that <nl> / / the C compiler can build us without error if longjmp is not actually used . <nl>
|
Stop using dynCalls in wasm2c ( )
|
emscripten-core/emscripten
|
f377d3ef9cb6da6a0fd9c6971f0fa5dbcf320dfb
|
2020-08-28T13:06:50Z
|
mmm a / BUILD <nl> ppp b / BUILD <nl> GRPCXX_PUBLIC_HDRS = [ <nl> " include / grpcpp / create_channel . h " , <nl> " include / grpcpp / create_channel_impl . h " , <nl> " include / grpcpp / create_channel_posix . h " , <nl> - " include / grpcpp / create_channel_posix_impl . h " , <nl> " include / grpcpp / ext / health_check_service_server_builder_option . h " , <nl> " include / grpcpp / generic / async_generic_service . h " , <nl> " include / grpcpp / generic / generic_stub . h " , <nl> mmm a / BUILD . gn <nl> ppp b / BUILD . gn <nl> config ( " grpc_config " ) { <nl> " include / grpcpp / create_channel . h " , <nl> " include / grpcpp / create_channel_impl . h " , <nl> " include / grpcpp / create_channel_posix . h " , <nl> - " include / grpcpp / create_channel_posix_impl . h " , <nl> " include / grpcpp / ext / health_check_service_server_builder_option . h " , <nl> " include / grpcpp / generic / async_generic_service . h " , <nl> " include / grpcpp / generic / generic_stub . h " , <nl> mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> foreach ( _hdr <nl> include / grpcpp / create_channel . h <nl> include / grpcpp / create_channel_impl . h <nl> include / grpcpp / create_channel_posix . h <nl> - include / grpcpp / create_channel_posix_impl . h <nl> include / grpcpp / ext / health_check_service_server_builder_option . h <nl> include / grpcpp / generic / async_generic_service . h <nl> include / grpcpp / generic / generic_stub . h <nl> foreach ( _hdr <nl> include / grpcpp / create_channel . h <nl> include / grpcpp / create_channel_impl . h <nl> include / grpcpp / create_channel_posix . h <nl> - include / grpcpp / create_channel_posix_impl . h <nl> include / grpcpp / ext / health_check_service_server_builder_option . h <nl> include / grpcpp / generic / async_generic_service . h <nl> include / grpcpp / generic / generic_stub . h <nl> mmm a / Makefile <nl> ppp b / Makefile <nl> PUBLIC_HEADERS_CXX + = \ <nl> include / grpcpp / create_channel . h \ <nl> include / grpcpp / create_channel_impl . h \ <nl> include / grpcpp / create_channel_posix . h \ <nl> - include / grpcpp / create_channel_posix_impl . h \ <nl> include / grpcpp / ext / health_check_service_server_builder_option . h \ <nl> include / grpcpp / generic / async_generic_service . h \ <nl> include / grpcpp / generic / generic_stub . h \ <nl> PUBLIC_HEADERS_CXX + = \ <nl> include / grpcpp / create_channel . h \ <nl> include / grpcpp / create_channel_impl . h \ <nl> include / grpcpp / create_channel_posix . h \ <nl> - include / grpcpp / create_channel_posix_impl . h \ <nl> include / grpcpp / ext / health_check_service_server_builder_option . h \ <nl> include / grpcpp / generic / async_generic_service . h \ <nl> include / grpcpp / generic / generic_stub . h \ <nl> mmm a / build_autogenerated . yaml <nl> ppp b / build_autogenerated . yaml <nl> libs : <nl> - include / grpcpp / create_channel . h <nl> - include / grpcpp / create_channel_impl . h <nl> - include / grpcpp / create_channel_posix . h <nl> - - include / grpcpp / create_channel_posix_impl . h <nl> - include / grpcpp / ext / health_check_service_server_builder_option . h <nl> - include / grpcpp / generic / async_generic_service . h <nl> - include / grpcpp / generic / generic_stub . h <nl> libs : <nl> - include / grpcpp / create_channel . h <nl> - include / grpcpp / create_channel_impl . h <nl> - include / grpcpp / create_channel_posix . h <nl> - - include / grpcpp / create_channel_posix_impl . h <nl> - include / grpcpp / ext / health_check_service_server_builder_option . h <nl> - include / grpcpp / generic / async_generic_service . h <nl> - include / grpcpp / generic / generic_stub . h <nl> mmm a / include / grpcpp / create_channel_posix . h <nl> ppp b / include / grpcpp / create_channel_posix . h <nl> <nl> / * <nl> * <nl> - * Copyright 2019 gRPC authors . <nl> + * Copyright 2016 gRPC authors . <nl> * <nl> * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> * you may not use this file except in compliance with the License . <nl> <nl> * <nl> * / <nl> <nl> - # ifndef GRPCPP_CREATE_CHANNEL_POSIX_H <nl> - # define GRPCPP_CREATE_CHANNEL_POSIX_H <nl> + # ifndef GRPCPP_CREATE_CHANNEL_POSIX_IMPL_H <nl> + # define GRPCPP_CREATE_CHANNEL_POSIX_IMPL_H <nl> <nl> - # include < grpcpp / create_channel_posix_impl . h > <nl> + # include < memory > <nl> <nl> - namespace grpc { <nl> + # include < grpc / support / port_platform . h > <nl> + # include < grpcpp / channel . h > <nl> + # include < grpcpp / support / channel_arguments . h > <nl> + <nl> + namespace grpc_impl { <nl> <nl> # ifdef GPR_SUPPORT_CHANNELS_FROM_FD <nl> <nl> - static inline std : : shared_ptr < Channel > CreateInsecureChannelFromFd ( <nl> - const grpc : : string & target , int fd ) { <nl> - return : : grpc_impl : : CreateInsecureChannelFromFd ( target , fd ) ; <nl> - } <nl> + / / / Create a new \ a Channel communicating over the given file descriptor . <nl> + / / / <nl> + / / / \ param target The name of the target . <nl> + / / / \ param fd The file descriptor representing a socket . <nl> + std : : shared_ptr < grpc : : Channel > CreateInsecureChannelFromFd ( <nl> + const grpc : : string & target , int fd ) ; <nl> <nl> - static inline std : : shared_ptr < Channel > CreateCustomInsecureChannelFromFd ( <nl> - const grpc : : string & target , int fd , const ChannelArguments & args ) { <nl> - return : : grpc_impl : : CreateCustomInsecureChannelFromFd ( target , fd , args ) ; <nl> - } <nl> + / / / Create a new \ a Channel communicating over given file descriptor with custom <nl> + / / / channel arguments . <nl> + / / / <nl> + / / / \ param target The name of the target . <nl> + / / / \ param fd The file descriptor representing a socket . <nl> + / / / \ param args Options for channel creation . <nl> + std : : shared_ptr < grpc : : Channel > CreateCustomInsecureChannelFromFd ( <nl> + const grpc : : string & target , int fd , const grpc : : ChannelArguments & args ) ; <nl> <nl> namespace experimental { <nl> <nl> - static inline std : : shared_ptr < Channel > <nl> + / / / Create a new \ a Channel communicating over given file descriptor with custom <nl> + / / / channel arguments . <nl> + / / / <nl> + / / / \ param target The name of the target . <nl> + / / / \ param fd The file descriptor representing a socket . <nl> + / / / \ param args Options for channel creation . <nl> + / / / \ param interceptor_creators Vector of interceptor factory objects . <nl> + std : : shared_ptr < grpc : : Channel > <nl> CreateCustomInsecureChannelWithInterceptorsFromFd ( <nl> - const grpc : : string & target , int fd , const ChannelArguments & args , <nl> + const grpc : : string & target , int fd , const grpc : : ChannelArguments & args , <nl> std : : unique_ptr < std : : vector < <nl> - std : : unique_ptr < experimental : : ClientInterceptorFactoryInterface > > > <nl> - interceptor_creators ) { <nl> - return : : grpc_impl : : experimental : : <nl> - CreateCustomInsecureChannelWithInterceptorsFromFd ( <nl> - target , fd , args , std : : move ( interceptor_creators ) ) ; <nl> - } <nl> + std : : unique_ptr < grpc : : experimental : : ClientInterceptorFactoryInterface > > > <nl> + interceptor_creators ) ; <nl> <nl> } / / namespace experimental <nl> <nl> # endif / / GPR_SUPPORT_CHANNELS_FROM_FD <nl> <nl> - } / / namespace grpc <nl> + } / / namespace grpc_impl <nl> <nl> - # endif / / GRPCPP_CREATE_CHANNEL_POSIX_H <nl> + # endif / / GRPCPP_CREATE_CHANNEL_POSIX_IMPL_H <nl> deleted file mode 100644 <nl> index 5c11120611a . . 00000000000 <nl> mmm a / include / grpcpp / create_channel_posix_impl . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * <nl> - * Copyright 2016 gRPC authors . <nl> - * <nl> - * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> - * you may not use this file except in compliance with the License . <nl> - * You may obtain a copy of the License at <nl> - * <nl> - * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> - * <nl> - * Unless required by applicable law or agreed to in writing , software <nl> - * distributed under the License is distributed on an " AS IS " BASIS , <nl> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> - * See the License for the specific language governing permissions and <nl> - * limitations under the License . <nl> - * <nl> - * / <nl> - <nl> - # ifndef GRPCPP_CREATE_CHANNEL_POSIX_IMPL_H <nl> - # define GRPCPP_CREATE_CHANNEL_POSIX_IMPL_H <nl> - <nl> - # include < memory > <nl> - <nl> - # include < grpc / support / port_platform . h > <nl> - # include < grpcpp / channel . h > <nl> - # include < grpcpp / support / channel_arguments . h > <nl> - <nl> - namespace grpc_impl { <nl> - <nl> - # ifdef GPR_SUPPORT_CHANNELS_FROM_FD <nl> - <nl> - / / / Create a new \ a Channel communicating over the given file descriptor . <nl> - / / / <nl> - / / / \ param target The name of the target . <nl> - / / / \ param fd The file descriptor representing a socket . <nl> - std : : shared_ptr < grpc : : Channel > CreateInsecureChannelFromFd ( <nl> - const grpc : : string & target , int fd ) ; <nl> - <nl> - / / / Create a new \ a Channel communicating over given file descriptor with custom <nl> - / / / channel arguments . <nl> - / / / <nl> - / / / \ param target The name of the target . <nl> - / / / \ param fd The file descriptor representing a socket . <nl> - / / / \ param args Options for channel creation . <nl> - std : : shared_ptr < grpc : : Channel > CreateCustomInsecureChannelFromFd ( <nl> - const grpc : : string & target , int fd , const grpc : : ChannelArguments & args ) ; <nl> - <nl> - namespace experimental { <nl> - <nl> - / / / Create a new \ a Channel communicating over given file descriptor with custom <nl> - / / / channel arguments . <nl> - / / / <nl> - / / / \ param target The name of the target . <nl> - / / / \ param fd The file descriptor representing a socket . <nl> - / / / \ param args Options for channel creation . <nl> - / / / \ param interceptor_creators Vector of interceptor factory objects . <nl> - std : : shared_ptr < grpc : : Channel > <nl> - CreateCustomInsecureChannelWithInterceptorsFromFd ( <nl> - const grpc : : string & target , int fd , const grpc : : ChannelArguments & args , <nl> - std : : unique_ptr < std : : vector < <nl> - std : : unique_ptr < grpc : : experimental : : ClientInterceptorFactoryInterface > > > <nl> - interceptor_creators ) ; <nl> - <nl> - } / / namespace experimental <nl> - <nl> - # endif / / GPR_SUPPORT_CHANNELS_FROM_FD <nl> - <nl> - } / / namespace grpc_impl <nl> - <nl> - # endif / / GRPCPP_CREATE_CHANNEL_POSIX_IMPL_H <nl> mmm a / src / cpp / client / create_channel_posix . cc <nl> ppp b / src / cpp / client / create_channel_posix . cc <nl> <nl> namespace grpc_impl { <nl> <nl> class ChannelArguments ; <nl> + } / / namespace grpc_impl <nl> + <nl> + namespace grpc { <nl> <nl> # ifdef GPR_SUPPORT_CHANNELS_FROM_FD <nl> <nl> - std : : shared_ptr < grpc : : Channel > CreateInsecureChannelFromFd ( <nl> + std : : shared_ptr < Channel > CreateInsecureChannelFromFd ( <nl> const grpc : : string & target , int fd ) { <nl> grpc : : internal : : GrpcLibrary init_lib ; <nl> init_lib . init ( ) ; <nl> - return : : grpc : : CreateChannelInternal ( <nl> + return CreateChannelInternal ( <nl> " " , grpc_insecure_channel_create_from_fd ( target . c_str ( ) , fd , nullptr ) , <nl> std : : vector < std : : unique_ptr < <nl> - grpc : : experimental : : ClientInterceptorFactoryInterface > > ( ) ) ; <nl> + experimental : : ClientInterceptorFactoryInterface > > ( ) ) ; <nl> } <nl> <nl> - std : : shared_ptr < grpc : : Channel > CreateCustomInsecureChannelFromFd ( <nl> + std : : shared_ptr < Channel > CreateCustomInsecureChannelFromFd ( <nl> const grpc : : string & target , int fd , const grpc : : ChannelArguments & args ) { <nl> - grpc : : internal : : GrpcLibrary init_lib ; <nl> + internal : : GrpcLibrary init_lib ; <nl> init_lib . init ( ) ; <nl> grpc_channel_args channel_args ; <nl> args . SetChannelArgs ( & channel_args ) ; <nl> - return : : grpc : : CreateChannelInternal ( <nl> + return CreateChannelInternal ( <nl> " " , <nl> grpc_insecure_channel_create_from_fd ( target . c_str ( ) , fd , & channel_args ) , <nl> std : : vector < std : : unique_ptr < <nl> - grpc : : experimental : : ClientInterceptorFactoryInterface > > ( ) ) ; <nl> + experimental : : ClientInterceptorFactoryInterface > > ( ) ) ; <nl> } <nl> <nl> namespace experimental { <nl> <nl> - std : : shared_ptr < grpc : : Channel > <nl> + std : : shared_ptr < Channel > <nl> CreateCustomInsecureChannelWithInterceptorsFromFd ( <nl> - const grpc : : string & target , int fd , const grpc : : ChannelArguments & args , <nl> + const grpc : : string & target , int fd , const ChannelArguments & args , <nl> std : : vector < <nl> std : : unique_ptr < grpc : : experimental : : ClientInterceptorFactoryInterface > > <nl> interceptor_creators ) { <nl> CreateCustomInsecureChannelWithInterceptorsFromFd ( <nl> init_lib . init ( ) ; <nl> grpc_channel_args channel_args ; <nl> args . SetChannelArgs ( & channel_args ) ; <nl> - return : : grpc : : CreateChannelInternal ( <nl> + return CreateChannelInternal ( <nl> " " , <nl> grpc_insecure_channel_create_from_fd ( target . c_str ( ) , fd , & channel_args ) , <nl> std : : move ( interceptor_creators ) ) ; <nl> CreateCustomInsecureChannelWithInterceptorsFromFd ( <nl> <nl> # endif / / GPR_SUPPORT_CHANNELS_FROM_FD <nl> <nl> - } / / namespace grpc_impl <nl> + <nl> + } / / namespace grpc <nl> mmm a / tools / doxygen / Doxyfile . c + + <nl> ppp b / tools / doxygen / Doxyfile . c + + <nl> include / grpcpp / completion_queue_impl . h \ <nl> include / grpcpp / create_channel . h \ <nl> include / grpcpp / create_channel_impl . h \ <nl> include / grpcpp / create_channel_posix . h \ <nl> - include / grpcpp / create_channel_posix_impl . h \ <nl> include / grpcpp / ext / health_check_service_server_builder_option . h \ <nl> include / grpcpp / generic / async_generic_service . h \ <nl> include / grpcpp / generic / generic_stub . h \ <nl> mmm a / tools / doxygen / Doxyfile . c + + . internal <nl> ppp b / tools / doxygen / Doxyfile . c + + . internal <nl> include / grpcpp / completion_queue_impl . h \ <nl> include / grpcpp / create_channel . h \ <nl> include / grpcpp / create_channel_impl . h \ <nl> include / grpcpp / create_channel_posix . h \ <nl> - include / grpcpp / create_channel_posix_impl . h \ <nl> include / grpcpp / ext / health_check_service_server_builder_option . h \ <nl> include / grpcpp / generic / async_generic_service . h \ <nl> include / grpcpp / generic / generic_stub . h \ <nl>
|
Move create_channel_posix from : : grpc_impl to : : grpc
|
grpc/grpc
|
ecbbc03c3d9070651e34ebcf8c928fac0ddb8b03
|
2020-06-24T20:00:25Z
|
mmm a / tensorflow / g3doc / tutorials / estimators / index . md <nl> ppp b / tensorflow / g3doc / tutorials / estimators / index . md <nl> with the ` input_from_feature_columns ( ) ` function in <nl> [ tf . contrib . layers ] ( . . / . . / api_docs / python / contrib . layers . md # layers - contrib ) . <nl> <nl> ` ` ` python <nl> - input layer = tf . contrib . layers . input_from_feature_columns ( <nl> + input_layer = tf . contrib . layers . input_from_feature_columns ( <nl> columns_to_tensors = features , feature_columns = [ age , height , weight ] ) <nl> ` ` ` <nl> <nl>
|
Fixed typo input layer - > input_layer
|
tensorflow/tensorflow
|
0571ea532da31863c450835bde6946c2d8c7882c
|
2017-01-27T01:30:46Z
|
mmm a / . travis . yml <nl> ppp b / . travis . yml <nl> notifications : <nl> email : false <nl> <nl> script : <nl> - - source $ TRAVIS / run_test . sh <nl> + # bump the time limit of no ouput <nl> + # the ` travis_wait ` wrapper can be removed once this issue fixed : <nl> + # https : / / github . com / JuliaLang / julia / pull / 23601 <nl> + - travis_wait 60 $ TRAVIS / run_test . sh <nl> <nl> after_success : <nl> - source $ TRAVIS / run_coverage . sh <nl> mmm a / deps / build . jl <nl> ppp b / deps / build . jl <nl> else <nl> info ( " Did not find a CUDA installation , using CPU - only version of MXNet . " ) <nl> end <nl> <nl> + function get_cpucore ( ) <nl> + if haskey ( ENV , " TRAVIS " ) # on travis - ci <nl> + 4 <nl> + else <nl> + min ( Sys . CPU_CORES , 8 ) <nl> + end <nl> + end <nl> + <nl> using BinDeps <nl> @ BinDeps . setup <nl> if ! libmxnet_detected <nl> if ! libmxnet_detected <nl> ChangeDirectory ( _mxdir ) <nl> ` cp . . / . . / cblas . h include / cblas . h ` <nl> if USE_JULIA_BLAS <nl> - ` make - j $ ( min ( Sys . CPU_CORES , 8 ) ) USE_BLAS = $ blas_name $ MSHADOW_LDFLAGS ` <nl> + ` make - j $ ( get_cpucore ( ) ) USE_BLAS = $ blas_name $ MSHADOW_LDFLAGS ` <nl> else <nl> - ` make - j $ ( min ( Sys . CPU_CORES , 8 ) ) ` <nl> + ` make - j $ ( get_cpucore ( ) ) ` <nl> end <nl> end <nl> FileRule ( joinpath ( _libdir , " libmxnet . so " ) , @ build_steps begin <nl>
|
travis : set make - j4 and travis_wait
|
apache/incubator-mxnet
|
4e5ab13edd3afbefd80eeca0e8c462d34fb62fe3
|
2017-09-09T17:15:17Z
|
mmm a / modules / common / configs / vehicle_config_helper . h <nl> ppp b / modules / common / configs / vehicle_config_helper . h <nl> class VehicleConfigHelper { <nl> / * * <nl> * @ brief Initialize vehicle configurations with default configuration file <nl> * pointed by gflags FLAGS_vehicle_config_path . The code will crash if <nl> - * FLAGS_vehicle_config_path does not exist or it points to a file with invalid <nl> + * FLAGS_vehicle_config_path does not exist or it points to a file with <nl> + * invalid <nl> * format . <nl> * / <nl> static void Init ( ) ; <nl> mmm a / modules / planning / common / BUILD <nl> ppp b / modules / planning / common / BUILD <nl> cc_library ( <nl> " ego_info . h " , <nl> ] , <nl> deps = [ <nl> + " : frame " , <nl> " / / modules / common : log " , <nl> + " / / modules / common / configs / proto : vehicle_config_proto " , <nl> + " / / modules / common / math : geometry " , <nl> " / / modules / common / vehicle_state / proto : vehicle_state_proto " , <nl> " / / modules / planning / reference_line " , <nl> " @ eigen " , <nl> mmm a / modules / planning / common / ego_info . cc <nl> ppp b / modules / planning / common / ego_info . cc <nl> <nl> <nl> # include " modules / planning / common / ego_info . h " <nl> <nl> + # include " modules / common / configs / vehicle_config_helper . h " <nl> # include " modules / common / log . h " <nl> <nl> namespace apollo { <nl> namespace planning { <nl> <nl> + using common : : math : : Vec2d ; <nl> + using common : : math : : Box2d ; <nl> + <nl> EgoInfo : : EgoInfo ( ) { } <nl> <nl> - void EgoInfo : : CalculateFrontClearDistance ( ) { <nl> - / / TODO ( Liangliang ) : implement this function <nl> + void EgoInfo : : Init ( ) { <nl> + common : : VehicleConfig ego_vehicle_config_ = <nl> + common : : VehicleConfigHelper : : GetConfig ( ) ; <nl> + } <nl> + <nl> + SLBoundary EgoInfo : : GetSLBoundaryOnReferenceLine ( <nl> + const ReferenceLine * reference_line ) const { <nl> + if ( sl_boundary_map_ . find ( reference_line ) ! = sl_boundary_map_ . end ( ) ) { <nl> + return sl_boundary_map_ . at ( reference_line ) ; <nl> + } else { <nl> + return SLBoundary ( ) ; <nl> + } <nl> + } <nl> + <nl> + void EgoInfo : : SetSLBoundary ( const ReferenceLine * reference_line , <nl> + const SLBoundary & sl_boundary ) { <nl> + sl_boundary_map_ [ reference_line ] = sl_boundary ; <nl> + } <nl> + <nl> + void EgoInfo : : CalculateFrontObstacleClearDistance ( const Frame & frame ) { <nl> + Vec2d position ( vehicle_state_ . x ( ) , vehicle_state_ . y ( ) ) ; <nl> + <nl> + const auto & param = ego_vehicle_config_ . vehicle_param ( ) ; <nl> + Vec2d vec_to_center ( <nl> + ( param . front_edge_to_center ( ) - param . back_edge_to_center ( ) ) / 2 . 0 , <nl> + ( param . left_edge_to_center ( ) - param . right_edge_to_center ( ) ) / 2 . 0 ) ; <nl> + <nl> + Vec2d center ( position + vec_to_center . rotate ( vehicle_state_ . heading ( ) ) ) ; <nl> + <nl> + const double buffer = 0 . 1 ; / / in meters <nl> + Box2d ego_box ( center , vehicle_state_ . heading ( ) , param . length ( ) + buffer , <nl> + param . width ( ) + buffer ) ; <nl> + const double adc_half_diagnal = ego_box . diagonal ( ) / 2 . 0 ; <nl> + <nl> + Vec2d unit_vec_heading = Vec2d : : CreateUnitVec2d ( vehicle_state_ . heading ( ) ) ; <nl> + <nl> + / / Due to the error of ego heading , only short range distance is meaningful <nl> + const double kDistanceThreshold = 50 . 0 ; <nl> + const double impact_region_length = <nl> + param . length ( ) + buffer + kDistanceThreshold ; <nl> + Box2d ego_front_region ( center + unit_vec_heading * kDistanceThreshold / 2 . 0 , <nl> + vehicle_state_ . heading ( ) , impact_region_length , <nl> + param . width ( ) + buffer ) ; <nl> + <nl> + for ( const auto & obstacle : frame . obstacles ( ) ) { <nl> + if ( obstacle - > IsVirtual ( ) | | <nl> + ! ego_front_region . HasOverlap ( obstacle - > PerceptionBoundingBox ( ) ) ) { <nl> + continue ; <nl> + } <nl> + <nl> + double dist = ego_box . center ( ) . DistanceTo ( <nl> + obstacle - > PerceptionBoundingBox ( ) . center ( ) ) - <nl> + adc_half_diagnal ; <nl> + <nl> + if ( front_clear_distance_ < 0 . 0 | | dist < front_clear_distance_ ) { <nl> + front_clear_distance_ = dist ; <nl> + } <nl> + } <nl> } <nl> <nl> } / / namespace planning <nl> mmm a / modules / planning / common / ego_info . h <nl> ppp b / modules / planning / common / ego_info . h <nl> <nl> # ifndef MODULES_PLANNING_COMMON_EGO_INFO_H_ <nl> # define MODULES_PLANNING_COMMON_EGO_INFO_H_ <nl> <nl> + # include < limits > <nl> # include < unordered_map > <nl> # include < utility > <nl> # include < vector > <nl> <nl> + # include " modules / common / configs / proto / vehicle_config . pb . h " <nl> # include " modules / common / vehicle_state / proto / vehicle_state . pb . h " <nl> <nl> # include " modules / common / macro . h " <nl> + # include " modules / planning / common / frame . h " <nl> # include " modules / planning / reference_line / reference_line . h " <nl> <nl> namespace apollo { <nl> class EgoInfo { <nl> public : <nl> ~ EgoInfo ( ) = default ; <nl> <nl> + void Init ( ) ; <nl> + <nl> common : : TrajectoryPoint start_point ( ) const { return start_point_ ; } <nl> <nl> void set_start_point ( const common : : TrajectoryPoint & start_point ) { <nl> class EgoInfo { <nl> } <nl> <nl> SLBoundary GetSLBoundaryOnReferenceLine ( <nl> - const ReferenceLine * reference_line ) const { <nl> - if ( sl_boundary_map_ . find ( reference_line ) ! = sl_boundary_map_ . end ( ) ) { <nl> - return sl_boundary_map_ . at ( reference_line ) ; <nl> - } else { <nl> - return SLBoundary ( ) ; <nl> - } <nl> - } <nl> + const ReferenceLine * reference_line ) const ; <nl> <nl> void SetSLBoundary ( const ReferenceLine * reference_line , <nl> - const SLBoundary & sl_boundary ) { <nl> - sl_boundary_map_ [ reference_line ] = sl_boundary ; <nl> - } <nl> + const SLBoundary & sl_boundary ) ; <nl> <nl> common : : VehicleState vehicle_state ( ) const { return vehicle_state_ ; } <nl> <nl> class EgoInfo { <nl> vehicle_state_ = vehicle_state ; <nl> } <nl> <nl> - void CalculateFrontClearDistance ( ) ; <nl> + void CalculateFrontObstacleClearDistance ( const Frame & frame ) ; <nl> + <nl> + double front_clear_distance ( ) const { return front_clear_distance_ ; } <nl> <nl> private : <nl> / / stitched point ( at stitching mode ) <nl> class EgoInfo { <nl> * / <nl> SLBoundary vehicle_sl_boundary_ ; <nl> <nl> - double front_clear_distance_ = - 1 . 0 ; <nl> + double front_clear_distance_ = std : : numeric_limits < double > : : max ( ) ; <nl> + <nl> + common : : VehicleConfig ego_vehicle_config_ ; <nl> <nl> DECLARE_SINGLETON ( EgoInfo ) ; <nl> } ; <nl> mmm a / modules / planning / common / ego_info_test . cc <nl> ppp b / modules / planning / common / ego_info_test . cc <nl> <nl> <nl> # include " modules / common / util / util . h " <nl> # include " modules / planning / common / planning_gflags . h " <nl> + # include " modules / planning / reference_line / reference_line_provider . h " <nl> <nl> namespace apollo { <nl> namespace planning { <nl> TEST_F ( EgoInfoTest , simple ) { <nl> <nl> EXPECT_DOUBLE_EQ ( sl_boundary2 . start_s ( ) , sl_boundary . start_s ( ) ) ; <nl> EXPECT_DOUBLE_EQ ( sl_boundary2 . end_s ( ) , sl_boundary . end_s ( ) ) ; <nl> + <nl> + uint32_t sequence_num = 0 ; <nl> + common : : TrajectoryPoint planning_start_point ; <nl> + const double start_time = 102342 . 0 ; <nl> + common : : VehicleState vehicle_state ; <nl> + ReferenceLineProvider reference_line_provider ; <nl> + <nl> + Frame frame ( sequence_num , planning_start_point , start_time , vehicle_state , <nl> + & reference_line_provider ) ; <nl> + ego_info - > CalculateFrontObstacleClearDistance ( frame ) ; <nl> } <nl> <nl> } / / namespace planning <nl> mmm a / modules / planning / common / frame . h <nl> ppp b / modules / planning / common / frame . h <nl> class Frame { <nl> <nl> / * * <nl> * Find an obstacle that collides with ADC ( Autonomous Driving Car ) if <nl> - * such <nl> - * obstacle exists . <nl> + * such obstacle exists . <nl> * @ return pointer to the obstacle if such obstacle exists , otherwise <nl> * @ return false if no colliding obstacle . <nl> * / <nl>
|
Planning : calculate front clear distance .
|
ApolloAuto/apollo
|
8e48596deee4e8922550a633abd1e870388e9ef0
|
2018-09-06T22:29:38Z
|
mmm a / src / apps / Menu / Menu / AppDelegate . m <nl> ppp b / src / apps / Menu / Menu / AppDelegate . m <nl> @ implementation AppDelegate <nl> <nl> - ( void ) applicationDidFinishLaunching : ( NSNotification * ) aNotification { <nl> [ KarabinerKit setup ] ; <nl> + [ KarabinerKit exitIfAnotherProcessIsRunning : " menu . pid " ] ; <nl> + <nl> [ self . menuController setup ] ; <nl> } <nl> <nl> mmm a / src / apps / PreferencesWindow / PreferencesWindow / AppDelegate . m <nl> ppp b / src / apps / PreferencesWindow / PreferencesWindow / AppDelegate . m <nl> - ( void ) applicationDidFinishLaunching : ( NSNotification * ) aNotification { <nl> [ [ NSApplication sharedApplication ] disableRelaunchOnLogin ] ; <nl> <nl> [ KarabinerKit setup ] ; <nl> + [ KarabinerKit exitIfAnotherProcessIsRunning : " preferences_window . pid " ] ; <nl> <nl> [ self . systemPreferencesManager setup ] ; <nl> <nl> mmm a / src / apps / lib / KarabinerKit / KarabinerKit / KarabinerKit . h <nl> ppp b / src / apps / lib / KarabinerKit / KarabinerKit / KarabinerKit . h <nl> <nl> @ interface KarabinerKit : NSObject <nl> <nl> + ( void ) setup ; <nl> + + ( void ) exitIfAnotherProcessIsRunning : ( const char * ) pidFileName ; <nl> <nl> + ( void ) relaunch ; <nl> + ( BOOL ) quitKarabinerWithConfirmation ; <nl> mmm a / src / apps / lib / KarabinerKit / KarabinerKit / KarabinerKit . m <nl> ppp b / src / apps / lib / KarabinerKit / KarabinerKit / KarabinerKit . m <nl> + ( void ) setup { <nl> } ) ; <nl> } <nl> <nl> + + ( void ) exitIfAnotherProcessIsRunning : ( const char * ) pidFileName { <nl> + if ( ! libkrbn_lock_single_application_with_user_pid_file ( pidFileName ) ) { <nl> + NSLog ( @ " Exit since another process is running . " ) ; <nl> + [ NSApp terminate : nil ] ; <nl> + } <nl> + } <nl> + <nl> + ( void ) relaunch { <nl> + libkrbn_unlock_single_application ( ) ; <nl> + <nl> [ NSTask launchedTaskWithLaunchPath : [ [ NSBundle mainBundle ] executablePath ] arguments : @ [ ] ] ; <nl> [ NSApp terminate : nil ] ; <nl> } <nl>
|
add exitIfAnotherProcessIsRunning
|
pqrs-org/Karabiner-Elements
|
ed2e21adeccaad23b7e251cda324cc37ba31b606
|
2017-02-01T18:10:54Z
|
mmm a / Marlin / ultralcd . pde <nl> ppp b / Marlin / ultralcd . pde <nl> char * ftostr31 ( const float & x ) <nl> <nl> char * ftostr32 ( const float & x ) <nl> { <nl> - int xx = x * 100 ; <nl> + long xx = x * 100 ; <nl> conv [ 0 ] = ( xx > = 0 ) ? ' + ' : ' - ' ; <nl> xx = abs ( xx ) ; <nl> conv [ 1 ] = ( xx / 100 ) % 10 + ' 0 ' ; <nl> char * itostr4 ( const int & xx ) <nl> / / convert float to string with + 1234 . 5 format <nl> char * ftostr51 ( const float & x ) <nl> { <nl> - int xx = x * 10 ; <nl> + long xx = x * 10 ; <nl> conv [ 0 ] = ( xx > = 0 ) ? ' + ' : ' - ' ; <nl> xx = abs ( xx ) ; <nl> conv [ 1 ] = ( xx / 10000 ) % 10 + ' 0 ' ; <nl> char * ftostr51 ( const float & x ) <nl> / / convert float to string with + 123 . 45 format <nl> char * ftostr52 ( const float & x ) <nl> { <nl> - int xx = x * 100 ; <nl> + long xx = x * 100 ; <nl> conv [ 0 ] = ( xx > = 0 ) ? ' + ' : ' - ' ; <nl> xx = abs ( xx ) ; <nl> conv [ 1 ] = ( xx / 10000 ) % 10 + ' 0 ' ; <nl>
|
changed int to long to overcome overflow of number display
|
MarlinFirmware/Marlin
|
31873ec707d5ba19de59b046cb1e882b8bd4e1db
|
2012-08-21T14:47:39Z
|
mmm a / tensorflow / python / keras / layers / merge . py <nl> ppp b / tensorflow / python / keras / layers / merge . py <nl> def __init__ ( self , axis = - 1 , * * kwargs ) : <nl> @ tf_utils . shape_type_conversion <nl> def build ( self , input_shape ) : <nl> # Used purely for shape validation . <nl> - if not isinstance ( input_shape [ 0 ] , tuple ) or len ( input_shape ) < 2 : <nl> + if not isinstance ( input_shape [ 0 ] , tuple ) or len ( input_shape ) < 1 : <nl> raise ValueError ( ' A ` Concatenate ` layer should be called ' <nl> - ' on a list of at least 2 inputs ' ) <nl> + ' on a list of at least 1 input . ' ) <nl> if all ( shape is None for shape in input_shape ) : <nl> return <nl> reduced_inputs_shapes = [ list ( shape ) for shape in input_shape ] <nl>
|
Allow unit - length input for Concatenate layer
|
tensorflow/tensorflow
|
851cfee4a9dce5e961c304d1e03b5c1fce61d023
|
2020-10-21T10:44:09Z
|
mmm a / dbms / src / DataStreams / ApplyingMutationsBlockInputStream . h <nl> ppp b / dbms / src / DataStreams / ApplyingMutationsBlockInputStream . h <nl> <nl> namespace DB <nl> { <nl> <nl> + / / / A stream that pulls the blocks from ` input ` and executes mutation commands on these blocks <nl> + / / / ( see Storages / MutationCommands . h for a full list ) . <nl> + / / / Example : if mutation commands contain ALTER DELETE , this stream will delete rows that satisfy the predicate specified in the command . <nl> class ApplyingMutationsBlockInputStream : public IProfilingBlockInputStream <nl> { <nl> public : <nl> ApplyingMutationsBlockInputStream ( <nl> const BlockInputStreamPtr & input , const std : : vector < MutationCommand > & commands , const Context & context ) ; <nl> <nl> - String getName ( ) const override { return " ApplyMutations " ; } <nl> + String getName ( ) const override { return " ApplyingMutations " ; } <nl> <nl> Block getHeader ( ) const override ; <nl> Block getTotals ( ) override ; <nl> mmm a / dbms / src / Storages / MergeTree / MergeTreeDataPart . h <nl> ppp b / dbms / src / Storages / MergeTree / MergeTreeDataPart . h <nl> struct MergeTreeDataPart <nl> / / / Returns part - > name with prefixes like ' tmp_ < name > ' <nl> String getNameWithPrefix ( ) const ; <nl> <nl> + / / / Generate the new name for this part according to ` new_part_info ` and min / max dates from the old name . <nl> + / / / This is useful when you want to change e . g . block numbers or the mutation version of the part . <nl> String getNewName ( const MergeTreePartInfo & new_part_info ) const ; <nl> <nl> bool contains ( const MergeTreeDataPart & other ) const { return info . contains ( other . info ) ; } <nl> mmm a / dbms / src / Storages / MergeTree / ReplicatedMergeTreeQueue . h <nl> ppp b / dbms / src / Storages / MergeTree / ReplicatedMergeTreeQueue . h <nl> class ReplicatedMergeTreeQueue <nl> const String & new_part_name , String & out_reason , <nl> std : : lock_guard < std : : mutex > & queue_lock ) const ; <nl> <nl> - / / / After removing the queue element , update the insertion times in the RAM . Running under mutex . <nl> + / / / After removing the queue element , update the insertion times in the RAM . Running under queue_mutex . <nl> / / / Returns information about what times have changed - this information can be passed to updateTimesInZooKeeper . <nl> void updateTimesOnRemoval ( const LogEntryPtr & entry , <nl> std : : optional < time_t > & min_unprocessed_insert_time_changed , <nl> mmm a / dbms / src / Storages / tests / get_abandonable_lock_in_all_partitions . cpp <nl> ppp b / dbms / src / Storages / tests / get_abandonable_lock_in_all_partitions . cpp <nl> <nl> <nl> using namespace DB ; <nl> <nl> + / / / This test is useful for assessing the performance of acquiring block numbers in all partitions ( and there <nl> + / / / can be ~ 1000 of them ) . This is needed when creating a mutation entry for a ReplicatedMergeTree table . <nl> int main ( int argc , char * * argv ) <nl> try <nl> { <nl> mmm a / dbms / src / Storages / tests / get_current_inserts_in_replicated . cpp <nl> ppp b / dbms / src / Storages / tests / get_current_inserts_in_replicated . cpp <nl> <nl> <nl> using namespace DB ; <nl> <nl> + / / / This test is useful for assessing the performance of getting the numbers of all currently committing <nl> + / / / blocks from ZooKeeper . This is needed to select merges without checking that all block numbers between <nl> + / / / parts have been abandoned ( see DB : : ReplicatedMergeTreeMergePredicate for details ) . <nl> int main ( int argc , char * * argv ) <nl> try <nl> { <nl>
|
add comments [ # CLICKHOUSE - 3747 ]
|
ClickHouse/ClickHouse
|
2e77c508ad5fe508ab796283ffc1bc6a943647cb
|
2018-06-04T11:43:09Z
|
mmm a / src / ia32 / codegen - ia32 . cc <nl> ppp b / src / ia32 / codegen - ia32 . cc <nl> Result CodeGenerator : : ConstantSmiBinaryOperation ( Token : : Value op , <nl> break ; <nl> } <nl> <nl> + case Token : : DIV : <nl> + if ( ! reversed & & int_value = = 2 ) { <nl> + operand - > ToRegister ( ) ; <nl> + frame_ - > Spill ( operand - > reg ( ) ) ; <nl> + <nl> + DeferredInlineSmiOperation * deferred = <nl> + new DeferredInlineSmiOperation ( op , <nl> + operand - > reg ( ) , <nl> + operand - > reg ( ) , <nl> + smi_value , <nl> + overwrite_mode ) ; <nl> + / / Check that lowest log2 ( value ) bits of operand are zero , and test <nl> + / / smi tag at the same time . <nl> + ASSERT_EQ ( 0 , kSmiTag ) ; <nl> + ASSERT_EQ ( 1 , kSmiTagSize ) ; <nl> + __ test ( operand - > reg ( ) , Immediate ( 3 ) ) ; <nl> + deferred - > Branch ( not_zero ) ; / / Branch if non - smi or odd smi . <nl> + __ sar ( operand - > reg ( ) , 1 ) ; <nl> + deferred - > BindExit ( ) ; <nl> + answer = * operand ; <nl> + } else { <nl> + / / Cannot fall through MOD to default case , so we duplicate the <nl> + / / default case here . <nl> + Result constant_operand ( value ) ; <nl> + if ( reversed ) { <nl> + answer = LikelySmiBinaryOperation ( op , & constant_operand , operand , <nl> + overwrite_mode ) ; <nl> + } else { <nl> + answer = LikelySmiBinaryOperation ( op , operand , & constant_operand , <nl> + overwrite_mode ) ; <nl> + } <nl> + } <nl> + break ; <nl> / / Generate inline code for mod of powers of 2 and negative powers of 2 . <nl> case Token : : MOD : <nl> if ( ! reversed & & <nl> mmm a / test / mjsunit / div - mod . js <nl> ppp b / test / mjsunit / div - mod . js <nl> function compute_mod ( dividend , divisor ) { <nl> doTest ( - a , - b ) ; <nl> } <nl> } <nl> - } ) ( ) <nl> + } ) ( ) ; <nl> + <nl> + <nl> + ( function ( ) { <nl> + / / Edge cases <nl> + var zero = 0 ; <nl> + var minsmi32 = - 0x40000000 ; <nl> + var minsmi64 = - 0x80000000 ; <nl> + var somenum = 3532 ; <nl> + assertEquals ( - 0 , zero / - 1 , " 0 / - 1 " ) ; <nl> + assertEquals ( 1 , minsmi32 / - 0x40000000 , " minsmi / minsmi - 32 " ) ; <nl> + assertEquals ( 1 , minsmi64 / - 0x80000000 , " minsmi / minsmi - 64 " ) ; <nl> + assertEquals ( somenum , somenum % - 0x40000000 , " % minsmi - 32 " ) ; <nl> + assertEquals ( somenum , somenum % - 0x80000000 , " % minsmi - 64 " ) ; <nl> + } ) ( ) ; <nl>
|
Added optimization for div / mod by constant power of 2 .
|
v8/v8
|
2e6ab729efd29865b09b5b1da350a2bc0aa2b1fe
|
2010-02-12T13:37:10Z
|
mmm a / tools / distrib / python / grpcio_tools / setup . py <nl> ppp b / tools / distrib / python / grpcio_tools / setup . py <nl> <nl> _PACKAGE_PATH = os . path . realpath ( os . path . dirname ( __file__ ) ) <nl> _README_PATH = os . path . join ( _PACKAGE_PATH , ' README . rst ' ) <nl> <nl> - _TEST_CLASS = " grpc_tools . test . protoc_test . ProtocTest " <nl> - <nl> os . chdir ( os . path . dirname ( os . path . abspath ( __file__ ) ) ) <nl> sys . path . insert ( 0 , os . path . abspath ( ' . ' ) ) <nl> <nl> def extension_modules ( ) : <nl> ' grpcio > = { version } ' . format ( version = grpc_version . VERSION ) , <nl> ] , <nl> package_data = package_data ( ) , <nl> - test_suite = _TEST_CLASS , <nl> ) <nl>
|
Revert changes to grpcio - tools setup . py
|
grpc/grpc
|
5ace9fc14537cbee29ea08f404b70b8a4646b001
|
2020-08-17T17:12:25Z
|
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> execute_process ( <nl> COMMAND bash - c " grep \ " namespace [ _A - Za - z0 - 9 ] \ \ + { \ " $ { GFLAGS_INCLUDE_PATH } / gflags / gflags_declare . h | head - 1 | awk ' { print $ 2 } ' | tr - d ' \ n ' " <nl> OUTPUT_VARIABLE GFLAGS_NS <nl> ) <nl> - message ( " GFLAGS_INCLUDE_PATH = $ { GFLAGS_INCLUDE_PATH } " ) <nl> # STREQUAL not works . Use MATCHES as workaround <nl> if ( $ { GFLAGS_NS } MATCHES " . * GFLAGS_NAMESPACE . * " ) <nl> execute_process ( <nl> find_library ( PROTOBUF_LIB NAMES protobuf ) <nl> find_path ( LEVELDB_HEADER NAMES leveldb / db . h ) <nl> find_library ( LEVELDB_LIB NAMES leveldb ) <nl> <nl> - message ( " CMAKE_CXX_FLAGS = $ { CMAKE_CXX_FLAGS } " ) <nl> - <nl> if ( WITH_GLOG ) <nl> find_path ( GLOG_HEADER NAMES glog / logging . h ) <nl> find_library ( GLOG_LIB NAMES glog ) <nl> mmm a / src / CMakeLists . txt <nl> ppp b / src / CMakeLists . txt <nl> foreach ( PROTO $ { brpc_policy_PROTOS } ) <nl> ) <nl> endforeach ( ) <nl> <nl> - message ( " CMAKE_CXX_FLAGS = $ { CMAKE_CXX_FLAGS } " ) <nl> include_directories ( $ { CMAKE_CURRENT_BINARY_DIR } ) <nl> include_directories ( $ { CMAKE_SOURCE_DIR } / src ) <nl> <nl> set ( protoc_gen_mcpack_SOURCES <nl> add_executable ( protoc - gen - mcpack $ { protoc_gen_mcpack_SOURCES } ) <nl> target_link_libraries ( protoc - gen - mcpack brpc ) <nl> <nl> + <nl> + get_property ( LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ) <nl> + if ( " $ { LIB64 } " STREQUAL " TRUE " ) <nl> + set ( LIBSUFFIX 64 ) <nl> + else ( ) <nl> + set ( LIBSUFFIX " " ) <nl> + endif ( ) <nl> + <nl> # install directory <nl> # cmake - DCMAKE_INSTALL_PREFIX = / usr <nl> install ( TARGETS brpc <nl> RUNTIME DESTINATION bin <nl> - LIBRARY DESTINATION lib <nl> - ARCHIVE DESTINATION lib <nl> + LIBRARY DESTINATION lib $ { LIBSUFFIX } <nl> + ARCHIVE DESTINATION lib $ { LIBSUFFIX } <nl> ) <nl> <nl> install ( DIRECTORY $ { CMAKE_SOURCE_DIR } / src / <nl> DESTINATION include <nl> FILES_MATCHING <nl> PATTERN " * . h " <nl> + PATTERN " * . hpp " <nl> + ) <nl> + <nl> + install ( DIRECTORY $ { CMAKE_CURRENT_BINARY_DIR } / <nl> + DESTINATION include <nl> + FILES_MATCHING <nl> + PATTERN " * . h " <nl> + PATTERN " * . hpp " <nl> ) <nl> mmm a / test / CMakeLists . txt <nl> ppp b / test / CMakeLists . txt <nl> foreach ( PROTO $ { PROTOS } ) <nl> COMMAND $ { PROTOBUF_PROTOC_EXECUTABLE } $ { PROTO_FLAGS } - - cpp_out = $ { CMAKE_CURRENT_BINARY_DIR } - - proto_path = $ { PROTOBUF_INCLUDE_DIR } - - proto_path = $ { CMAKE_SOURCE_DIR } / src - - proto_path = $ { CMAKE_SOURCE_DIR } / test $ { PROTO } <nl> WORKING_DIRECTORY $ { CMAKE_CURRENT_BINARY_DIR } <nl> ) <nl> - message ( " command = $ { PROTOBUF_PROTOC_EXECUTABLE } $ { PROTO_FLAGS } - - cpp_out = $ { CMAKE_CURRENT_BINARY_DIR } - - proto_path = $ { PROTOBUF_INCLUDE_DIR } - - proto_path = $ { CMAKE_SOURCE_DIR } / src - - proto_path = $ { CMAKE_CURRENT_BINARY_DIR } $ { PROTO } " ) <nl> endforeach ( ) <nl> <nl> find_path ( GTEST_HEADER NAMES gtest / gtest . h ) <nl>
|
add unnecessary message and add installation
|
apache/incubator-brpc
|
e52df63a464b1451d0381f85e61f2cc674d777da
|
2017-12-24T04:03:31Z
|
new file mode 100644 <nl> index 000000000000 . . 134576c9af83 <nl> mmm / dev / null <nl> ppp b / cmake / caches / Windows - x86_64 . cmake <nl> <nl> + set ( LLVM_ENABLE_PROJECTS <nl> + clang <nl> + clang - tools - extra <nl> + lld <nl> + lldb <nl> + CACHE STRING " " ) <nl> + <nl> + set ( LLVM_EXTERNAL_PROJECTS <nl> + cmark <nl> + swift <nl> + CACHE STRING " " ) <nl> + <nl> + # NOTE ( compnerd ) always enable assertions , the toolchain will not provide enough <nl> + # context to resolve issues otherwise and may silently generate invalid output . <nl> + set ( LLVM_ENABLE_ASSERTIONS YES CACHE BOOL " " ) <nl> + <nl> + set ( ENABLE_X86_RELAX_RELOCATIONS YES CACHE BOOL " " ) <nl> + set ( LLVM_ENABLE_PYTHON YES CACHE BOOL " " ) <nl> + set ( LLVM_TARGETS_TO_BUILD AArch64 ARM WebAssembly X86 CACHE STRING " " ) <nl> + <nl> + # Disable certain targets to reduce the configure time or to avoid configuration <nl> + # differences ( and in some cases weird build errors on a complete build ) . <nl> + set ( LLVM_APPEND_VC_REV NO CACHE BOOL " " ) <nl> + set ( LLVM_BUILD_LLVM_DYLIB NO CACHE BOOL " " ) <nl> + set ( LLVM_BUILD_LLVM_C_DYLIB NO CACHE BOOL " " ) <nl> + set ( LLVM_ENABLE_LIBEDIT NO CACHE BOOL " " ) <nl> + set ( LLVM_ENABLE_LIBXML2 NO CACHE BOOL " " ) <nl> + set ( LLVM_ENABLE_OCAMLDOC NO CACHE BOOL " " ) <nl> + set ( LLVM_ENABLE_ZLIB NO CACHE BOOL " " ) <nl> + set ( LLVM_INCLUDE_BENCHMARKS NO CACHE BOOL " " ) <nl> + set ( LLVM_INCLUDE_DOCS NO CACHE BOOL " " ) <nl> + set ( LLVM_INCLUDE_EXAMPLES NO CACHE BOOL " " ) <nl> + set ( LLVM_INCLUDE_GO_TESTS NO CACHE BOOL " " ) <nl> + set ( LLVM_TOOL_GOLD_BUILD NO CACHE BOOL " " ) <nl> + set ( LLVM_TOOL_LLVM_SHLIB_BUILD NO CACHE BOOL " " ) <nl> + <nl> + # Avoid swig dependency for lldb <nl> + set ( LLDB_ALLOW_STATIC_BINDINGS YES CACHE BOOL " " ) <nl> + set ( LLDB_USE_STATIC_BINDINGS YES CACHE BOOL " " ) <nl> + <nl> + # This requires perl which may not be available on Windows <nl> + set ( SWIFT_INCLUDE_DOCS NO CACHE BOOL " " ) <nl> + set ( SWIFT_BUILD_STATIC_STDLIB NO CACHE BOOL " " ) <nl> + set ( SWIFT_BUILD_STATIC_SDK_OVERLAY NO CACHE BOOL " " ) <nl> + <nl> + set ( LLVM_INSTALL_BINUTILS_SYMLINKS YES CACHE BOOL " " ) <nl> + set ( LLVM_INSTALL_TOOLCHAIN_ONLY YES CACHE BOOL " " ) <nl> + set ( LLVM_TOOLCHAIN_TOOLS <nl> + addr2line <nl> + ar <nl> + c + + filt <nl> + dsymutil <nl> + dwp <nl> + # lipo <nl> + llvm - ar <nl> + llvm - cov <nl> + llvm - cvtres <nl> + llvm - cxxfilt <nl> + llvm - dlltool <nl> + llvm - dwarfdump <nl> + llvm - dwp <nl> + llvm - lib <nl> + llvm - lipo <nl> + llvm - mt <nl> + llvm - mt <nl> + llvm - nm <nl> + llvm - objcopy <nl> + llvm - objdump <nl> + llvm - pdbutil <nl> + llvm - profdata <nl> + llvm - ranlib <nl> + llvm - rc <nl> + llvm - readelf <nl> + llvm - readobj <nl> + llvm - size <nl> + llvm - strings <nl> + llvm - strip <nl> + llvm - symbolizer <nl> + llvm - undname <nl> + nm <nl> + objcopy <nl> + objdump <nl> + ranlib <nl> + readelf <nl> + size <nl> + strings <nl> + CACHE STRING " " ) <nl> + <nl> + set ( CLANG_TOOLS <nl> + clang <nl> + clangd <nl> + clang - format <nl> + clang - resource - headers <nl> + clang - tidy <nl> + CACHE STRING " " ) <nl> + <nl> + set ( LLD_TOOLS <nl> + lld <nl> + CACHE STRING " " ) <nl> + <nl> + set ( LLDB_TOOLS <nl> + liblldb <nl> + lldb <nl> + lldb - argdumper <nl> + lldb - python - scripts <nl> + lldb - server <nl> + lldb - vscode <nl> + repl_swift <nl> + CACHE STRING " " ) <nl> + <nl> + set ( SWIFT_INSTALL_COMPONENTS <nl> + autolink - driver <nl> + compiler <nl> + clang - builtin - headers <nl> + editor - integration <nl> + tools <nl> + sourcekit - inproc <nl> + swift - remote - mirror <nl> + swift - remote - mirror - headers <nl> + CACHE STRING " " ) <nl> + <nl> + set ( LLVM_DISTRIBUTION_COMPONENTS <nl> + IndexStore <nl> + libclang <nl> + libclang - headers <nl> + LTO <nl> + $ { LLVM_TOOLCHAIN_TOOLS } <nl> + $ { CLANG_TOOLS } <nl> + $ { LLD_TOOLS } <nl> + $ { LLDB_TOOLS } <nl> + $ { SWIFT_INSTALL_COMPONENTS } <nl> + CACHE STRING " " ) <nl> mmm a / docs / WindowsBuild . md <nl> ppp b / docs / WindowsBuild . md <nl> From the settings application , go to ` Update & Security ` . In the ` For developer <nl> <nl> 1 . Clone ` apple / llvm - project ` into a directory for the toolchain <nl> 2 . Clone ` apple / swift - cmark ` , ` apple / swift ` , ` apple / swift - corelibs - libdispatch ` , ` apple / swift - corelibs - foundation ` , ` apple / swift - corelibs - xctest ` , ` apple / swift - llbuild ` , ` apple / swift - package - manager ` into the toolchain directory <nl> - 3 . Clone ` compnerd / swift - build ` as a peer of the toolchain directory <nl> <nl> - Currently , other repositories in the Swift project have not been tested and may not be supported . <nl> <nl> git clone https : / / github . com / apple / swift - corelibs - xctest swift - corelibs - xctest <nl> git clone https : / / github . com / apple / swift - llbuild llbuild <nl> git clone https : / / github . com / apple / swift - tools - support - core swift - tools - support - core <nl> git clone - c core . autocrlf = input https : / / github . com / apple / swift - package - manager swiftpm <nl> - git clone https : / / github . com / compnerd / swift - build swift - build <nl> ` ` ` <nl> <nl> - # # Acquire ICU , SQLite3 , curl , libxml2 and zlib <nl> + # # Dependencies ( ICU , SQLite3 , curl , libxml2 and zlib ) <nl> <nl> - ` ` ` <nl> - C : \ Python27 \ python . exe - m pip install - - user msrest azure - devops tabulate <nl> - C : \ Python27 \ python . exe swift - build \ utilities \ swift - build . py - - build - id ICU - - latest - artifacts - - filter windows - x64 - - download <nl> - C : \ Python27 \ python . exe swift - build \ utilities \ swift - build . py - - build - id XML2 - - latest - artifacts - - filter windows - x64 - - download <nl> - C : \ Python27 \ python . exe swift - build \ utilities \ swift - build . py - - build - id CURL - - latest - artifacts - - filter windows - x64 - - download <nl> - C : \ Python27 \ python . exe swift - build \ utilities \ swift - build . py - - build - id zlib - - latest - artifacts - - filter windows - x64 - - download <nl> - C : \ Python27 \ python . exe swift - build \ utilities \ swift - build . py - - build - id SQLite - - latest - artifacts - - filter windows - x64 - - download <nl> - ` ` ` <nl> - <nl> - Extract the zip files , ignoring the top level directory , into ` S : / Library ` . The directory structure should resemble : <nl> + The instructions assume that the dependencies are in ` S : / Library ` . The directory <nl> + structure should resemble : <nl> <nl> ` ` ` <nl> / Library <nl> Extract the zip files , ignoring the top level directory , into ` S : / Library ` . The <nl> ┕ usr / . . . <nl> ` ` ` <nl> <nl> + Note that only ICU is required for building the toolchain , and SQLite is only <nl> + needed for building llbuild and onwards . The ICU project provides binaries , <nl> + alternatively , see the ICU project for details on building ICU from source . <nl> + <nl> # # One - time Setup ( re - run on Visual Studio upgrades ) <nl> <nl> Set up the ` ucrt ` , ` visualc ` , and ` WinSDK ` modules by : <nl> Warning : Creating the above links usually requires administrator privileges . The <nl> <nl> ` ` ` cmd <nl> cmake - B " S : \ b \ toolchain " ^ <nl> - - C S : \ swift - build \ cmake \ caches \ windows - x86_64 . cmake ^ <nl> - - C S : \ swift - build \ cmake \ caches \ org . compnerd . dt . cmake ^ <nl> + - C S : \ swift \ cmake \ caches \ Windows - x86_64 . cmake ^ <nl> - D CMAKE_BUILD_TYPE = Release ^ <nl> - - D LLVM_ENABLE_ASSERTIONS = YES ^ <nl> - - D LLVM_ENABLE_PROJECTS = " clang ; clang - tools - extra ; lldb ; lld " ^ <nl> - - D LLVM_EXTERNAL_PROJECTS = " cmark ; swift " ^ <nl> - D SWIFT_PATH_TO_LIBDISPATCH_SOURCE = S : \ swift - corelibs - libdispatch ^ <nl> - D LLVM_ENABLE_PDB = YES ^ <nl> - - D LLVM_ENABLE_LIBEDIT = NO ^ <nl> - - D LLDB_ENABLE_PYTHON = YES ^ <nl> - - D LLVM_EXTERNAL_SWIFT_SOURCE_DIR = " S : / swift " ^ <nl> - - D LLVM_EXTERNAL_CMARK_SOURCE_DIR = " S : / cmark " ^ <nl> - - D SWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE = " S : / Library / icu - 67 / usr / include " ^ <nl> - - D SWIFT_WINDOWS_x86_64_ICU_UC = " S : / Library / icu - 67 / usr / lib / icuuc67 . lib " ^ <nl> - - D SWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE = " S : / Library / icu - 67 / usr / include " ^ <nl> - - D SWIFT_WINDOWS_x86_64_ICU_I18N = " S : / Library / icu - 67 / usr / lib / icuin67 . lib " ^ <nl> - - D CMAKE_INSTALL_PREFIX = " C : \ Library \ Developer \ Toolchains \ unknown - Asserts - development . xctoolchain \ usr " ^ <nl> - - D PYTHON_EXECUTABLE = C : \ Python27 \ python . exe ^ <nl> - - D SWIFT_BUILD_DYNAMIC_STDLIB = YES ^ <nl> - - D SWIFT_BUILD_DYNAMIC_SDK_OVERLAY = YES ^ <nl> + - D LLVM_EXTERNAL_SWIFT_SOURCE_DIR = S : \ swift ^ <nl> + - D LLVM_EXTERNAL_CMARK_SOURCE_DIR = S : \ cmark ^ <nl> + - D SWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE = S : \ Library \ icu - 67 \ usr \ include ^ <nl> + - D SWIFT_WINDOWS_x86_64_ICU_UC = S : \ Library \ icu - 67 \ usr \ lib \ icuuc67 . lib ^ <nl> + - D SWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE = S : \ Library \ icu - 67 \ usr \ include ^ <nl> + - D SWIFT_WINDOWS_x86_64_ICU_I18N = S : \ Library \ icu - 67 \ usr \ lib \ icuin67 . lib ^ <nl> + - D CMAKE_INSTALL_PREFIX = C : \ Library \ Developer \ Toolchains \ unknown - Asserts - development . xctoolchain \ usr ^ <nl> - G Ninja ^ <nl> - S S : \ llvm - project \ llvm <nl> <nl>
|
docs : make Windows build instructions fully self - contained
|
apple/swift
|
b8d9e3b9c75cb24e8916be32c057fb1759f095c3
|
2020-07-06T23:14:00Z
|
mmm a / src / library_gc . js <nl> ppp b / src / library_gc . js <nl> if ( GC_SUPPORT ) { <nl> GC . finalizerArgs [ ptr ] = arg ; <nl> } , <nl> <nl> + getHeapSize : function ( ) { <nl> + return GC . totalAllocations ; <nl> + } , <nl> + <nl> maybeCollect : function ( ) { <nl> if ( GC . needCollect ( ) ) GC . collect ( ) ; <nl> } , <nl> if ( GC_SUPPORT ) { <nl> GC . registerFinalizer ( ptr , func , arg , old_func , old_arg ) ; <nl> } , <nl> <nl> + GC_get_heap_size__deps : [ ' $ GC ' ] , <nl> + GC_get_heap_size : function ( ) { <nl> + return GC . getHeapSize ( ) ; <nl> + } , <nl> + <nl> GC_MAYBE_COLLECT__deps : [ ' $ GC ' ] , <nl> GC_MAYBE_COLLECT : function ( ) { <nl> GC . maybeCollect ( ) ; <nl> mmm a / system / include / gc . h <nl> ppp b / system / include / gc . h <nl> void GC_FREE ( void * ptr ) ; <nl> void GC_REGISTER_FINALIZER_NO_ORDER ( void * ptr , void ( * func ) ( void * , void * ) , void * arg , <nl> void * ( * old_func ) ( void * , void * ) , void * old_arg ) ; <nl> <nl> + / * Gets the bytes allocated and managed by the GC * / <nl> + int GC_get_heap_size ( ) ; <nl> + <nl> / * Non - Boehm additions * / <nl> <nl> / * Call this once per frame or such , it will collect if necessary * / <nl> mmm a / tests / runner . py <nl> ppp b / tests / runner . py <nl> def test_gc ( self ) : <nl> / / This should never trigger since local5 is uncollectable <nl> GC_REGISTER_FINALIZER_NO_ORDER ( local5 , finalizer , ( void * ) 5 , 0 , 0 ) ; <nl> <nl> + printf ( " heap size = % d \ n " , GC_get_heap_size ( ) ) ; <nl> + <nl> local4 = GC_REALLOC ( local4 , 24 ) ; <nl> <nl> + printf ( " heap size = % d \ n " , GC_get_heap_size ( ) ) ; <nl> + <nl> local6 = GC_MALLOC ( 12 ) ; <nl> GC_REGISTER_FINALIZER_NO_ORDER ( local6 , finalizer , ( void * ) 6 , 0 , 0 ) ; <nl> / / This should be the same as a free <nl> def test_gc ( self ) : <nl> finalizing2 3 ( global = = 0 ) <nl> * <nl> finalizing 0 ( global = = 1 ) <nl> + heap size = 72 <nl> + heap size = 84 <nl> finalizing 6 ( global = = 0 ) <nl> object scan test test <nl> finalizing 4 ( global = = 0 ) <nl>
|
Support GC_get_heap_size ( ) .
|
emscripten-core/emscripten
|
3c33204a2d2614be4a3f9e17fc57537246864093
|
2013-02-01T02:39:08Z
|
mmm a / README . md <nl> ppp b / README . md <nl> For previous versions , please read : <nl> - [ x ] Support HTTP RAW API , please read [ # 459 ] [ bug # 459 ] , [ # 470 ] [ bug # 470 ] , [ # 319 ] [ bug # 319 ] . <nl> - [ x ] Support HTTP callback ( [ CN ] [ v3_CN_HTTPCallback ] , [ EN ] [ v3_EN_HTTPCallback ] ) for authentication and integration . <nl> - [ x ] Support RTMP client library : srs - librtmp ( [ CN ] [ v3_CN_SrsLibrtmp ] , [ EN ] [ v3_EN_SrsLibrtmp ] ) <nl> - - [ x ] Support Adobe FMS / AMS token traverse ( [ CN ] [ v3_CN_DRM2 ] , [ EN ] [ v3_EN_DRM2 ] ) authentication . <nl> - [ x ] Support DVR ( [ CN ] [ v3_CN_DVR ] , [ EN ] [ v3_EN_DVR ] ) to record live streaming to FLV file . <nl> - [ x ] Support DVR in MP4 format , read [ # 738 ] [ bug # 738 ] . <nl> - [ x ] Support DVR control module like NGINX - RTMP , please read [ # 459 ] [ bug # 459 ] . <nl> For previous versions , please read : <nl> - [ x ] [ Experimental ] Support a simple [ mgmt console ] [ console ] , please read [ srs - ngb ] [ srs - ngb ] . <nl> - [ x ] [ Deprecated ] Support Adobe HDS ( f4m ) , please read wiki ( [ CN ] [ v2_CN_DeliveryHDS ] , [ EN ] [ v2_EN_DeliveryHDS ] ) . <nl> - [ x ] [ Deprecated ] Support bandwidth testing ( [ CN ] [ v1_CN_BandwidthTestTool ] , [ EN ] [ v1_EN_BandwidthTestTool ] ) and flash client example . <nl> + - [ x ] [ Deprecated ] Support Adobe FMS / AMS token traverse ( [ CN ] [ v3_CN_DRM2 ] , [ EN ] [ v3_EN_DRM2 ] ) authentication . <nl> - [ ] Utest cover almost all kernel code . <nl> - [ ] Enhanced forwarding with vhost and variables . <nl> - [ ] Support source cleanup for idle streams . <nl> For previous versions , please read : <nl> <nl> # # V3 changes <nl> <nl> + * v3 . 0 , 2019 - 12 - 23 , For [ # 1535 ] [ bug # 1535 ] , deprecate Adobe FMS / AMS edge token traversing ( [ CN ] [ v3_CN_DRM2 ] , [ EN ] [ v3_EN_DRM2 ] ) authentication . 3 . 0 . 79 <nl> * v3 . 0 , 2019 - 12 - 23 , For [ # 1535 ] [ bug # 1535 ] , deprecate BWT ( bandwidth testing ) ( [ CN ] [ v1_CN_BandwidthTestTool ] , [ EN ] [ v1_EN_BandwidthTestTool ] ) . 3 . 0 . 78 <nl> * v3 . 0 , 2019 - 12 - 23 , For [ # 1535 ] [ bug # 1535 ] , deprecate Adobe HDS ( f4m ) ( [ CN ] [ v2_CN_DeliveryHDS ] , [ EN ] [ v2_EN_DeliveryHDS ] ) . 3 . 0 . 77 <nl> * v3 . 0 , 2019 - 12 - 20 , Fix [ # 1508 ] [ bug # 1508 ] , http - client support read chunked response . 3 . 0 . 76 <nl> mmm a / trunk / src / core / srs_core . hpp <nl> ppp b / trunk / src / core / srs_core . hpp <nl> <nl> / / The version config . <nl> # define VERSION_MAJOR 3 <nl> # define VERSION_MINOR 0 <nl> - # define VERSION_REVISION 78 <nl> + # define VERSION_REVISION 79 <nl> <nl> / / The macros generated by configure script . <nl> # include < srs_auto_headers . hpp > <nl>
|
For , deprecate Adobe FMS / AMS edge token traversing authentication . 3 . 0 . 79
|
ossrs/srs
|
2d29e3c4e6aad585575e593a83d4546cf398108f
|
2019-12-23T04:21:46Z
|
mmm a / src / mongo / db / repl / master_slave . h <nl> ppp b / src / mongo / db / repl / master_slave . h <nl> namespace mongo { <nl> <nl> ReplSource ( ) ; <nl> <nl> - / / returns the dummy ns used to do the drop <nl> void resyncDrop ( const string & db ) ; <nl> / / call without the db mutex <nl> void syncToTailOfRemoteLog ( ) ; <nl>
|
SERVER - 11611 : remove dead comment
|
mongodb/mongo
|
1403644604daa0f34712696edc7a8c0b33bb1b30
|
2013-12-29T02:26:53Z
|
mmm a / lib / SILPasses / LetPropertiesOpts . cpp <nl> ppp b / lib / SILPasses / LetPropertiesOpts . cpp <nl> void LetPropertiesOpt : : optimizeLetPropertyAccess ( VarDecl * Property , <nl> SILInstruction * I = prev ( SILBasicBlock : : iterator ( Load ) ) ; <nl> SILBuilderWithScope < 1 > B ( Load ) ; <nl> for ( auto Use : Load - > getUses ( ) ) { <nl> - if ( isa < StoreInst > ( Use - > getUser ( ) ) ) { <nl> - if ( CanRemove ) <nl> - Use - > getUser ( ) - > eraseFromParent ( ) ; <nl> + if ( isa < StoreInst > ( Use - > getUser ( ) ) ) <nl> continue ; <nl> - } <nl> + <nl> replaceLoadSequence ( Use - > getUser ( ) , I , B ) ; <nl> eraseUsesOfInstruction ( Use - > getUser ( ) ) ; <nl> Use - > getUser ( ) - > eraseFromParent ( ) ; <nl> mmm a / test / SILPasses / let_properties_opts . swift <nl> ppp b / test / SILPasses / let_properties_opts . swift <nl> <nl> / / CHECK - WMO - NOT : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop2 <nl> / / CHECK - WMO - NOT : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop3 <nl> / / CHECK - WMO : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop0 <nl> - / / CHECK - WMO - NOT : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop1 <nl> - / / CHECK - WMO - NOT : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop2 <nl> - / / CHECK - WMO - NOT : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop3 <nl> - / / CHECK - WMO - WMO : return <nl> + / / CHECK - WMO : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop1 <nl> + / / CHECK - WMO : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop2 <nl> + / / CHECK - WMO : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop3 <nl> + / / CHECK - WMO : return <nl> <nl> / / CHECK - WMO - LABEL : sil @ _TFC19let_properties_opts3FoocfMS0_FT1iVSs5Int64_S0_ : $ @ convention ( method ) ( Int64 , @ owned Foo ) - > @ owned Foo <nl> / / CHECK - WMO - NOT : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop1 <nl> / / CHECK - WMO - NOT : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop2 <nl> / / CHECK - WMO - NOT : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop3 <nl> / / CHECK - WMO : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop0 <nl> - / / CHECK - WMO - NOT : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop1 <nl> - / / CHECK - WMO - NOT : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop2 <nl> - / / CHECK - WMO - NOT : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop3 <nl> - / / CHECK - WMO - WMO : return <nl> + / / CHECK - WMO : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop1 <nl> + / / CHECK - WMO : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop2 <nl> + / / CHECK - WMO : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop3 <nl> + / / CHECK - WMO : return <nl> <nl> / / Check that intializers do not contain a code to intialize private properties , <nl> / / because their values are propagated into their uses and they cannot be accessed <nl> <nl> / / CHECK - LABEL : sil @ _TFC19let_properties_opts3FoocfMS0_FT1iVSs5Int32_S0_ : $ @ convention ( method ) ( Int32 , @ owned Foo ) - > @ owned Foo <nl> / / CHECK : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop0 <nl> / / CHECK : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop1 <nl> - / / CHECK - NOT : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop2 <nl> + / / CHECK : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop2 <nl> / / CHECK : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop3 <nl> / / CHECK : return <nl> <nl> / / CHECK - LABEL : sil @ _TFC19let_properties_opts3FoocfMS0_FT1iVSs5Int64_S0_ : $ @ convention ( method ) ( Int64 , @ owned Foo ) - > @ owned Foo <nl> / / CHECK : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop0 <nl> / / CHECK : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop1 <nl> - / / CHECK - NOT : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop2 <nl> + / / CHECK : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop2 <nl> / / CHECK : ref_element_addr % { { [ 0 - 9 ] + } } : $ Foo , # Foo . Prop3 <nl> / / CHECK : return <nl> <nl>
|
[ let - properties - opts ] Don ' t remove assignments to let properties from initializers .
|
apple/swift
|
dbd2a8661eff5737e2ec5ae703c0569621be3ccf
|
2015-09-23T03:39:48Z
|
mmm a / dbms / src / Interpreters / Context . cpp <nl> ppp b / dbms / src / Interpreters / Context . cpp <nl> struct ContextShared <nl> ConfigurationPtr users_config ; / / / Config with the users , profiles and quotas sections . <nl> InterserverIOHandler interserver_io_handler ; / / / Handler for interserver communication . <nl> BackgroundProcessingPoolPtr background_pool ; / / / The thread pool for the background work performed by the tables . <nl> - mutable std : : mutex macros_mutex ; <nl> MacrosPtr macros ; / / / Substitutions extracted from config . <nl> + mutable std : : mutex macros_mutex ; <nl> std : : unique_ptr < Compiler > compiler ; / / / Used for dynamic compilation of queries ' parts if it necessary . <nl> std : : shared_ptr < DDLWorker > ddl_worker ; / / / Process ddl commands from zk . <nl> / / / Rules for selecting the compression settings , depending on the size of the part . <nl>
|
Update Context . cpp
|
ClickHouse/ClickHouse
|
165de1bc3686b34b6640e31928ef217772a4da42
|
2018-03-13T23:03:00Z
|
mmm a / src / csharp / Grpc . IntegrationTesting / InteropClient . cs <nl> ppp b / src / csharp / Grpc . IntegrationTesting / InteropClient . cs <nl> public static async Task RunTimeoutOnSleepingServerAsync ( TestService . TestService <nl> / / Deadline was reached before write has started . Eat the exception and continue . <nl> } <nl> <nl> - var ex = Assert . ThrowsAsync < RpcException > ( async ( ) = > await call . ResponseStream . MoveNext ( ) ) ; <nl> - / / We can ' t guarantee the status code always DeadlineExceeded . See issue # 2685 . <nl> - Assert . Contains ( ex . Status . StatusCode , new [ ] { StatusCode . DeadlineExceeded , StatusCode . Internal } ) ; <nl> + try <nl> + { <nl> + await call . ResponseStream . MoveNext ( ) ; <nl> + Assert . Fail ( ) ; <nl> + } <nl> + catch ( RpcException ex ) <nl> + { <nl> + / / We can ' t guarantee the status code always DeadlineExceeded . See issue # 2685 . <nl> + Assert . Contains ( ex . Status . StatusCode , new [ ] { StatusCode . DeadlineExceeded , StatusCode . Internal } ) ; <nl> + } <nl> } <nl> Console . WriteLine ( " Passed ! " ) ; <nl> } <nl>
|
fix one more test
|
grpc/grpc
|
1e5d9b9caa188408336633bf06cc42d2aad6c6af
|
2016-05-26T04:38:10Z
|
mmm a / . github / ISSUE_TEMPLATE . md <nl> ppp b / . github / ISSUE_TEMPLATE . md <nl> Steps to reproduce the behavior : <nl> < ! mmm Provide a link to a live example , or an unambiguous set of steps to - - > <nl> < ! mmm reproduce this bug . Include code to reproduce , if relevant - - > <nl> < ! mmm Put your text below this line - - > <nl> - 1 . <nl> + 1 . <nl> 2 . <nl> 3 . <nl> <nl> The debuglog can be found here : <nl> <nl> <nl> <nl> - # # # Screenshots <nl> + # # # Screenshots <nl> Here are some links or screenshots to help explain the problem : <nl> < ! mmm Put your text below this line - - > <nl> <nl> Used Operating system : <nl> - [ ] iOS <nl> - [ ] Linux <nl> - [ ] OSX <nl> - - [ ] Raspberry - Pi <nl> - [ ] Windows <nl> - [ ] Windows UWP <nl> <nl> Used Operating system : <nl> <nl> < ! mmm End of this issue - - > <nl> * note : Once the issue is made we require you to update it with new information or Kodi versions should that be required . <nl> - Team Kodi will consider your problem report however , we will not make any promises the problem will be solved . * <nl> \ No newline at end of file <nl> + Team Kodi will consider your problem report however , we will not make any promises the problem will be solved . * <nl> mmm a / . github / ISSUE_TEMPLATE / bug_report . md <nl> ppp b / . github / ISSUE_TEMPLATE / bug_report . md <nl> Used Operating system : <nl> - [ ] iOS <nl> - [ ] Linux <nl> - [ ] OSX <nl> - - [ ] Raspberry - Pi <nl> - [ ] Windows <nl> - [ ] Windows UWP <nl> <nl> mmm a / addons / resource . language . en_gb / resources / strings . po <nl> ppp b / addons / resource . language . en_gb / resources / strings . po <nl> msgctxt " # 16329 " <nl> msgid " VAAPI - Motion compensated " <nl> msgstr " " <nl> <nl> - # . Description of OSD video settings for deinterlace method with label # 16330 <nl> - # : xbmc / video / dialogs / GUIDialogVideoSettings . cpp <nl> - msgctxt " # 16330 " <nl> - msgid " MMAL - Advanced " <nl> - msgstr " " <nl> - <nl> - # . Description of OSD video settings for deinterlace method with label # 16331 <nl> - # : xbmc / video / dialogs / GUIDialogVideoSettings . cpp <nl> - msgctxt " # 16331 " <nl> - msgid " MMAL - Advanced ( half ) " <nl> - msgstr " " <nl> - <nl> - # . Description of OSD video settings for deinterlace method with label # 16332 <nl> - # : xbmc / video / dialogs / GUIDialogVideoSettings . cpp <nl> - msgctxt " # 16332 " <nl> - msgid " MMAL - Bob " <nl> - msgstr " " <nl> - <nl> - # . Description of OSD video settings for deinterlace method with label # 16333 <nl> - # : xbmc / video / dialogs / GUIDialogVideoSettings . cpp <nl> - msgctxt " # 16333 " <nl> - msgid " MMAL - Bob ( half ) " <nl> - msgstr " " <nl> + # empty strings from id 16330 to 16333 <nl> <nl> # . Description of OSD video settings for deinterlace method with label # 16334 <nl> # : xbmc / video / dialogs / GUIDialogVideoSettings . cpp <nl> msgctxt " # 36433 " <nl> msgid " When enabled , VAAPI render method is preferred and the CPU has less load . If you experience hangs , disable this option . " <nl> msgstr " " <nl> <nl> - # . Description of setting " Enable MMAL hardware decoding of video files " <nl> - # : system / settings / settings . xml <nl> - msgctxt " # 36434 " <nl> - msgid " Allow hardware acceleration - MMAL " <nl> - msgstr " " <nl> - <nl> - # . Description of setting " Enable MMAL hardware decoding of video files " <nl> - # : system / settings / settings . xml <nl> - msgctxt " # 36435 " <nl> - msgid " Use VideoPlayer for decoding of video files with MMAL acceleration . " <nl> - msgstr " " <nl> + # empty strings from id 36434 to 36435 <nl> <nl> # . Description for setting # 310 : " Keyboard layouts " <nl> # : system / settings / settings . xml <nl> msgctxt " # 36541 " <nl> msgid " Allows volume control from AirPlay clients . " <nl> msgstr " " <nl> <nl> - # : system / settings / rbp . xml <nl> - msgctxt " # 36542 " <nl> - msgid " Output to both analogue ( headphones ) and HDMI " <nl> - msgstr " " <nl> - <nl> - # : system / settings / rbp . xml <nl> - msgctxt " # 36543 " <nl> - msgid " Enable this to make dialogue louder compared to background sounds when downmixing multichannel audio " <nl> - msgstr " " <nl> + # empty strings from id 36542 to 36543 <nl> <nl> # : system / settings / settings . xml <nl> msgctxt " # 36544 " <nl> msgctxt " # 36546 " <nl> msgid " Sets the visual depth of subtitles for stereoscopic 3D videos . The higher the value , the closer the subtitles will appear to the viewer . " <nl> msgstr " " <nl> <nl> - # : system / settings / rbp . xml <nl> - msgctxt " # 36547 " <nl> - msgid " Use higher quality textures for covers and fanart ( uses more memory ) " <nl> - msgstr " " <nl> - <nl> - # : system / settings / rbp . xml <nl> - # : system / settings / gbm . xml <nl> - msgctxt " # 36548 " <nl> - msgid " Limits resolution of GUI to save memory . Does not affect video playback . Requires restart . " <nl> - msgstr " " <nl> + # empty strings from id 36547 to 36548 <nl> <nl> # . Description of setting with label # 1268 " iOS 8 compatibility mode " <nl> # : system / settings / settings . xml <nl> msgctxt " # 37016 " <nl> msgid " Select this option if your receiver is capable of decoding Dolby Digital Plus ( E - AC3 ) streams . " <nl> msgstr " " <nl> <nl> - # : system / settings / rbp . xml <nl> - msgctxt " # 37017 " <nl> - msgid " Dual audio output " <nl> - msgstr " " <nl> - <nl> - # : system / settings / rbp . xml <nl> - msgctxt " # 37018 " <nl> - msgid " Boost centre channel when downmixing " <nl> - msgstr " " <nl> - <nl> - # empty string with id 37019 <nl> - <nl> - # : system / settings / rbp . xml <nl> - msgctxt " # 37020 " <nl> - msgid " Enable higher colour depth artwork " <nl> - msgstr " " <nl> - <nl> - # : system / settings / rbp . xml <nl> - # : system / settings / gbm . xml <nl> - msgctxt " # 37021 " <nl> - msgid " Set GUI resolution limit " <nl> - msgstr " " <nl> + # empty strings from id 37017 to 37021 <nl> <nl> # : xbmc / network / upnp / UPnPPlayer . cpp <nl> msgctxt " # 37022 " <nl> msgctxt " # 37023 " <nl> msgid " Do you wish to stop playback on the remote device ? " <nl> msgstr " " <nl> <nl> - # : system / settings / rbp . xml <nl> - msgctxt " # 37024 " <nl> - msgid " Select this if the audio out connection only supports multichannel audio as Dolby Digital 5 . 1 ( AC3 ) , this allows multichannel audio such as AAC 5 . 1 or FLAC 5 . 1 to be listened to in 5 . 1 surround sound . Note : Not recommended on Pi as this requires a lot of CPU . " <nl> - msgstr " " <nl> + # empty string id 37024 <nl> <nl> # : system / settings / settings . xml <nl> msgctxt " # 37025 " <nl> msgid " Configure audio encoder settings such as quality and compression level " <nl> msgstr " " <nl> <nl> - # : system / settings / rbp . xml <nl> # : system / settings / android . xml <nl> msgctxt " # 37026 " <nl> msgid " Auto " <nl> msgstr " " <nl> <nl> - # : system / settings / rbp . xml <nl> + # : system / settings / android . xml <nl> msgctxt " # 37027 " <nl> msgid " 540 " <nl> msgstr " " <nl> <nl> - # : system / settings / rbp . xml <nl> # : system / settings / android . xml <nl> # : system / settings / gbm . xml <nl> msgctxt " # 37028 " <nl> msgid " 720 " <nl> msgstr " " <nl> <nl> - # : system / settings / rbp . xml <nl> + # : system / settings / android . xml <nl> msgctxt " # 37029 " <nl> msgid " 900 " <nl> msgstr " " <nl> <nl> - # : system / settings / rbp . xml <nl> # : system / settings / android . xml <nl> # : system / settings / gbm . xml <nl> msgctxt " # 37030 " <nl> msgctxt " # 37046 " <nl> msgid " 1080 " <nl> msgstr " " <nl> <nl> - # empty strings from id 37047 to 38009 <nl> - <nl> - # : system / settings / rbp . xml <nl> - msgctxt " # 38010 " <nl> - msgid " GPU accelerated " <nl> - msgstr " " <nl> + # empty strings from id 37047 to 38010 <nl> <nl> # . Setting # 38011 " Show All Items entry " <nl> # : system / settings / settings . xml <nl> msgctxt " # 38026 " <nl> msgid " Appearances " <nl> msgstr " " <nl> <nl> - # : system / settings / rbp . xml <nl> - msgctxt " # 38027 " <nl> - msgid " Decode the stereo stream from 3D files " <nl> - msgstr " " <nl> - <nl> - # . Description of setting with label # 38027 " Decode the stereo stream from 3D files " <nl> - # : system / settings / rbp . xml <nl> - msgctxt " # 38028 " <nl> - msgid " If enabled , videos created in Multiview Video Coding ( MVC ) format can also be watched in stereoscopic 3D . MVC format is typically found on 3D Blu - rays . [ CR ] Note : Processing of this data may reduce playback performance , so only enable if you require stereoscopic 3D support . " <nl> - msgstr " " <nl> - <nl> - # : system / settings / rbp . xml <nl> - msgctxt " # 38029 " <nl> - msgid " Enable Full HD HDMI modes for stereoscopic 3D " <nl> - msgstr " " <nl> - <nl> - # . Description of setting " Enable Full HD HDMI modes for stereoscopic 3D " with label # 38029 <nl> - # : system / settings / rbp . xml <nl> - msgctxt " # 38030 " <nl> - msgid " This option uses frame - packing to output full resolution for 3D through HDMI . [ CR ] Enabling this improves quality of Multiview Video Coding ( MVC ) videos , but may not be supported by all displays . " <nl> - msgstr " " <nl> + # empty strings from id 38027 to 38030 <nl> <nl> # . Label for an option to select the video stream to play if current video has more than one video stream <nl> # : xbmc / video / dialogs / GUIDialogVideoSettings . cpp <nl> mmm a / cmake / addons / README . md <nl> ppp b / cmake / addons / README . md <nl> where <nl> <nl> List of platforms to build an add - on for ( or * all * ) . Negating platforms is supported using a leading exclamation mark , e . g . * ! windows * . <nl> <nl> - Available platforms are : linux , windows , osx , ios , android , rbpi and freebsd . <nl> + Available platforms are : linux , windows , osx , ios , android and freebsd . <nl> <nl> # # # # Attention <nl> If no add - on definitions could be found , the buildsystem assumes that the bootstrapping of the add - on definition repositories hasn ' t been performed yet and automatically executes the add - on bootstrapping buildsystem located in the * bootstrap * sub - directory with the default settings ( i . e . * all * add - ons from all pre - defined add - on definition repositories are bootstrapped into the directory pointed to by the * ADDONS_DEFINITION_DIR * option ) . <nl> Buildsystem will print a warning if you use any of the below - listed variables . F <nl> <nl> # # Building <nl> The buildsystem makes some assumptions about the environment which must be met by whoever uses it : <nl> - - Any dependencies of the add - ons must already be built and their include and library files must be present in the path pointed to by ` < CMAKE_PREFIX_PATH > ` ( in * include * and * lib * sub - directories ) <nl> \ No newline at end of file <nl> + - Any dependencies of the add - ons must already be built and their include and library files must be present in the path pointed to by ` < CMAKE_PREFIX_PATH > ` ( in * include * and * lib * sub - directories ) <nl> deleted file mode 120000 <nl> index e89ae50094c7 . . 000000000000 <nl> mmm a / cmake / installdata / rbpi / lirc . txt <nl> ppp / dev / null <nl> @ @ - 1 + 0 , 0 @ @ <nl> - . . / linux / lirc . txt <nl> \ No newline at end of file <nl> mmm a / cmake / modules / FindEGL . cmake <nl> ppp b / cmake / modules / FindEGL . cmake <nl> <nl> # <nl> # EGL : : EGL - The EGL library <nl> <nl> - if ( CORE_PLATFORM_NAME_LC STREQUAL rbpi ) <nl> - set ( _brcmprefix brcm ) <nl> - endif ( ) <nl> - <nl> if ( PKG_CONFIG_FOUND ) <nl> - pkg_check_modules ( PC_EGL $ { _brcmprefix } egl QUIET ) <nl> + pkg_check_modules ( PC_EGL egl QUIET ) <nl> endif ( ) <nl> <nl> find_path ( EGL_INCLUDE_DIR EGL / egl . h <nl> PATHS $ { PC_EGL_INCLUDEDIR } ) <nl> <nl> - find_library ( EGL_LIBRARY NAMES $ { _brcmprefix } EGL egl <nl> + find_library ( EGL_LIBRARY NAMES EGL egl <nl> PATHS $ { PC_EGL_LIBDIR } ) <nl> <nl> set ( EGL_VERSION $ { PC_EGL_VERSION } ) <nl> deleted file mode 100644 <nl> index 0b5f5564ecb2 . . 000000000000 <nl> mmm a / cmake / modules / FindMMAL . cmake <nl> ppp / dev / null <nl> <nl> - # - Try to find MMAL <nl> - # Once done this will define <nl> - # <nl> - # MMAL_FOUND - system has MMAL <nl> - # MMAL_INCLUDE_DIRS - the MMAL include directory <nl> - # MMAL_LIBRARIES - The MMAL libraries <nl> - <nl> - if ( PKG_CONFIG_FOUND ) <nl> - pkg_check_modules ( PC_MMAL mmal QUIET ) <nl> - endif ( ) <nl> - <nl> - <nl> - find_path ( MMAL_INCLUDE_DIR NAMES interface / mmal / mmal . h PATHS $ { PC_MMAL_INCLUDEDIR } ) <nl> - find_library ( MMAL_LIBRARY NAMES mmal libmmal PATHS $ { PC_MMAL_LIBDIR } ) <nl> - find_library ( MMALCORE_LIBRARY NAMES mmal_core libmmal_core PATHS $ { PC_MMAL_LIBDIR } ) <nl> - find_library ( MMALUTIL_LIBRARY NAMES mmal_util libmmal_util PATHS $ { PC_MMAL_LIBDIR } ) <nl> - find_library ( MMALCLIENT_LIBRARY NAMES mmal_vc_client libmmal_vc_client PATHS $ { PC_MMAL_LIBDIR } ) <nl> - find_library ( MMALCOMPONENT_LIBRARY NAMES mmal_components libmmal_components PATHS $ { PC_MMAL_LIBDIR } ) <nl> - find_library ( BCM_LIBRARY NAMES bcm_host libbcm_host PATHS $ { PC_MMAL_LIBDIR } ) <nl> - find_library ( VCHIQ_LIBRARY NAMES vchiq_arm libvchiq_arm PATHS $ { PC_MMAL_LIBDIR } ) <nl> - find_library ( VCHOSTIF_LIBRARY NAMES vchostif libvchostif PATHS $ { PC_MMAL_LIBDIR } ) <nl> - find_library ( VCILCS_LIBRARY NAMES vcilcs libvcilcs PATHS $ { PC_MMAL_LIBDIR } ) <nl> - find_library ( VCOS_LIBRARY NAMES vcos libvcos PATHS $ { PC_MMAL_LIBDIR } ) <nl> - find_library ( VCSM_LIBRARY NAMES vcsm libvcsm PATHS $ { PC_MMAL_LIBDIR } ) <nl> - find_library ( CONTAINER_LIBRARY NAMES containers libcontainers PATHS $ { PC_MMAL_LIBDIR } ) <nl> - <nl> - <nl> - include ( FindPackageHandleStandardArgs ) <nl> - find_package_handle_standard_args ( MMAL REQUIRED_VARS MMAL_INCLUDE_DIR <nl> - MMAL_LIBRARY MMALCORE_LIBRARY MMALUTIL_LIBRARY <nl> - MMALCLIENT_LIBRARY MMALCOMPONENT_LIBRARY BCM_LIBRARY <nl> - VCHIQ_LIBRARY VCOS_LIBRARY VCSM_LIBRARY VCHOSTIF_LIBRARY <nl> - VCILCS_LIBRARY CONTAINER_LIBRARY ) <nl> - <nl> - <nl> - if ( MMAL_FOUND ) <nl> - set ( MMAL_INCLUDE_DIRS $ { MMAL_INCLUDE_DIR } ) <nl> - set ( MMAL_LIBRARIES $ { MMAL_LIBRARY } $ { MMALCORE_LIBRARY } $ { MMALUTIL_LIBRARY } <nl> - $ { MMALCLIENT_LIBRARY } $ { MMALCOMPONENT_LIBRARY } <nl> - $ { BCM_LIBRARY } $ { VCHIQ_LIBRARY } $ { VCOS_LIBRARY } $ { VCSM_LIBRARY } <nl> - $ { VCHOSTIF_LIBRARY } $ { VCILCS_LIBRARY } $ { CONTAINER_LIBRARY } <nl> - CACHE STRING " mmal libraries " FORCE ) <nl> - list ( APPEND MMAL_DEFINITIONS - DHAVE_MMAL = 1 - DHAS_MMAL = 1 ) <nl> - <nl> - if ( NOT TARGET MMAL : : MMAL ) <nl> - add_library ( MMAL : : MMAL UNKNOWN IMPORTED ) <nl> - set_target_properties ( MMAL : : MMAL PROPERTIES <nl> - IMPORTED_LOCATION " $ { MMAL_LIBRARIES } " <nl> - INTERFACE_INCLUDE_DIRECTORIES " $ { MMAL_INCLUDE_DIR } " ) <nl> - endif ( ) <nl> - endif ( ) <nl> - <nl> - mark_as_advanced ( MMAL_INCLUDE_DIRS MMAL_LIBRARIES MMAL_DEFINITIONS <nl> - MMAL_LIBRARY MMALCORE_LIBRARY MMALUTIL_LIBRARY MMALCLIENT_LIBRARY MMALCOMPONENT_LIBRARY BCM_LIBRARY <nl> - VCHIQ_LIBRARY VCOS_LIBRARY VCSM_LIBRARY VCHOSTIF_LIBRARY VCILCS_LIBRARY CONTAINER_LIBRARY ) <nl> mmm a / cmake / modules / FindOpenGLES . cmake <nl> ppp b / cmake / modules / FindOpenGLES . cmake <nl> <nl> # OPENGLES_LIBRARIES - the OpenGLES libraries <nl> # OPENGLES_DEFINITIONS - the OpenGLES definitions <nl> <nl> - if ( CORE_PLATFORM_NAME_LC STREQUAL rbpi ) <nl> - set ( _brcmprefix brcm ) <nl> - endif ( ) <nl> - <nl> if ( PKG_CONFIG_FOUND ) <nl> - pkg_check_modules ( PC_OPENGLES $ { _brcmprefix } glesv2 QUIET ) <nl> + pkg_check_modules ( PC_OPENGLES glesv2 QUIET ) <nl> endif ( ) <nl> <nl> if ( NOT CORE_SYSTEM_NAME STREQUAL darwin_embedded ) <nl> find_path ( OPENGLES_INCLUDE_DIR GLES2 / gl2 . h <nl> PATHS $ { PC_OPENGLES_INCLUDEDIR } ) <nl> - find_library ( OPENGLES_gl_LIBRARY NAMES $ { _brcmprefix } GLESv2 <nl> + find_library ( OPENGLES_gl_LIBRARY NAMES GLESv2 <nl> PATHS $ { PC_OPENGLES_LIBDIR } ) <nl> else ( ) <nl> find_library ( OPENGLES_gl_LIBRARY NAMES OpenGLES <nl> deleted file mode 100644 <nl> index f0956939b650 . . 000000000000 <nl> mmm a / cmake / platform / freebsd / rbpi . cmake <nl> ppp / dev / null <nl> @ @ - 1 + 0 , 0 @ @ <nl> - include ( cmake / platform / linux / rbpi . cmake ) <nl> deleted file mode 100644 <nl> index 3dde57dce595 . . 000000000000 <nl> mmm a / cmake / platform / linux / rbpi . cmake <nl> ppp / dev / null <nl> <nl> - set ( PLATFORM_REQUIRED_DEPS OpenGLES EGL MMAL LibInput Xkbcommon ) <nl> - set ( APP_RENDER_SYSTEM gles ) <nl> - list ( APPEND PLATFORM_DEFINES - D_ARMEL - DTARGET_RASPBERRY_PI ) <nl> mmm a / cmake / scripts / linux / ArchSetup . cmake <nl> ppp b / cmake / scripts / linux / ArchSetup . cmake <nl> else ( ) <nl> endif ( ) <nl> endif ( ) <nl> <nl> - # temp until further cleanup is done <nl> - # add Raspberry Pi 2 and 3 specific flags <nl> - if ( CORE_PLATFORM_NAME_LC STREQUAL rbpi ) <nl> - if ( CPU MATCHES " cortex - a7 " ) <nl> - set ( NEON_FLAGS " - fPIC - mcpu = cortex - a7 - mfloat - abi = hard - mfpu = neon - vfpv4 - mvectorize - with - neon - quad " ) <nl> - elseif ( CPU MATCHES " cortex - a53 " ) <nl> - set ( NEON_FLAGS " - fPIC - mcpu = cortex - a53 - mfloat - abi = hard - mfpu = neon - fp - armv8 - mvectorize - with - neon - quad " ) <nl> - endif ( ) <nl> - endif ( ) <nl> - <nl> if ( ( CMAKE_BUILD_TYPE STREQUAL Release OR CMAKE_BUILD_TYPE STREQUAL MinSizeRel ) <nl> AND CMAKE_COMPILER_IS_GNUCXX ) <nl> # Make sure we strip binaries in Release build <nl> deleted file mode 100644 <nl> index dc268e773c92 . . 000000000000 <nl> mmm a / cmake / treedata / common / rbpi / rbpi . txt <nl> ppp / dev / null <nl> <nl> - xbmc / cores / omxplayer cores / omxplayer <nl> - xbmc / windowing / rpi windowing / rpi <nl> mmm a / cmake / treedata / freebsd / subdirs . txt <nl> ppp b / cmake / treedata / freebsd / subdirs . txt <nl> <nl> - xbmc / cores / RetroPlayer / process / rbpi cores / RetroPlayer / process / rbpi <nl> - xbmc / cores / VideoPlayer / Process / rbpi cores / VideoPlayer / Process / rbpi <nl> xbmc / input / touch input / touch <nl> xbmc / input / touch / generic input / touch / generic <nl> xbmc / platform / freebsd platform / freebsd <nl> mmm a / cmake / treedata / linux / subdirs . txt <nl> ppp b / cmake / treedata / linux / subdirs . txt <nl> <nl> - xbmc / cores / RetroPlayer / process / rbpi cores / RetroPlayer / process / rbpi <nl> - xbmc / cores / VideoPlayer / Process / rbpi cores / VideoPlayer / Process / rbpi <nl> xbmc / input / touch input / touch <nl> xbmc / input / touch / generic input / touch / generic <nl> xbmc / platform / linux platform / linux <nl> mmm a / docs / README . RaspberryPi . md <nl> ppp b / docs / README . RaspberryPi . md <nl> <nl> ! [ Kodi Logo ] ( resources / banner_slim . png ) <nl> <nl> # Raspberry Pi build guide <nl> - This guide has been tested with Ubuntu 16 . 04 ( Xenial ) x86_64 and 18 . 04 ( Bionic ) . It is meant to cross - compile Kodi for the Raspberry Pi using * * [ Kodi ' s unified depends build system ] ( . . / tools / depends / README . md ) * * . Please read it in full before you proceed to familiarize yourself with the build procedure . <nl> <nl> - If you ' re looking to build Kodi natively using * * [ Raspbian ] ( https : / / www . raspberrypi . org / downloads / raspbian / ) * * , you should follow the * * [ Ubuntu guide ] ( README . Ubuntu . md ) * * instead . Several other distributions have * * [ specific guides ] ( README . md ) * * and a general * * [ Linux guide ] ( README . Linux . md ) * * is also available . <nl> - <nl> - # # Table of Contents <nl> - 1 . * * [ Document conventions ] ( # 1 - document - conventions ) * * <nl> - 2 . * * [ Install the required packages ] ( # 2 - install - the - required - packages ) * * <nl> - 3 . * * [ Get the source code ] ( # 3 - get - the - source - code ) * * <nl> - 3 . 1 . * * [ Get Raspberry Pi tools and firmware ] ( # 31 - get - raspberry - pi - tools - and - firmware ) * * <nl> - 4 . * * [ Build tools and dependencies ] ( # 4 - build - tools - and - dependencies ) * * <nl> - 5 . * * [ Build Kodi ] ( # 5 - build - kodi ) * * <nl> - 6 . * * [ Docker ] ( # 6 - docker ) * * <nl> - 7 . * * [ Troubleshooting ] ( # 7 - troubleshooting ) * * <nl> - 7 . 1 . * * [ ImportError : No module named \ _sysconfigdata \ _nd ] ( # 71 - importerror - no - module - named - _sysconfigdata_nd ) * * <nl> - 7 . 2 . * * [ Errors connecting to any internet ( TLS ) service ] ( # 72 - errors - connecting - to - any - internet - tls - service ) * * <nl> - <nl> - # # 1 . Document conventions <nl> - This guide assumes you are using ` terminal ` , also known as ` console ` , ` command - line ` or simply ` cli ` . Commands need to be run at the terminal , one at a time and in the provided order . <nl> - <nl> - This is a comment that provides context : <nl> - ` ` ` <nl> - this is a command <nl> - this is another command <nl> - and yet another one <nl> - ` ` ` <nl> - <nl> - * * Example : * * Clone Kodi ' s current master branch : <nl> - ` ` ` <nl> - git clone https : / / github . com / xbmc / xbmc kodi <nl> - ` ` ` <nl> - <nl> - Commands that contain strings enclosed in angle brackets denote something you need to change to suit your needs . <nl> - ` ` ` <nl> - git clone - b < branch - name > https : / / github . com / xbmc / xbmc kodi <nl> - ` ` ` <nl> - <nl> - * * Example : * * Clone Kodi ' s current Krypton branch : <nl> - ` ` ` <nl> - git clone - b Krypton https : / / github . com / xbmc / xbmc kodi <nl> - ` ` ` <nl> - <nl> - Several different strategies are used to draw your attention to certain pieces of information . In order of how critical the information is , these items are marked as a note , tip , or warning . For example : <nl> - <nl> - * * NOTE : * * Linux is user friendly . . . It ' s just very particular about who its friends are . <nl> - * * TIP : * * Algorithm is what developers call code they do not want to explain . <nl> - * * WARNING : * * Developers don ' t change light bulbs . It ' s a hardware problem . <nl> - <nl> - * * [ back to top ] ( # table - of - contents ) * * | * * [ back to section top ] ( # 1 - document - conventions ) * * <nl> - <nl> - # # 2 . Install the required packages <nl> - * * NOTE : * * Kodi requires a compiler with C + + 14 support , i . e . gcc > = 4 . 9 or clang > = 3 . 4 <nl> - <nl> - Install build dependencies needed to cross - compile Kodi for the Raspberry Pi : <nl> - ` ` ` <nl> - sudo apt install autoconf bison build - essential curl default - jdk gawk git gperf libcurl4 - openssl - dev zlib1g - dev <nl> - ` ` ` <nl> - <nl> - * * [ back to top ] ( # table - of - contents ) * * <nl> - <nl> - # # 3 . Get the source code <nl> - Change to your ` home ` directory : <nl> - ` ` ` <nl> - cd $ HOME <nl> - ` ` ` <nl> - <nl> - Clone Kodi ' s current master branch : <nl> - ` ` ` <nl> - git clone https : / / github . com / xbmc / xbmc kodi <nl> - ` ` ` <nl> - <nl> - # # # 3 . 1 . Get Raspberry Pi tools and firmware <nl> - Clone Raspberry Pi tools : <nl> - ` ` ` <nl> - git clone https : / / github . com / raspberrypi / tools - - depth = 1 <nl> - ` ` ` <nl> - <nl> - Clone Raspberry Pi firmware : <nl> - ` ` ` <nl> - git clone https : / / github . com / raspberrypi / firmware - - depth = 1 <nl> - ` ` ` <nl> - <nl> - * * [ back to top ] ( # table - of - contents ) * * <nl> - <nl> - # # 4 . Build tools and dependencies <nl> - Create target directory : <nl> - ` ` ` <nl> - mkdir $ HOME / kodi - rpi <nl> - ` ` ` <nl> - <nl> - Prepare to configure build : <nl> - ` ` ` <nl> - cd $ HOME / kodi / tools / depends <nl> - . / bootstrap <nl> - ` ` ` <nl> - <nl> - * * TIP : * * Look for comments starting with ` Or . . . ` and only execute the command ( s ) you need . <nl> - <nl> - Configure build for Raspberry Pi 1 : <nl> - ` ` ` <nl> - . / configure - - host = arm - linux - gnueabihf - - prefix = $ HOME / kodi - rpi - - with - toolchain = $ HOME / tools / arm - bcm2708 / arm - rpi - 4 . 9 . 3 - linux - gnueabihf - - with - firmware = $ HOME / firmware - - with - platform = raspberry - pi - - disable - debug <nl> - ` ` ` <nl> - <nl> - Or configure build for Raspberry Pi 2 and 3 : <nl> - ` ` ` <nl> - . / configure - - host = arm - linux - gnueabihf - - prefix = $ HOME / kodi - rpi - - with - toolchain = $ HOME / tools / arm - bcm2708 / arm - rpi - 4 . 9 . 3 - linux - gnueabihf - - with - firmware = $ HOME / firmware - - with - platform = raspberry - pi2 - - disable - debug <nl> - ` ` ` <nl> - <nl> - Build tools and dependencies : <nl> - ` ` ` <nl> - make - j $ ( getconf _NPROCESSORS_ONLN ) <nl> - ` ` ` <nl> - <nl> - * * TIP : * * By adding ` - j < number > ` to the make command , you can choose how many concurrent jobs will be used and expedite the build process . It is recommended to use ` - j $ ( getconf _NPROCESSORS_ONLN ) ` to compile on all available processor cores . The build machine can also be configured to do this automatically by adding ` export MAKEFLAGS = " - j $ ( getconf _NPROCESSORS_ONLN ) " ` to your shell config ( e . g . ` ~ / . bashrc ` ) . <nl> - <nl> - * * [ back to top ] ( # table - of - contents ) * * | * * [ back to section top ] ( # 4 - build - tools - and - dependencies ) * * <nl> - <nl> - # # 5 . Build Kodi <nl> - Configure CMake build : <nl> - ` ` ` <nl> - cd $ HOME / kodi <nl> - make - C tools / depends / target / cmakebuildsys <nl> - ` ` ` <nl> - <nl> - * * TIP : * * BUILD_DIR can be provided as an argument to cmakebuildsys . This allows you to provide an alternate build location . Change all paths onwards as required if BUILD_DIR option used . <nl> - ` ` ` <nl> - mkdir $ HOME / kodi - build <nl> - make - C tools / depends / target / cmakebuildsys BUILD_DIR = $ HOME / kodi - build <nl> - ` ` ` <nl> - <nl> - Build Kodi : <nl> - ` ` ` <nl> - cd $ HOME / kodi / build <nl> - make - j $ ( getconf _NPROCESSORS_ONLN ) <nl> - ` ` ` <nl> - <nl> - Install to target directory : <nl> - ` ` ` <nl> - make install <nl> - ` ` ` <nl> - <nl> - After the build process is finished , you can find the files ready to be installed inside ` $ HOME / kodi - rpi ` . Look for a directory called ` raspberry - pi - release ` or ` raspberry - pi2 - release ` . <nl> - <nl> - * * [ back to top ] ( # table - of - contents ) * * <nl> - <nl> - <nl> - # # 6 . Docker <nl> - <nl> - If you encounter issues with the previous instructions , or if you don ' t have a proper system for cross - compiling Kodi , it ' s also possible to use a [ Docker ] ( https : / / www . docker . com / ) image to perform the build . This method , although it should work just like the build instructions mentioned above , is * * not * * supported . Therefore , issues related specifically to Docker should * * not * * be opened . <nl> - <nl> - Here is an example Dockerfile , summarizing basically all the instructions described above ( / ! \ may not be up to date with the actual instructions ! ) . * * Please read the comments as they describe things you NEED to change and / or consider before building . * * <nl> - <nl> - ` ` ` Dockerfile <nl> - # Change ' latest ' to the officially supported version of Ubuntu for cross - compilation <nl> - FROM ubuntu : latest <nl> - <nl> - RUN apt - get update & & apt - get upgrade - y <nl> - RUN apt - get - y install autoconf bison build - essential curl default - jdk gawk git gperf libcurl4 - openssl - dev zlib1g - dev file <nl> - <nl> - # The ' HOME ' variable doesn ' t really matter - it is only the location of the files within the image <nl> - ARG HOME = / home / pi <nl> - # This is the location kodi will be built for , that means you will have to put the built files in <nl> - # this directory afterwards . It is important because many paths end up hardcoded during the build . <nl> - ARG PREFIX = / opt / kodi <nl> - <nl> - RUN mkdir $ PREFIX <nl> - WORKDIR $ HOME <nl> - <nl> - # Replace ' master ' with whichever branch / tag you wish to build - be careful with nightly builds ! <nl> - RUN git clone - b master https : / / github . com / xbmc / xbmc kodi - - depth 1 <nl> - RUN git clone https : / / github . com / raspberrypi / tools - - depth = 1 <nl> - RUN git clone https : / / github . com / raspberrypi / firmware - - depth = 1 <nl> - <nl> - WORKDIR $ HOME / kodi / tools / depends <nl> - RUN . / bootstrap <nl> - <nl> - # Change this if you ' re building on a RPi1 , as described above <nl> - RUN . / configure - - host = arm - linux - gnueabihf - - prefix = $ PREFIX - - with - toolchain = $ HOME / tools / arm - bcm2708 / arm - rpi - 4 . 9 . 3 - linux - gnueabihf - - with - firmware = $ HOME / firmware - - with - platform = raspberry - pi2 - - disable - debug <nl> - <nl> - RUN make - j $ ( getconf _NPROCESSORS_ONLN ) <nl> - <nl> - WORKDIR $ HOME / kodi <nl> - # This step builds all the binary addons . <nl> - # Kodi - at its core - works fine without them , however they are used by many other addons . <nl> - # Therefore , it is recommended to simply compile all of them . <nl> - RUN make - j $ ( getconf _NPROCESSORS_ONLN ) - C tools / depends / target / binary - addons <nl> - RUN make - C tools / depends / target / cmakebuildsys <nl> - <nl> - WORKDIR $ HOME / kodi / build <nl> - RUN make - j $ ( getconf _NPROCESSORS_ONLN ) <nl> - <nl> - RUN make install <nl> - RUN tar zfc / kodi . tar . gz $ PREFIX <nl> - ` ` ` <nl> - <nl> - You can then build the image , and afterwards retrieve the build files from a dummy container : <nl> - <nl> - ` ` ` bash <nl> - docker build - t kodi_build . <nl> - docker run - - name some - temp - container - name kodi_build / bin / bash <nl> - docker cp some - temp - container - name : / kodi . tar . gz . / <nl> - docker rm some - temp - container - name <nl> - ` ` ` <nl> - <nl> - You should now have a file ` kodi . tar . gz ` in your current directory . Now you need to uncompress this file in the ` $ PREFIX ` directory ( as mentioned in the Dockerfile ) of your Raspberry . Note that the archive contains multiple directories in its root , but only the ` raspberry - pi2 - release ` ( or ` raspberry - pi - release ` ) is needed , so you can delete the others safely . If you encounter problems , please take a look at the [ Troubleshooting ] ( # 7 - troubleshooting ) section below before filing an issue . <nl> - <nl> - * * [ back to top ] ( # table - of - contents ) * * <nl> - <nl> - # # 7 . Troubleshooting <nl> - <nl> - # # # 7 . 1 ImportError : No module named \ _sysconfigdata \ _nd <nl> - <nl> - This is caused by an issue with a python package . The solution is to simply add a missing symlink so the library can be found , i . e . : <nl> - <nl> - ` ` ` bash <nl> - ln - s / usr / lib / python2 . 7 / plat - arm - linux - gnueabihf / _sysconfigdata_nd . py / usr / lib / python2 . 7 / <nl> - ` ` ` <nl> - <nl> - # # # 7 . 2 Errors connecting to any internet ( TLS ) service <nl> - <nl> - First , you should enable debug logging ( instructions [ here ] ( https : / / kodi . wiki / view / Log_file ) ) . Then you need to check the logs and find what the source of your problem is . If , when trying to access TLS services ( e . g . when installing an addon ) , the connection fails and your log contains entries such as : <nl> - <nl> - ` ` ` log <nl> - # note that those logs appear when enabling component - specific logs - > libcurl <nl> - 2019 - 05 - 19 17 : 18 : 39 . 570 T : 1854288832 DEBUG : Curl : : Debug - TEXT : SSL certificate problem : unable to get local issuer certificate <nl> - 2019 - 05 - 19 17 : 18 : 39 . 570 T : 1854288832 DEBUG : Curl : : Debug - TEXT : Closing connection 0 <nl> - <nl> - # this is part of the regular Kodi logs <nl> - 2019 - 05 - 19 17 : 18 : 39 . 570 T : 1854288832 ERROR : CCurlFile : : FillBuffer - Failed : Peer certificate cannot be authenticated with given CA certificates ( 60 ) <nl> - ` ` ` <nl> - <nl> - Then , you need to define the environment variable ` SSL_CERT_FILE ` so it points to your system ' s certificate file . Depending on how you start Kodi , putting this line in your in your ` . profile ` file should fix this issue : <nl> - <nl> - ` ` ` bash <nl> - export SSL_CERT_FILE = / etc / ssl / certs / ca - certificates . crt <nl> - ` ` ` <nl> - <nl> - Note that you need to define this variable * before * starting Kodi . For example , if you start Kodi on startup through a crontab , your ` . profile ` will * not * be sourced . <nl> - <nl> - * * [ back to top ] ( # table - of - contents ) * * <nl> + The Raspberry Pi platform has been merged into the GBM build . See [ README . Linux . md ] ( README . Linux . md ) . <nl> mmm a / docs / README . md <nl> ppp b / docs / README . md <nl> Kodi uses CMake as its building system but instructions are highly dependent on <nl> < a href = " README . Linux . md " title = " Linux " > < img src = " resources / linux . svg " height = " 78 " > < / a > <nl> < a href = " README . macOS . md " title = " macOS " > < img src = " resources / macos . svg " height = " 78 " > < / a > <nl> < a href = " README . openSUSE . md " title = " openSUSE " > < img src = " resources / opensuse . svg " height = " 78 " > < / a > <nl> - < a href = " README . RaspberryPi . md " title = " Raspberry Pi " > < img src = " resources / raspberrypi . svg " height = " 78 " > < / a > <nl> < a href = " README . tvOS . md " title = " tvOS " > < img src = " resources / tvos . svg " height = " 78 " > < / a > <nl> < a href = " README . Ubuntu . md " title = " Ubuntu " > < img src = " resources / ubuntu . svg " height = " 78 " > < / a > <nl> < a href = " README . Windows . md " title = " Windows " > < img src = " resources / windows . svg " height = " 78 " > < / a > <nl> deleted file mode 100644 <nl> index b1121fb85f5e . . 000000000000 <nl> mmm a / docs / resources / raspberrypi . svg <nl> ppp / dev / null <nl> <nl> - < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> - < ! - - Created with Inkscape ( http : / / www . inkscape . org / ) - - > <nl> - < svg width = " 100 " height = " 100 " version = " 1 . 1 " viewBox = " 0 0 26 . 458333 26 . 458334 " xmlns = " http : / / www . w3 . org / 2000 / svg " xmlns : cc = " http : / / creativecommons . org / ns # " xmlns : dc = " http : / / purl . org / dc / elements / 1 . 1 / " xmlns : rdf = " http : / / www . w3 . org / 1999 / 02 / 22 - rdf - syntax - ns # " > <nl> - < metadata > <nl> - < rdf : RDF > <nl> - < cc : Work rdf : about = " " > <nl> - < dc : format > image / svg + xml < / dc : format > <nl> - < dc : type rdf : resource = " http : / / purl . org / dc / dcmitype / StillImage " / > <nl> - < dc : title / > <nl> - < / cc : Work > <nl> - < / rdf : RDF > <nl> - < / metadata > <nl> - < rect x = " - 1 . 4211e - 14 " y = " 8 . 5449e - 6 " width = " 26 . 458 " height = " 26 . 458 " fill = " # c51a4a " stroke - width = " . 27763 " / > <nl> - < path d = " m9 . 9286 3 . 97c - 0 . 093646 3e - 3 - 0 . 19449 0 . 0375 - 0 . 30893 0 . 12775 - 0 . 2802 - 0 . 10803 - 0 . 55196 - 0 . 14559 - 0 . 79495 0 . 0744 - 0 . 37521 - 0 . 0487 - 0 . 49712 0 . 0518 - 0 . 58952 0 . 16905 - 0 . 082373 - 2e - 3 - 0 . 61632 - 0 . 0847 - 0 . 86123 0 . 2806 - 0 . 61536 - 0 . 0728 - 0 . 80985 0 . 36195 - 0 . 58947 0 . 76742 - 0 . 12571 0 . 19454 - 0 . 25596 0 . 38676 0 . 037957 0 . 75772 - 0 . 10396 0 . 20656 - 0 . 039487 0 . 43068 0 . 20542 0 . 70187 - 0 . 06464 0 . 29046 0 . 062431 0 . 49532 0 . 29034 0 . 65502 - 0 . 042659 0 . 39742 0 . 36444 0 . 6285 0 . 48596 0 . 71082 0 . 046682 0 . 23154 0 . 14395 0 . 4501 0 . 6089 0 . 57089 0 . 076707 0 . 34512 0 . 35612 0 . 40472 0 . 62675 0 . 47713 - 0 . 89437 0 . 5199 - 1 . 6613 1 . 2039 - 1 . 6561 2 . 8822l - 0 . 13104 0 . 2337c - 1 . 0255 0 . 62363 - 1 . 9482 2 . 6281 - 0 . 50534 4 . 2573 0 . 094213 0 . 50999 0 . 25227 0 . 8763 0 . 393 1 . 2817 0 . 21046 1 . 6336 1 . 5841 2 . 3986 1 . 9465 2 . 4891 0 . 53089 0 . 40438 1 . 0963 0 . 78809 1 . 8615 1 . 0569 0 . 7213 0 . 7439 1 . 5028 1 . 0274 2 . 2885 1 . 027 0 . 01156 0 1 . 602 - 0 . 28303 2 . 3233 - 1 . 027 0 . 76515 - 0 . 26882 1 . 3306 - 0 . 65253 1 . 8615 - 1 . 0569 0 . 36229 - 0 . 0905 1 . 7359 - 0 . 85546 1 . 9464 - 2 . 4891 0 . 14072 - 0 . 40541 0 . 29878 - 0 . 77172 0 . 39306 - 1 . 2817 1 . 4427 - 1 . 6294 0 . 52012 - 3 . 6339 - 0 . 5054 - 4 . 2576l - 0 . 13121 - 0 . 23369c0 . 0052 - 1 . 6782 - 0 . 76175 - 2 . 3622 - 1 . 6561 - 2 . 8822 0 . 27057 - 0 . 0724 0 . 55004 - 0 . 132 0 . 62669 - 0 . 47713 0 . 46495 - 0 . 12084 0 . 56228 - 0 . 33935 0 . 6089 - 0 . 57089 0 . 12158 - 0 . 0823 0 . 52862 - 0 . 3134 0 . 48602 - 0 . 71082 0 . 22786 - 0 . 1597 0 . 35493 - 0 . 36461 0 . 29029 - 0 . 65501 0 . 24496 - 0 . 2712 0 . 30938 - 0 . 49532 0 . 20542 - 0 . 70193 0 . 29397 - 0 . 37073 0 . 16356 - 0 . 56296 0 . 03801 - 0 . 7575 0 . 22026 - 0 . 40546 0 . 02589 - 0 . 84027 - 0 . 5897 - 0 . 76742 - 0 . 2448 - 0 . 36529 - 0 . 77863 - 0 . 28235 - 0 . 86123 - 0 . 28065 - 0 . 09234 - 0 . 11722 - 0 . 21426 - 0 . 21766 - 0 . 58947 - 0 . 169 - 0 . 24298 - 0 . 21998 - 0 . 51469 - 0 . 18247 - 0 . 79495 - 0 . 0744 - 0 . 33278 - 0 . 26259 - 0 . 55298 - 0 . 0521 - 0 . 80452 0 . 0275 - 0 . 40286 - 0 . 13166 - 0 . 49503 0 . 0487 - 0 . 69297 0 . 12215 - 0 . 4394 - 0 . 0929 - 0 . 57293 0 . 10928 - 0 . 78356 0 . 32263l - 0 . 24502 - 5e - 3c - 0 . 66272 0 . 39056 - 0 . 99198 1 . 1858 - 1 . 1087 1 . 5947 - 0 . 11676 - 0 . 40891 - 0 . 44523 - 1 . 2042 - 1 . 1078 - 1 . 5947l - 0 . 24502 5e - 3c - 0 . 21092 - 0 . 21335 - 0 . 34439 - 0 . 41549 - 0 . 78379 - 0 . 32263 - 0 . 198 - 0 . 0735 - 0 . 28983 - 0 . 25381 - 0 . 69303 - 0 . 12215 - 0 . 16508 - 0 . 0522 - 0 . 31691 - 0 . 16078 - 0 . 49565 - 0 . 15522l - 4 . 5488 7 . 9878 " fill = " # ffffff " stroke - width = " . 056652 " / > <nl> - < g transform = " translate ( 0 , - 270 . 54 ) " fill = " # c51a4a " stroke - width = " . 056652 " > <nl> - < path d = " m8 . 6091 276 . 23c1 . 7583 0 . 9065 2 . 7804 1 . 6398 3 . 3405 2 . 2643 - 0 . 28678 1 . 1494 - 1 . 7829 1 . 2019 - 2 . 3299 1 . 1696 0 . 112 - 0 . 0521 0 . 20548 - 0 . 1146 0 . 23862 - 0 . 21052 - 0 . 13727 - 0 . 0976 - 0 . 62397 - 0 . 0103 - 0 . 96377 - 0 . 20117 0 . 13053 - 0 . 0271 0 . 1916 - 0 . 0534 0 . 25261 - 0 . 14973 - 0 . 32099 - 0 . 10237 - 0 . 6668 - 0 . 19064 - 0 . 87018 - 0 . 36026 0 . 10974 1e - 3 0 . 21222 0 . 0246 0 . 35555 - 0 . 0748 - 0 . 28751 - 0 . 15495 - 0 . 59434 - 0 . 27777 - 0 . 83273 - 0 . 51464 0 . 14866 - 4e - 3 0 . 30893 - 1e - 3 0 . 35555 - 0 . 0561 - 0 . 26315 - 0 . 16305 - 0 . 48523 - 0 . 34433 - 0 . 66901 - 0 . 54267 0 . 20803 0 . 0251 0 . 2959 4e - 3 0 . 3462 - 0 . 0328 - 0 . 19896 - 0 . 20378 - 0 . 45073 - 0 . 37583 - 0 . 57077 - 0 . 62692 0 . 15443 0 . 0533 0 . 29578 0 . 0736 0 . 39764 - 5e - 3 - 0 . 067586 - 0 . 15251 - 0 . 35719 - 0 . 24248 - 0 . 52398 - 0 . 59888 0 . 16265 0 . 0158 0 . 3351 0 . 0355 0 . 3696 0 - 0 . 075461 - 0 . 30751 - 0 . 20497 - 0 . 48041 - 0 . 33198 - 0 . 65955 0 . 34802 - 5e - 3 0 . 87534 1e - 3 0 . 85149 - 0 . 028l - 0 . 21522 - 0 . 21987c0 . 33997 - 0 . 0915 0 . 68782 0 . 0147 0 . 94037 0 . 0935 0 . 11336 - 0 . 0895 - 0 . 00204 - 0 . 20259 - 0 . 14038 - 0 . 31811 0 . 28893 0 . 0386 0 . 54998 0 . 10498 0 . 786 0 . 19647 0 . 12605 - 0 . 11381 - 0 . 081863 - 0 . 22768 - 0 . 18248 - 0 . 3415 0 . 44636 0 . 0846 0 . 63547 0 . 20367 0 . 82339 0 . 32281 0 . 13636 - 0 . 1307 0 . 0078 - 0 . 2418 - 0 . 084185 - 0 . 35555 0 . 33657 0 . 12463 0 . 50993 0 . 28558 0 . 6924 0 . 44444 0 . 06186 - 0 . 0835 0 . 15721 - 0 . 14475 0 . 04209 - 0 . 34621 0 . 23896 0 . 13772 0 . 41894 0 . 30003 0 . 55208 0 . 48189 0 . 14786 - 0 . 0942 0 . 08809 - 0 . 22287 0 . 08889 - 0 . 34156 0 . 24836 0 . 20202 0 . 40597 0 . 41702 0 . 59887 0 . 62692 0 . 03886 - 0 . 0283 0 . 07286 - 0 . 12424 0 . 10294 - 0 . 27601 0 . 59241 0 . 57474 1 . 4296 2 . 0225 0 . 21516 2 . 5965 - 1 . 0335 - 0 . 8524 - 2 . 2679 - 1 . 472 - 3 . 6357 - 1 . 9368l3 . 966e - 4 - 2 . 3e - 4 " / > <nl> - < path d = " m17 . 939 276 . 23c - 1 . 758 0 . 90661 - 2 . 7802 1 . 6397 - 3 . 3402 2 . 2643 0 . 28678 1 . 1494 1 . 7828 1 . 2019 2 . 3298 1 . 1696 - 0 . 112 - 0 . 0521 - 0 . 20548 - 0 . 1146 - 0 . 23856 - 0 . 21052 0 . 13727 - 0 . 0976 0 . 62397 - 0 . 0103 0 . 96371 - 0 . 20117 - 0 . 13053 - 0 . 0271 - 0 . 19154 - 0 . 0534 - 0 . 25261 - 0 . 14973 0 . 32105 - 0 . 10237 0 . 66686 - 0 . 19064 0 . 87018 - 0 . 36026 - 0 . 10974 1e - 3 - 0 . 21222 0 . 0246 - 0 . 35555 - 0 . 0748 0 . 28757 - 0 . 15495 0 . 5944 - 0 . 27777 0 . 83279 - 0 . 51464 - 0 . 14871 - 4e - 3 - 0 . 30898 - 1e - 3 - 0 . 35555 - 0 . 0561 0 . 26315 - 0 . 16305 0 . 48523 - 0 . 34433 0 . 66901 - 0 . 54267 - 0 . 20808 0 . 0251 - 0 . 2959 4e - 3 - 0 . 3462 - 0 . 0328 0 . 19891 - 0 . 20378 0 . 45073 - 0 . 37583 0 . 57077 - 0 . 62692 - 0 . 15449 0 . 0533 - 0 . 29584 0 . 0736 - 0 . 3977 - 5e - 3 0 . 06759 - 0 . 15251 0 . 35725 - 0 . 24248 0 . 52398 - 0 . 59888 - 0 . 16259 0 . 0158 - 0 . 3351 0 . 0355 - 0 . 3696 0 0 . 07563 - 0 . 30762 0 . 20514 - 0 . 48052 0 . 33215 - 0 . 65966 - 0 . 34802 - 5e - 3 - 0 . 87534 1e - 3 - 0 . 85149 - 0 . 028l0 . 21522 - 0 . 21993c - 0 . 33997 - 0 . 0915 - 0 . 68782 0 . 0147 - 0 . 94037 0 . 0936 - 0 . 11336 - 0 . 0894 2e - 3 - 0 . 20259 0 . 14033 - 0 . 3181 - 0 . 28887 0 . 0385 - 0 . 54998 0 . 10498 - 0 . 78594 0 . 19647 - 0 . 12611 - 0 . 11382 0 . 08186 - 0 . 22769 0 . 18248 - 0 . 3415 - 0 . 44636 0 . 0846 - 0 . 63547 0 . 20366 - 0 . 82344 0 . 3228 - 0 . 13636 - 0 . 13069 - 0 . 0078 - 0 . 24179 0 . 08424 - 0 . 35555 - 0 . 33657 0 . 12464 - 0 . 50993 0 . 28559 - 0 . 6924 0 . 44444 - 0 . 06192 - 0 . 0835 - 0 . 15721 - 0 . 14474 - 0 . 04215 - 0 . 3462 - 0 . 2389 0 . 13772 - 0 . 41889 0 . 30003 - 0 . 55202 0 . 48189 - 0 . 14786 - 0 . 0942 - 0 . 08809 - 0 . 22293 - 0 . 08889 - 0 . 34156 - 0 . 24836 0 . 20202 - 0 . 40597 0 . 41696 - 0 . 59887 0 . 62691 - 0 . 03886 - 0 . 0283 - 0 . 07286 - 0 . 12423 - 0 . 10294 - 0 . 27606 - 0 . 59241 0 . 57479 - 1 . 4296 2 . 0226 - 0 . 21516 2 . 5966 1 . 0329 - 0 . 85262 2 . 2672 - 1 . 4721 3 . 6352 - 1 . 9369h - 2 . 26e - 4 " / > <nl> - < path d = " m15 . 403 287 . 93c0 . 0061 1 . 0726 - 0 . 93188 1 . 9467 - 2 . 095 1 . 9523 - 1 . 1632 6e - 3 - 2 . 1111 - 0 . 85924 - 2 . 1172 - 1 . 9318 - 5 . 6e - 5 - 7e - 3 - 5 . 6e - 5 - 0 . 0136 0 - 0 . 0204 - 0 . 0061 - 1 . 0726 0 . 93182 - 1 . 9466 2 . 095 - 1 . 9523 1 . 1632 - 6e - 3 2 . 111 0 . 85925 2 . 1172 1 . 9318v0 . 0205 " / > <nl> - < path d = " m12 . 078 282 . 39c0 . 87267 0 . 5718 1 . 03 1 . 8678 0 . 35136 2 . 8947s - 1 . 9362 1 . 396 - 2 . 8089 0 . 82423c - 0 . 87267 - 0 . 57179 - 1 . 0299 - 1 . 8678 - 0 . 35136 - 2 . 8947 0 . 67864 - 1 . 0269 1 . 9362 - 1 . 396 2 . 8089 - 0 . 82424 " / > <nl> - < path d = " m14 . 434 282 . 28c - 0 . 87262 0 . 57174 - 1 . 0299 1 . 8678 - 0 . 35136 2 . 8947 0 . 67864 1 . 0269 1 . 9362 1 . 396 2 . 8089 0 . 82418 0 . 87267 - 0 . 57174 1 . 03 - 1 . 8677 0 . 35136 - 2 . 8947 - 0 . 67858 - 1 . 0269 - 1 . 9362 - 1 . 3959 - 2 . 8089 - 0 . 82418 " / > <nl> - < path d = " m7 . 7169 283 . 32c0 . 94219 - 0 . 25256 0 . 3181 3 . 8979 - 0 . 44852 3 . 5573 - 0 . 84327 - 0 . 67825 - 1 . 1149 - 2 . 6645 0 . 44852 - 3 . 5573 " / > <nl> - < path d = " m18 . 605 283 . 27c - 0 . 9423 - 0 . 2525 - 0 . 3181 3 . 8981 0 . 44852 3 . 5576 0 . 84327 - 0 . 6783 1 . 1149 - 2 . 6648 - 0 . 44852 - 3 . 5576 " / > <nl> - < path d = " m15 . 404 280 . 18c1 . 626 - 0 . 27454 2 . 979 0 . 6915 2 . 9243 2 . 4546 - 0 . 05348 0 . 67598 - 3 . 5234 - 2 . 354 - 2 . 9243 - 2 . 4546 " / > <nl> - < path d = " m10 . 911 280 . 13c - 1 . 6261 - 0 . 2746 - 2 . 979 0 . 69167 - 2 . 9243 2 . 4547 0 . 05348 0 . 67592 3 . 5234 - 2 . 354 2 . 9243 - 2 . 4547 " / > <nl> - < path d = " m13 . 247 279 . 71c - 0 . 97046 - 0 . 0253 - 1 . 9018 0 . 72023 - 1 . 9041 1 . 1527 - 0 . 0027 0 . 52539 0 . 7673 1 . 0634 1 . 9107 1 . 077 1 . 1676 8e - 3 1 . 9127 - 0 . 43062 1 . 9164 - 0 . 97284 0 . 0043 - 0 . 61434 - 1 . 0619 - 1 . 2664 - 1 . 9231 - 1 . 2569v5e - 5 " / > <nl> - < path d = " m13 . 306 290 . 49c0 . 8461 - 0 . 0369 1 . 9814 0 . 2725 1 . 9837 0 . 68306 0 . 01405 0 . 39861 - 1 . 0297 1 . 2993 - 2 . 0398 1 . 2819 - 1 . 0461 0 . 0451 - 2 . 0719 - 0 . 85693 - 2 . 0585 - 1 . 1696 - 0 . 01569 - 0 . 45843 1 . 2738 - 0 . 81636 2 . 1146 - 0 . 79534 " / > <nl> - < path d = " m10 . 181 288 . 06c0 . 60238 0 . 72572 0 . 87704 2 . 0008 0 . 3743 2 . 3766 - 0 . 4756 0 . 28694 - 1 . 6306 0 . 16876 - 2 . 4515 - 1 . 0106 - 0 . 55366 - 0 . 98961 - 0 . 48234 - 1 . 9966 - 0 . 09359 - 2 . 2924 0 . 58131 - 0 . 35408 1 . 4795 0 . 12424 2 . 1708 0 . 92638h - 5 . 7e - 5 " / > <nl> - < path d = " m16 . 311 287 . 83c - 0 . 65179 0 . 76339 - 1 . 0147 2 . 1558 - 0 . 53927 2 . 6043 0 . 45464 0 . 34841 1 . 675 0 . 29969 2 . 5765 - 0 . 95114 0 . 65456 - 0 . 8401 0 . 43526 - 2 . 2431 0 . 06135 - 2 . 6156 - 0 . 55542 - 0 . 4296 - 1 . 3528 0 . 12022 - 2 . 0986 0 . 9623v2 . 3e - 4 " / > <nl> - < / g > <nl> - < / svg > <nl> deleted file mode 100644 <nl> index f6c228253d7d . . 000000000000 <nl> mmm a / system / settings / rbp . xml <nl> ppp / dev / null <nl> <nl> - < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> - < settings version = " 1 " > <nl> - < section id = " player " > <nl> - < category id = " videoplayer " > <nl> - < group id = " 3 " > <nl> - < setting id = " videoplayer . rendermethod " > <nl> - < visible > false < / visible > <nl> - < / setting > <nl> - < setting id = " videoplayer . hqscalers " > <nl> - < visible > false < / visible > <nl> - < / setting > <nl> - < setting id = " videoplayer . usemmal " type = " boolean " label = " 36434 " help = " 36435 " > <nl> - < level > 2 < / level > <nl> - < default > true < / default > <nl> - < control type = " toggle " / > <nl> - < / setting > <nl> - < setting id = " videoplayer . limitguiupdate " type = " integer " label = " 38013 " help = " 38014 " > <nl> - < level > 2 < / level > <nl> - < default > 10 < / default > <nl> - < constraints > <nl> - < minimum label = " 38015 " > 0 < / minimum > < ! - - Unlimited - - > <nl> - < step > 5 < / step > <nl> - < maximum > 25 < / maximum > <nl> - < / constraints > <nl> - < control type = " spinner " format = " string " > <nl> - < formatlabel > 38016 < / formatlabel > <nl> - < / control > <nl> - < control type = " edit " format = " integer " / > <nl> - < / setting > <nl> - < / group > <nl> - < group id = " 4 " > <nl> - < setting id = " videoplayer . supportmvc " type = " boolean " label = " 38027 " help = " 38028 " > <nl> - < level > 2 < / level > <nl> - < default > true < / default > <nl> - < control type = " toggle " / > <nl> - < / setting > <nl> - < / group > <nl> - < / category > <nl> - < / section > <nl> - < section id = " media " > <nl> - < category id = " video " > <nl> - < group id = " 1 " > <nl> - < setting id = " myvideos . extractchapterthumbs " > <nl> - < default > false < / default > <nl> - < / setting > <nl> - < / group > <nl> - < / category > <nl> - < / section > <nl> - < section id = " system " > <nl> - < category id = " display " > <nl> - < group id = " 1 " > <nl> - < setting id = " videoscreen . screen " > <nl> - < visible > false < / visible > <nl> - < / setting > <nl> - < setting id = " videoscreen . blankdisplays " > <nl> - < visible > false < / visible > <nl> - < / setting > <nl> - < setting id = " videoscreen . fakefullscreen " > <nl> - < visible > false < / visible > <nl> - < / setting > <nl> - < setting id = " videoscreen . textures32 " type = " boolean " label = " 37020 " help = " 36547 " > <nl> - < level > 2 < / level > <nl> - < default > false < / default > <nl> - < control type = " toggle " / > <nl> - < / setting > <nl> - < setting id = " videoscreen . limitgui " type = " integer " label = " 37021 " help = " 36548 " > <nl> - < level > 2 < / level > <nl> - < default > 0 < / default > <nl> - < constraints > <nl> - < options > <nl> - < option label = " 37026 " > 0 < / option > < ! - - auto - - > <nl> - < option label = " 37027 " > 540 < / option > < ! - - 540 - - > <nl> - < option label = " 37028 " > 720 < / option > < ! - - 720 - - > <nl> - < option label = " 37029 " > 900 < / option > < ! - - 900 - - > <nl> - < option label = " 37030 " > 1080 < / option > < ! - - unlimited - - > <nl> - < / options > <nl> - < / constraints > <nl> - < control type = " spinner " format = " string " / > <nl> - < control type = " edit " format = " integer " / > <nl> - < / setting > <nl> - < / group > <nl> - < group id = " 2 " > <nl> - < setting id = " videoscreen . framepacking " type = " boolean " label = " 38029 " help = " 38030 " > <nl> - < level > 2 < / level > <nl> - < default > false < / default > <nl> - < control type = " toggle " / > <nl> - < / setting > <nl> - < / group > <nl> - < / category > <nl> - < category id = " audio " > <nl> - < group id = " 1 " > <nl> - < setting id = " audiooutput . processquality " > <nl> - < default > 101 < / default > < ! - - AE_QUALITY_GPU - - > <nl> - < / setting > <nl> - < setting id = " audiooutput . atempothreshold " > <nl> - < default > 100 < / default > < ! - - disabled - - > <nl> - < / setting > <nl> - < setting id = " audiooutput . audiodevice " > <nl> - < default > PI : HDMI < / default > <nl> - < / setting > <nl> - < / group > <nl> - < group id = " 3 " > <nl> - < setting id = " audiooutput . ac3transcode " help = " 37024 " > <nl> - < / setting > <nl> - < / group > <nl> - < / category > <nl> - < category id = " input " > <nl> - < group id = " 4 " label = " 35150 " > <nl> - < setting id = " input . libinputkeyboardlayout " type = " string " label = " 310 " help = " 36436 " > <nl> - < level > 0 < / level > <nl> - < default > us < / default > <nl> - < visible > true < / visible > <nl> - < constraints > <nl> - < options > libinputkeyboardlayout < / options > <nl> - < / constraints > <nl> - < control type = " list " format = " string " > <nl> - < multiselect > false < / multiselect > <nl> - < / control > <nl> - < / setting > <nl> - < / group > <nl> - < / category > <nl> - < / section > <nl> - < / settings > <nl> deleted file mode 100644 <nl> index 44a982453dc6 . . 000000000000 <nl> mmm a / system / settings / rbp2 . xml <nl> ppp / dev / null <nl> <nl> - < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> - < settings version = " 1 " > <nl> - < section id = " system " > <nl> - < category id = " display " > <nl> - < group id = " 1 " > <nl> - < setting id = " videoscreen . textures32 " > <nl> - < default > true < / default > <nl> - < / setting > <nl> - < / group > <nl> - < / category > <nl> - < category id = " audio " > <nl> - < group id = " 1 " > <nl> - < setting id = " audiooutput . atempothreshold " > <nl> - < default > 2 < / default > < ! - - 2 % - - > <nl> - < / setting > <nl> - < / group > <nl> - < group id = " 3 " > <nl> - < setting id = " audiooutput . ac3transcode " help = " 36429 " > <nl> - < / setting > <nl> - < / group > <nl> - < group id = " 1 " > <nl> - < setting id = " audiooutput . processquality " > <nl> - < default > 30 < / default > < ! - - AE_QUALITY_MID - - > <nl> - < / setting > <nl> - < / group > <nl> - < / category > <nl> - < / section > <nl> - < / settings > <nl> mmm a / tools / buildsteps / defaultenv <nl> ppp b / tools / buildsteps / defaultenv <nl> case $ XBMC_PLATFORM_DIR in <nl> DEFAULT_CONFIGURATION = " Debug " <nl> ; ; <nl> <nl> - rbpi ) <nl> - JENKINS_RBPI_DEVENV = $ { JENKINS_RBPI_DEVENV : - " / home / jenkins / rbpi - dev " } <nl> - DEFAULT_XBMC_DEPENDS_ROOT = $ WORKSPACE / tools / depends / xbmc - depends <nl> - DEFAULT_CONFIGURATION = " Debug " <nl> - ; ; <nl> - <nl> freebsd ) <nl> DEFAULT_CONFIGURATION = " Debug " <nl> ; ; <nl> deleted file mode 100755 <nl> index 13d5ca27cbda . . 000000000000 <nl> mmm a / tools / buildsteps / rbpi / configure - depends <nl> ppp / dev / null <nl> <nl> - WORKSPACE = $ { WORKSPACE : - $ ( cd $ ( dirname $ 0 ) / . . / . . / . . ; pwd - P ) } <nl> - XBMC_PLATFORM_DIR = rbpi <nl> - . $ WORKSPACE / tools / buildsteps / defaultenv <nl> - <nl> - if [ " $ ( pathChanged $ WORKSPACE / tools / depends ) " = = " 1 " ] <nl> - then <nl> - cd $ WORKSPACE / tools / depends ; <nl> - <nl> - . / configure - - with - platform = raspberry - pi2 - - host = arm - linux - gnueabihf - - prefix = $ XBMC_DEPENDS_ROOT - - with - tarballs = $ TARBALLS \ <nl> - - - with - firmware = $ JENKINS_RBPI_DEVENV / firmware - - build = i686 - linux $ DEBUG_SWITCH \ <nl> - - - with - toolchain = $ JENKINS_RBPI_DEVENV / tools / arm - bcm2708 / arm - rpi - 4 . 9 . 3 - linux - gnueabihf <nl> - fi <nl> deleted file mode 100755 <nl> index 6dd54bf8451e . . 000000000000 <nl> mmm a / tools / buildsteps / rbpi / configure - xbmc <nl> ppp / dev / null <nl> <nl> - WORKSPACE = $ { WORKSPACE : - $ ( cd $ ( dirname $ 0 ) / . . / . . / . . ; pwd - P ) } <nl> - XBMC_PLATFORM_DIR = rbpi <nl> - . $ WORKSPACE / tools / buildsteps / defaultenv <nl> - <nl> - make - C $ WORKSPACE / tools / depends / target / cmakebuildsys <nl> deleted file mode 100755 <nl> index 862e7d79e916 . . 000000000000 <nl> mmm a / tools / buildsteps / rbpi / make - binary - addons <nl> ppp / dev / null <nl> <nl> - WORKSPACE = $ { WORKSPACE : - $ ( cd $ ( dirname $ 0 ) / . . / . . / . . ; pwd - P ) } <nl> - XBMC_PLATFORM_DIR = rbpi <nl> - . $ WORKSPACE / tools / buildsteps / defaultenv <nl> - <nl> - . $ WORKSPACE / tools / buildsteps / $ XBMC_PLATFORM_DIR / make - native - depends <nl> - <nl> - # clear the build failed file <nl> - rm - f $ WORKSPACE / cmake / $ FAILED_BUILD_FILENAME <nl> - <nl> - ALL_BINARY_ADDONS_BUILT = " 1 " <nl> - # only build binary addons when requested by env / jenkins <nl> - if [ " $ BUILD_BINARY_ADDONS " = = " true " ] <nl> - then <nl> - for addon in $ BINARY_ADDONS <nl> - do <nl> - echo " building $ addon " <nl> - git clean - xffd $ WORKSPACE / $ BINARY_ADDONS_ROOT / $ addon <nl> - cd $ WORKSPACE / $ BINARY_ADDONS_ROOT / $ addon ; make - j $ BUILDTHREADS V = 99 VERBOSE = 1 | | ALL_BINARY_ADDONS_BUILT = " 0 " <nl> - done <nl> - fi <nl> - <nl> - if [ " $ ALL_BINARY_ADDONS_BUILT " = = " 1 " ] <nl> - then <nl> - tagSuccessFulBuild $ WORKSPACE / cmake <nl> - else <nl> - # mark the build failure in the filesystem but leave jenkins running <nl> - tagFailedBuild $ WORKSPACE / cmake <nl> - fi <nl> deleted file mode 100755 <nl> index ceeee09234db . . 000000000000 <nl> mmm a / tools / buildsteps / rbpi / make - depends <nl> ppp / dev / null <nl> <nl> - WORKSPACE = $ { WORKSPACE : - $ ( cd $ ( dirname $ 0 ) / . . / . . / . . ; pwd - P ) } <nl> - XBMC_PLATFORM_DIR = rbpi <nl> - . $ WORKSPACE / tools / buildsteps / defaultenv <nl> - <nl> - if [ " $ ( pathChanged $ WORKSPACE / tools / depends ) " = = " 1 " ] <nl> - then <nl> - cd $ WORKSPACE / tools / depends ; make - j $ BUILDTHREADS | | make & & tagSuccessFulBuild $ WORKSPACE / tools / depends <nl> - fi <nl> - <nl> deleted file mode 100755 <nl> index d4d9e7dbe113 . . 000000000000 <nl> mmm a / tools / buildsteps / rbpi / make - native - depends <nl> ppp / dev / null <nl> <nl> - WORKSPACE = $ { WORKSPACE : - $ ( cd $ ( dirname $ 0 ) / . . / . . / . . ; pwd - P ) } <nl> - XBMC_PLATFORM_DIR = rbpi <nl> - . $ WORKSPACE / tools / buildsteps / defaultenv <nl> - <nl> - if [ " $ ( pathChanged $ WORKSPACE / tools / depends ) " = = " 1 " ] & & [ " $ BINARY_ADDONS_CLEAN_NATIVETOOLS " ! = " 0 " ] <nl> - then <nl> - git clean - xffd $ WORKSPACE / tools / depends / native <nl> - cd $ WORKSPACE / tools / depends / native ; make - j $ BUILDTHREADS & & tagSuccessFulBuild $ WORKSPACE / tools / depends <nl> - fi <nl> \ No newline at end of file <nl> deleted file mode 100755 <nl> index 07cfae21c781 . . 000000000000 <nl> mmm a / tools / buildsteps / rbpi / make - xbmc <nl> ppp / dev / null <nl> <nl> - WORKSPACE = $ { WORKSPACE : - $ ( cd $ ( dirname $ 0 ) / . . / . . / . . ; pwd - P ) } <nl> - XBMC_PLATFORM_DIR = rbpi <nl> - . $ WORKSPACE / tools / buildsteps / defaultenv <nl> - <nl> - cd $ WORKSPACE / build ; make - j $ BUILDTHREADS | | make <nl> deleted file mode 100755 <nl> index f3c41a5c9606 . . 000000000000 <nl> mmm a / tools / buildsteps / rbpi / package <nl> ppp / dev / null <nl> <nl> - WORKSPACE = $ { WORKSPACE : - $ ( cd $ ( dirname $ 0 ) / . . / . . / . . ; pwd - P ) } <nl> - XBMC_PLATFORM_DIR = rbpi <nl> - . $ WORKSPACE / tools / buildsteps / defaultenv <nl> - <nl> - # nothing for rbpi atm <nl> deleted file mode 100755 <nl> index c38eb7790114 . . 000000000000 <nl> mmm a / tools / buildsteps / rbpi / prepare - depends <nl> ppp / dev / null <nl> <nl> - WORKSPACE = $ { WORKSPACE : - $ ( cd $ ( dirname $ 0 ) / . . / . . / . . ; pwd - P ) } <nl> - XBMC_PLATFORM_DIR = rbpi <nl> - . $ WORKSPACE / tools / buildsteps / defaultenv <nl> - <nl> - # clean without depends for skipping depends build if possible <nl> - # also skip binary addons ( pvr , audioencoder ) as long as they are deployed in tree <nl> - cd $ WORKSPACE ; git clean - xfd - e " cmake / . last_success_revision " - e " tools / depends " $ { DEPLOYED_BINARY_ADDONS } <nl> - <nl> - if [ - d $ JENKINS_RBPI_DEVENV / firmware ] <nl> - then <nl> - cd $ JENKINS_RBPI_DEVENV / firmware ; git pull origin master <nl> - else <nl> - cd $ JENKINS_RBPI_DEVENV ; git clone git : / / github . com / raspberrypi / firmware . git - - depth = 1 - b master <nl> - fi <nl> - <nl> - cd $ WORKSPACE <nl> - <nl> - # if depends path has changed - cleanout everything and do a full rebuild <nl> - if [ " $ ( pathChanged $ WORKSPACE / tools / depends ) " = = " 1 " ] <nl> - then <nl> - # clean up the rest too <nl> - cd $ WORKSPACE ; git clean - xffd <nl> - cd $ WORKSPACE / tools / depends / ; . / bootstrap <nl> - fi <nl> deleted file mode 100755 <nl> index 3957f5aab772 . . 000000000000 <nl> mmm a / tools / buildsteps / rbpi / prepare - xbmc <nl> ppp / dev / null <nl> <nl> - WORKSPACE = $ { WORKSPACE : - $ ( cd $ ( dirname $ 0 ) / . . / . . / . . ; pwd - P ) } <nl> - XBMC_PLATFORM_DIR = rbpi <nl> - . $ WORKSPACE / tools / buildsteps / defaultenv <nl> - <nl> - cd $ WORKSPACE <nl> - <nl> - # build binary addons before building xbmc . . . <nl> - # make sure that binary_addons don ' t clean the native tools <nl> - # here <nl> - BINARY_ADDONS_CLEAN_NATIVETOOLS = " 0 " <nl> - . $ WORKSPACE / tools / buildsteps / $ XBMC_PLATFORM_DIR / make - binary - addons <nl> mmm a / tools / depends / README . md <nl> ppp b / tools / depends / README . md <nl> Paths below are examples . If you want to build Kodi , follow our * * [ build guides ] <nl> # # # All platforms <nl> ` . / bootstrap ` <nl> # # # Darwin <nl> - * * macOS ( x86_64 ) * * <nl> + * * macOS ( x86_64 ) * * <nl> ` . / configure - - host = x86_64 - apple - darwin ` <nl> <nl> - * * iOS ( arm64 ) * * <nl> + * * iOS ( arm64 ) * * <nl> ` . / configure - - host = aarch64 - apple - darwin ` <nl> <nl> - * * tvOS * * <nl> + * * tvOS * * <nl> ` . / configure - - host = aarch64 - apple - darwin - - with - platform = tvos ` <nl> <nl> * * NOTE : * * You can target the same ` - - prefix = ` path . Each setup will be done in an isolated directory . The last configure / make you do is the one used for Kodi / Xcode . <nl> - <nl> + <nl> # # # Android <nl> - * * arm * * <nl> + * * arm * * <nl> ` . / configure - - with - tarballs = $ HOME / android - tools / xbmc - tarballs - - host = arm - linux - androideabi - - with - sdk - path = $ HOME / android - tools / android - sdk - linux - - with - ndk - path = $ HOME / android - tools / android - ndk - r20 - - prefix = $ HOME / android - tools / xbmc - depends ` <nl> <nl> - * * aarch64 * * <nl> + * * aarch64 * * <nl> ` . / configure - - with - tarballs = $ HOME / android - tools / xbmc - tarballs - - host = aarch64 - linux - android - - with - sdk - path = $ HOME / android - tools / android - sdk - linux - - with - ndk - path = $ HOME / android - tools / android - ndk - r20 - - prefix = $ HOME / android - tools / xbmc - depends ` <nl> <nl> - * * x86 * * <nl> + * * x86 * * <nl> ` . / configure - - with - tarballs = $ HOME / android - tools / xbmc - tarballs - - host = i686 - linux - android - - with - sdk - path = $ HOME / android - tools / android - sdk - linux - - with - ndk - path = $ HOME / android - tools / android - ndk - r20 - - prefix = $ HOME / android - tools / xbmc - depends ` <nl> <nl> * * x86_64 * * <nl> Paths below are examples . If you want to build Kodi , follow our * * [ build guides ] <nl> > * * Note : * * Android x86 and x86_64 are not maintained and are not 100 % sure that everything works correctly ! <nl> <nl> # # # Linux <nl> - * * ARM ( codesourcery / lenaro / etc ) * * <nl> + * * ARM ( codesourcery / lenaro / etc ) * * <nl> ` . / configure - - with - toolchain = / opt / toolchains / my - example - toolchain / - - prefix = / opt / xbmc - deps - - host = arm - linux - gnueabi ` <nl> <nl> - * * Raspberry Pi * * <nl> - ` . / configure - - with - platform = raspberry - pi - - host = arm - linux - gnueabihf - - prefix = / opt / xbmc - deps - - with - tarballs = / opt / xbmc - tarballs - - with - toolchain = / opt / rbp - dev / tools / arm - bcm2708 / arm - rpi - 4 . 9 . 3 - linux - gnueabihf - - with - firmware = / opt / rbp - dev / firmware - - build = i686 - linux ` <nl> - <nl> - * * Native * * <nl> + * * Native * * <nl> ` . / configure - - with - toolchain = / usr - - prefix = / opt / xbmc - deps - - host = x86_64 - linux - gnu ` <nl> <nl> Cross compiling is a PITA . <nl> mmm a / tools / depends / configure . ac <nl> ppp b / tools / depends / configure . ac <nl> case $ use_platform in <nl> fi <nl> target_platform = $ use_platform <nl> ; ; <nl> - raspberry - pi ) <nl> - target_platform = raspberry - pi <nl> - use_cpu = arm1176jzf - s <nl> - ffmpeg_options_default = " - - cpu = arm1176jzf - s " <nl> - platform_cflags = " - mcpu = arm1176jzf - s - mtune = arm1176jzf - s - mfloat - abi = hard - mfpu = vfp " <nl> - platform_cxxflags = " - mcpu = arm1176jzf - s - mtune = arm1176jzf - s - mfloat - abi = hard - mfpu = vfp " <nl> - platform_ldflags = " " <nl> - ; ; <nl> - raspberry - pi2 ) <nl> - target_platform = raspberry - pi <nl> - use_cpu = cortex - a7 <nl> - ffmpeg_options_default = " - - cpu = cortex - a7 " <nl> - platform_cflags = " - fPIC - mcpu = cortex - a7 - mfloat - abi = hard - mfpu = neon - vfpv4 - mvectorize - with - neon - quad " <nl> - platform_cxxflags = " - fPIC - mcpu = cortex - a7 - mfloat - abi = hard - mfpu = neon - vfpv4 - mvectorize - with - neon - quad " <nl> - platform_ldflags = " - lpthread " <nl> - ; ; <nl> - raspberry - pi3 ) <nl> - target_platform = raspberry - pi <nl> - use_cpu = cortex - a53 <nl> - ffmpeg_options_default = " - - cpu = cortex - a53 " <nl> - platform_cflags = " - fPIC - mcpu = cortex - a53 - mfloat - abi = hard - mfpu = neon - fp - armv8 - mvectorize - with - neon - quad " <nl> - platform_cxxflags = " - fPIC - mcpu = cortex - a53 - mfloat - abi = hard - mfpu = neon - fp - armv8 - mvectorize - with - neon - quad " <nl> - platform_ldflags = " - lpthread " <nl> - ; ; <nl> tvos ) <nl> platform_cflags + = " - fembed - bitcode " <nl> platform_cxxflags + = " - fembed - bitcode " <nl> case $ use_platform in <nl> AC_MSG_ERROR ( unsupported platform ( $ use_platform ) ) <nl> esac <nl> <nl> - if test " $ target_platform " = " raspberry - pi " ; then <nl> - if test - d " $ { use_firmware } / opt / vc / include " ; then <nl> - : <nl> - else <nl> - AC_MSG_ERROR ( [ Raspberry Pi firmware not found ] ) <nl> - fi <nl> - use_arch = " arm " <nl> - use_hardcoded_tables = " yes " <nl> - ARCH = " arm " <nl> - cross_compiling = " yes " <nl> - use_host = " arm - linux - gnueabihf " <nl> - deps_dir = " $ use_platform - $ build_type " <nl> - platform_cflags + = " - pipe - mabi = aapcs - linux - Wno - psabi \ <nl> - - Wa , - mno - warn - deprecated - Wno - deprecated - declarations \ <nl> - - isystem $ { use_firmware } / opt / vc / include \ <nl> - - isystem $ { use_firmware } / opt / vc / include / interface / vcos / pthreads \ <nl> - - isystem $ { use_firmware } / opt / vc / include / interface / vmcs_host / linux " <nl> - platform_cxxflags + = " - pipe - mabi = aapcs - linux - Wno - psabi \ <nl> - - Wa , - mno - warn - deprecated - Wno - deprecated - declarations \ <nl> - - isystem $ { use_firmware } / opt / vc / include \ <nl> - - isystem $ { use_firmware } / opt / vc / include / interface / vcos / pthreads \ <nl> - - isystem $ { use_firmware } / opt / vc / include / interface / vmcs_host / linux " <nl> - platform_ldflags + = " - L $ { use_firmware } / opt / vc / lib - lEGL - lGLESv2 - lbcm_host - lvcos \ <nl> - - lvchiq_arm " <nl> - fi <nl> - <nl> XBMC_SETUP_ARCH_DEFINES ( ) <nl> <nl> <nl> mmm a / tools / depends / m4 / xbmc_arch . m4 <nl> ppp b / tools / depends / m4 / xbmc_arch . m4 <nl> if test " $ target_platform " = " target_android " ; then <nl> AC_SUBST ( ARCH_DEFINES , " - DTARGET_POSIX - DTARGET_LINUX - DTARGET_ANDROID " ) <nl> fi <nl> <nl> - if test " $ target_platform " = " target_raspberry_pi " ; then <nl> - AC_SUBST ( ARCH_DEFINES , " - DTARGET_POSIX - DTARGET_LINUX - D_ARMEL - DTARGET_RASPBERRY_PI " ) <nl> - fi <nl> ] ) <nl> mmm a / tools / depends / target / Makefile <nl> ppp b / tools / depends / target / Makefile <nl> endif <nl> WAYLANDPP_DEPS = <nl> ALSA_LIB = <nl> ifeq ( $ ( OS ) , linux ) <nl> - DEPENDS + = dbus libuuid <nl> - # not for raspberry pi or gbm <nl> - ifeq ( , $ ( filter $ ( TARGET_PLATFORM ) , raspberry - pi gbm ) ) <nl> - DEPENDS + = linux - system - libs <nl> - WAYLANDPP_DEPS + = linux - system - libs <nl> - endif <nl> - DEPENDS + = alsa - lib <nl> + DEPENDS + = dbus libuuid alsa - lib <nl> ALSA_LIB = alsa - lib <nl> LIBUUID = libuuid <nl> - ifeq ( $ ( TARGET_PLATFORM ) , $ ( filter $ ( TARGET_PLATFORM ) , raspberry - pi gbm ) ) <nl> - DEPENDS + = libxkbcommon libinput libudev libevdev mtdev <nl> - endif <nl> + <nl> ifeq ( $ ( TARGET_PLATFORM ) , gbm ) <nl> - DEPENDS + = libdrm mesa <nl> + DEPENDS + = libxkbcommon libinput libudev libevdev mtdev libdrm mesa <nl> ifeq ( $ ( CPU ) , x86_64 ) <nl> DEPENDS + = libva <nl> LIBVA = libva <nl> endif <nl> + else <nl> + DEPENDS + = linux - system - libs <nl> + WAYLANDPP_DEPS + = linux - system - libs <nl> endif <nl> endif <nl> <nl> mmm a / tools / depends / target / Toolchain . cmake . in <nl> ppp b / tools / depends / target / Toolchain . cmake . in <nl> set ( PLATFORM " @ target_platform @ " ) <nl> if ( OS STREQUAL linux ) <nl> set ( CMAKE_SYSTEM_NAME Linux ) <nl> set ( CORE_SYSTEM_NAME linux ) <nl> - if ( PLATFORM STREQUAL raspberry - pi ) <nl> - set ( CORE_PLATFORM_NAME rbpi ) <nl> - # wrapping libdvd fails with gold on rbpi <nl> - # todo : revisit after toolchain bump <nl> - set ( ENABLE_LDGOLD OFF CACHE BOOL " Disabling Gnu Gold Linker " FORCE ) <nl> - elseif ( NOT " @ target_platform @ " STREQUAL " " ) <nl> - set ( CORE_PLATFORM_NAME @ target_platform @ ) <nl> - endif ( ) <nl> + set ( CORE_PLATFORM_NAME @ target_platform @ ) <nl> if ( NOT " @ app_rendersystem @ " STREQUAL " " ) <nl> set ( X11_RENDER_SYSTEM @ app_rendersystem @ CACHE STRING " Render system to use with X11 : \ " gl \ " or \ " gles \ " " ) <nl> set ( WAYLAND_RENDER_SYSTEM @ app_rendersystem @ CACHE STRING " Render system to use with Wayland : \ " gl \ " or \ " gles \ " " ) <nl> if ( NOT " @ use_sdk_path @ " STREQUAL " " ) <nl> list ( APPEND CMAKE_FIND_ROOT_PATH @ use_sdk_path @ @ use_sdk_path @ / usr ) <nl> endif ( ) <nl> <nl> - # add RBPI ' s firmware directories <nl> - if ( CORE_PLATFORM_NAME STREQUAL rbpi ) <nl> - list ( APPEND CMAKE_FIND_ROOT_PATH @ use_firmware @ / opt / vc ) <nl> - list ( APPEND CMAKE_LIBRARY_PATH @ use_firmware @ / opt / vc / lib ) <nl> - list ( APPEND CMAKE_INCLUDE_PATH @ use_firmware @ / opt / vc / include ) <nl> - endif ( ) <nl> - <nl> # add Android directories and tools <nl> if ( CORE_SYSTEM_NAME STREQUAL android ) <nl> set ( NDKROOT @ use_ndk_path @ ) <nl> mmm a / tools / depends / target / Toolchain_binaddons . cmake . in <nl> ppp b / tools / depends / target / Toolchain_binaddons . cmake . in <nl> set ( CMAKE_FIND_ROOT_PATH @ CMAKE_FIND_ROOT_PATH @ ) <nl> if ( OS STREQUAL linux ) <nl> set ( CMAKE_SYSTEM_NAME Linux ) <nl> set ( CORE_SYSTEM_NAME linux ) <nl> - if ( PLATFORM STREQUAL raspberry - pi ) <nl> - set ( CORE_PLATFORM_NAME rbpi ) <nl> - set ( ENABLE_LDGOLD OFF CACHE BOOL " Disabling Gnu Gold Linker " FORCE ) <nl> - if ( NOT APP_RENDER_SYSTEM ) <nl> - set ( APP_RENDER_SYSTEM gles ) <nl> - endif ( ) <nl> - elseif ( NOT " @ target_platform @ " STREQUAL " " ) <nl> - set ( CORE_PLATFORM_NAME @ target_platform @ ) <nl> - endif ( ) <nl> + set ( CORE_PLATFORM_NAME @ target_platform @ ) <nl> if ( NOT APP_RENDER_SYSTEM ) <nl> set ( APP_RENDER_SYSTEM gl ) <nl> endif ( ) <nl> if ( NOT " @ use_toolchain @ " STREQUAL " " ) <nl> list ( APPEND CMAKE_FIND_ROOT_PATH @ use_toolchain @ / sysroot / usr ) <nl> endif ( ) <nl> <nl> - # add RBPI ' s firmware directories <nl> - if ( CORE_PLATFORM_NAME STREQUAL rbpi ) <nl> - list ( APPEND CMAKE_FIND_ROOT_PATH @ use_firmware @ / opt / vc ) <nl> - list ( APPEND CMAKE_LIBRARY_PATH @ CMAKE_FIND_ROOT_PATH @ / lib : @ use_firmware @ / opt / vc / lib ) <nl> - list ( APPEND CMAKE_INCLUDE_PATH @ CMAKE_FIND_ROOT_PATH @ / include : @ use_firmware @ / opt / vc / include ) <nl> - endif ( ) <nl> - <nl> # add Android directories and tools <nl> if ( CORE_SYSTEM_NAME STREQUAL android ) <nl> set ( NDKROOT @ use_ndk_path @ ) <nl> mmm a / tools / depends / target / ffmpeg / CMakeLists . txt <nl> ppp b / tools / depends / target / ffmpeg / CMakeLists . txt <nl> if ( CMAKE_BUILD_TYPE STREQUAL Release ) <nl> endif ( ) <nl> <nl> if ( CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL freebsd ) <nl> - if ( CORE_PLATFORM_NAME STREQUAL rbpi ) <nl> - list ( APPEND ffmpeg_conf - - cpu = $ { CPU } - - disable - vaapi - - disable - vdpau ) <nl> + list ( APPEND ffmpeg_conf - - enable - pic ) <nl> + if ( ENABLE_VAAPI ) <nl> + list ( APPEND ffmpeg_conf - - enable - vaapi ) <nl> else ( ) <nl> - list ( APPEND ffmpeg_conf - - enable - pic ) <nl> - if ( ENABLE_VAAPI ) <nl> - list ( APPEND ffmpeg_conf - - enable - vaapi ) <nl> - else ( ) <nl> - list ( APPEND ffmpeg_conf - - disable - vaapi ) <nl> - endif ( ) <nl> - if ( ENABLE_VDPAU ) <nl> - list ( APPEND ffmpeg_conf - - enable - vdpau ) <nl> - else ( ) <nl> - list ( APPEND ffmpeg_conf - - disable - vdpau ) <nl> - endif ( ) <nl> + list ( APPEND ffmpeg_conf - - disable - vaapi ) <nl> + endif ( ) <nl> + if ( ENABLE_VDPAU ) <nl> + list ( APPEND ffmpeg_conf - - enable - vdpau ) <nl> + else ( ) <nl> + list ( APPEND ffmpeg_conf - - disable - vdpau ) <nl> endif ( ) <nl> elseif ( CORE_SYSTEM_NAME STREQUAL android ) <nl> if ( CPU MATCHES arm64 ) <nl> elseif ( CORE_SYSTEM_NAME STREQUAL osx ) <nl> - - disable - securetransport ) <nl> endif ( ) <nl> <nl> - if ( CPU MATCHES arm OR CORE_PLATFORM_NAME STREQUAL rbpi ) <nl> + if ( CPU MATCHES arm ) <nl> list ( APPEND ffmpeg_conf - - enable - pic - - disable - armv5te - - disable - armv6t2 ) <nl> elseif ( CPU MATCHES mips ) <nl> list ( APPEND ffmpeg_conf - - disable - mips32r2 - - disable - mipsdsp - - disable - mipsdspr2 ) <nl> mmm a / tools / depends / xbmc - addons . include <nl> ppp b / tools / depends / xbmc - addons . include <nl> export PKG_CONFIG_LIBDIR = $ ( ADDON_DEPS_DIR ) / lib / pkgconfig <nl> ifeq ( $ ( CROSS_COMPILING ) , yes ) <nl> DEPS = $ ( TOOLCHAIN_FILE ) $ ( abs_top_srcdir ) / target / config - binaddons . site $ ( abs_top_srcdir ) / target / Toolchain_binaddons . cmake $ ( CONFIG_SUB ) $ ( CONFIG_GUESS ) <nl> TOOLCHAIN = - DCMAKE_TOOLCHAIN_FILE = $ ( TOOLCHAIN_FILE ) <nl> - ifeq ( $ ( OS ) , linux ) <nl> - ifneq ( $ ( TARGET_PLATFORM ) , raspberry - pi ) <nl> - DEPS + = linux - system - libs <nl> - endif <nl> - endif <nl> endif <nl> <nl> ifeq ( $ ( PLATFORM ) , ) <nl> mmm a / xbmc / Application . cpp <nl> ppp b / xbmc / Application . cpp <nl> bool CApplication : : Create ( const CAppParamParser & params ) <nl> # else <nl> buildType = " Unknown " ; <nl> # endif <nl> - std : : string specialVersion ; <nl> <nl> - / / ! @ todo - move to CPlatformXXX <nl> - # if defined ( TARGET_RASPBERRY_PI ) <nl> - specialVersion = " ( version for Raspberry Pi ) " ; <nl> - / / # elif defined ( some_ID ) / / uncomment for special version / fork <nl> - / / specialVersion = " ( version for XXXX ) " ; <nl> - # endif <nl> - CLog : : Log ( LOGINFO , " Using % s % s x % d build % s " , buildType . c_str ( ) , CSysInfo : : GetAppName ( ) . c_str ( ) , <nl> - g_sysinfo . GetXbmcBitness ( ) , specialVersion . c_str ( ) ) ; <nl> + CLog : : Log ( LOGINFO , " Using % s % s x % d " , buildType . c_str ( ) , CSysInfo : : GetAppName ( ) . c_str ( ) , <nl> + g_sysinfo . GetXbmcBitness ( ) ) ; <nl> CLog : : Log ( <nl> LOGINFO , " % s compiled % s by % s for % s % s % d - bit % s ( % s ) " , CSysInfo : : GetAppName ( ) . c_str ( ) , <nl> CSysInfo : : GetBuildDate ( ) , g_sysinfo . GetUsedCompilerNameAndVer ( ) . c_str ( ) , <nl> void CApplication : : FrameMove ( bool processEvents , bool processGUI ) <nl> if ( processGUI & & m_renderGUI ) <nl> { <nl> m_skipGuiRender = false ; <nl> - # if defined ( TARGET_RASPBERRY_PI ) <nl> + <nl> + / * ! @ todo look into the possibility to use this for GBM <nl> int fps = 0 ; <nl> <nl> / / This code reduces rendering fps of the GUI layer when playing videos in fullscreen mode <nl> void CApplication : : FrameMove ( bool processEvents , bool processGUI ) <nl> unsigned int frameTime = now - m_lastRenderTime ; <nl> if ( fps > 0 & & frameTime * fps < 1000 ) <nl> m_skipGuiRender = true ; <nl> - # endif <nl> + * / <nl> <nl> if ( CServiceBroker : : GetSettingsComponent ( ) - > GetAdvancedSettings ( ) - > m_guiSmartRedraw & & m_guiRefreshTimer . IsTimePast ( ) ) <nl> { <nl> mmm a / xbmc / GUIInfoManager . cpp <nl> ppp b / xbmc / GUIInfoManager . cpp <nl> const infomap weather [ ] = { { " isfetched " , WEATHER_IS_FETCHED } , <nl> / / / @ return * * True * * if Kodi is running on a linux / unix based computer . <nl> / / / < p > <nl> / / / } <nl> - / / / \ table_row3 { < b > ` System . Platform . Linux . RaspberryPi ` < / b > , <nl> - / / / \ anchor System_PlatformLinuxRaspberryPi <nl> - / / / _boolean_ , <nl> - / / / @ return * * True * * if Kodi is running on a Raspberry Pi . <nl> - / / / < p > < hr > <nl> - / / / @ skinning_v13 * * [ New Boolean Condition ] * * \ link System_PlatformLinuxRaspberryPi <nl> - / / / ` System . Platform . Linux . RaspberryPi ` \ endlink < p > <nl> - / / / } <nl> / / / \ table_row3 { < b > ` System . Platform . Windows ` < / b > , <nl> / / / \ anchor System_PlatformWindows <nl> / / / _boolean_ , <nl> const infomap slideshow [ ] = { { " ispaused " , SLIDESHOW_ISPAUSED <nl> / / / \ page modules__infolabels_boolean_conditions <nl> / / / \ section modules_rm_infolabels_booleans Additional revision history for Infolabels and Boolean Conditions <nl> / / / < hr > <nl> + / / / \ subsection modules_rm_infolabels_booleans_v19 Kodi v19 ( Matrix ) <nl> + / / / @ skinning_v19 * * [ Removed Infolabels ] * * The following infolabels have been removed : <nl> + / / / - ` System . Platform . Linux . RaspberryPi ` - use \ link System_Platform_Linux ` System . Platform . Linux ` \ endlink instead <nl> + / / / <nl> + / / / < hr > <nl> / / / \ subsection modules_rm_infolabels_booleans_v18 Kodi v18 ( Leia ) <nl> / / / <nl> / / / @ skinning_v18 * * [ Removed Infolabels ] * * The following infolabels have been removed : <nl> int CGUIInfoManager : : TranslateSingleString ( const std : : string & strCondition , bool <nl> { / / ! @ todo replace with a single system . platform <nl> std : : string platform = info [ 2 ] . name ; <nl> if ( platform = = " linux " ) <nl> - { <nl> - if ( info . size ( ) = = 4 ) <nl> - { <nl> - std : : string device = info [ 3 ] . name ; <nl> - if ( device = = " raspberrypi " ) <nl> - return SYSTEM_PLATFORM_LINUX_RASPBERRY_PI ; <nl> - } <nl> - else return SYSTEM_PLATFORM_LINUX ; <nl> - } <nl> + return SYSTEM_PLATFORM_LINUX ; <nl> else if ( platform = = " windows " ) <nl> return SYSTEM_PLATFORM_WINDOWS ; <nl> else if ( platform = = " uwp " ) <nl> mmm a / xbmc / SystemGlobals . cpp <nl> ppp b / xbmc / SystemGlobals . cpp <nl> std : : map < std : : string , std : : string > CSpecialProtocol : : m_pathMap ; <nl> <nl> # include " filesystem / ZipManager . h " <nl> <nl> - # ifdef TARGET_RASPBERRY_PI <nl> - # include " platform / linux / RBP . h " <nl> - # endif <nl> - <nl> CLangCodeExpander g_LangCodeExpander ; <nl> CLocalizeStrings g_localizeStrings ; <nl> CLocalizeStrings g_localizeStringsTemp ; <nl> std : : map < std : : string , std : : string > CSpecialProtocol : : m_pathMap ; <nl> CAlarmClock g_alarmClock ; <nl> CSectionLoader g_sectionLoader ; <nl> <nl> - # ifdef TARGET_RASPBERRY_PI <nl> - CRBP g_RBP ; <nl> - # endif <nl> - <nl> CZipManager g_ZipManager ; <nl> mmm a / xbmc / TextureCacheJob . cpp <nl> ppp b / xbmc / TextureCacheJob . cpp <nl> <nl> # include " FileItem . h " <nl> # include " music / MusicThumbLoader . h " <nl> # include " music / tags / MusicInfoTag . h " <nl> - # if defined ( TARGET_RASPBERRY_PI ) <nl> - # include " cores / omxplayer / OMXImage . h " <nl> - # endif <nl> <nl> # include < inttypes . h > <nl> <nl> bool CTextureCacheJob : : CacheTexture ( CBaseTexture * * out_texture ) <nl> else if ( m_details . hash = = m_oldHash ) <nl> return true ; <nl> <nl> - # if defined ( TARGET_RASPBERRY_PI ) <nl> - if ( COMXImage : : CreateThumb ( image , width , height , additional_info , CTextureCache : : GetCachedPath ( m_cachePath + " . jpg " ) ) ) <nl> - { <nl> - m_details . width = width ; <nl> - m_details . height = height ; <nl> - m_details . file = m_cachePath + " . jpg " ; <nl> - if ( out_texture ) <nl> - * out_texture = LoadImage ( CTextureCache : : GetCachedPath ( m_details . file ) , width , height , " " / * already flipped * / ) ; <nl> - CLog : : Log ( LOGDEBUG , " Fast % s image ' % s ' to ' % s ' : % p " , <nl> - m_oldHash . empty ( ) ? " Caching " : " Recaching " , CURL : : GetRedacted ( image ) , <nl> - m_details . file , static_cast < void * > ( out_texture ) ) ; <nl> - return true ; <nl> - } <nl> - # endif <nl> CBaseTexture * texture = LoadImage ( image , width , height , additional_info , true ) ; <nl> if ( texture ) <nl> { <nl> mmm a / xbmc / addons / addoninfo / AddonInfoBuilder . cpp <nl> ppp b / xbmc / addons / addoninfo / AddonInfoBuilder . cpp <nl> const char * CAddonInfoBuilder : : GetPlatformLibraryName ( const TiXmlElement * elemen <nl> # if defined ( TARGET_FREEBSD ) <nl> libraryName = element - > Attribute ( " library_freebsd " ) ; <nl> if ( libraryName = = nullptr ) <nl> - # elif defined ( TARGET_RASPBERRY_PI ) <nl> - libraryName = element - > Attribute ( " library_rbpi " ) ; <nl> - if ( libraryName = = nullptr ) <nl> # endif <nl> libraryName = element - > Attribute ( " library_linux " ) ; <nl> # elif defined ( TARGET_WINDOWS_DESKTOP ) <nl> mmm a / xbmc / cores / AudioEngine / AEResampleFactory . cpp <nl> ppp b / xbmc / cores / AudioEngine / AEResampleFactory . cpp <nl> <nl> <nl> # include " AEResampleFactory . h " <nl> # include " cores / AudioEngine / Engines / ActiveAE / ActiveAEResampleFFMPEG . h " <nl> - # if defined ( TARGET_RASPBERRY_PI ) <nl> - # include " ServiceBroker . h " <nl> - # include " settings / Settings . h " <nl> - # include " settings / SettingsComponent . h " <nl> - # include " cores / AudioEngine / Engines / ActiveAE / ActiveAEResamplePi . h " <nl> - # endif <nl> <nl> namespace ActiveAE <nl> { <nl> <nl> IAEResample * CAEResampleFactory : : Create ( uint32_t flags / * = 0 * / ) <nl> { <nl> - # if defined ( TARGET_RASPBERRY_PI ) <nl> - if ( ! ( flags & AERESAMPLEFACTORY_QUICK_RESAMPLE ) & & CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) - > GetInt ( CSettings : : SETTING_AUDIOOUTPUT_PROCESSQUALITY ) = = AE_QUALITY_GPU ) <nl> - return new CActiveAEResamplePi ( ) ; <nl> - # endif <nl> return new CActiveAEResampleFFMPEG ( ) ; <nl> } <nl> <nl> mmm a / xbmc / cores / AudioEngine / CMakeLists . txt <nl> ppp b / xbmc / cores / AudioEngine / CMakeLists . txt <nl> if ( ALSA_FOUND ) <nl> Utils / AEELDParser . cpp ) <nl> list ( APPEND HEADERS Sinks / AESinkALSA . h <nl> Utils / AEELDParser . h ) <nl> - <nl> + <nl> if ( NOT CORE_PLATFORM_NAME_LC STREQUAL x11 ) <nl> list ( APPEND SOURCES Sinks / alsa / ALSAHControlMonitor . cpp ) <nl> list ( APPEND HEADERS Sinks / alsa / ALSAHControlMonitor . h ) <nl> if ( CORE_SYSTEM_NAME MATCHES windows ) <nl> endif ( ) <nl> endif ( ) <nl> <nl> - if ( CORE_PLATFORM_NAME_LC STREQUAL rbpi ) <nl> - list ( APPEND SOURCES Engines / ActiveAE / ActiveAEResamplePi . cpp <nl> - Sinks / AESinkPi . cpp ) <nl> - list ( APPEND HEADERS Engines / ActiveAE / ActiveAEResamplePi . h <nl> - Sinks / AESinkPi . h ) <nl> - endif ( ) <nl> - <nl> if ( CORE_SYSTEM_NAME STREQUAL osx ) <nl> list ( APPEND SOURCES Sinks / AESinkDARWINOSX . cpp <nl> Sinks / darwin / CoreAudioHelpers . cpp <nl> mmm a / xbmc / cores / AudioEngine / Engines / ActiveAE / ActiveAE . cpp <nl> ppp b / xbmc / cores / AudioEngine / Engines / ActiveAE / ActiveAE . cpp <nl> bool CActiveAE : : SupportsQualityLevel ( enum AEQuality level ) <nl> { <nl> if ( level = = AE_QUALITY_LOW | | level = = AE_QUALITY_MID | | level = = AE_QUALITY_HIGH ) <nl> return true ; <nl> - # if defined ( TARGET_RASPBERRY_PI ) <nl> - if ( level = = AE_QUALITY_GPU ) <nl> - return true ; <nl> - # endif <nl> <nl> return false ; <nl> } <nl> deleted file mode 100644 <nl> index 00d0ad57a8e2 . . 000000000000 <nl> mmm a / xbmc / cores / AudioEngine / Engines / ActiveAE / ActiveAEResamplePi . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2010 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # include < cassert > <nl> - <nl> - # include " cores / AudioEngine / Utils / AEUtil . h " <nl> - # include " ActiveAEResamplePi . h " <nl> - # include " settings / Settings . h " <nl> - # include " utils / log . h " <nl> - # include " platform / linux / RBP . h " <nl> - <nl> - extern " C " { <nl> - # include < libavutil / channel_layout . h > <nl> - # include < libavutil / opt . h > <nl> - # include < libswresample / swresample . h > <nl> - } <nl> - <nl> - / / # define DEBUG_VERBOSE <nl> - <nl> - # define CLASSNAME " CActiveAEResamplePi " <nl> - <nl> - # define BUFFERSIZE ( 32 * 1024 * 2 * 8 ) <nl> - <nl> - / / # define BENCHMARKING <nl> - # ifdef BENCHMARKING <nl> - # define LOGTIMEINIT ( f ) \ <nl> - struct timespec now ; \ <nl> - uint64_t Start , End ; \ <nl> - clock_gettime ( CLOCK_MONOTONIC , & now ) ; \ <nl> - Start = ( ( int64_t ) now . tv_sec * 1000000000L ) + now . tv_nsec ; \ <nl> - const char * _filename = f ; <nl> - <nl> - # define LOGTIME ( n ) \ <nl> - clock_gettime ( CLOCK_MONOTONIC , & now ) ; \ <nl> - End = ( ( int64_t ) now . tv_sec * 1000000000L ) + now . tv_nsec ; \ <nl> - CLog : : Log ( LOGINFO , " ActiveAE : : % s % d - resample % s took % . 0fms " , __FUNCTION__ , n , _filename , \ <nl> - ( End - Start ) * 1e - 6 ) ; \ <nl> - Start = End ; <nl> - # else <nl> - # define LOGTIMEINIT ( f ) <nl> - # define LOGTIME ( n ) <nl> - # endif <nl> - <nl> - using namespace ActiveAE ; <nl> - <nl> - CActiveAEResamplePi : : CActiveAEResamplePi ( ) <nl> - { <nl> - CLog : : Log ( LOGINFO , " % s : : % s " , CLASSNAME , __func__ ) ; <nl> - <nl> - m_Initialized = false ; <nl> - m_encoded_buffer = NULL ; <nl> - m_offset = 0 ; <nl> - m_ratio = 0 . 0 ; <nl> - } <nl> - <nl> - CActiveAEResamplePi : : ~ CActiveAEResamplePi ( ) <nl> - { <nl> - CLog : : Log ( LOGINFO , " % s : : % s " , CLASSNAME , __func__ ) ; <nl> - DeInit ( ) ; <nl> - } <nl> - <nl> - void CActiveAEResamplePi : : DeInit ( ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : % s " , CLASSNAME , __func__ ) ; <nl> - if ( m_Initialized ) <nl> - { <nl> - m_omx_mixer . FlushAll ( ) ; <nl> - m_omx_mixer . Deinitialize ( ) ; <nl> - m_Initialized = false ; <nl> - } <nl> - } <nl> - <nl> - static int format_to_bits ( AVSampleFormat fmt ) <nl> - { <nl> - switch ( fmt ) <nl> - { <nl> - case AV_SAMPLE_FMT_U8 : <nl> - case AV_SAMPLE_FMT_U8P : <nl> - return 8 ; <nl> - case AV_SAMPLE_FMT_S16 : <nl> - case AV_SAMPLE_FMT_S16P : <nl> - return 16 ; <nl> - case AV_SAMPLE_FMT_S32 : <nl> - case AV_SAMPLE_FMT_S32P : <nl> - case AV_SAMPLE_FMT_FLT : <nl> - case AV_SAMPLE_FMT_FLTP : <nl> - return 32 ; <nl> - default : <nl> - assert ( 0 ) ; <nl> - } <nl> - return 0 ; <nl> - } <nl> - <nl> - bool CActiveAEResamplePi : : Init ( SampleConfig dstConfig , SampleConfig srcConfig , bool upmix , bool normalize , double centerMix , <nl> - CAEChannelInfo * remapLayout , AEQuality quality , bool force_resample ) <nl> - { <nl> - LOGTIMEINIT ( " x " ) ; <nl> - <nl> - CLog : : Log ( LOGINFO , <nl> - " % s : : % s remap : % p chan : % d - > % d rate : % d - > % d format : % d - > % d bits : % d - > % d dither : % d - > % d " <nl> - " norm : % d upmix : % d " , <nl> - CLASSNAME , __func__ , static_cast < void * > ( remapLayout ) , srcConfig . channels , dstConfig . channels , <nl> - srcConfig . sample_rate , dstConfig . sample_rate , srcConfig . fmt , dstConfig . fmt , <nl> - srcConfig . bits_per_sample , dstConfig . bits_per_sample , srcConfig . dither_bits , dstConfig . dither_bits , <nl> - normalize , upmix ) ; <nl> - <nl> - m_dst_chan_layout = dstConfig . channel_layout ; <nl> - m_dst_channels = dstConfig . channels ; <nl> - m_dst_rate = dstConfig . sample_rate ; <nl> - m_dst_fmt = dstConfig . fmt ; <nl> - m_dst_bits = dstConfig . bits_per_sample ; <nl> - m_dst_dither_bits = dstConfig . dither_bits ; <nl> - m_src_chan_layout = srcConfig . channel_layout ; <nl> - m_src_channels = srcConfig . channels ; <nl> - m_src_rate = srcConfig . sample_rate ; <nl> - m_src_fmt = srcConfig . fmt ; <nl> - m_src_bits = srcConfig . bits_per_sample ; <nl> - m_src_dither_bits = srcConfig . dither_bits ; <nl> - m_offset = 0 ; <nl> - m_src_pitch = format_to_bits ( m_src_fmt ) > > 3 ; <nl> - m_dst_pitch = format_to_bits ( m_dst_fmt ) > > 3 ; <nl> - m_force_resample = force_resample ; <nl> - <nl> - / / special handling for S24 formats which are carried in S32 ( S24NE3 ) <nl> - if ( ( m_dst_fmt = = AV_SAMPLE_FMT_S32 | | m_dst_fmt = = AV_SAMPLE_FMT_S32P ) & & m_dst_bits = = 24 & & m_dst_dither_bits = = - 8 ) <nl> - m_dst_pitch = 24 ; <nl> - <nl> - if ( m_dst_chan_layout = = 0 ) <nl> - m_dst_chan_layout = av_get_default_channel_layout ( m_dst_channels ) ; <nl> - if ( m_src_chan_layout = = 0 ) <nl> - m_src_chan_layout = av_get_default_channel_layout ( m_src_channels ) ; <nl> - <nl> - OMX_CONFIG_BRCMAUDIODOWNMIXCOEFFICIENTS8x8 mix ; <nl> - OMX_INIT_STRUCTURE ( mix ) ; <nl> - <nl> - assert ( sizeof ( mix . coeff ) / sizeof ( mix . coeff [ 0 ] ) = = 64 ) ; <nl> - <nl> - LOGTIME ( 1 ) ; <nl> - / / this code is just uses ffmpeg to produce the 8x8 mixing matrix <nl> - { <nl> - / / dummy sample rate and format , as we only care about channel mapping <nl> - SwrContext * m_pContext = swr_alloc_set_opts ( NULL , m_dst_chan_layout , AV_SAMPLE_FMT_FLT , 48000 , <nl> - m_src_chan_layout , AV_SAMPLE_FMT_FLT , 48000 , 0 , NULL ) ; <nl> - if ( ! m_pContext ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " CActiveAEResamplePi : : Init - create context failed " ) ; <nl> - return false ; <nl> - } <nl> - / / tell resampler to clamp float values <nl> - / / not required for sink stage ( remapLayout = = true ) <nl> - if ( ! remapLayout & & normalize ) <nl> - { <nl> - av_opt_set_double ( m_pContext , " rematrix_maxval " , 1 . 0 , 0 ) ; <nl> - } <nl> - <nl> - if ( remapLayout ) <nl> - { <nl> - / / one - to - one mapping of channels <nl> - / / remapLayout is the layout of the sink , if the channel is in our src layout <nl> - / / the channel is mapped by setting coef 1 . 0 <nl> - double m_rematrix [ AE_CH_MAX ] [ AE_CH_MAX ] ; <nl> - memset ( m_rematrix , 0 , sizeof ( m_rematrix ) ) ; <nl> - m_dst_chan_layout = 0 ; <nl> - for ( unsigned int out = 0 ; out < remapLayout - > Count ( ) ; out + + ) <nl> - { <nl> - m_dst_chan_layout + = ( uint64_t ) ( 1 < < out ) ; <nl> - int idx = CAEUtil : : GetAVChannelIndex ( ( * remapLayout ) [ out ] , m_src_chan_layout ) ; <nl> - if ( idx > = 0 ) <nl> - { <nl> - m_rematrix [ out ] [ idx ] = 1 . 0 ; <nl> - } <nl> - } <nl> - <nl> - av_opt_set_int ( m_pContext , " out_channel_count " , m_dst_channels , 0 ) ; <nl> - av_opt_set_int ( m_pContext , " out_channel_layout " , m_dst_chan_layout , 0 ) ; <nl> - <nl> - if ( swr_set_matrix ( m_pContext , ( const double * ) m_rematrix , AE_CH_MAX ) < 0 ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " CActiveAEResamplePi : : Init - setting channel matrix failed " ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - / / stereo upmix <nl> - else if ( upmix & & m_src_channels = = 2 & & m_dst_channels > 2 ) <nl> - { <nl> - double m_rematrix [ AE_CH_MAX ] [ AE_CH_MAX ] ; <nl> - memset ( m_rematrix , 0 , sizeof ( m_rematrix ) ) ; <nl> - for ( int out = 0 ; out < m_dst_channels ; out + + ) <nl> - { <nl> - uint64_t out_chan = av_channel_layout_extract_channel ( m_dst_chan_layout , out ) ; <nl> - switch ( out_chan ) <nl> - { <nl> - case AV_CH_FRONT_LEFT : <nl> - case AV_CH_BACK_LEFT : <nl> - case AV_CH_SIDE_LEFT : <nl> - m_rematrix [ out ] [ 0 ] = 1 . 0 ; <nl> - break ; <nl> - case AV_CH_FRONT_RIGHT : <nl> - case AV_CH_BACK_RIGHT : <nl> - case AV_CH_SIDE_RIGHT : <nl> - m_rematrix [ out ] [ 1 ] = 1 . 0 ; <nl> - break ; <nl> - case AV_CH_FRONT_CENTER : <nl> - m_rematrix [ out ] [ 0 ] = 0 . 5 ; <nl> - m_rematrix [ out ] [ 1 ] = 0 . 5 ; <nl> - break ; <nl> - case AV_CH_LOW_FREQUENCY : <nl> - m_rematrix [ out ] [ 0 ] = 0 . 5 ; <nl> - m_rematrix [ out ] [ 1 ] = 0 . 5 ; <nl> - break ; <nl> - default : <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - if ( swr_set_matrix ( m_pContext , ( const double * ) m_rematrix , AE_CH_MAX ) < 0 ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " CActiveAEResamplePi : : Init - setting channel matrix failed " ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> - if ( swr_init ( m_pContext ) < 0 ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " CActiveAEResamplePi : : Init - init resampler failed " ) ; <nl> - return false ; <nl> - } <nl> - <nl> - const int samples = 8 ; <nl> - uint8_t * output , * input ; <nl> - av_samples_alloc ( & output , NULL , m_dst_channels , samples , AV_SAMPLE_FMT_FLT , 1 ) ; <nl> - av_samples_alloc ( & input , NULL , m_src_channels , samples , AV_SAMPLE_FMT_FLT , 1 ) ; <nl> - <nl> - / / Produce " identity " samples <nl> - float * f = ( float * ) input ; <nl> - for ( int j = 0 ; j < samples ; j + + ) <nl> - for ( int i = 0 ; i < m_src_channels ; i + + ) <nl> - * f + + = i = = j ? 1 . 0f : 0 . 0f ; <nl> - <nl> - int ret = swr_convert ( m_pContext , & output , samples , ( const uint8_t * * ) & input , samples ) ; <nl> - if ( ret < 0 ) <nl> - CLog : : Log ( LOGERROR , " CActiveAEResamplePi : : Resample - resample failed " ) ; <nl> - <nl> - f = ( float * ) output ; <nl> - for ( int j = 0 ; j < samples ; j + + ) <nl> - for ( int i = 0 ; i < m_dst_channels ; i + + ) <nl> - mix . coeff [ 8 * i + j ] = * f + + * ( 1 < < 16 ) ; <nl> - <nl> - for ( int j = 0 ; j < 8 ; j + + ) <nl> - { <nl> - char s [ 128 ] = { } , * t = s ; <nl> - for ( int i = 0 ; i < 8 ; i + + ) <nl> - t + = sprintf ( t , " % 6 . 2f " , mix . coeff [ j * 8 + i ] * ( 1 . 0 / 0x10000 ) ) ; <nl> - CLog : : Log ( LOGINFO , " % s : : % s % s " , CLASSNAME , __func__ , s ) ; <nl> - } <nl> - av_freep ( & input ) ; <nl> - av_freep ( & output ) ; <nl> - swr_free ( & m_pContext ) ; <nl> - } <nl> - LOGTIME ( 2 ) ; <nl> - <nl> - / / This may be called before Application calls g_RBP . Initialise , so call it here too <nl> - g_RBP . Initialize ( ) ; <nl> - <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - if ( ! m_omx_mixer . Initialize ( " OMX . broadcom . audio_mixer " , OMX_IndexParamAudioInit ) ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - m_omx_mixer . Initialize omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - <nl> - LOGTIME ( 3 ) ; <nl> - <nl> - if ( m_force_resample ) <nl> - { <nl> - OMX_PARAM_U32TYPE scaleType ; <nl> - OMX_INIT_STRUCTURE ( scaleType ) ; <nl> - <nl> - scaleType . nPortIndex = m_omx_mixer . GetInputPort ( ) ; <nl> - scaleType . nU32 = ( 1 < < 16 ) ; <nl> - omx_err = m_omx_mixer . SetConfig ( OMX_IndexParamBrcmTimeScale , & scaleType ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - error m_omx_mixer Failed to set OMX_IndexParamBrcmTimeScale omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - m_ratio = 1 . 0 ; <nl> - } <nl> - / / audio_mixer only supports up to 192kHz , however as long as ratio of samplerates remains the same we can lie <nl> - while ( srcConfig . sample_rate > 192000 | | dstConfig . sample_rate > 192000 ) <nl> - srcConfig . sample_rate > > = 1 , dstConfig . sample_rate > > = 1 ; <nl> - <nl> - OMX_INIT_STRUCTURE ( m_pcm_input ) ; <nl> - m_pcm_input . nPortIndex = m_omx_mixer . GetInputPort ( ) ; <nl> - m_pcm_input . eNumData = OMX_NumericalDataSigned ; <nl> - m_pcm_input . eEndian = OMX_EndianLittle ; <nl> - m_pcm_input . bInterleaved = OMX_TRUE ; <nl> - m_pcm_input . nBitPerSample = m_src_pitch < < 3 ; <nl> - / / 0x8000 = float , 0x10000 = planar <nl> - uint32_t flags = 0 ; <nl> - if ( m_src_fmt = = AV_SAMPLE_FMT_FLT | | m_src_fmt = = AV_SAMPLE_FMT_FLTP ) <nl> - flags | = 0x8000 ; <nl> - if ( m_src_fmt > = AV_SAMPLE_FMT_U8P ) <nl> - flags | = 0x10000 ; <nl> - m_pcm_input . ePCMMode = flags = = 0 ? OMX_AUDIO_PCMModeLinear : ( OMX_AUDIO_PCMMODETYPE ) flags ; <nl> - m_pcm_input . nChannels = srcConfig . channels ; <nl> - m_pcm_input . nSamplingRate = srcConfig . sample_rate ; <nl> - <nl> - omx_err = m_omx_mixer . SetParameter ( OMX_IndexParamAudioPcm , & m_pcm_input ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - error m_omx_mixer in SetParameter omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - <nl> - OMX_INIT_STRUCTURE ( m_pcm_output ) ; <nl> - m_pcm_output . nPortIndex = m_omx_mixer . GetOutputPort ( ) ; <nl> - m_pcm_output . eNumData = OMX_NumericalDataSigned ; <nl> - m_pcm_output . eEndian = OMX_EndianLittle ; <nl> - m_pcm_output . bInterleaved = OMX_TRUE ; <nl> - m_pcm_output . nBitPerSample = m_dst_pitch < < 3 ; <nl> - flags = 0 ; <nl> - if ( m_dst_fmt = = AV_SAMPLE_FMT_FLT | | m_dst_fmt = = AV_SAMPLE_FMT_FLTP ) <nl> - flags | = 0x8000 ; <nl> - if ( m_dst_fmt > = AV_SAMPLE_FMT_U8P ) <nl> - flags | = 0x10000 ; <nl> - / / shift bits if destination format requires it , swr_resamples aligns to the left <nl> - if ( m_dst_bits ! = 32 & & ( m_dst_dither_bits + m_dst_bits ) ! = 32 ) <nl> - flags | = ( 32 - m_dst_bits - m_dst_dither_bits ) < < 8 ; <nl> - <nl> - m_pcm_output . ePCMMode = flags = = 0 ? OMX_AUDIO_PCMModeLinear : ( OMX_AUDIO_PCMMODETYPE ) flags ; <nl> - m_pcm_output . nChannels = dstConfig . channels ; <nl> - m_pcm_output . nSamplingRate = dstConfig . sample_rate ; <nl> - <nl> - omx_err = m_omx_mixer . SetParameter ( OMX_IndexParamAudioPcm , & m_pcm_output ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - error m_omx_mixer out SetParameter omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - <nl> - LOGTIME ( 4 ) ; <nl> - <nl> - mix . nPortIndex = m_omx_mixer . GetInputPort ( ) ; <nl> - omx_err = m_omx_mixer . SetConfig ( OMX_IndexConfigBrcmAudioDownmixCoefficients8x8 , & mix ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( <nl> - LOGERROR , <nl> - " % s : : % s - error setting mixer OMX_IndexConfigBrcmAudioDownmixCoefficients , error 0x % 08x " , <nl> - CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - / / set up the number / size of buffers for decoder input <nl> - OMX_PARAM_PORTDEFINITIONTYPE port_param ; <nl> - OMX_INIT_STRUCTURE ( port_param ) ; <nl> - port_param . nPortIndex = m_omx_mixer . GetInputPort ( ) ; <nl> - <nl> - omx_err = m_omx_mixer . GetParameter ( OMX_IndexParamPortDefinition , & port_param ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : % s - error get OMX_IndexParamPortDefinition ( input ) omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - <nl> - port_param . nBufferCountActual = std : : max ( ( unsigned int ) port_param . nBufferCountMin , ( unsigned int ) 1 ) ; <nl> - port_param . nBufferSize = BUFFERSIZE ; <nl> - <nl> - omx_err = m_omx_mixer . SetParameter ( OMX_IndexParamPortDefinition , & port_param ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : % s - error set OMX_IndexParamPortDefinition ( input ) omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - <nl> - LOGTIME ( 5 ) ; <nl> - <nl> - omx_err = m_omx_mixer . AllocInputBuffers ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : % s - Error alloc buffers 0x % 08x " , CLASSNAME , __func__ , omx_err ) ; <nl> - <nl> - LOGTIME ( 6 ) ; <nl> - <nl> - / / set up the number / size of buffers for decoder output <nl> - OMX_INIT_STRUCTURE ( port_param ) ; <nl> - port_param . nPortIndex = m_omx_mixer . GetOutputPort ( ) ; <nl> - <nl> - omx_err = m_omx_mixer . GetParameter ( OMX_IndexParamPortDefinition , & port_param ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : % s - error get OMX_IndexParamPortDefinition ( input ) omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - <nl> - port_param . nBufferCountActual = std : : max ( ( unsigned int ) port_param . nBufferCountMin , ( unsigned int ) 1 ) ; <nl> - port_param . nBufferSize = BUFFERSIZE ; <nl> - <nl> - omx_err = m_omx_mixer . SetParameter ( OMX_IndexParamPortDefinition , & port_param ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : % s - error set OMX_IndexParamPortDefinition ( input ) omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - <nl> - LOGTIME ( 7 ) ; <nl> - <nl> - omx_err = m_omx_mixer . AllocOutputBuffers ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : % s - Error alloc buffers 0x % 08x " , CLASSNAME , __func__ , omx_err ) ; <nl> - <nl> - LOGTIME ( 8 ) ; <nl> - <nl> - omx_err = m_omx_mixer . SetStateForComponent ( OMX_StateExecuting ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : % s - m_omx_mixer OMX_StateExecuting omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - <nl> - LOGTIME ( 9 ) ; <nl> - <nl> - m_Initialized = true ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - <nl> - static void copy_planes ( uint8_t * * dst_buffer , int d_pitch , int d_planes , int d_samplesize , int offset , uint8_t * src_buffer , int src_samples , int planesize ) <nl> - { <nl> - for ( int i = 0 ; i < d_planes ; i + + ) <nl> - memcpy ( dst_buffer [ i ] + offset * d_pitch , src_buffer + i * planesize , src_samples * d_samplesize / d_planes ) ; <nl> - } <nl> - <nl> - int CActiveAEResamplePi : : Resample ( uint8_t * * dst_buffer , int dst_samples , uint8_t * * src_buffer , int src_samples , double ratio ) <nl> - { <nl> - # ifdef DEBUG_VERBOSE <nl> - CLog : : Log ( LOGINFO , " % s : : % s samples : % d - > % d ( % . 2f ) " , CLASSNAME , __func__ , src_samples , dst_samples , ratio ) ; <nl> - # endif <nl> - if ( ! m_Initialized ) <nl> - return 0 ; <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - if ( m_ratio ! = 0 . 0 & & ratio ! = m_ratio ) <nl> - { <nl> - OMX_PARAM_U32TYPE scaleType ; <nl> - OMX_INIT_STRUCTURE ( scaleType ) ; <nl> - <nl> - scaleType . nPortIndex = m_omx_mixer . GetInputPort ( ) ; <nl> - scaleType . nU32 = ( 1 < < 16 ) / ratio ; <nl> - omx_err = m_omx_mixer . SetConfig ( OMX_IndexParamBrcmTimeScale , & scaleType ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - error m_omx_mixer Failed to set OMX_IndexParamBrcmTimeScale omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - m_ratio = ratio ; <nl> - } <nl> - <nl> - const int s_planes = m_src_fmt > = AV_SAMPLE_FMT_U8P ? m_src_channels : 1 ; <nl> - const int d_planes = m_dst_fmt > = AV_SAMPLE_FMT_U8P ? m_dst_channels : 1 ; <nl> - const int s_chans = m_src_fmt > = AV_SAMPLE_FMT_U8P ? 1 : m_src_channels ; <nl> - const int d_chans = m_dst_fmt > = AV_SAMPLE_FMT_U8P ? 1 : m_dst_channels ; <nl> - const int s_pitch = s_chans * m_src_pitch ; <nl> - const int d_pitch = d_chans * m_dst_pitch ; <nl> - <nl> - const int s_samplesize = m_src_channels * m_src_pitch ; <nl> - const int d_samplesize = m_dst_channels * m_dst_pitch ; <nl> - const int max_src_samples = BUFFERSIZE / s_samplesize ; <nl> - const int max_dst_samples = ( long long ) ( BUFFERSIZE / d_samplesize ) * m_src_rate / ( m_dst_rate + m_src_rate - 1 ) ; <nl> - <nl> - int sent = 0 ; <nl> - int received = 0 ; <nl> - <nl> - while ( 1 ) <nl> - { <nl> - if ( m_encoded_buffer & & m_encoded_buffer - > nFilledLen ) <nl> - { <nl> - int samples_available = m_encoded_buffer - > nFilledLen / d_samplesize - m_offset ; <nl> - int samples = std : : min ( samples_available , dst_samples - received ) ; <nl> - copy_planes ( dst_buffer , d_pitch , d_planes , d_samplesize , received , ( uint8_t * ) m_encoded_buffer - > pBuffer + m_offset * d_pitch , samples , m_encoded_buffer - > nFilledLen / d_planes ) ; <nl> - received + = samples ; <nl> - m_offset + = samples ; <nl> - if ( m_offset = = m_encoded_buffer - > nFilledLen / d_samplesize ) <nl> - { <nl> - m_offset = 0 ; <nl> - m_encoded_buffer = NULL ; <nl> - } <nl> - else if ( m_offset > m_encoded_buffer - > nFilledLen / d_samplesize ) assert ( 0 ) ; <nl> - else assert ( sent = = src_samples ) ; <nl> - } <nl> - <nl> - if ( sent > = src_samples ) <nl> - break ; <nl> - <nl> - OMX_BUFFERHEADERTYPE * omx_buffer = m_omx_mixer . GetInputBuffer ( 1000 ) ; <nl> - if ( omx_buffer = = NULL ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_mixer . GetInputBuffer failed to get buffer " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - int send = std : : min ( std : : min ( max_dst_samples , max_src_samples ) , src_samples - sent ) ; <nl> - <nl> - omx_buffer - > nOffset = 0 ; <nl> - omx_buffer - > nFlags = OMX_BUFFERFLAG_EOS ; <nl> - omx_buffer - > nFilledLen = send * s_samplesize ; <nl> - <nl> - assert ( omx_buffer - > nFilledLen > 0 & & omx_buffer - > nFilledLen < = omx_buffer - > nAllocLen ) ; <nl> - <nl> - if ( omx_buffer - > nFilledLen ) <nl> - { <nl> - int planesize = omx_buffer - > nFilledLen / s_planes ; <nl> - for ( int i = 0 ; i < s_planes ; i + + ) <nl> - memcpy ( ( uint8_t * ) omx_buffer - > pBuffer + i * planesize , src_buffer [ i ] + sent * s_pitch , planesize ) ; <nl> - sent + = send ; <nl> - } <nl> - <nl> - omx_err = m_omx_mixer . EmptyThisBuffer ( omx_buffer ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s OMX_EmptyThisBuffer ( ) failed with result ( 0x % x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - m_omx_mixer . DecoderEmptyBufferDone ( m_omx_mixer . GetComponent ( ) , omx_buffer ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_encoded_buffer = m_omx_mixer . GetOutputBuffer ( ) ; <nl> - <nl> - if ( ! m_encoded_buffer ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s no output buffer " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - omx_err = m_omx_mixer . FillThisBuffer ( m_encoded_buffer ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_mixer . FillThisBuffer result ( 0x % x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - m_omx_mixer . DecoderFillBufferDone ( m_omx_mixer . GetComponent ( ) , m_encoded_buffer ) ; <nl> - return false ; <nl> - } <nl> - omx_err = m_omx_mixer . WaitForOutputDone ( 1000 ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_mixer . WaitForOutputDone result ( 0x % x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - assert ( m_encoded_buffer - > nFilledLen > 0 & & m_encoded_buffer - > nFilledLen < = m_encoded_buffer - > nAllocLen ) ; <nl> - <nl> - if ( m_omx_mixer . BadState ( ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_mixer . BadState " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - if ( sent < src_samples ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s More data to send % d / % d " , CLASSNAME , __func__ , sent , src_samples ) ; <nl> - } <nl> - # ifdef DEBUG_VERBOSE <nl> - CLog : : Log ( LOGINFO , " % s : : % s format : % d - > % d rate : % d - > % d chan : % d - > % d samples % d - > % d ( % f ) % d " , CLASSNAME , __func__ , <nl> - ( int ) m_src_fmt , ( int ) m_dst_fmt , m_src_rate , m_dst_rate , m_src_channels , m_dst_channels , src_samples , dst_samples , ratio , received ) ; <nl> - # endif <nl> - assert ( received < = dst_samples ) ; <nl> - return received ; <nl> - } <nl> - <nl> - int64_t CActiveAEResamplePi : : GetDelay ( int64_t base ) <nl> - { <nl> - int64_t ret = av_rescale_rnd ( GetBufferedSamples ( ) , m_dst_rate , base , AV_ROUND_UP ) ; <nl> - <nl> - # ifdef DEBUG_VERBOSE <nl> - CLog : : Log ( LOGINFO , " % s : : % s = % " PRId64 , CLASSNAME , __func__ , ret ) ; <nl> - # endif <nl> - return ret ; <nl> - } <nl> - <nl> - int CActiveAEResamplePi : : GetBufferedSamples ( ) <nl> - { <nl> - int samples = 0 ; <nl> - if ( m_encoded_buffer ) <nl> - { <nl> - const int d_samplesize = m_dst_channels * m_src_pitch ; <nl> - samples = m_encoded_buffer - > nFilledLen / d_samplesize - m_offset ; <nl> - } <nl> - # ifdef DEBUG_VERBOSE <nl> - CLog : : Log ( LOGINFO , " % s : : % s = % d " , CLASSNAME , __func__ , samples ) ; <nl> - # endif <nl> - return samples ; <nl> - } <nl> - <nl> - int CActiveAEResamplePi : : CalcDstSampleCount ( int src_samples , int dst_rate , int src_rate ) <nl> - { <nl> - int ret = av_rescale_rnd ( src_samples , dst_rate , src_rate , AV_ROUND_UP ) ; <nl> - # ifdef DEBUG_VERBOSE <nl> - CLog : : Log ( LOGINFO , " % s : : % s = % d " , CLASSNAME , __func__ , ret ) ; <nl> - # endif <nl> - return ret ; <nl> - } <nl> - <nl> - int CActiveAEResamplePi : : GetSrcBufferSize ( int samples ) <nl> - { <nl> - int ret = av_samples_get_buffer_size ( NULL , m_src_channels , samples , m_src_fmt , 1 ) ; <nl> - # ifdef DEBUG_VERBOSE <nl> - CLog : : Log ( LOGINFO , " % s : : % s = % d " , CLASSNAME , __func__ , ret ) ; <nl> - # endif <nl> - return ret ; <nl> - } <nl> - <nl> - int CActiveAEResamplePi : : GetDstBufferSize ( int samples ) <nl> - { <nl> - int ret = av_samples_get_buffer_size ( NULL , m_dst_channels , samples , m_dst_fmt , 1 ) ; <nl> - # ifdef DEBUG_VERBOSE <nl> - CLog : : Log ( LOGINFO , " % s : : % s = % d " , CLASSNAME , __func__ , ret ) ; <nl> - # endif <nl> - return ret ; <nl> - } <nl> deleted file mode 100644 <nl> index 8a6ad52ce10c . . 000000000000 <nl> mmm a / xbmc / cores / AudioEngine / Engines / ActiveAE / ActiveAEResamplePi . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2010 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # include " cores / AudioEngine / Interfaces / AEResample . h " <nl> - <nl> - # include " platform / linux / OMXCore . h " <nl> - <nl> - namespace ActiveAE <nl> - { <nl> - <nl> - class CActiveAEResamplePi : public IAEResample <nl> - { <nl> - public : <nl> - const char * GetName ( ) { return " ActiveAEResamplePi " ; } <nl> - CActiveAEResamplePi ( ) ; <nl> - virtual ~ CActiveAEResamplePi ( ) ; <nl> - bool Init ( SampleConfig dstConfig , SampleConfig srcConfig , bool upmix , bool normalize , double centerMix , <nl> - CAEChannelInfo * remapLayout , AEQuality quality , bool force_resample ) ; <nl> - int Resample ( uint8_t * * dst_buffer , int dst_samples , uint8_t * * src_buffer , int src_samples , double ratio ) ; <nl> - int64_t GetDelay ( int64_t base ) ; <nl> - int GetBufferedSamples ( ) ; <nl> - bool WantsNewSamples ( int samples ) { return GetBufferedSamples ( ) < = samples ; } <nl> - int CalcDstSampleCount ( int src_samples , int dst_rate , int src_rate ) ; <nl> - int GetSrcBufferSize ( int samples ) ; <nl> - int GetDstBufferSize ( int samples ) ; <nl> - <nl> - protected : <nl> - void DeInit ( ) ; <nl> - uint64_t m_src_chan_layout , m_dst_chan_layout ; <nl> - int m_src_rate , m_dst_rate ; <nl> - int m_src_channels , m_dst_channels ; <nl> - AVSampleFormat m_src_fmt , m_dst_fmt ; <nl> - int m_src_bits , m_dst_bits ; <nl> - int m_src_pitch , m_dst_pitch ; <nl> - int m_src_dither_bits , m_dst_dither_bits ; <nl> - <nl> - OMX_AUDIO_PARAM_PCMMODETYPE m_pcm_input ; <nl> - OMX_AUDIO_PARAM_PCMMODETYPE m_pcm_output ; <nl> - COMXCoreComponent m_omx_mixer ; <nl> - bool m_Initialized ; <nl> - bool m_force_resample ; <nl> - OMX_BUFFERHEADERTYPE * m_encoded_buffer ; <nl> - unsigned int m_offset ; <nl> - double m_ratio ; <nl> - } ; <nl> - <nl> - } <nl> deleted file mode 100644 <nl> index 7822c91fdbe4 . . 000000000000 <nl> mmm a / xbmc / cores / AudioEngine / Sinks / AESinkPi . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2010 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # include " AESinkPi . h " <nl> - <nl> - # include " ServiceBroker . h " <nl> - # include " cores / AudioEngine / AESinkFactory . h " <nl> - # include " cores / AudioEngine / Utils / AEUtil . h " <nl> - # include " settings / Settings . h " <nl> - # include " settings / SettingsComponent . h " <nl> - # include " utils / XTimeUtils . h " <nl> - # include " utils / log . h " <nl> - <nl> - # include " platform / linux / RBP . h " <nl> - <nl> - # include < cassert > <nl> - # include < limits . h > <nl> - # include < stdint . h > <nl> - <nl> - # define CLASSNAME " CAESinkPi " <nl> - <nl> - # define NUM_OMX_BUFFERS 2 <nl> - # define AUDIO_PLAYBUFFER ( 0 . 1 ) / / 100ms <nl> - <nl> - # ifdef OMX_SKIP64BIT <nl> - static inline OMX_TICKS ToOMXTime ( int64_t pts ) <nl> - { <nl> - OMX_TICKS ticks ; <nl> - ticks . nLowPart = pts ; <nl> - ticks . nHighPart = pts > > 32 ; <nl> - return ticks ; <nl> - } <nl> - # else <nl> - # define ToOMXTime ( x ) ( x ) <nl> - # endif <nl> - <nl> - static const unsigned int PassthroughSampleRates [ ] = { 8000 , 11025 , 16000 , 22050 , 24000 , 32000 , 44100 , 48000 , 88200 , 96000 , 176400 , 192000 } ; <nl> - <nl> - CAEDeviceInfo CAESinkPi : : m_info ; <nl> - <nl> - CAESinkPi : : CAESinkPi ( ) : <nl> - m_sinkbuffer_sec_per_byte ( 0 ) , <nl> - m_Initialized ( false ) , <nl> - m_submitted ( 0 ) , <nl> - m_omx_output ( NULL ) , <nl> - m_output ( AESINKPI_UNKNOWN ) <nl> - { <nl> - } <nl> - <nl> - CAESinkPi : : ~ CAESinkPi ( ) <nl> - { <nl> - } <nl> - <nl> - void CAESinkPi : : SetAudioDest ( ) <nl> - { <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - OMX_CONFIG_BRCMAUDIODESTINATIONTYPE audioDest ; <nl> - OMX_INIT_STRUCTURE ( audioDest ) ; <nl> - if ( m_omx_render . IsInitialized ( ) ) <nl> - { <nl> - if ( m_output = = AESINKPI_ANALOGUE ) <nl> - strncpy ( reinterpret_cast < char * > ( audioDest . sName ) , " local " , strlen ( " local " ) + 1 ) ; <nl> - else <nl> - strncpy ( reinterpret_cast < char * > ( audioDest . sName ) , " hdmi " , strlen ( " hdmi " ) + 1 ) ; <nl> - omx_err = m_omx_render . SetConfig ( OMX_IndexConfigBrcmAudioDestination , & audioDest ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - m_omx_render . SetConfig omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - } <nl> - if ( m_omx_render_slave . IsInitialized ( ) ) <nl> - { <nl> - if ( m_output ! = AESINKPI_ANALOGUE ) <nl> - strncpy ( reinterpret_cast < char * > ( audioDest . sName ) , " local " , strlen ( " local " ) + 1 ) ; <nl> - else <nl> - strncpy ( reinterpret_cast < char * > ( audioDest . sName ) , " hdmi " , strlen ( " hdmi " ) + 1 ) ; <nl> - omx_err = m_omx_render_slave . SetConfig ( OMX_IndexConfigBrcmAudioDestination , & audioDest ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - m_omx_render_slave . SetConfig omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - } <nl> - } <nl> - <nl> - static void SetAudioProps ( bool stream_channels , uint32_t channel_map ) <nl> - { <nl> - char command [ 80 ] , response [ 80 ] ; <nl> - <nl> - sprintf ( command , " hdmi_stream_channels % d " , stream_channels ? 1 : 0 ) ; <nl> - vc_gencmd ( response , sizeof response , command ) ; <nl> - <nl> - sprintf ( command , " hdmi_channel_map 0x % 08x " , channel_map ) ; <nl> - vc_gencmd ( response , sizeof response , command ) ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , " % s : % s hdmi_stream_channels % d hdmi_channel_map % 08x " , CLASSNAME , __func__ , stream_channels , channel_map ) ; <nl> - } <nl> - <nl> - static uint32_t GetChannelMap ( const CAEChannelInfo & channelLayout , bool passthrough ) <nl> - { <nl> - unsigned int channels = channelLayout . Count ( ) ; <nl> - uint32_t channel_map = 0 ; <nl> - if ( passthrough ) <nl> - return 0 ; <nl> - <nl> - static const unsigned char map_normal [ ] = <nl> - { <nl> - 0 , / / AE_CH_RAW , <nl> - 1 , / / AE_CH_FL <nl> - 2 , / / AE_CH_FR <nl> - 4 , / / AE_CH_FC <nl> - 3 , / / AE_CH_LFE <nl> - 7 , / / AE_CH_BL <nl> - 8 , / / AE_CH_BR <nl> - 1 , / / AE_CH_FLOC , <nl> - 2 , / / AE_CH_FROC , <nl> - 4 , / / AE_CH_BC , <nl> - 5 , / / AE_CH_SL <nl> - 6 , / / AE_CH_SR <nl> - } ; <nl> - static const unsigned char map_back [ ] = <nl> - { <nl> - 0 , / / AE_CH_RAW , <nl> - 1 , / / AE_CH_FL <nl> - 2 , / / AE_CH_FR <nl> - 4 , / / AE_CH_FC <nl> - 3 , / / AE_CH_LFE <nl> - 5 , / / AE_CH_BL <nl> - 6 , / / AE_CH_BR <nl> - 1 , / / AE_CH_FLOC , <nl> - 2 , / / AE_CH_FROC , <nl> - 4 , / / AE_CH_BC , <nl> - 5 , / / AE_CH_SL <nl> - 6 , / / AE_CH_SR <nl> - } ; <nl> - const unsigned char * map = map_normal ; <nl> - / / According to CEA - 861 - D only RL and RR are known . In case of a format having SL and SR channels <nl> - / / but no BR BL channels , we use the wide map in order to open only the num of channels really <nl> - / / needed . <nl> - if ( channelLayout . HasChannel ( AE_CH_BL ) & & ! channelLayout . HasChannel ( AE_CH_SL ) ) <nl> - map = map_back ; <nl> - <nl> - for ( unsigned int i = 0 ; i < channels ; + + i ) <nl> - { <nl> - AEChannel c = channelLayout [ i ] ; <nl> - unsigned int chan = 0 ; <nl> - if ( ( unsigned int ) c < sizeof map_normal / sizeof * map_normal ) <nl> - chan = map [ ( unsigned int ) c ] ; <nl> - if ( chan > 0 ) <nl> - channel_map | = ( chan - 1 ) < < ( 3 * i ) ; <nl> - } <nl> - / / These numbers are from Table 28 Audio InfoFrame Data byte 4 of CEA 861 <nl> - / / and describe the speaker layout <nl> - static const uint8_t cea_map [ ] = { <nl> - 0xff , / / 0 <nl> - 0xff , / / 1 <nl> - 0x00 , / / 2 . 0 <nl> - 0x02 , / / 3 . 0 <nl> - 0x08 , / / 4 . 0 <nl> - 0x0a , / / 5 . 0 <nl> - 0xff , / / 6 <nl> - 0x12 , / / 7 . 0 <nl> - 0xff , / / 8 <nl> - } ; <nl> - static const uint8_t cea_map_lfe [ ] = { <nl> - 0xff , / / 0 <nl> - 0xff , / / 1 <nl> - 0xff , / / 2 <nl> - 0x01 , / / 2 . 1 <nl> - 0x03 , / / 3 . 1 <nl> - 0x09 , / / 4 . 1 <nl> - 0x0b , / / 5 . 1 <nl> - 0xff , / / 7 <nl> - 0x13 , / / 7 . 1 <nl> - } ; <nl> - uint8_t cea = channelLayout . HasChannel ( AE_CH_LFE ) ? cea_map_lfe [ channels ] : cea_map [ channels ] ; <nl> - if ( cea = = 0xff ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - Unexpected CEA mapping % d , % d " , CLASSNAME , __func__ , channelLayout . HasChannel ( AE_CH_LFE ) , channels ) ; <nl> - <nl> - channel_map | = cea < < 24 ; <nl> - <nl> - return channel_map ; <nl> - } <nl> - <nl> - void CAESinkPi : : Register ( ) <nl> - { <nl> - AE : : AESinkRegEntry reg ; <nl> - reg . sinkName = " PI " ; <nl> - reg . createFunc = CAESinkPi : : Create ; <nl> - reg . enumerateFunc = CAESinkPi : : EnumerateDevicesEx ; <nl> - AE : : CAESinkFactory : : RegisterSink ( reg ) ; <nl> - } <nl> - <nl> - IAESink * CAESinkPi : : Create ( std : : string & device , AEAudioFormat & desiredFormat ) <nl> - { <nl> - IAESink * sink = new CAESinkPi ( ) ; <nl> - if ( sink - > Initialize ( desiredFormat , device ) ) <nl> - return sink ; <nl> - <nl> - delete sink ; <nl> - return nullptr ; <nl> - } <nl> - <nl> - <nl> - bool CAESinkPi : : Initialize ( AEAudioFormat & format , std : : string & device ) <nl> - { <nl> - / / This may be called before Application calls g_RBP . Initialise , so call it here too <nl> - g_RBP . Initialize ( ) ; <nl> - <nl> - / * if we are raw need to let gpu know * / <nl> - m_passthrough = format . m_dataFormat = = AE_FMT_RAW ; <nl> - <nl> - m_initDevice = device ; <nl> - m_initFormat = format ; <nl> - <nl> - const std : : string audioDevice = CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) - > GetString ( CSettings : : SETTING_AUDIOOUTPUT_AUDIODEVICE ) ; <nl> - <nl> - if ( m_passthrough | | audioDevice = = " PI : HDMI " ) <nl> - m_output = AESINKPI_HDMI ; <nl> - else if ( audioDevice = = " PI : Analogue " ) <nl> - m_output = AESINKPI_ANALOGUE ; <nl> - else if ( audioDevice = = " PI : Both " ) <nl> - m_output = AESINKPI_BOTH ; <nl> - else if ( audioDevice = = " Default " ) <nl> - m_output = AESINKPI_HDMI ; <nl> - else assert ( 0 ) ; <nl> - <nl> - / / analogue only supports stereo <nl> - if ( m_output = = AESINKPI_ANALOGUE | | m_output = = AESINKPI_BOTH ) <nl> - format . m_channelLayout = AE_CH_LAYOUT_2_0 ; <nl> - <nl> - / / setup for a 50ms sink feed from SoftAE <nl> - if ( format . m_dataFormat ! = AE_FMT_FLOATP & & format . m_dataFormat ! = AE_FMT_FLOAT & & <nl> - format . m_dataFormat ! = AE_FMT_S32NE & & format . m_dataFormat ! = AE_FMT_S32NEP & & format . m_dataFormat ! = AE_FMT_S32LE & & <nl> - format . m_dataFormat ! = AE_FMT_S16NE & & format . m_dataFormat ! = AE_FMT_S16NEP & & format . m_dataFormat ! = AE_FMT_S16LE ) <nl> - format . m_dataFormat = AE_FMT_S16LE ; <nl> - unsigned int channels = format . m_channelLayout . Count ( ) ; <nl> - unsigned int sample_size = CAEUtil : : DataFormatToBits ( format . m_dataFormat ) > > 3 ; <nl> - format . m_frameSize = sample_size * channels ; <nl> - format . m_sampleRate = std : : max ( 8000U , std : : min ( 192000U , format . m_sampleRate ) ) ; <nl> - format . m_frames = format . m_sampleRate * AUDIO_PLAYBUFFER / NUM_OMX_BUFFERS ; <nl> - <nl> - m_format = format ; <nl> - m_sinkbuffer_sec_per_byte = 1 . 0 / ( double ) ( m_format . m_frameSize * m_format . m_sampleRate ) ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , " % s : % s Format : % d Channels : % d Samplerate : % d framesize : % d bufsize : % d bytes / s = % . 2f dest = % s " , CLASSNAME , __func__ , <nl> - m_format . m_dataFormat , channels , m_format . m_sampleRate , m_format . m_frameSize , m_format . m_frameSize * m_format . m_frames , 1 . 0 / m_sinkbuffer_sec_per_byte , <nl> - audioDevice . c_str ( ) ) ; <nl> - <nl> - / / magic value used when omxplayer is playing - want sink to be disabled <nl> - if ( m_passthrough & & m_format . m_streamInfo . m_sampleRate = = 16000 ) <nl> - return true ; <nl> - <nl> - SetAudioProps ( m_passthrough , GetChannelMap ( m_format . m_channelLayout , m_passthrough ) ) ; <nl> - <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - if ( ! m_omx_render . Initialize ( " OMX . broadcom . audio_render " , OMX_IndexParamAudioInit ) ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - m_omx_render . Initialize omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - <nl> - if ( m_output = = AESINKPI_BOTH ) <nl> - { <nl> - if ( ! m_omx_splitter . Initialize ( " OMX . broadcom . audio_splitter " , OMX_IndexParamAudioInit ) ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - m_omx_splitter . Initialize omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - if ( ! m_omx_render_slave . Initialize ( " OMX . broadcom . audio_render " , OMX_IndexParamAudioInit ) ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - m_omx_render . Initialize omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - m_omx_output = & m_omx_splitter ; <nl> - } <nl> - else <nl> - m_omx_output = & m_omx_render ; <nl> - <nl> - SetAudioDest ( ) ; <nl> - <nl> - OMX_INIT_STRUCTURE ( m_pcm_input ) ; <nl> - m_pcm_input . eNumData = OMX_NumericalDataSigned ; <nl> - m_pcm_input . eEndian = OMX_EndianLittle ; <nl> - m_pcm_input . bInterleaved = OMX_TRUE ; <nl> - m_pcm_input . nBitPerSample = sample_size * 8 ; <nl> - / / 0x8000 = float , 0x10000 = planar <nl> - uint32_t flags = 0 ; <nl> - if ( m_format . m_dataFormat = = AE_FMT_FLOAT | | m_format . m_dataFormat = = AE_FMT_FLOATP ) <nl> - flags | = 0x8000 ; <nl> - if ( AE_IS_PLANAR ( m_format . m_dataFormat ) ) <nl> - flags | = 0x10000 ; <nl> - m_pcm_input . ePCMMode = flags = = 0 ? OMX_AUDIO_PCMModeLinear : ( OMX_AUDIO_PCMMODETYPE ) flags ; <nl> - m_pcm_input . nChannels = channels ; <nl> - m_pcm_input . nSamplingRate = m_format . m_sampleRate ; <nl> - <nl> - if ( m_omx_splitter . IsInitialized ( ) ) <nl> - { <nl> - m_pcm_input . nPortIndex = m_omx_splitter . GetInputPort ( ) ; <nl> - omx_err = m_omx_splitter . SetParameter ( OMX_IndexParamAudioPcm , & m_pcm_input ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - error m_omx_splitter SetParameter in omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - <nl> - m_pcm_input . nPortIndex = m_omx_splitter . GetOutputPort ( ) ; <nl> - omx_err = m_omx_splitter . SetParameter ( OMX_IndexParamAudioPcm , & m_pcm_input ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - error m_omx_splitter SetParameter omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - <nl> - m_pcm_input . nPortIndex = m_omx_splitter . GetOutputPort ( ) + 1 ; <nl> - omx_err = m_omx_splitter . SetParameter ( OMX_IndexParamAudioPcm , & m_pcm_input ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - error m_omx_splitter SetParameter omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - } <nl> - <nl> - if ( m_omx_render_slave . IsInitialized ( ) ) <nl> - { <nl> - m_pcm_input . nPortIndex = m_omx_render_slave . GetInputPort ( ) ; <nl> - omx_err = m_omx_render_slave . SetParameter ( OMX_IndexParamAudioPcm , & m_pcm_input ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - error m_omx_render_slave SetParameter in omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - } <nl> - <nl> - if ( m_omx_render . IsInitialized ( ) ) <nl> - { <nl> - m_pcm_input . nPortIndex = m_omx_render . GetInputPort ( ) ; <nl> - omx_err = m_omx_render . SetParameter ( OMX_IndexParamAudioPcm , & m_pcm_input ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - error m_omx_render SetParameter in omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - } <nl> - <nl> - if ( m_omx_output - > IsInitialized ( ) ) <nl> - { <nl> - / / set up the number / size of buffers for decoder input <nl> - OMX_PARAM_PORTDEFINITIONTYPE port_param ; <nl> - OMX_INIT_STRUCTURE ( port_param ) ; <nl> - port_param . nPortIndex = m_omx_output - > GetInputPort ( ) ; <nl> - <nl> - omx_err = m_omx_output - > GetParameter ( OMX_IndexParamPortDefinition , & port_param ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : % s - error get OMX_IndexParamPortDefinition ( input ) omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - <nl> - port_param . nBufferCountActual = std : : max ( ( unsigned int ) port_param . nBufferCountMin , ( unsigned int ) NUM_OMX_BUFFERS ) ; <nl> - port_param . nBufferSize = ALIGN_UP ( m_format . m_frameSize * m_format . m_frames , port_param . nBufferAlignment ) ; <nl> - <nl> - omx_err = m_omx_output - > SetParameter ( OMX_IndexParamPortDefinition , & port_param ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : % s - error set OMX_IndexParamPortDefinition ( input ) omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - <nl> - omx_err = m_omx_output - > AllocInputBuffers ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : % s - Error alloc buffers 0x % 08x " , CLASSNAME , __func__ , omx_err ) ; <nl> - } <nl> - <nl> - if ( m_omx_splitter . IsInitialized ( ) ) <nl> - { <nl> - m_omx_tunnel_splitter . Initialize ( & m_omx_splitter , m_omx_splitter . GetOutputPort ( ) , & m_omx_render , m_omx_render . GetInputPort ( ) ) ; <nl> - omx_err = m_omx_tunnel_splitter . Establish ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXAudio : : Initialize - Error m_omx_tunnel_splitter . Establish 0x % 08x " , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_omx_tunnel_splitter_slave . Initialize ( & m_omx_splitter , m_omx_splitter . GetOutputPort ( ) + 1 , & m_omx_render_slave , m_omx_render_slave . GetInputPort ( ) ) ; <nl> - omx_err = m_omx_tunnel_splitter_slave . Establish ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXAudio : : Initialize - Error m_omx_tunnel_splitter_slave . Establish 0x % 08x " , omx_err ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> - if ( m_omx_splitter . IsInitialized ( ) ) <nl> - { <nl> - omx_err = m_omx_splitter . SetStateForComponent ( OMX_StateExecuting ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : % s - m_omx_splitter OMX_StateExecuting omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - } <nl> - if ( m_omx_render . IsInitialized ( ) ) <nl> - { <nl> - omx_err = m_omx_render . SetStateForComponent ( OMX_StateExecuting ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : % s - m_omx_render OMX_StateExecuting omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - } <nl> - if ( m_omx_render_slave . IsInitialized ( ) ) <nl> - { <nl> - omx_err = m_omx_render_slave . SetStateForComponent ( OMX_StateExecuting ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - CLog : : Log ( LOGERROR , " % s : % s - m_omx_render_slave OMX_StateExecuting omx_err ( 0x % 08x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - } <nl> - <nl> - m_Initialized = true ; <nl> - return true ; <nl> - } <nl> - <nl> - <nl> - void CAESinkPi : : Deinitialize ( ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : % s " , CLASSNAME , __func__ ) ; <nl> - SetAudioProps ( false , 0 ) ; <nl> - <nl> - if ( m_omx_render . IsInitialized ( ) ) <nl> - m_omx_render . IgnoreNextError ( OMX_ErrorPortUnpopulated ) ; <nl> - if ( m_omx_render_slave . IsInitialized ( ) ) <nl> - m_omx_render_slave . IgnoreNextError ( OMX_ErrorPortUnpopulated ) ; <nl> - <nl> - if ( m_omx_tunnel_splitter . IsInitialized ( ) ) <nl> - m_omx_tunnel_splitter . Deestablish ( ) ; <nl> - if ( m_omx_tunnel_splitter_slave . IsInitialized ( ) ) <nl> - m_omx_tunnel_splitter_slave . Deestablish ( ) ; <nl> - <nl> - if ( m_omx_splitter . IsInitialized ( ) ) <nl> - m_omx_splitter . FlushAll ( ) ; <nl> - if ( m_omx_render . IsInitialized ( ) ) <nl> - m_omx_render . FlushAll ( ) ; <nl> - if ( m_omx_render_slave . IsInitialized ( ) ) <nl> - m_omx_render_slave . FlushAll ( ) ; <nl> - <nl> - if ( m_omx_splitter . IsInitialized ( ) ) <nl> - m_omx_splitter . Deinitialize ( ) ; <nl> - if ( m_omx_render . IsInitialized ( ) ) <nl> - m_omx_render . Deinitialize ( ) ; <nl> - if ( m_omx_render_slave . IsInitialized ( ) ) <nl> - m_omx_render_slave . Deinitialize ( ) ; <nl> - <nl> - m_Initialized = false ; <nl> - } <nl> - <nl> - bool CAESinkPi : : IsCompatible ( const AEAudioFormat & format , const std : : string & device ) <nl> - { <nl> - bool compatible = <nl> - / * compare against the requested format and the real format * / <nl> - ( m_initFormat . m_sampleRate = = format . m_sampleRate | | m_format . m_sampleRate = = format . m_sampleRate ) & & <nl> - ( m_initFormat . m_dataFormat = = format . m_dataFormat | | m_format . m_dataFormat = = format . m_dataFormat ) & & <nl> - ( m_initFormat . m_channelLayout = = format . m_channelLayout | | m_format . m_channelLayout = = format . m_channelLayout ) & & <nl> - ( m_initDevice = = device ) ; <nl> - CLog : : Log ( LOGDEBUG , " % s : % s Format : % d Channels : % d Samplerate : % d = % d " , CLASSNAME , __func__ , format . m_dataFormat , format . m_channelLayout . Count ( ) , format . m_sampleRate , compatible ) ; <nl> - return compatible ; <nl> - } <nl> - <nl> - void CAESinkPi : : GetDelay ( AEDelayStatus & status ) <nl> - { <nl> - OMX_PARAM_U32TYPE param ; <nl> - OMX_INIT_STRUCTURE ( param ) ; <nl> - <nl> - if ( ! m_Initialized ) <nl> - { <nl> - status . SetDelay ( 0 ) ; <nl> - return ; <nl> - } <nl> - <nl> - param . nPortIndex = m_omx_render . GetInputPort ( ) ; <nl> - <nl> - OMX_ERRORTYPE omx_err = m_omx_render . GetConfig ( OMX_IndexConfigAudioRenderingLatency , & param ) ; <nl> - <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - error getting OMX_IndexConfigAudioRenderingLatency error 0x % 08x " , <nl> - CLASSNAME , __func__ , omx_err ) ; <nl> - } <nl> - double sinkbuffer_seconds_to_empty = m_sinkbuffer_sec_per_byte * param . nU32 * m_format . m_frameSize ; <nl> - status . SetDelay ( sinkbuffer_seconds_to_empty ) ; <nl> - } <nl> - <nl> - double CAESinkPi : : GetCacheTotal ( ) <nl> - { <nl> - return AUDIO_PLAYBUFFER ; <nl> - } <nl> - <nl> - unsigned int CAESinkPi : : AddPackets ( uint8_t * * data , unsigned int frames , unsigned int offset ) <nl> - { <nl> - if ( ! m_Initialized | | ! m_omx_output | | ! frames ) <nl> - { <nl> - KODI : : TIME : : Sleep ( 10 ) ; <nl> - return frames ; <nl> - } <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - OMX_BUFFERHEADERTYPE * omx_buffer = NULL ; <nl> - <nl> - unsigned int channels = m_format . m_channelLayout . Count ( ) ; <nl> - unsigned int sample_size = CAEUtil : : DataFormatToBits ( m_format . m_dataFormat ) > > 3 ; <nl> - const int planes = AE_IS_PLANAR ( m_format . m_dataFormat ) ? channels : 1 ; <nl> - const int chans = AE_IS_PLANAR ( m_format . m_dataFormat ) ? 1 : channels ; <nl> - const int pitch = chans * sample_size ; <nl> - <nl> - AEDelayStatus status ; <nl> - GetDelay ( status ) ; <nl> - double delay = status . GetDelay ( ) ; <nl> - if ( delay < = 0 . 0 & & m_submitted ) <nl> - CLog : : Log ( LOGINFO , " % s : % s Underrun ( delay : % . 2f frames : % d ) " , CLASSNAME , __func__ , delay , frames ) ; <nl> - <nl> - omx_buffer = m_omx_output - > GetInputBuffer ( 1000 ) ; <nl> - if ( omx_buffer = = NULL ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " CAESinkPi : : AddPackets timeout " ) ; <nl> - return 0 ; <nl> - } <nl> - <nl> - omx_buffer - > nFilledLen = frames * m_format . m_frameSize ; <nl> - / / must be true <nl> - assert ( omx_buffer - > nFilledLen < = omx_buffer - > nAllocLen ) ; <nl> - omx_buffer - > nTimeStamp = ToOMXTime ( 0 ) ; <nl> - omx_buffer - > nFlags = OMX_BUFFERFLAG_ENDOFFRAME ; <nl> - <nl> - if ( omx_buffer - > nFilledLen ) <nl> - { <nl> - int planesize = omx_buffer - > nFilledLen / planes ; <nl> - for ( int i = 0 ; i < planes ; i + + ) <nl> - memcpy ( ( uint8_t * ) omx_buffer - > pBuffer + i * planesize , data [ i ] + offset * pitch , planesize ) ; <nl> - } <nl> - omx_err = m_omx_output - > EmptyThisBuffer ( omx_buffer ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : % s frames = % d err = % x " , CLASSNAME , __func__ , frames , omx_err ) ; <nl> - m_omx_output - > DecoderEmptyBufferDone ( m_omx_output - > GetComponent ( ) , omx_buffer ) ; <nl> - } <nl> - m_submitted + + ; <nl> - GetDelay ( status ) ; <nl> - delay = status . GetDelay ( ) ; <nl> - if ( delay > AUDIO_PLAYBUFFER ) <nl> - KODI : : TIME : : Sleep ( static_cast < int > ( 1000 . 0f * ( delay - AUDIO_PLAYBUFFER ) ) ) ; <nl> - return frames ; <nl> - } <nl> - <nl> - void CAESinkPi : : Drain ( ) <nl> - { <nl> - AEDelayStatus status ; <nl> - GetDelay ( status ) ; <nl> - int delay = ( int ) ( status . GetDelay ( ) * 1000 . 0 ) ; <nl> - if ( delay ) <nl> - KODI : : TIME : : Sleep ( delay ) ; <nl> - CLog : : Log ( LOGDEBUG , " % s : % s delay : % dms now : % dms " , CLASSNAME , __func__ , delay , ( int ) ( status . GetDelay ( ) * 1000 . 0 ) ) ; <nl> - } <nl> - <nl> - void CAESinkPi : : EnumerateDevicesEx ( AEDeviceInfoList & list , bool force ) <nl> - { <nl> - m_info . m_channels . Reset ( ) ; <nl> - m_info . m_dataFormats . clear ( ) ; <nl> - m_info . m_streamTypes . clear ( ) ; <nl> - m_info . m_sampleRates . clear ( ) ; <nl> - <nl> - m_info . m_deviceType = AE_DEVTYPE_HDMI ; <nl> - m_info . m_deviceName = " HDMI " ; <nl> - m_info . m_displayName = " HDMI " ; <nl> - m_info . m_displayNameExtra = " " ; <nl> - m_info . m_channels + = AE_CH_FL ; <nl> - m_info . m_channels + = AE_CH_FR ; <nl> - for ( unsigned int i = 0 ; i < sizeof PassthroughSampleRates / sizeof * PassthroughSampleRates ; i + + ) <nl> - m_info . m_sampleRates . push_back ( PassthroughSampleRates [ i ] ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_FLOAT ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_S32NE ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_S16NE ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_S32LE ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_S16LE ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_FLOATP ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_S32NEP ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_S16NEP ) ; <nl> - <nl> - m_info . m_streamTypes . push_back ( CAEStreamInfo : : STREAM_TYPE_AC3 ) ; <nl> - m_info . m_streamTypes . push_back ( CAEStreamInfo : : STREAM_TYPE_EAC3 ) ; <nl> - m_info . m_streamTypes . push_back ( CAEStreamInfo : : STREAM_TYPE_DTSHD_CORE ) ; <nl> - m_info . m_streamTypes . push_back ( CAEStreamInfo : : STREAM_TYPE_DTS_2048 ) ; <nl> - m_info . m_streamTypes . push_back ( CAEStreamInfo : : STREAM_TYPE_DTS_1024 ) ; <nl> - m_info . m_streamTypes . push_back ( CAEStreamInfo : : STREAM_TYPE_DTS_512 ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_RAW ) ; <nl> - <nl> - m_info . m_wantsIECPassthrough = true ; <nl> - list . push_back ( m_info ) ; <nl> - <nl> - m_info . m_channels . Reset ( ) ; <nl> - m_info . m_dataFormats . clear ( ) ; <nl> - m_info . m_streamTypes . clear ( ) ; <nl> - m_info . m_sampleRates . clear ( ) ; <nl> - <nl> - m_info . m_deviceType = AE_DEVTYPE_PCM ; <nl> - m_info . m_deviceName = " Analogue " ; <nl> - m_info . m_displayName = " Analogue " ; <nl> - m_info . m_displayNameExtra = " " ; <nl> - m_info . m_channels + = AE_CH_FL ; <nl> - m_info . m_channels + = AE_CH_FR ; <nl> - m_info . m_sampleRates . push_back ( 48000 ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_FLOAT ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_S32LE ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_S16LE ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_FLOATP ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_S32NEP ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_S16NEP ) ; <nl> - <nl> - m_info . m_wantsIECPassthrough = true ; <nl> - list . push_back ( m_info ) ; <nl> - <nl> - m_info . m_channels . Reset ( ) ; <nl> - m_info . m_dataFormats . clear ( ) ; <nl> - m_info . m_streamTypes . clear ( ) ; <nl> - m_info . m_sampleRates . clear ( ) ; <nl> - <nl> - m_info . m_deviceType = AE_DEVTYPE_PCM ; <nl> - m_info . m_deviceName = " Both " ; <nl> - m_info . m_displayName = " HDMI and Analogue " ; <nl> - m_info . m_displayNameExtra = " " ; <nl> - m_info . m_channels + = AE_CH_FL ; <nl> - m_info . m_channels + = AE_CH_FR ; <nl> - m_info . m_sampleRates . push_back ( 48000 ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_FLOAT ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_S32LE ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_S16LE ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_FLOATP ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_S32NEP ) ; <nl> - m_info . m_dataFormats . push_back ( AE_FMT_S16NEP ) ; <nl> - <nl> - m_info . m_wantsIECPassthrough = true ; <nl> - list . push_back ( m_info ) ; <nl> - } <nl> deleted file mode 100644 <nl> index 3003bf90a97e . . 000000000000 <nl> mmm a / xbmc / cores / AudioEngine / Sinks / AESinkPi . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2010 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # include " cores / AudioEngine / Interfaces / AESink . h " <nl> - # include " cores / AudioEngine / Utils / AEDeviceInfo . h " <nl> - # include " utils / XTimeUtils . h " <nl> - <nl> - # include " platform / linux / OMXCore . h " <nl> - <nl> - class CAESinkPi : public IAESink <nl> - { <nl> - public : <nl> - virtual const char * GetName ( ) { return " SinkPi " ; } <nl> - <nl> - CAESinkPi ( ) ; <nl> - virtual ~ CAESinkPi ( ) ; <nl> - <nl> - static void Register ( ) ; <nl> - static IAESink * Create ( std : : string & device , AEAudioFormat & desiredFormat ) ; <nl> - <nl> - virtual bool Initialize ( AEAudioFormat & format , std : : string & device ) ; <nl> - virtual void Deinitialize ( ) ; <nl> - virtual bool IsCompatible ( const AEAudioFormat & format , const std : : string & device ) ; <nl> - <nl> - virtual void GetDelay ( AEDelayStatus & status ) ; <nl> - virtual double GetCacheTotal ( ) ; <nl> - virtual unsigned int AddPackets ( uint8_t * * data , unsigned int frames , unsigned int offset ) ; <nl> - virtual void Drain ( ) ; <nl> - <nl> - static void EnumerateDevicesEx ( AEDeviceInfoList & list , bool force = false ) ; <nl> - private : <nl> - void SetAudioDest ( ) ; <nl> - <nl> - std : : string m_initDevice ; <nl> - AEAudioFormat m_initFormat ; <nl> - AEAudioFormat m_format ; <nl> - double m_sinkbuffer_sec_per_byte ; <nl> - static CAEDeviceInfo m_info ; <nl> - bool m_Initialized ; <nl> - uint32_t m_submitted ; <nl> - OMX_AUDIO_PARAM_PCMMODETYPE m_pcm_input ; <nl> - COMXCoreComponent * m_omx_output ; <nl> - COMXCoreComponent m_omx_splitter ; <nl> - COMXCoreComponent m_omx_render ; <nl> - COMXCoreComponent m_omx_render_slave ; <nl> - bool m_passthrough ; <nl> - COMXCoreTunnel m_omx_tunnel_splitter ; <nl> - COMXCoreTunnel m_omx_tunnel_splitter_slave ; <nl> - enum { AESINKPI_UNKNOWN , AESINKPI_HDMI , AESINKPI_ANALOGUE , AESINKPI_BOTH } m_output ; <nl> - } ; <nl> deleted file mode 100644 <nl> index 97eb97960f35 . . 000000000000 <nl> mmm a / xbmc / cores / RetroPlayer / process / rbpi / CMakeLists . txt <nl> ppp / dev / null <nl> <nl> - if ( CORE_PLATFORM_NAME_LC STREQUAL rbpi ) <nl> - set ( SOURCES RPProcessInfoPi . cpp ) <nl> - <nl> - set ( HEADERS RPProcessInfoPi . h ) <nl> - <nl> - core_add_library ( rp - process - pi ) <nl> - endif ( ) <nl> deleted file mode 100644 <nl> index 135172979a0c . . 000000000000 <nl> mmm a / xbmc / cores / RetroPlayer / process / rbpi / RPProcessInfoPi . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2017 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # include " RPProcessInfoPi . h " <nl> - <nl> - using namespace KODI ; <nl> - using namespace RETRO ; <nl> - <nl> - CRPProcessInfoPi : : CRPProcessInfoPi ( ) : CRPProcessInfo ( " RPi " ) <nl> - { <nl> - } <nl> - <nl> - CRPProcessInfo * CRPProcessInfoPi : : Create ( ) <nl> - { <nl> - return new CRPProcessInfoPi ( ) ; <nl> - } <nl> - <nl> - void CRPProcessInfoPi : : Register ( ) <nl> - { <nl> - CRPProcessInfo : : RegisterProcessControl ( CRPProcessInfoPi : : Create ) ; <nl> - } <nl> deleted file mode 100644 <nl> index a800f72bbbb0 . . 000000000000 <nl> mmm a / xbmc / cores / RetroPlayer / process / rbpi / RPProcessInfoPi . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2017 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # include " cores / RetroPlayer / process / RPProcessInfo . h " <nl> - <nl> - namespace KODI <nl> - { <nl> - namespace RETRO <nl> - { <nl> - class CRPProcessInfoPi : public CRPProcessInfo <nl> - { <nl> - public : <nl> - CRPProcessInfoPi ( ) ; <nl> - <nl> - static CRPProcessInfo * Create ( ) ; <nl> - static void Register ( ) ; <nl> - } ; <nl> - } / / namespace RETRO <nl> - } / / namespace KODI <nl> mmm a / xbmc / cores / VideoPlayer / DVDCodecs / Video / CMakeLists . txt <nl> ppp b / xbmc / cores / VideoPlayer / DVDCodecs / Video / CMakeLists . txt <nl> if ( APPLE ) <nl> list ( APPEND HEADERS VTB . h ) <nl> endif ( ) <nl> <nl> - if ( MMAL_FOUND ) <nl> - list ( APPEND SOURCES MMALCodec . cpp ) <nl> - list ( APPEND HEADERS MMALCodec . h ) <nl> - list ( APPEND SOURCES MMALFFmpeg . cpp ) <nl> - list ( APPEND HEADERS MMALFFmpeg . h ) <nl> - endif ( ) <nl> - <nl> if ( CORE_SYSTEM_NAME STREQUAL android ) <nl> list ( APPEND SOURCES DVDVideoCodecAndroidMediaCodec . cpp ) <nl> list ( APPEND HEADERS DVDVideoCodecAndroidMediaCodec . h ) <nl> deleted file mode 100644 <nl> index 4fdd733026ef . . 000000000000 <nl> mmm a / xbmc / cores / VideoPlayer / DVDCodecs / Video / MMALCodec . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2010 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # if defined ( TARGET_WINDOWS ) <nl> - # endif <nl> - <nl> - # include < interface / mmal / util / mmal_util . h > <nl> - # include < interface / mmal / util / mmal_default_components . h > <nl> - # include < interface / mmal / util / mmal_util_params . h > <nl> - <nl> - # include " MMALCodec . h " <nl> - <nl> - # include " ServiceBroker . h " <nl> - # include " DVDClock . h " <nl> - # include " DVDStreamInfo . h " <nl> - # include " cores / VideoPlayer / DVDCodecs / DVDCodecs . h " <nl> - # include " cores / VideoPlayer / DVDCodecs / DVDFactoryCodec . h " <nl> - # include " DVDVideoCodec . h " <nl> - # include " utils / log . h " <nl> - # include " utils / TimeUtils . h " <nl> - # include " settings / MediaSettings . h " <nl> - # include " settings / Settings . h " <nl> - # include " settings / SettingsComponent . h " <nl> - # include " messaging / ApplicationMessenger . h " <nl> - # include " Application . h " <nl> - # include " guilib / GUIWindowManager . h " <nl> - # include " cores / VideoPlayer / VideoRenderers / RenderFlags . h " <nl> - # include " settings / DisplaySettings . h " <nl> - # include " settings / SettingsComponent . h " <nl> - # include " cores / VideoPlayer / VideoRenderers / RenderManager . h " <nl> - # include " cores / VideoPlayer / Interface / Addon / TimingConstants . h " <nl> - <nl> - # include " platform / linux / RBP . h " <nl> - <nl> - using namespace KODI : : MESSAGING ; <nl> - using namespace MMAL ; <nl> - <nl> - # define CLASSNAME " CMMALVideoBuffer " <nl> - <nl> - # define VERBOSE 0 <nl> - <nl> - CMMALVideoBuffer : : CMMALVideoBuffer ( int id ) : CMMALBuffer ( id ) <nl> - { <nl> - } <nl> - <nl> - CMMALVideoBuffer : : ~ CMMALVideoBuffer ( ) <nl> - { <nl> - } <nl> - <nl> - # undef CLASSNAME <nl> - # define CLASSNAME " CMMALVideo " <nl> - <nl> - CMMALVideo : : CMMALVideo ( CProcessInfo & processInfo ) : CDVDVideoCodec ( processInfo ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s % p " , CLASSNAME , __func__ , static_cast < void * > ( this ) ) ; <nl> - <nl> - m_decoded_width = 0 ; <nl> - m_decoded_height = 0 ; <nl> - m_decoded_aligned_width = 0 ; <nl> - m_decoded_aligned_height = 0 ; <nl> - <nl> - m_finished = false ; <nl> - m_pFormatName = " mmal - xxxx " ; <nl> - <nl> - m_interlace_mode = MMAL_InterlaceProgressive ; <nl> - m_decoderPts = DVD_NOPTS_VALUE ; <nl> - m_demuxerPts = DVD_NOPTS_VALUE ; <nl> - <nl> - m_dec = NULL ; <nl> - m_dec_input = NULL ; <nl> - m_dec_output = NULL ; <nl> - m_dec_input_pool = NULL ; <nl> - m_pool = nullptr ; <nl> - <nl> - m_codingType = 0 ; <nl> - <nl> - m_es_format = mmal_format_alloc ( ) ; <nl> - m_preroll = true ; <nl> - m_speed = DVD_PLAYSPEED_NORMAL ; <nl> - m_fps = 0 . 0f ; <nl> - m_num_decoded = 0 ; <nl> - m_codecControlFlags = 0 ; <nl> - m_got_eos = false ; <nl> - m_packet_num = 0 ; <nl> - m_packet_num_eos = ~ 0 ; <nl> - } <nl> - <nl> - CMMALVideo : : ~ CMMALVideo ( ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s % p " , CLASSNAME , __func__ , static_cast < void * > ( this ) ) ; <nl> - if ( ! m_finished ) <nl> - Dispose ( ) ; <nl> - <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - <nl> - if ( m_dec & & m_dec - > control & & m_dec - > control - > is_enabled ) <nl> - mmal_port_disable ( m_dec - > control ) ; <nl> - <nl> - if ( m_dec_input & & m_dec_input - > is_enabled ) <nl> - mmal_port_disable ( m_dec_input ) ; <nl> - <nl> - m_dec_output = NULL ; <nl> - <nl> - if ( m_dec_input_pool ) <nl> - mmal_port_pool_destroy ( m_dec_input , m_dec_input_pool ) ; <nl> - m_dec_input_pool = NULL ; <nl> - m_dec_input = NULL ; <nl> - <nl> - m_dec = NULL ; <nl> - mmal_format_free ( m_es_format ) ; <nl> - m_es_format = NULL ; <nl> - } <nl> - <nl> - void CMMALVideo : : PortSettingsChanged ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) <nl> - { <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - MMAL_EVENT_FORMAT_CHANGED_T * fmt = mmal_event_format_changed_get ( buffer ) ; <nl> - mmal_format_copy ( m_es_format , fmt - > format ) ; <nl> - <nl> - if ( m_es_format - > es - > video . crop . width & & m_es_format - > es - > video . crop . height ) <nl> - { <nl> - if ( m_es_format - > es - > video . par . num & & m_es_format - > es - > video . par . den ) <nl> - m_aspect_ratio = ( float ) ( m_es_format - > es - > video . par . num * m_es_format - > es - > video . crop . width ) / ( m_es_format - > es - > video . par . den * m_es_format - > es - > video . crop . height ) ; <nl> - m_decoded_width = m_es_format - > es - > video . crop . width ; <nl> - m_decoded_height = m_es_format - > es - > video . crop . height ; <nl> - m_decoded_aligned_width = m_es_format - > es - > video . width ; <nl> - m_decoded_aligned_height = m_es_format - > es - > video . height ; <nl> - <nl> - m_processInfo . SetVideoDimensions ( m_decoded_width , m_decoded_height ) ; <nl> - m_processInfo . SetVideoDAR ( m_aspect_ratio ) ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s format changed : % dx % d ( % dx % d ) % . 2f " , CLASSNAME , __func__ , m_decoded_width , m_decoded_height , m_decoded_aligned_width , m_decoded_aligned_height , m_aspect_ratio ) ; <nl> - } <nl> - else <nl> - CLog : : Log ( LOGERROR , " % s : : % s format changed : Unexpected % dx % d ( % dx % d ) " , CLASSNAME , __func__ , m_es_format - > es - > video . crop . width , m_es_format - > es - > video . crop . height , m_decoded_aligned_width , m_decoded_aligned_height ) ; <nl> - <nl> - if ( ! change_dec_output_format ( ) ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s - change_dec_output_format ( ) failed " , CLASSNAME , __func__ ) ; <nl> - } <nl> - <nl> - void CMMALVideo : : dec_control_port_cb ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) <nl> - { <nl> - MMAL_STATUS_T status ; <nl> - <nl> - if ( buffer - > cmd = = MMAL_EVENT_ERROR ) <nl> - { <nl> - status = ( MMAL_STATUS_T ) * ( uint32_t * ) buffer - > data ; <nl> - CLog : : Log ( LOGERROR , " % s : : % s Error ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - } <nl> - else if ( buffer - > cmd = = MMAL_EVENT_FORMAT_CHANGED ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s format changed " , CLASSNAME , __func__ ) ; <nl> - PortSettingsChanged ( port , buffer ) ; <nl> - } <nl> - else <nl> - CLog : : Log ( LOGERROR , " % s : : % s other ( cmd : % x data : % x ) " , CLASSNAME , __func__ , buffer - > cmd , * ( uint32_t * ) buffer - > data ) ; <nl> - <nl> - mmal_buffer_header_release ( buffer ) ; <nl> - } <nl> - <nl> - static void dec_control_port_cb_static ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) <nl> - { <nl> - CMMALVideo * mmal = reinterpret_cast < CMMALVideo * > ( port - > userdata ) ; <nl> - mmal - > dec_control_port_cb ( port , buffer ) ; <nl> - } <nl> - <nl> - <nl> - void CMMALVideo : : dec_input_port_cb ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s port : % p buffer % p , len % d cmd : % x " , CLASSNAME , __func__ , <nl> - static_cast < void * > ( port ) , static_cast < void * > ( buffer ) , buffer - > length , buffer - > cmd ) ; <nl> - mmal_buffer_header_release ( buffer ) ; <nl> - CSingleLock output_lock ( m_output_mutex ) ; <nl> - m_output_cond . notifyAll ( ) ; <nl> - } <nl> - <nl> - static void dec_input_port_cb_static ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) <nl> - { <nl> - CMMALVideo * mmal = reinterpret_cast < CMMALVideo * > ( port - > userdata ) ; <nl> - mmal - > dec_input_port_cb ( port , buffer ) ; <nl> - } <nl> - <nl> - <nl> - void CMMALVideo : : dec_output_port_cb ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) <nl> - { <nl> - if ( ! ( buffer - > cmd = = 0 & & buffer - > length > 0 ) ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s port : % p buffer % p , len % d cmd : % x flags : % x " , CLASSNAME , <nl> - __func__ , static_cast < void * > ( port ) , static_cast < void * > ( buffer ) , buffer - > length , <nl> - buffer - > cmd , buffer - > flags ) ; <nl> - } <nl> - <nl> - bool kept = false ; <nl> - CMMALVideoBuffer * omvb = ( CMMALVideoBuffer * ) buffer - > user_data ; <nl> - <nl> - assert ( ! ( buffer - > flags & MMAL_BUFFER_HEADER_FLAG_TRANSMISSION_FAILED ) ) ; <nl> - if ( buffer - > cmd = = 0 ) <nl> - { <nl> - if ( buffer - > length > 0 ) <nl> - { <nl> - if ( buffer - > pts ! = MMAL_TIME_UNKNOWN ) <nl> - m_decoderPts = buffer - > pts ; <nl> - else if ( buffer - > dts ! = MMAL_TIME_UNKNOWN ) <nl> - m_decoderPts = buffer - > dts ; <nl> - <nl> - assert ( ! ( buffer - > flags & MMAL_BUFFER_HEADER_FLAG_DECODEONLY ) ) ; <nl> - assert ( omvb ) ; <nl> - assert ( omvb - > mmal_buffer = = buffer ) ; <nl> - bool wanted = true ; <nl> - / / we don ' t keep up when running at 60fps in the background so switch to half rate <nl> - if ( m_fps > 40 . 0f & & ! CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) . IsFullScreenVideo ( ) & & ! ( m_num_decoded & 1 ) ) <nl> - wanted = false ; <nl> - if ( ( buffer - > flags & MMAL_BUFFER_HEADER_FLAG_CORRUPTED ) ) <nl> - wanted = false ; <nl> - m_num_decoded + + ; <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , <nl> - " % s : : % s - omvb : % p mmal : % p len : % u dts : % . 3f pts : % . 3f flags : % x : % x pool : % p % dx % d " <nl> - " ( % dx % d ) % dx % d ( % dx % d ) enc : % . 4s " , <nl> - CLASSNAME , __func__ , static_cast < void * > ( buffer ) , static_cast < void * > ( omvb ) , <nl> - buffer - > length , buffer - > dts * 1e - 6 , buffer - > pts * 1e - 6 , buffer - > flags , <nl> - buffer - > type - > video . flags , static_cast < void * > ( m_pool . get ( ) ) , omvb - > Width ( ) , <nl> - omvb - > Height ( ) , omvb - > AlignedWidth ( ) , omvb - > AlignedHeight ( ) , m_decoded_width , <nl> - m_decoded_height , m_decoded_aligned_width , m_decoded_aligned_height , <nl> - ( char * ) & omvb - > Encoding ( ) ) ; <nl> - if ( wanted ) <nl> - { <nl> - std : : shared_ptr < CMMALPool > pool = std : : dynamic_pointer_cast < CMMALPool > ( m_pool ) ; <nl> - if ( pool ) <nl> - pool - > Configure ( AV_PIX_FMT_NONE , m_decoded_width , m_decoded_height , m_decoded_aligned_width , m_decoded_aligned_height , 128 ) ; <nl> - omvb - > m_aspect_ratio = m_aspect_ratio ; <nl> - { <nl> - CSingleLock output_lock ( m_output_mutex ) ; <nl> - m_output_ready . push ( omvb ) ; <nl> - m_output_cond . notifyAll ( ) ; <nl> - } <nl> - kept = true ; <nl> - } <nl> - } <nl> - if ( buffer - > flags & MMAL_BUFFER_HEADER_FLAG_EOS ) <nl> - { <nl> - CSingleLock output_lock ( m_output_mutex ) ; <nl> - m_got_eos = true ; <nl> - m_output_cond . notifyAll ( ) ; <nl> - } <nl> - } <nl> - else if ( buffer - > cmd = = MMAL_EVENT_FORMAT_CHANGED ) <nl> - { <nl> - PortSettingsChanged ( port , buffer ) ; <nl> - } <nl> - if ( ! kept ) <nl> - { <nl> - if ( omvb ) <nl> - omvb - > Release ( ) ; <nl> - else <nl> - mmal_buffer_header_release ( buffer ) ; <nl> - } <nl> - } <nl> - <nl> - static void dec_output_port_cb_static ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) <nl> - { <nl> - CMMALVideo * mmal = reinterpret_cast < CMMALVideo * > ( port - > userdata ) ; <nl> - mmal - > dec_output_port_cb ( port , buffer ) ; <nl> - } <nl> - <nl> - bool CMMALVideo : : change_dec_output_format ( ) <nl> - { <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - MMAL_STATUS_T status ; <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s " , CLASSNAME , __func__ ) ; <nl> - <nl> - MMAL_PARAMETER_VIDEO_INTERLACE_TYPE_T interlace_type = { { MMAL_PARAMETER_VIDEO_INTERLACE_TYPE , sizeof ( interlace_type ) } } ; <nl> - status = mmal_port_parameter_get ( m_dec_output , & interlace_type . hdr ) ; <nl> - <nl> - if ( status = = MMAL_SUCCESS ) <nl> - { <nl> - if ( m_interlace_mode ! = interlace_type . eMode ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s Interlace mode % d - > % d " , CLASSNAME , __func__ , m_interlace_mode , interlace_type . eMode ) ; <nl> - m_interlace_mode = interlace_type . eMode ; <nl> - } <nl> - } <nl> - else <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to query interlace type on % s ( status = % x % s ) " , CLASSNAME , __func__ , m_dec_output - > name , status , mmal_status_to_string ( status ) ) ; <nl> - <nl> - mmal_format_copy ( m_dec_output - > format , m_es_format ) ; <nl> - <nl> - status = mmal_port_parameter_set_boolean ( m_dec_output , MMAL_PARAMETER_ZERO_COPY , MMAL_TRUE ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable zero copy mode on % s ( status = % x % s ) " , CLASSNAME , __func__ , m_dec_output - > name , status , mmal_status_to_string ( status ) ) ; <nl> - <nl> - status = mmal_port_format_commit ( m_dec_output ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to commit decoder output port ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - return true ; <nl> - } <nl> - <nl> - bool CMMALVideo : : SendCodecConfigData ( ) <nl> - { <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - MMAL_STATUS_T status ; <nl> - if ( ! m_dec_input_pool | | ! m_hints . extrasize ) <nl> - return true ; <nl> - / / send code config data <nl> - MMAL_BUFFER_HEADER_T * buffer = mmal_queue_timedwait ( m_dec_input_pool - > queue , 500 ) ; <nl> - if ( ! buffer ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - mmal_queue_get failed " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - mmal_buffer_header_reset ( buffer ) ; <nl> - buffer - > cmd = 0 ; <nl> - buffer - > length = std : : min ( m_hints . extrasize , buffer - > alloc_size ) ; <nl> - memcpy ( buffer - > data , m_hints . extradata , buffer - > length ) ; <nl> - buffer - > flags = MMAL_BUFFER_HEADER_FLAG_FRAME_END | MMAL_BUFFER_HEADER_FLAG_CONFIG ; <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s - % - 8p % - 6d flags : % x " , CLASSNAME , __func__ , static_cast < void * > ( buffer ) , <nl> - buffer - > length , buffer - > flags ) ; <nl> - status = mmal_port_send_buffer ( m_dec_input , buffer ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed send buffer to decoder input port ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - return true ; <nl> - } <nl> - <nl> - bool CMMALVideo : : Open ( CDVDStreamInfo & hints , CDVDCodecOptions & options ) <nl> - { <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s usemmal : % d options : % x % dx % d " , CLASSNAME , __func__ , CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) - > GetBool ( CSettings : : SETTING_VIDEOPLAYER_USEMMAL ) , hints . codecOptions , hints . width , hints . height ) ; <nl> - <nl> - / / This occurs at start of m2ts files before streams have been fully identified - just ignore <nl> - if ( ! hints . width ) <nl> - return false ; <nl> - / / we always qualify even if DVDFactoryCodec does this too . <nl> - if ( ! CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) - > GetBool ( CSettings : : SETTING_VIDEOPLAYER_USEMMAL ) | | ( hints . codecOptions & CODEC_FORCE_SOFTWARE ) ) <nl> - return false ; <nl> - <nl> - std : : list < EINTERLACEMETHOD > deintMethods ; <nl> - deintMethods . push_back ( EINTERLACEMETHOD : : VS_INTERLACEMETHOD_AUTO ) ; <nl> - deintMethods . push_back ( EINTERLACEMETHOD : : VS_INTERLACEMETHOD_MMAL_ADVANCED ) ; <nl> - deintMethods . push_back ( EINTERLACEMETHOD : : VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF ) ; <nl> - deintMethods . push_back ( EINTERLACEMETHOD : : VS_INTERLACEMETHOD_MMAL_BOB ) ; <nl> - deintMethods . push_back ( EINTERLACEMETHOD : : VS_INTERLACEMETHOD_MMAL_BOB_HALF ) ; <nl> - m_processInfo . UpdateDeinterlacingMethods ( deintMethods ) ; <nl> - <nl> - m_hints = hints ; <nl> - MMAL_STATUS_T status ; <nl> - <nl> - m_decoded_width = hints . width ; <nl> - m_decoded_height = hints . height ; <nl> - <nl> - m_decoded_aligned_width = ALIGN_UP ( m_decoded_width , 32 ) ; <nl> - m_decoded_aligned_height = ALIGN_UP ( m_decoded_height , 16 ) ; <nl> - <nl> - / / use aspect in stream if available <nl> - if ( m_hints . forced_aspect ) <nl> - m_aspect_ratio = m_hints . aspect ; <nl> - else <nl> - m_aspect_ratio = 0 . 0 ; <nl> - <nl> - switch ( hints . codec ) <nl> - { <nl> - case AV_CODEC_ID_H264 : <nl> - / / H . 264 <nl> - switch ( hints . profile ) <nl> - { <nl> - / / Cannot hardware decode Hi10P without artifacts - switch to software on Pi2 / Pi3 <nl> - case FF_PROFILE_H264_HIGH_10 : <nl> - case FF_PROFILE_H264_HIGH_10_INTRA : <nl> - if ( g_RBP . RaspberryPiVersion ( ) > 1 ) <nl> - return false ; <nl> - } <nl> - m_codingType = MMAL_ENCODING_H264 ; <nl> - m_pFormatName = " mmal - h264 " ; <nl> - if ( CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) - > GetBool ( CSettings : : SETTING_VIDEOPLAYER_SUPPORTMVC ) ) <nl> - { <nl> - m_codingType = MMAL_ENCODING_MVC ; <nl> - m_pFormatName = " mmal - mvc " ; <nl> - } <nl> - break ; <nl> - case AV_CODEC_ID_H263 : <nl> - case AV_CODEC_ID_MPEG4 : <nl> - / / MPEG - 4 , DivX 4 / 5 and Xvid compatible <nl> - m_codingType = MMAL_ENCODING_MP4V ; <nl> - m_pFormatName = " mmal - mpeg4 " ; <nl> - break ; <nl> - case AV_CODEC_ID_MPEG1VIDEO : <nl> - case AV_CODEC_ID_MPEG2VIDEO : <nl> - / / MPEG - 2 <nl> - m_codingType = MMAL_ENCODING_MP2V ; <nl> - m_pFormatName = " mmal - mpeg2 " ; <nl> - break ; <nl> - case AV_CODEC_ID_VP6 : <nl> - / / this form is encoded upside down <nl> - / / fall through <nl> - case AV_CODEC_ID_VP6F : <nl> - case AV_CODEC_ID_VP6A : <nl> - / / VP6 <nl> - m_codingType = MMAL_ENCODING_VP6 ; <nl> - m_pFormatName = " mmal - vp6 " ; <nl> - break ; <nl> - case AV_CODEC_ID_VP8 : <nl> - / / VP8 <nl> - m_codingType = MMAL_ENCODING_VP8 ; <nl> - m_pFormatName = " mmal - vp8 " ; <nl> - break ; <nl> - case AV_CODEC_ID_THEORA : <nl> - / / theora <nl> - m_codingType = MMAL_ENCODING_THEORA ; <nl> - m_pFormatName = " mmal - theora " ; <nl> - break ; <nl> - case AV_CODEC_ID_MJPEG : <nl> - case AV_CODEC_ID_MJPEGB : <nl> - / / mjpg <nl> - m_codingType = MMAL_ENCODING_MJPEG ; <nl> - m_pFormatName = " mmal - mjpg " ; <nl> - break ; <nl> - case AV_CODEC_ID_VC1 : <nl> - case AV_CODEC_ID_WMV3 : <nl> - / / VC - 1 , WMV9 <nl> - m_codingType = MMAL_ENCODING_WVC1 ; <nl> - m_pFormatName = " mmal - vc1 " ; <nl> - break ; <nl> - default : <nl> - CLog : : Log ( LOGERROR , " % s : : % s : Video codec unknown : % x " , CLASSNAME , __func__ , hints . codec ) ; <nl> - return false ; <nl> - break ; <nl> - } <nl> - <nl> - if ( ( m_codingType = = MMAL_ENCODING_MP2V & & ! g_RBP . GetCodecMpg2 ( ) ) | | <nl> - ( m_codingType = = MMAL_ENCODING_WVC1 & & ! g_RBP . GetCodecWvc1 ( ) ) ) <nl> - { <nl> - CLog : : Log ( LOGWARNING , " % s : : % s Codec % s is not supported " , CLASSNAME , __func__ , m_pFormatName ) ; <nl> - return false ; <nl> - } <nl> - <nl> - / * Create video component with attached pool * / <nl> - m_pool = std : : make_shared < CMMALPool > ( MMAL_COMPONENT_DEFAULT_VIDEO_DECODER , false , MMAL_NUM_OUTPUT_BUFFERS , 128 , MMAL_ENCODING_OPAQUE , MMALStateHWDec ) ; <nl> - if ( ! m_pool ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to create pool for video output " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - std : : shared_ptr < CMMALPool > pool = std : : dynamic_pointer_cast < CMMALPool > ( m_pool ) ; <nl> - pool - > SetProcessInfo ( & m_processInfo ) ; <nl> - m_dec = pool - > GetComponent ( ) ; <nl> - <nl> - m_dec - > control - > userdata = ( struct MMAL_PORT_USERDATA_T * ) this ; <nl> - status = mmal_port_enable ( m_dec - > control , dec_control_port_cb_static ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable decoder control port % s ( status = % x % s ) " , CLASSNAME , __func__ , MMAL_COMPONENT_DEFAULT_VIDEO_DECODER , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_dec_input = m_dec - > input [ 0 ] ; <nl> - <nl> - m_dec_input - > format - > type = MMAL_ES_TYPE_VIDEO ; <nl> - m_dec_input - > format - > encoding = m_codingType ; <nl> - if ( m_decoded_width & & m_decoded_height ) <nl> - { <nl> - m_dec_input - > format - > es - > video . crop . width = m_decoded_width ; <nl> - m_dec_input - > format - > es - > video . crop . height = m_decoded_height ; <nl> - <nl> - m_dec_input - > format - > es - > video . width = m_decoded_aligned_width ; <nl> - m_dec_input - > format - > es - > video . height = m_decoded_aligned_width ; <nl> - } <nl> - if ( hints . fpsrate > 0 & & hints . fpsscale > 0 ) <nl> - { <nl> - m_dec_input - > format - > es - > video . frame_rate . num = hints . fpsrate ; <nl> - m_dec_input - > format - > es - > video . frame_rate . den = hints . fpsscale ; <nl> - m_fps = hints . fpsrate / hints . fpsscale ; <nl> - } <nl> - else <nl> - m_fps = 0 . 0f ; <nl> - m_dec_input - > format - > flags | = MMAL_ES_FORMAT_FLAG_FRAMED ; <nl> - <nl> - status = mmal_port_parameter_set_boolean ( m_dec_input , MMAL_PARAMETER_VIDEO_DECODE_ERROR_CONCEALMENT , MMAL_FALSE ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to disable error concealment on % s ( status = % x % s ) " , CLASSNAME , __func__ , m_dec_input - > name , status , mmal_status_to_string ( status ) ) ; <nl> - <nl> - / / we need an extra buffer when seeking as a picture remains on screen from old seek point <nl> - status = mmal_port_parameter_set_uint32 ( m_dec_input , MMAL_PARAMETER_EXTRA_BUFFERS , GetAllowedReferences ( ) + 1 ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable extra buffers on % s ( status = % x % s ) " , CLASSNAME , __func__ , m_dec_input - > name , status , mmal_status_to_string ( status ) ) ; <nl> - <nl> - status = mmal_port_parameter_set_uint32 ( m_dec_input , MMAL_PARAMETER_VIDEO_INTERPOLATE_TIMESTAMPS , 1 ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to disable interpolate timestamps mode on % s ( status = % x % s ) " , CLASSNAME , __func__ , m_dec_input - > name , status , mmal_status_to_string ( status ) ) ; <nl> - <nl> - / / limit number of callback structures in video_decode to reduce latency . Too low and video hangs . <nl> - / / negative numbers have special meaning . - 1 = size of DPB - 2 = size of DPB + 1 <nl> - status = mmal_port_parameter_set_uint32 ( m_dec_input , MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS , - 5 ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to configure max num callbacks on % s ( status = % x % s ) " , CLASSNAME , __func__ , m_dec_input - > name , status , mmal_status_to_string ( status ) ) ; <nl> - <nl> - status = mmal_port_parameter_set_boolean ( m_dec_input , MMAL_PARAMETER_ZERO_COPY , MMAL_TRUE ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable zero copy mode on % s ( status = % x % s ) " , CLASSNAME , __func__ , m_dec_input - > name , status , mmal_status_to_string ( status ) ) ; <nl> - <nl> - status = mmal_port_format_commit ( m_dec_input ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to commit format for decoder input port % s ( status = % x % s ) " , CLASSNAME , __func__ , m_dec_input - > name , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - / / use a small number of large buffers to keep latency under control <nl> - m_dec_input - > buffer_size = 1024 * 1024 ; <nl> - m_dec_input - > buffer_num = 2 ; <nl> - <nl> - m_dec_input - > userdata = ( struct MMAL_PORT_USERDATA_T * ) this ; <nl> - status = mmal_port_enable ( m_dec_input , dec_input_port_cb_static ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable decoder input port % s ( status = % x % s ) " , CLASSNAME , __func__ , m_dec_input - > name , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_dec_output = m_dec - > output [ 0 ] ; <nl> - <nl> - mmal_format_copy ( m_es_format , m_dec_output - > format ) ; <nl> - <nl> - status = mmal_port_format_commit ( m_dec_output ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to commit decoder output format ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_dec_output - > buffer_size = m_dec_output - > buffer_size_min ; <nl> - m_dec_output - > buffer_num = MMAL_NUM_OUTPUT_BUFFERS ; <nl> - m_dec_output - > userdata = ( struct MMAL_PORT_USERDATA_T * ) this ; <nl> - status = mmal_port_enable ( m_dec_output , dec_output_port_cb_static ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable decoder output port ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - status = mmal_component_enable ( m_dec ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable decoder component % s ( status = % x % s ) " , CLASSNAME , __func__ , m_dec - > name , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_dec_input_pool = mmal_port_pool_create ( m_dec_input , m_dec_input - > buffer_num , m_dec_input - > buffer_size ) ; <nl> - if ( ! m_dec_input_pool ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to create pool for decoder input port ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! SendCodecConfigData ( ) ) <nl> - return false ; <nl> - <nl> - if ( pool ) <nl> - pool - > Prime ( ) ; <nl> - m_preroll = ! m_hints . stills ; <nl> - m_speed = DVD_PLAYSPEED_NORMAL ; <nl> - <nl> - m_processInfo . SetVideoDecoderName ( m_pFormatName , true ) ; <nl> - m_processInfo . SetVideoDimensions ( m_decoded_width , m_decoded_height ) ; <nl> - m_processInfo . SetVideoDAR ( m_aspect_ratio ) ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - void CMMALVideo : : Dispose ( ) <nl> - { <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - m_finished = true ; <nl> - Reset ( ) ; <nl> - } <nl> - <nl> - bool CMMALVideo : : AddData ( const DemuxPacket & packet ) <nl> - { <nl> - uint8_t * pData = packet . pData ; <nl> - int iSize = packet . iSize ; <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - / / if ( CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - / / CLog : : Log ( LOGDEBUG , " % s : : % s - % - 8p % - 6d dts : % . 3f pts : % . 3f ready_queue ( % d ) " , <nl> - / / CLASSNAME , __func__ , pData , iSize , dts = = DVD_NOPTS_VALUE ? 0 . 0 : packet . dts * 1e - 6 , packet . pts = = DVD_NOPTS_VALUE ? 0 . 0 : packet . pts * 1e - 6 , m_output_ready . size ( ) ) ; <nl> - <nl> - MMAL_BUFFER_HEADER_T * buffer ; <nl> - MMAL_STATUS_T status ; <nl> - assert ( pData ! = nullptr & & iSize > 0 ) ; / / no longer valid <nl> - <nl> - while ( iSize > 0 ) <nl> - { <nl> - / / 500ms timeout <nl> - lock . Leave ( ) ; <nl> - buffer = mmal_queue_timedwait ( m_dec_input_pool - > queue , 500 ) ; <nl> - if ( ! buffer ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - mmal_queue_get failed " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - lock . Enter ( ) ; <nl> - <nl> - mmal_buffer_header_reset ( buffer ) ; <nl> - buffer - > cmd = 0 ; <nl> - buffer - > pts = packet . pts = = DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : packet . pts ; <nl> - buffer - > dts = packet . dts = = DVD_NOPTS_VALUE ? MMAL_TIME_UNKNOWN : packet . dts ; <nl> - if ( m_hints . ptsinvalid ) buffer - > pts = MMAL_TIME_UNKNOWN ; <nl> - buffer - > length = ( uint32_t ) iSize > buffer - > alloc_size ? buffer - > alloc_size : ( uint32_t ) iSize ; <nl> - / / set a flag so we can identify primary frames from generated frames ( deinterlace ) <nl> - buffer - > flags = 0 ; <nl> - if ( m_codecControlFlags & DVD_CODEC_CTRL_DROP_ANY ) <nl> - buffer - > flags | = MMAL_BUFFER_HEADER_FLAG_USER3 ; <nl> - <nl> - if ( pData ) <nl> - memcpy ( buffer - > data , pData , buffer - > length ) ; <nl> - iSize - = buffer - > length ; <nl> - pData + = buffer - > length ; <nl> - <nl> - if ( iSize = = 0 ) <nl> - { <nl> - m_packet_num + + ; <nl> - buffer - > flags | = MMAL_BUFFER_HEADER_FLAG_FRAME_END ; <nl> - } <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , <nl> - " % s : : % s - % - 8p % - 6d / % - 6d dts : % . 3f pts : % . 3f flags : % x ready_queue ( % d ) " , CLASSNAME , <nl> - __func__ , static_cast < void * > ( buffer ) , buffer - > length , iSize , <nl> - packet . dts = = DVD_NOPTS_VALUE ? 0 . 0 : packet . dts * 1e - 6 , <nl> - packet . pts = = DVD_NOPTS_VALUE ? 0 . 0 : packet . pts * 1e - 6 , buffer - > flags , <nl> - m_output_ready . size ( ) ) ; <nl> - status = mmal_port_send_buffer ( m_dec_input , buffer ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed send buffer to decoder input port ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - if ( packet . pts ! = DVD_NOPTS_VALUE ) <nl> - m_demuxerPts = packet . pts ; <nl> - else if ( packet . dts ! = DVD_NOPTS_VALUE ) <nl> - m_demuxerPts = packet . dts ; <nl> - <nl> - if ( m_demuxerPts ! = DVD_NOPTS_VALUE & & m_decoderPts = = DVD_NOPTS_VALUE ) <nl> - m_decoderPts = m_demuxerPts ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - void CMMALVideo : : Reset ( void ) <nl> - { <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s " , CLASSNAME , __func__ ) ; <nl> - <nl> - if ( m_dec_input & & m_dec_input - > is_enabled ) <nl> - mmal_port_disable ( m_dec_input ) ; <nl> - if ( m_dec_output & & m_dec_output - > is_enabled ) <nl> - mmal_port_disable ( m_dec_output ) ; <nl> - if ( ! m_finished ) <nl> - { <nl> - if ( m_dec_input ) <nl> - mmal_port_enable ( m_dec_input , dec_input_port_cb_static ) ; <nl> - if ( m_dec_output ) <nl> - mmal_port_enable ( m_dec_output , dec_output_port_cb_static ) ; <nl> - } <nl> - / / blow all ready video frames <nl> - while ( 1 ) <nl> - { <nl> - CMMALVideoBuffer * buffer = NULL ; <nl> - { <nl> - CSingleLock output_lock ( m_output_mutex ) ; <nl> - / / fetch a output buffer and pop it off the ready list <nl> - if ( ! m_output_ready . empty ( ) ) <nl> - { <nl> - buffer = m_output_ready . front ( ) ; <nl> - m_output_ready . pop ( ) ; <nl> - } <nl> - m_output_cond . notifyAll ( ) ; <nl> - } <nl> - if ( buffer ) <nl> - buffer - > Release ( ) ; <nl> - else <nl> - break ; <nl> - } <nl> - <nl> - if ( ! m_finished ) <nl> - { <nl> - SendCodecConfigData ( ) ; <nl> - std : : shared_ptr < CMMALPool > pool = std : : dynamic_pointer_cast < CMMALPool > ( m_pool ) ; <nl> - if ( pool ) <nl> - pool - > Prime ( ) ; <nl> - } <nl> - m_decoderPts = DVD_NOPTS_VALUE ; <nl> - m_demuxerPts = DVD_NOPTS_VALUE ; <nl> - m_codecControlFlags = 0 ; <nl> - m_num_decoded = 0 ; <nl> - m_got_eos = false ; <nl> - m_packet_num = 0 ; <nl> - m_packet_num_eos = ~ 0 ; <nl> - m_preroll = ! m_hints . stills & & ( m_speed = = DVD_PLAYSPEED_NORMAL | | m_speed = = DVD_PLAYSPEED_PAUSE ) ; <nl> - } <nl> - <nl> - void CMMALVideo : : SetSpeed ( int iSpeed ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s % d - > % d " , CLASSNAME , __func__ , m_speed , iSpeed ) ; <nl> - <nl> - m_speed = iSpeed ; <nl> - } <nl> - <nl> - CDVDVideoCodec : : VCReturn CMMALVideo : : GetPicture ( VideoPicture * picture ) <nl> - { <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - MMAL_STATUS_T status ; <nl> - bool drain = ( m_codecControlFlags & DVD_CODEC_CTRL_DRAIN ) ? true : false ; <nl> - bool send_eos = drain & & ! m_got_eos & & m_packet_num_eos ! = m_packet_num ; <nl> - <nl> - / / we don ' t get an EOS response if no packets have been sent <nl> - if ( ! drain ) <nl> - m_got_eos = false ; <nl> - else if ( m_packet_num = = 0 & & send_eos ) <nl> - m_got_eos = true ; <nl> - <nl> - if ( send_eos & & ! m_got_eos ) <nl> - { <nl> - MMAL_BUFFER_HEADER_T * buffer ; <nl> - / / 500ms timeout <nl> - lock . Leave ( ) ; <nl> - buffer = mmal_queue_timedwait ( m_dec_input_pool - > queue , 500 ) ; <nl> - lock . Enter ( ) ; <nl> - <nl> - if ( buffer ) <nl> - { <nl> - mmal_buffer_header_reset ( buffer ) ; <nl> - buffer - > cmd = 0 ; <nl> - buffer - > flags | = MMAL_BUFFER_HEADER_FLAG_FRAME_END | MMAL_BUFFER_HEADER_FLAG_EOS ; <nl> - m_packet_num_eos = m_packet_num ; <nl> - m_got_eos = false ; <nl> - status = mmal_port_send_buffer ( m_dec_input , buffer ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed send buffer to decoder input port ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return VC_ERROR ; <nl> - } <nl> - else <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s - Send EOS ( % d , % d , % d ) " , CLASSNAME , __func__ , m_got_eos , m_packet_num , m_packet_num_eos ) ; <nl> - } <nl> - else <nl> - { <nl> - CLog : : Log ( LOGWARNING , " % s : : % s - mmal_queue_get failed " , CLASSNAME , __func__ ) ; <nl> - / / lets assume decoder has returned all it will <nl> - m_got_eos = true ; <nl> - } <nl> - } <nl> - <nl> - / / we ' ve built up quite a lot of data in decoder - try to throttle it <nl> - double queued = m_decoderPts ! = DVD_NOPTS_VALUE & & m_demuxerPts ! = DVD_NOPTS_VALUE ? m_demuxerPts - m_decoderPts : 0 . 0 ; <nl> - bool full = queued > DVD_MSEC_TO_TIME ( 1000 ) ; <nl> - CDVDVideoCodec : : VCReturn ret = CDVDVideoCodec : : VC_NONE ; <nl> - <nl> - CMMALVideoBuffer * buffer = nullptr ; <nl> - XbmcThreads : : EndTime delay ( 500 ) ; <nl> - while ( ret = = CDVDVideoCodec : : VC_NONE & & ! delay . IsTimePast ( ) ) <nl> - { <nl> - CSingleLock output_lock ( m_output_mutex ) ; <nl> - unsigned int pics = m_output_ready . size ( ) ; <nl> - if ( m_preroll & & ( pics > = GetAllowedReferences ( ) | | drain ) ) <nl> - m_preroll = false ; <nl> - if ( pics > 0 & & ! m_preroll ) <nl> - { <nl> - / / fetch a output buffer and pop it off the ready list <nl> - buffer = m_output_ready . front ( ) ; <nl> - m_output_ready . pop ( ) ; <nl> - m_output_cond . notifyAll ( ) ; <nl> - ret = CDVDVideoCodec : : VC_PICTURE ; <nl> - } <nl> - else if ( m_got_eos ) <nl> - ret = CDVDVideoCodec : : VC_EOF ; <nl> - else if ( ( m_preroll | | pics < = 1 ) & & mmal_queue_length ( m_dec_input_pool - > queue ) > 0 ) <nl> - ret = CDVDVideoCodec : : VC_BUFFER ; <nl> - if ( ret = = CDVDVideoCodec : : VC_NONE ) <nl> - { <nl> - / / otherwise we busy spin <nl> - lock . Leave ( ) ; <nl> - m_output_cond . wait ( output_lock , delay . MillisLeft ( ) ) ; <nl> - lock . Enter ( ) ; <nl> - } <nl> - } <nl> - <nl> - if ( ret = = CDVDVideoCodec : : VC_PICTURE ) <nl> - { <nl> - assert ( buffer & & buffer - > mmal_buffer ) ; <nl> - if ( picture - > videoBuffer ) <nl> - picture - > videoBuffer - > Release ( ) ; <nl> - picture - > videoBuffer = dynamic_cast < CVideoBuffer * > ( buffer ) ; <nl> - assert ( picture - > videoBuffer ) ; <nl> - picture - > color_range = 0 ; <nl> - picture - > iWidth = buffer - > Width ( ) ? buffer - > Width ( ) : m_decoded_width ; <nl> - picture - > iHeight = buffer - > Height ( ) ? buffer - > Height ( ) : m_decoded_height ; <nl> - picture - > iDisplayWidth = picture - > iWidth ; <nl> - picture - > iDisplayHeight = picture - > iHeight ; <nl> - / / CLog : : Log ( LOGDEBUG , " % s : : % s - % dx % d % dx % d % dx % d % dx % d % f , % f " , CLASSNAME , __func__ , picture - > iWidth , picture - > iHeight , picture - > iDisplayWidth , picture - > iDisplayHeight , m_decoded_width , m_decoded_height , buffer - > Width ( ) , buffer - > Height ( ) , buffer - > m_aspect_ratio , m_hints . aspect ) ; <nl> - <nl> - if ( buffer - > m_aspect_ratio > 0 . 0 ) <nl> - { <nl> - picture - > iDisplayWidth = ( ( int ) lrint ( picture - > iHeight * buffer - > m_aspect_ratio ) ) & - 3 ; <nl> - if ( picture - > iDisplayWidth > picture - > iWidth ) <nl> - { <nl> - picture - > iDisplayWidth = picture - > iWidth ; <nl> - picture - > iDisplayHeight = ( ( int ) lrint ( picture - > iWidth / buffer - > m_aspect_ratio ) ) & - 3 ; <nl> - } <nl> - } <nl> - <nl> - / / timestamp is in microseconds <nl> - picture - > dts = buffer - > mmal_buffer - > dts = = MMAL_TIME_UNKNOWN ? DVD_NOPTS_VALUE : buffer - > mmal_buffer - > dts ; <nl> - picture - > pts = buffer - > mmal_buffer - > pts = = MMAL_TIME_UNKNOWN ? DVD_NOPTS_VALUE : buffer - > mmal_buffer - > pts ; <nl> - picture - > iRepeatPicture = 0 ; <nl> - picture - > iFlags = 0 ; <nl> - if ( buffer - > mmal_buffer - > flags & MMAL_BUFFER_HEADER_FLAG_USER3 ) <nl> - picture - > iFlags | = DVP_FLAG_DROPPED ; <nl> - CLog : : Log ( LOGINFO , LOGVIDEO , <nl> - " % s : : % s dts : % . 3f pts : % . 3f flags : % x : % x MMALBuffer : % p mmal_buffer : % p " , CLASSNAME , <nl> - __func__ , picture - > dts = = DVD_NOPTS_VALUE ? 0 . 0 : picture - > dts * 1e - 6 , <nl> - picture - > pts = = DVD_NOPTS_VALUE ? 0 . 0 : picture - > pts * 1e - 6 , picture - > iFlags , <nl> - buffer - > mmal_buffer - > flags , static_cast < void * > ( buffer ) , <nl> - static_cast < void * > ( buffer - > mmal_buffer ) ) ; <nl> - assert ( ! ( buffer - > mmal_buffer - > flags & MMAL_BUFFER_HEADER_FLAG_DECODEONLY ) ) ; <nl> - buffer - > mmal_buffer - > flags & = ~ MMAL_BUFFER_HEADER_FLAG_USER3 ; <nl> - buffer - > m_stills = m_hints . stills ; <nl> - } <nl> - <nl> - if ( ret = = CDVDVideoCodec : : VC_NONE ) <nl> - CLog : : Log ( LOGWARNING , " % s : : % s - ret ( % x ) pics ( % d ) inputs ( % d ) slept ( % 2d ) queued ( % . 2f ) ( % . 2f : % . 2f ) full ( % d ) flags ( % x ) preroll ( % d ) eos ( % d % d / % d ) " , CLASSNAME , __func__ , ret , m_output_ready . size ( ) , mmal_queue_length ( m_dec_input_pool - > queue ) , 500 - delay . MillisLeft ( ) , queued * 1e - 6 , m_demuxerPts * 1e - 6 , m_decoderPts * 1e - 6 , full , m_codecControlFlags , m_preroll , m_got_eos , m_packet_num , m_packet_num_eos ) ; <nl> - else <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s - ret ( % x ) pics ( % d ) inputs ( % d ) slept ( % 2d ) queued ( % . 2f ) ( % . 2f : % . 2f ) full ( % d ) flags ( % x ) preroll ( % d ) eos ( % d % d / % d ) " , CLASSNAME , __func__ , ret , m_output_ready . size ( ) , mmal_queue_length ( m_dec_input_pool - > queue ) , 500 - delay . MillisLeft ( ) , queued * 1e - 6 , m_demuxerPts * 1e - 6 , m_decoderPts * 1e - 6 , full , m_codecControlFlags , m_preroll , m_got_eos , m_packet_num , m_packet_num_eos ) ; <nl> - <nl> - return ret ; <nl> - } <nl> - <nl> - void CMMALVideo : : SetCodecControl ( int flags ) <nl> - { <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - if ( m_codecControlFlags ! = flags ) <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s % x - > % x " , CLASSNAME , __func__ , m_codecControlFlags , flags ) ; <nl> - m_codecControlFlags = flags ; <nl> - } <nl> - <nl> - CDVDVideoCodec * CMMALVideo : : Create ( CProcessInfo & processInfo ) <nl> - { <nl> - return new CMMALVideo ( processInfo ) ; <nl> - } <nl> - <nl> - void CMMALVideo : : Register ( ) <nl> - { <nl> - CDVDFactoryCodec : : RegisterHWVideoCodec ( " mmal " , CMMALVideo : : Create ) ; <nl> - } <nl> deleted file mode 100644 <nl> index 0e5e27ce39f4 . . 000000000000 <nl> mmm a / xbmc / cores / VideoPlayer / DVDCodecs / Video / MMALCodec . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2010 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # include " DVDVideoCodec . h " <nl> - # include " cores / VideoPlayer / DVDResource . h " <nl> - # include " cores / VideoPlayer / DVDStreamInfo . h " <nl> - # include " cores / VideoPlayer / VideoRenderers / BaseRenderer . h " <nl> - # include " cores / VideoPlayer / VideoRenderers / HwDecRender / MMALRenderer . h " <nl> - # include " cores / VideoSettings . h " <nl> - # include " rendering / RenderSystem . h " <nl> - # include " threads / Event . h " <nl> - # include " utils / Geometry . h " <nl> - <nl> - # include < memory > <nl> - # include < queue > <nl> - # include < string > <nl> - <nl> - # include < semaphore . h > <nl> - <nl> - namespace MMAL { <nl> - <nl> - class CMMALVideo ; <nl> - class CMMALPool ; <nl> - <nl> - / / a mmal video frame <nl> - class CMMALVideoBuffer : public CMMALBuffer <nl> - { <nl> - public : <nl> - CMMALVideoBuffer ( int id ) ; <nl> - virtual ~ CMMALVideoBuffer ( ) ; <nl> - protected : <nl> - } ; <nl> - <nl> - class CMMALVideo : public CDVDVideoCodec <nl> - { <nl> - public : <nl> - CMMALVideo ( CProcessInfo & processInfo ) ; <nl> - virtual ~ CMMALVideo ( ) ; <nl> - <nl> - / / Required overrides <nl> - virtual bool Open ( CDVDStreamInfo & hints , CDVDCodecOptions & options ) override ; <nl> - virtual bool AddData ( const DemuxPacket & packet ) override ; <nl> - virtual void Reset ( void ) override ; <nl> - virtual CDVDVideoCodec : : VCReturn GetPicture ( VideoPicture * pDvdVideoPicture ) override ; <nl> - virtual unsigned GetAllowedReferences ( ) override { return 4 ; } <nl> - virtual const char * GetName ( void ) override { return m_pFormatName ? m_pFormatName : " mmal - xxx " ; } <nl> - virtual void SetCodecControl ( int flags ) override ; <nl> - virtual void SetSpeed ( int iSpeed ) override ; <nl> - <nl> - / / MMAL decoder callback routines . <nl> - void dec_output_port_cb ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) ; <nl> - void dec_control_port_cb ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) ; <nl> - void dec_input_port_cb ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) ; <nl> - static CDVDVideoCodec * Create ( CProcessInfo & processInfo ) ; <nl> - static void Register ( ) ; <nl> - <nl> - protected : <nl> - void QueryCodec ( void ) ; <nl> - void Dispose ( void ) ; <nl> - <nl> - / / Video format <nl> - unsigned int m_decoded_width ; <nl> - unsigned int m_decoded_height ; <nl> - unsigned int m_decoded_aligned_width ; <nl> - unsigned int m_decoded_aligned_height ; <nl> - unsigned int m_egl_buffer_count ; <nl> - bool m_finished ; <nl> - float m_aspect_ratio ; <nl> - const char * m_pFormatName ; <nl> - <nl> - / / mmal output buffers ( video frames ) <nl> - CCriticalSection m_output_mutex ; <nl> - XbmcThreads : : ConditionVariable m_output_cond ; <nl> - std : : queue < CMMALVideoBuffer * > m_output_ready ; <nl> - <nl> - / / initialize mmal and get decoder component <nl> - bool Initialize ( const std : : string & decoder_name ) ; <nl> - void PortSettingsChanged ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) ; <nl> - bool SendCodecConfigData ( ) ; <nl> - <nl> - CDVDStreamInfo m_hints ; <nl> - float m_fps ; <nl> - unsigned m_num_decoded ; <nl> - / / Components <nl> - MMAL_INTERLACETYPE_T m_interlace_mode ; <nl> - double m_demuxerPts ; <nl> - double m_decoderPts ; <nl> - int m_speed ; <nl> - int m_codecControlFlags ; <nl> - bool m_preroll ; <nl> - bool m_got_eos ; <nl> - uint32_t m_packet_num ; <nl> - uint32_t m_packet_num_eos ; <nl> - <nl> - CCriticalSection m_sharedSection ; <nl> - MMAL_COMPONENT_T * m_dec ; <nl> - MMAL_PORT_T * m_dec_input ; <nl> - MMAL_PORT_T * m_dec_output ; <nl> - MMAL_POOL_T * m_dec_input_pool ; <nl> - std : : shared_ptr < CMMALPool > m_pool ; <nl> - <nl> - MMAL_ES_FORMAT_T * m_es_format ; <nl> - <nl> - MMAL_FOURCC_T m_codingType ; <nl> - VideoPicture * m_lastDvdVideoPicture ; <nl> - <nl> - bool change_dec_output_format ( ) ; <nl> - } ; <nl> - <nl> - } ; <nl> deleted file mode 100644 <nl> index 28eff23f1614 . . 000000000000 <nl> mmm a / xbmc / cores / VideoPlayer / DVDCodecs / Video / MMALFFmpeg . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2016 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # include < interface / mmal / util / mmal_default_components . h > <nl> - <nl> - # include " cores / VideoPlayer / VideoRenderers / RenderManager . h " <nl> - # include " . . / DVDCodecUtils . h " <nl> - # include " cores / VideoPlayer / DVDCodecs / DVDFactoryCodec . h " <nl> - # include " MMALFFmpeg . h " <nl> - # include " utils / log . h " <nl> - # include " utils / StringUtils . h " <nl> - # include " platform / linux / RBP . h " <nl> - # include " settings / AdvancedSettings . h " <nl> - <nl> - extern " C " { <nl> - # include < libavutil / imgutils . h > <nl> - } <nl> - <nl> - using namespace MMAL ; <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - / / MMAL Buffers <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - # define CLASSNAME " CMMALYUVBuffer " <nl> - <nl> - # define VERBOSE 0 <nl> - <nl> - CMMALYUVBuffer : : CMMALYUVBuffer ( int id ) <nl> - : CMMALBuffer ( id ) <nl> - { <nl> - } <nl> - <nl> - CMMALYUVBuffer : : ~ CMMALYUVBuffer ( ) <nl> - { <nl> - delete m_gmem ; <nl> - } <nl> - <nl> - uint8_t * CMMALYUVBuffer : : GetMemPtr ( ) <nl> - { <nl> - if ( ! m_gmem ) <nl> - return nullptr ; <nl> - return static_cast < uint8_t * > ( m_gmem - > m_arm ) ; <nl> - } <nl> - <nl> - void CMMALYUVBuffer : : GetPlanes ( uint8_t * ( & planes ) [ YuvImage : : MAX_PLANES ] ) <nl> - { <nl> - for ( int i = 0 ; i < YuvImage : : MAX_PLANES ; i + + ) <nl> - planes [ i ] = nullptr ; <nl> - <nl> - std : : shared_ptr < CMMALPool > pool = std : : dynamic_pointer_cast < CMMALPool > ( m_pool ) ; <nl> - assert ( pool ) ; <nl> - AVRpiZcFrameGeometry geo = pool - > GetGeometry ( ) ; <nl> - <nl> - if ( VERBOSE ) <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s % dx % d % dx % d ( % dx % d % dx % d ) " , CLASSNAME , __FUNCTION__ , geo . getStrideY ( ) , geo . getHeightY ( ) , geo . getStrideC ( ) , geo . getHeightC ( ) , Width ( ) , Height ( ) , AlignedWidth ( ) , AlignedHeight ( ) ) ; <nl> - <nl> - planes [ 0 ] = GetMemPtr ( ) ; <nl> - if ( planes [ 0 ] & & geo . getPlanesC ( ) > = 1 ) <nl> - planes [ 1 ] = planes [ 0 ] + geo . getSizeY ( ) ; <nl> - if ( planes [ 1 ] & & geo . getPlanesC ( ) > = 2 ) <nl> - planes [ 2 ] = planes [ 1 ] + geo . getSizeC ( ) ; <nl> - } <nl> - <nl> - void CMMALYUVBuffer : : GetStrides ( int ( & strides ) [ YuvImage : : MAX_PLANES ] ) <nl> - { <nl> - for ( int i = 0 ; i < YuvImage : : MAX_PLANES ; i + + ) <nl> - strides [ i ] = 0 ; <nl> - std : : shared_ptr < CMMALPool > pool = std : : dynamic_pointer_cast < CMMALPool > ( m_pool ) ; <nl> - assert ( pool ) ; <nl> - AVRpiZcFrameGeometry geo = pool - > GetGeometry ( ) ; <nl> - strides [ 0 ] = geo . getStrideY ( ) ; <nl> - strides [ 1 ] = geo . getStrideC ( ) ; <nl> - strides [ 2 ] = geo . getStrideC ( ) ; <nl> - } <nl> - <nl> - void CMMALYUVBuffer : : SetDimensions ( int width , int height , const int ( & strides ) [ YuvImage : : MAX_PLANES ] , const int ( & planeOffsets ) [ YuvImage : : MAX_PLANES ] ) <nl> - { <nl> - std : : shared_ptr < CMMALPool > pool = std : : dynamic_pointer_cast < CMMALPool > ( m_pool ) ; <nl> - assert ( pool ) ; <nl> - pool - > SetDimensions ( width , height , strides , planeOffsets ) ; <nl> - } <nl> - <nl> - void CMMALYUVBuffer : : SetDimensions ( int width , int height , const int ( & strides ) [ YuvImage : : MAX_PLANES ] ) <nl> - { <nl> - const int ( & planeOffsets ) [ YuvImage : : MAX_PLANES ] = { } ; <nl> - SetDimensions ( width , height , strides , planeOffsets ) ; <nl> - } <nl> - <nl> - CGPUMEM * CMMALYUVBuffer : : Allocate ( int size , void * opaque ) <nl> - { <nl> - m_gmem = new CGPUMEM ( size , true ) ; <nl> - if ( m_gmem & & m_gmem - > m_vc ) <nl> - { <nl> - m_gmem - > m_opaque = opaque ; <nl> - } <nl> - else <nl> - { <nl> - delete m_gmem ; <nl> - m_gmem = nullptr ; <nl> - } <nl> - return m_gmem ; <nl> - } <nl> - <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - / / MMAL Decoder <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - # undef CLASSNAME <nl> - # define CLASSNAME " CDecoder " <nl> - <nl> - void CDecoder : : AlignedSize ( AVCodecContext * avctx , int & width , int & height ) <nl> - { <nl> - if ( ! avctx ) <nl> - return ; <nl> - int w = width , h = height ; <nl> - AVFrame picture ; <nl> - int unaligned ; <nl> - int stride_align [ AV_NUM_DATA_POINTERS ] ; <nl> - <nl> - avcodec_align_dimensions2 ( avctx , & w , & h , stride_align ) ; <nl> - <nl> - do { <nl> - / / NOTE : do not align linesizes individually , this breaks e . g . assumptions <nl> - / / that linesize [ 0 ] = = 2 * linesize [ 1 ] in the MPEG - encoder for 4 : 2 : 2 <nl> - av_image_fill_linesizes ( picture . linesize , avctx - > pix_fmt , w ) ; <nl> - / / increase alignment of w for next try ( rhs gives the lowest bit set in w ) <nl> - w + = w & ~ ( w - 1 ) ; <nl> - <nl> - unaligned = 0 ; <nl> - for ( int i = 0 ; i < 4 ; i + + ) <nl> - unaligned | = picture . linesize [ i ] % stride_align [ i ] ; <nl> - } while ( unaligned ) ; <nl> - width = w ; <nl> - height = h ; <nl> - } <nl> - <nl> - CDecoder : : CDecoder ( CProcessInfo & processInfo , CDVDStreamInfo & hints ) : m_processInfo ( processInfo ) , m_hints ( hints ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s - create % p " , CLASSNAME , __FUNCTION__ , static_cast < void * > ( this ) ) ; <nl> - m_avctx = nullptr ; <nl> - m_pool = nullptr ; <nl> - } <nl> - <nl> - CDecoder : : ~ CDecoder ( ) <nl> - { <nl> - if ( m_renderBuffer ) <nl> - m_renderBuffer - > Release ( ) ; <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s - destroy % p " , CLASSNAME , __FUNCTION__ , static_cast < void * > ( this ) ) ; <nl> - } <nl> - <nl> - long CDecoder : : Release ( ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s - m_refs : % ld " , CLASSNAME , __FUNCTION__ , m_refs . load ( ) ) ; <nl> - return IHardwareDecoder : : Release ( ) ; <nl> - } <nl> - <nl> - void CDecoder : : FFReleaseBuffer ( void * opaque , uint8_t * data ) <nl> - { <nl> - CGPUMEM * gmem = ( CGPUMEM * ) opaque ; <nl> - CMMALYUVBuffer * YUVBuffer = ( CMMALYUVBuffer * ) gmem - > m_opaque ; <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s buf : % p gmem : % p " , CLASSNAME , __FUNCTION__ , <nl> - static_cast < void * > ( YUVBuffer ) , static_cast < void * > ( gmem ) ) ; <nl> - <nl> - YUVBuffer - > Release ( ) ; <nl> - } <nl> - <nl> - int CDecoder : : FFGetBuffer ( AVCodecContext * avctx , AVFrame * frame , int flags ) <nl> - { <nl> - ICallbackHWAccel * cb = static_cast < ICallbackHWAccel * > ( avctx - > opaque ) ; <nl> - CDecoder * dec = static_cast < CDecoder * > ( cb - > GetHWAccel ( ) ) ; <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s % dx % d format : % x : % x flags : % x " , CLASSNAME , __FUNCTION__ , frame - > width , frame - > height , frame - > format , dec - > m_fmt , flags ) ; <nl> - <nl> - if ( ( avctx - > codec & & ( avctx - > codec - > capabilities & AV_CODEC_CAP_DR1 ) = = 0 ) | | frame - > format ! = dec - > m_fmt ) <nl> - { <nl> - assert ( 0 ) ; <nl> - return avcodec_default_get_buffer2 ( avctx , frame , flags ) ; <nl> - } <nl> - <nl> - std : : shared_ptr < CMMALPool > pool = std : : dynamic_pointer_cast < CMMALPool > ( dec - > m_pool ) ; <nl> - if ( ! pool - > IsConfigured ( ) ) <nl> - { <nl> - int aligned_width = frame - > width ; <nl> - int aligned_height = frame - > height ; <nl> - if ( pool - > Encoding ( ) ! = MMAL_ENCODING_YUVUV128 & & pool - > Encoding ( ) ! = MMAL_ENCODING_YUVUV64_16 ) <nl> - { <nl> - / / ffmpeg requirements <nl> - AlignedSize ( dec - > m_avctx , aligned_width , aligned_height ) ; <nl> - / / GPU requirements <nl> - aligned_width = ALIGN_UP ( aligned_width , 32 ) ; <nl> - aligned_height = ALIGN_UP ( aligned_height , 16 ) ; <nl> - } <nl> - pool - > Configure ( dec - > m_fmt , frame - > width , frame - > height , aligned_width , aligned_height , 0 ) ; <nl> - } <nl> - CMMALYUVBuffer * YUVBuffer = dynamic_cast < CMMALYUVBuffer * > ( pool - > Get ( ) ) ; <nl> - if ( ! YUVBuffer ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to allocated buffer in time " , CLASSNAME , __FUNCTION__ ) ; <nl> - return - 1 ; <nl> - } <nl> - assert ( YUVBuffer - > mmal_buffer ) ; <nl> - <nl> - CGPUMEM * gmem = YUVBuffer - > GetMem ( ) ; <nl> - assert ( gmem ) ; <nl> - <nl> - AVBufferRef * buf = av_buffer_create ( ( uint8_t * ) gmem - > m_arm , gmem - > m_numbytes , CDecoder : : FFReleaseBuffer , gmem , AV_BUFFER_FLAG_READONLY ) ; <nl> - if ( ! buf ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s av_buffer_create ( ) failed " , CLASSNAME , __FUNCTION__ ) ; <nl> - YUVBuffer - > Release ( ) ; <nl> - return - 1 ; <nl> - } <nl> - <nl> - uint8_t * planes [ YuvImage : : MAX_PLANES ] ; <nl> - int strides [ YuvImage : : MAX_PLANES ] ; <nl> - YUVBuffer - > GetPlanes ( planes ) ; <nl> - YUVBuffer - > GetStrides ( strides ) ; <nl> - <nl> - for ( int i = 0 ; i < AV_NUM_DATA_POINTERS ; i + + ) <nl> - { <nl> - frame - > data [ i ] = i < YuvImage : : MAX_PLANES ? planes [ i ] : nullptr ; <nl> - frame - > linesize [ i ] = i < YuvImage : : MAX_PLANES ? strides [ i ] : 0 ; <nl> - frame - > buf [ i ] = i = = 0 ? buf : nullptr ; <nl> - } <nl> - <nl> - frame - > extended_data = frame - > data ; <nl> - / / Leave extended buf alone <nl> - <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s buf : % p mmal : % p gmem : % p avbuf : % p : % p : % p " , CLASSNAME , <nl> - __FUNCTION__ , static_cast < void * > ( YUVBuffer ) , static_cast < void * > ( YUVBuffer - > mmal_buffer ) , <nl> - static_cast < void * > ( gmem ) , static_cast < void * > ( frame - > data [ 0 ] ) , <nl> - static_cast < void * > ( frame - > data [ 1 ] ) , static_cast < void * > ( frame - > data [ 2 ] ) ) ; <nl> - <nl> - return 0 ; <nl> - } <nl> - <nl> - <nl> - bool CDecoder : : Open ( AVCodecContext * avctx , AVCodecContext * mainctx , enum AVPixelFormat fmt ) <nl> - { <nl> - CSingleLock lock ( m_section ) ; <nl> - <nl> - CLog : : Log ( LOGINFO , " % s : : % s - fmt : % d " , CLASSNAME , __FUNCTION__ , fmt ) ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s MMAL - source requires % d references " , CLASSNAME , __FUNCTION__ , avctx - > refs ) ; <nl> - <nl> - avctx - > get_buffer2 = CDecoder : : FFGetBuffer ; <nl> - mainctx - > get_buffer2 = CDecoder : : FFGetBuffer ; <nl> - <nl> - m_avctx = mainctx ; <nl> - m_fmt = fmt ; <nl> - <nl> - / * Create dummy component with attached pool * / <nl> - m_pool = std : : make_shared < CMMALPool > ( MMAL_COMPONENT_DEFAULT_VIDEO_DECODER , false , MMAL_NUM_OUTPUT_BUFFERS , 0 , MMAL_ENCODING_UNKNOWN , MMALStateFFDec ) ; <nl> - if ( ! m_pool ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to create pool for decoder output " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - std : : shared_ptr < CMMALPool > pool = std : : dynamic_pointer_cast < CMMALPool > ( m_pool ) ; <nl> - pool - > SetProcessInfo ( & m_processInfo ) ; <nl> - <nl> - std : : list < EINTERLACEMETHOD > deintMethods ; <nl> - deintMethods . push_back ( EINTERLACEMETHOD : : VS_INTERLACEMETHOD_AUTO ) ; <nl> - deintMethods . push_back ( EINTERLACEMETHOD : : VS_INTERLACEMETHOD_MMAL_ADVANCED ) ; <nl> - deintMethods . push_back ( EINTERLACEMETHOD : : VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF ) ; <nl> - deintMethods . push_back ( EINTERLACEMETHOD : : VS_INTERLACEMETHOD_MMAL_BOB ) ; <nl> - deintMethods . push_back ( EINTERLACEMETHOD : : VS_INTERLACEMETHOD_MMAL_BOB_HALF ) ; <nl> - m_processInfo . UpdateDeinterlacingMethods ( deintMethods ) ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - CDVDVideoCodec : : VCReturn CDecoder : : Decode ( AVCodecContext * avctx , AVFrame * frame ) <nl> - { <nl> - CSingleLock lock ( m_section ) ; <nl> - <nl> - if ( frame ) <nl> - { <nl> - if ( ( frame - > format ! = AV_PIX_FMT_YUV420P & & frame - > format ! = AV_PIX_FMT_YUV420P10 & & frame - > format ! = AV_PIX_FMT_YUV420P12 & & frame - > format ! = AV_PIX_FMT_YUV420P14 & & frame - > format ! = AV_PIX_FMT_YUV420P16 & & <nl> - frame - > format ! = AV_PIX_FMT_BGR0 & & frame - > format ! = AV_PIX_FMT_RGB565LE ) | | <nl> - frame - > buf [ 1 ] ! = nullptr | | frame - > buf [ 0 ] = = nullptr ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s frame format invalid format : % d buf : % p , % p " , CLASSNAME , __func__ , <nl> - frame - > format , static_cast < void * > ( frame - > buf [ 0 ] ) , <nl> - static_cast < void * > ( frame - > buf [ 1 ] ) ) ; <nl> - return CDVDVideoCodec : : VC_ERROR ; <nl> - } <nl> - CVideoBuffer * old = m_renderBuffer ; <nl> - if ( m_renderBuffer ) <nl> - m_renderBuffer - > Release ( ) ; <nl> - <nl> - CGPUMEM * m_gmem = ( CGPUMEM * ) av_buffer_get_opaque ( frame - > buf [ 0 ] ) ; <nl> - assert ( m_gmem ) ; <nl> - / / need to flush ARM cache so GPU can see it <nl> - m_gmem - > Flush ( ) ; <nl> - m_renderBuffer = static_cast < CMMALYUVBuffer * > ( m_gmem - > m_opaque ) ; <nl> - assert ( m_renderBuffer & & m_renderBuffer - > mmal_buffer ) ; <nl> - if ( m_renderBuffer ) <nl> - { <nl> - m_renderBuffer - > m_stills = m_hints . stills ; <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s - mmal : % p buf : % p old : % p gpu : % p % dx % d ( % dx % d ) " , <nl> - CLASSNAME , __FUNCTION__ , static_cast < void * > ( m_renderBuffer - > mmal_buffer ) , <nl> - static_cast < void * > ( m_renderBuffer ) , static_cast < void * > ( old ) , <nl> - static_cast < void * > ( m_renderBuffer - > GetMem ( ) ) , m_renderBuffer - > Width ( ) , <nl> - m_renderBuffer - > Height ( ) , m_renderBuffer - > AlignedWidth ( ) , <nl> - m_renderBuffer - > AlignedHeight ( ) ) ; <nl> - m_renderBuffer - > Acquire ( ) ; <nl> - } <nl> - } <nl> - <nl> - CDVDVideoCodec : : VCReturn status = Check ( avctx ) ; <nl> - if ( status ! = CDVDVideoCodec : : VC_NONE ) <nl> - return status ; <nl> - <nl> - if ( frame ) <nl> - return CDVDVideoCodec : : VC_PICTURE ; <nl> - else <nl> - return CDVDVideoCodec : : VC_BUFFER ; <nl> - } <nl> - <nl> - bool CDecoder : : GetPicture ( AVCodecContext * avctx , VideoPicture * picture ) <nl> - { <nl> - CSingleLock lock ( m_section ) ; <nl> - <nl> - bool ret = ( ( ICallbackHWAccel * ) avctx - > opaque ) - > GetPictureCommon ( picture ) ; <nl> - if ( ! ret | | ! m_renderBuffer ) <nl> - return false ; <nl> - <nl> - CVideoBuffer * old = picture - > videoBuffer ; <nl> - if ( picture - > videoBuffer ) <nl> - picture - > videoBuffer - > Release ( ) ; <nl> - <nl> - picture - > videoBuffer = m_renderBuffer ; <nl> - CLog : : Log ( <nl> - LOGDEBUG , LOGVIDEO , " % s : : % s - mmal : % p dts : % . 3f pts : % . 3f buf : % p old : % p gpu : % p % dx % d ( % dx % d ) " , <nl> - CLASSNAME , __FUNCTION__ , static_cast < void * > ( m_renderBuffer - > mmal_buffer ) , 1e - 6 * picture - > dts , <nl> - 1e - 6 * picture - > pts , static_cast < void * > ( m_renderBuffer ) , static_cast < void * > ( old ) , <nl> - static_cast < void * > ( m_renderBuffer - > GetMem ( ) ) , m_renderBuffer - > Width ( ) , <nl> - m_renderBuffer - > Height ( ) , m_renderBuffer - > AlignedWidth ( ) , m_renderBuffer - > AlignedHeight ( ) ) ; <nl> - picture - > videoBuffer - > Acquire ( ) ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - CDVDVideoCodec : : VCReturn CDecoder : : Check ( AVCodecContext * avctx ) <nl> - { <nl> - CSingleLock lock ( m_section ) ; <nl> - return CDVDVideoCodec : : VC_NONE ; <nl> - } <nl> - <nl> - unsigned CDecoder : : GetAllowedReferences ( ) <nl> - { <nl> - return 6 ; <nl> - } <nl> - <nl> - IHardwareDecoder * CDecoder : : Create ( CDVDStreamInfo & hint , CProcessInfo & processInfo , AVPixelFormat fmt ) <nl> - { <nl> - return new CDecoder ( processInfo , hint ) ; <nl> - } <nl> - <nl> - void CDecoder : : Register ( ) <nl> - { <nl> - CDVDFactoryCodec : : RegisterHWAccel ( " mmalffmpeg " , CDecoder : : Create ) ; <nl> - } <nl> deleted file mode 100644 <nl> index 74106a770bb4 . . 000000000000 <nl> mmm a / xbmc / cores / VideoPlayer / DVDCodecs / Video / MMALFFmpeg . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2016 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # include " DVDCodecs / Video / DVDVideoCodecFFmpeg . h " <nl> - # include " cores / VideoPlayer / VideoRenderers / HwDecRender / MMALRenderer . h " <nl> - <nl> - # include < memory > <nl> - # include < queue > <nl> - <nl> - # include < libavcodec / avcodec . h > <nl> - <nl> - struct MMAL_BUFFER_HEADER_T ; <nl> - class CGPUMEM ; <nl> - <nl> - namespace MMAL { <nl> - <nl> - class CDecoder ; <nl> - <nl> - / / a mmal video frame <nl> - class CMMALYUVBuffer : public CMMALBuffer <nl> - { <nl> - public : <nl> - CMMALYUVBuffer ( int id ) ; <nl> - virtual ~ CMMALYUVBuffer ( ) ; <nl> - uint8_t * GetMemPtr ( ) override ; <nl> - virtual void GetPlanes ( uint8_t * ( & planes ) [ YuvImage : : MAX_PLANES ] ) override ; <nl> - virtual void GetStrides ( int ( & strides ) [ YuvImage : : MAX_PLANES ] ) override ; <nl> - virtual void SetDimensions ( int width , int height , const int ( & strides ) [ YuvImage : : MAX_PLANES ] ) override ; <nl> - virtual void SetDimensions ( int width , int height , const int ( & strides ) [ YuvImage : : MAX_PLANES ] , const int ( & planeOffsets ) [ YuvImage : : MAX_PLANES ] ) override ; <nl> - CGPUMEM * Allocate ( int size , void * opaque ) ; <nl> - CGPUMEM * GetMem ( ) { return m_gmem ; } <nl> - protected : <nl> - CGPUMEM * m_gmem = nullptr ; <nl> - } ; <nl> - <nl> - class CDecoder <nl> - : public IHardwareDecoder <nl> - { <nl> - public : <nl> - CDecoder ( CProcessInfo & processInfo , CDVDStreamInfo & hints ) ; <nl> - virtual ~ CDecoder ( ) ; <nl> - virtual bool Open ( AVCodecContext * avctx , AVCodecContext * mainctx , const enum AVPixelFormat ) override ; <nl> - virtual CDVDVideoCodec : : VCReturn Decode ( AVCodecContext * avctx , AVFrame * frame ) override ; <nl> - virtual bool GetPicture ( AVCodecContext * avctx , VideoPicture * picture ) override ; <nl> - virtual CDVDVideoCodec : : VCReturn Check ( AVCodecContext * avctx ) override ; <nl> - virtual const std : : string Name ( ) override { return " mmal " ; } <nl> - virtual unsigned GetAllowedReferences ( ) override ; <nl> - virtual long Release ( ) override ; <nl> - <nl> - static void AlignedSize ( AVCodecContext * avctx , int & width , int & height ) ; <nl> - static void FFReleaseBuffer ( void * opaque , uint8_t * data ) ; <nl> - static int FFGetBuffer ( AVCodecContext * avctx , AVFrame * pic , int flags ) ; <nl> - static IHardwareDecoder * Create ( CDVDStreamInfo & hint , CProcessInfo & processInfo , AVPixelFormat fmt ) ; <nl> - static void Register ( ) ; <nl> - <nl> - protected : <nl> - AVCodecContext * m_avctx ; <nl> - CProcessInfo & m_processInfo ; <nl> - CCriticalSection m_section ; <nl> - std : : shared_ptr < CMMALPool > m_pool ; <nl> - enum AVPixelFormat m_fmt ; <nl> - CDVDStreamInfo m_hints ; <nl> - CMMALYUVBuffer * m_renderBuffer = nullptr ; <nl> - } ; <nl> - <nl> - } ; <nl> deleted file mode 100644 <nl> index 1a41576405a4 . . 000000000000 <nl> mmm a / xbmc / cores / VideoPlayer / Process / rbpi / CMakeLists . txt <nl> ppp / dev / null <nl> <nl> - if ( CORE_PLATFORM_NAME_LC STREQUAL rbpi ) <nl> - set ( SOURCES ProcessInfoPi . cpp ) <nl> - <nl> - set ( HEADERS ProcessInfoPi . h ) <nl> - <nl> - core_add_library ( processPi ) <nl> - endif ( ) <nl> deleted file mode 100644 <nl> index 79ab42758cc1 . . 000000000000 <nl> mmm a / xbmc / cores / VideoPlayer / Process / rbpi / ProcessInfoPi . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2005 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # include " ProcessInfoPi . h " <nl> - <nl> - # include " cores / VideoPlayer / DVDCodecs / Video / MMALFFmpeg . h " <nl> - <nl> - # include " platform / linux / RBP . h " <nl> - <nl> - # include < interface / mmal / util / mmal_default_components . h > <nl> - <nl> - / / Override for platform ports <nl> - using namespace MMAL ; <nl> - <nl> - CProcessInfo * CProcessInfoPi : : Create ( ) <nl> - { <nl> - return new CProcessInfoPi ( ) ; <nl> - } <nl> - <nl> - CProcessInfoPi : : CProcessInfoPi ( ) <nl> - { <nl> - / * Create dummy component with attached pool * / <nl> - std : : shared_ptr < IVideoBufferPool > pool = std : : make_shared < CMMALPool > ( MMAL_COMPONENT_DEFAULT_VIDEO_DECODER , false , MMAL_NUM_OUTPUT_BUFFERS , 0 , MMAL_ENCODING_UNKNOWN , MMALStateFFDec ) ; <nl> - m_videoBufferManager . RegisterPool ( pool ) ; <nl> - } <nl> - <nl> - void CProcessInfoPi : : Register ( ) <nl> - { <nl> - CProcessInfo : : RegisterProcessControl ( " rbpi " , CProcessInfoPi : : Create ) ; <nl> - } <nl> - <nl> - EINTERLACEMETHOD CProcessInfoPi : : GetFallbackDeintMethod ( ) <nl> - { <nl> - return EINTERLACEMETHOD : : VS_INTERLACEMETHOD_DEINTERLACE_HALF ; <nl> - } <nl> - <nl> - bool CProcessInfoPi : : AllowDTSHDDecode ( ) <nl> - { <nl> - if ( g_RBP . RaspberryPiVersion ( ) = = 1 ) <nl> - return false ; <nl> - return true ; <nl> - } <nl> deleted file mode 100644 <nl> index 24334a43b06d . . 000000000000 <nl> mmm a / xbmc / cores / VideoPlayer / Process / rbpi / ProcessInfoPi . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2005 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # include " cores / IPlayer . h " <nl> - # include " cores / VideoPlayer / Process / ProcessInfo . h " <nl> - <nl> - namespace MMAL { <nl> - class CMMALYUVBuffer ; <nl> - } <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - / / <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - class CVideoBufferManagerPi : public CVideoBufferManager <nl> - { <nl> - public : <nl> - CVideoBufferManagerPi ( ) ; <nl> - void RegisterPool ( std : : shared_ptr < IVideoBufferPool > pool ) ; <nl> - void ReleasePools ( ) ; <nl> - CVideoBuffer * Get ( AVPixelFormat format , int width , int height ) ; <nl> - CVideoBuffer * Get ( AVPixelFormat format , int size ) ; <nl> - void SetDimensions ( int width , int height , const int ( & strides ) [ YuvImage : : MAX_PLANES ] ) ; <nl> - <nl> - protected : <nl> - } ; <nl> - <nl> - class CProcessInfoPi : public CProcessInfo <nl> - { <nl> - public : <nl> - CProcessInfoPi ( ) ; <nl> - static CProcessInfo * Create ( ) ; <nl> - static void Register ( ) ; <nl> - EINTERLACEMETHOD GetFallbackDeintMethod ( ) override ; <nl> - bool AllowDTSHDDecode ( ) override ; <nl> - <nl> - / / protected : <nl> - } ; <nl> mmm a / xbmc / cores / VideoPlayer / VideoPlayerAudio . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoPlayerAudio . cpp <nl> <nl> # include " utils / MathUtils . h " <nl> # include " cores / AudioEngine / Interfaces / AE . h " <nl> # include " cores / AudioEngine / Utils / AEUtil . h " <nl> - # ifdef TARGET_RASPBERRY_PI <nl> - # include " platform / linux / RBP . h " <nl> - # endif <nl> <nl> # include < sstream > <nl> # include < iomanip > <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / CMakeLists . txt <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / CMakeLists . txt <nl> if ( CORE_SYSTEM_NAME STREQUAL darwin_embedded ) <nl> list ( APPEND HEADERS RendererVTBGLES . h ) <nl> endif ( ) <nl> <nl> - if ( MMAL_FOUND ) <nl> - list ( APPEND SOURCES MMALRenderer . cpp ) <nl> - list ( APPEND HEADERS MMALRenderer . h ) <nl> - endif ( ) <nl> - <nl> if ( CORE_SYSTEM_NAME STREQUAL android ) <nl> list ( APPEND SOURCES RendererMediaCodec . cpp <nl> RendererMediaCodecSurface . cpp ) <nl> deleted file mode 100644 <nl> index 0c736428874b . . 000000000000 <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / MMALRenderer . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2005 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # include < interface / mmal / util / mmal_util . h > <nl> - # include < interface / mmal / util / mmal_default_components . h > <nl> - # include < interface / mmal / util / mmal_util_params . h > <nl> - <nl> - # include " Util . h " <nl> - # include " MMALRenderer . h " <nl> - # include " ServiceBroker . h " <nl> - # include " cores / VideoPlayer / DVDCodecs / Video / DVDVideoCodec . h " <nl> - # include " filesystem / File . h " <nl> - # include " settings / DisplaySettings . h " <nl> - # include " settings / MediaSettings . h " <nl> - # include " settings / Settings . h " <nl> - # include " settings / SettingsComponent . h " <nl> - # include " threads / SingleLock . h " <nl> - # include " utils / log . h " <nl> - # include " utils / MathUtils . h " <nl> - # include " cores / VideoPlayer / DVDCodecs / Video / MMALCodec . h " <nl> - # include " cores / VideoPlayer / DVDCodecs / Video / MMALFFmpeg . h " <nl> - # include " Application . h " <nl> - # include " platform / linux / RBP . h " <nl> - # include " cores / VideoPlayer / VideoRenderers / RenderFactory . h " <nl> - # include " cores / VideoPlayer / Interface / Addon / TimingConstants . h " <nl> - <nl> - extern " C " { <nl> - # include < libavutil / imgutils . h > <nl> - } <nl> - <nl> - # define VERBOSE 0 <nl> - <nl> - using namespace MMAL ; <nl> - <nl> - # define CLASSNAME " CMMALBuffer " <nl> - <nl> - CMMALBuffer : : CMMALBuffer ( int id ) : CVideoBuffer ( id ) <nl> - { <nl> - if ( VERBOSE & & CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % p " , CLASSNAME , __func__ , static_cast < void * > ( this ) ) ; <nl> - } <nl> - <nl> - CMMALBuffer : : ~ CMMALBuffer ( ) <nl> - { <nl> - if ( VERBOSE & & CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % p " , CLASSNAME , __func__ , static_cast < void * > ( this ) ) ; <nl> - } <nl> - <nl> - void CMMALBuffer : : Unref ( ) <nl> - { <nl> - if ( mmal_buffer ) <nl> - { <nl> - mmal_buffer_header_release ( mmal_buffer ) ; <nl> - mmal_buffer = nullptr ; <nl> - } <nl> - } <nl> - <nl> - void CMMALBuffer : : Update ( ) <nl> - { <nl> - if ( mmal_buffer ) <nl> - { <nl> - CMMALYUVBuffer * yuv = dynamic_cast < CMMALYUVBuffer * > ( this ) ; <nl> - if ( yuv ) <nl> - { <nl> - int size = 0 ; <nl> - std : : shared_ptr < CMMALPool > pool = std : : dynamic_pointer_cast < CMMALPool > ( m_pool ) ; <nl> - if ( pool ) <nl> - size = pool - > Size ( ) ; <nl> - mmal_buffer - > alloc_size = size ; <nl> - mmal_buffer - > length = size ; <nl> - CGPUMEM * gmem = yuv - > GetMem ( ) ; <nl> - if ( gmem ) <nl> - mmal_buffer - > data = ( uint8_t * ) gmem - > m_vc_handle ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - void CMMALBuffer : : SetVideoDeintMethod ( std : : string method ) <nl> - { <nl> - std : : shared_ptr < CMMALPool > pool = std : : dynamic_pointer_cast < CMMALPool > ( m_pool ) ; <nl> - if ( pool ) <nl> - pool - > SetVideoDeintMethod ( method ) ; <nl> - } <nl> - <nl> - <nl> - # undef CLASSNAME <nl> - # define CLASSNAME " CMMALPool " <nl> - <nl> - <nl> - void CMMALPool : : Return ( int id ) <nl> - { <nl> - CSingleLock lock ( m_critSection ) ; <nl> - <nl> - m_all [ id ] - > Unref ( ) ; <nl> - auto it = m_used . begin ( ) ; <nl> - while ( it ! = m_used . end ( ) ) <nl> - { <nl> - if ( * it = = id ) <nl> - { <nl> - m_used . erase ( it ) ; <nl> - break ; <nl> - } <nl> - else <nl> - + + it ; <nl> - } <nl> - m_free . push_back ( id ) ; <nl> - Prime ( ) ; <nl> - } <nl> - <nl> - CMMALPool : : CMMALPool ( const char * component_name , bool input , uint32_t num_buffers , uint32_t buffer_size , uint32_t encoding , MMALState state ) <nl> - : m_mmal_format ( encoding ) , m_state ( state ) , m_input ( input ) <nl> - { <nl> - CSingleLock lock ( m_critSection ) ; <nl> - MMAL_STATUS_T status ; <nl> - <nl> - status = mmal_component_create ( component_name , & m_component ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to create component % s " , CLASSNAME , __func__ , component_name ) ; <nl> - <nl> - MMAL_PORT_T * port = m_input ? m_component - > input [ 0 ] : m_component - > output [ 0 ] ; <nl> - <nl> - / / set up initial decoded frame format - may change from this <nl> - port - > format - > encoding = encoding ; <nl> - <nl> - status = mmal_port_parameter_set_boolean ( port , MMAL_PARAMETER_ZERO_COPY , MMAL_TRUE ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable zero copy mode on % s ( status = % x % s ) " , CLASSNAME , __func__ , port - > name , status , mmal_status_to_string ( status ) ) ; <nl> - <nl> - status = mmal_port_format_commit ( port ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to commit format for % s ( status = % x % s ) " , CLASSNAME , __func__ , port - > name , status , mmal_status_to_string ( status ) ) ; <nl> - <nl> - port - > buffer_size = buffer_size ; <nl> - port - > buffer_num = std : : max ( num_buffers , port - > buffer_num_recommended ) ; <nl> - <nl> - m_mmal_pool = mmal_port_pool_create ( port , port - > buffer_num , port - > buffer_size ) ; <nl> - if ( ! m_mmal_pool ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to create pool for port % s " , CLASSNAME , __func__ , port - > name ) ; <nl> - else <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s Created pool % p of size % d x % d for port % s " , CLASSNAME , __func__ , <nl> - static_cast < void * > ( m_mmal_pool ) , num_buffers , buffer_size , port - > name ) ; <nl> - } <nl> - } <nl> - <nl> - CMMALPool : : ~ CMMALPool ( ) <nl> - { <nl> - CSingleLock lock ( m_critSection ) ; <nl> - MMAL_STATUS_T status ; <nl> - <nl> - MMAL_PORT_T * port = m_input ? m_component - > input [ 0 ] : m_component - > output [ 0 ] ; <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s Destroying pool % p for port % s " , CLASSNAME , __func__ , <nl> - static_cast < void * > ( m_mmal_pool ) , port - > name ) ; <nl> - <nl> - if ( port & & port - > is_enabled ) <nl> - { <nl> - status = mmal_port_disable ( port ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to disable port % s ( status = % x % s ) " , CLASSNAME , __func__ , port - > name , status , mmal_status_to_string ( status ) ) ; <nl> - } <nl> - <nl> - if ( m_component & & m_component - > is_enabled ) <nl> - { <nl> - status = mmal_component_disable ( m_component ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to disable component % s ( status = % x % s ) " , CLASSNAME , __func__ , m_component - > name , status , mmal_status_to_string ( status ) ) ; <nl> - } <nl> - <nl> - mmal_port_pool_destroy ( port , m_mmal_pool ) ; <nl> - <nl> - if ( m_component ) <nl> - mmal_component_destroy ( m_component ) ; <nl> - m_component = nullptr ; <nl> - <nl> - m_mmal_pool = nullptr ; <nl> - for ( auto buf : m_all ) <nl> - { <nl> - delete buf ; <nl> - } <nl> - } <nl> - <nl> - std : : vector < CMMALPool : : MMALEncodingTable > CMMALPool : : mmal_encoding_table = <nl> - { <nl> - { AV_PIX_FMT_YUV420P , MMAL_ENCODING_I420 } , <nl> - { AV_PIX_FMT_YUVJ420P , MMAL_ENCODING_I420 } , <nl> - { AV_PIX_FMT_YUV420P10 , MMAL_ENCODING_I420_16 , } , <nl> - { AV_PIX_FMT_YUV420P12 , MMAL_ENCODING_I420_16 , } , <nl> - { AV_PIX_FMT_YUV420P14 , MMAL_ENCODING_I420_16 , } , <nl> - { AV_PIX_FMT_YUV420P16 , MMAL_ENCODING_I420_16 , } , <nl> - { AV_PIX_FMT_RGBA , MMAL_ENCODING_RGBA , } , <nl> - { AV_PIX_FMT_BGRA , MMAL_ENCODING_BGRA } , <nl> - { AV_PIX_FMT_RGB0 , MMAL_ENCODING_RGBA } , <nl> - { AV_PIX_FMT_BGR0 , MMAL_ENCODING_BGRA } , <nl> - { AV_PIX_FMT_RGB24 , MMAL_ENCODING_RGB24 } , <nl> - { AV_PIX_FMT_BGR24 , MMAL_ENCODING_BGR24 } , <nl> - { AV_PIX_FMT_RGB565 , MMAL_ENCODING_RGB16 } , <nl> - { AV_PIX_FMT_RGB565LE , MMAL_ENCODING_RGB16 } , <nl> - { AV_PIX_FMT_BGR565 , MMAL_ENCODING_BGR16 } , <nl> - { AV_PIX_FMT_NONE , MMAL_ENCODING_UNKNOWN } , <nl> - } ; <nl> - <nl> - <nl> - uint32_t CMMALPool : : TranslateFormat ( AVPixelFormat pixfmt ) <nl> - { <nl> - for ( const auto & entry : mmal_encoding_table ) <nl> - { <nl> - if ( entry . pixfmt = = pixfmt ) <nl> - return entry . encoding ; <nl> - } <nl> - assert ( 0 ) ; <nl> - return MMAL_ENCODING_UNKNOWN ; <nl> - } <nl> - <nl> - void CMMALPool : : Configure ( AVPixelFormat format , int width , int height , int alignedWidth , int alignedHeight , int size ) <nl> - { <nl> - CSingleLock lock ( m_critSection ) ; <nl> - if ( format ! = AV_PIX_FMT_NONE ) <nl> - m_mmal_format = TranslateFormat ( format ) ; <nl> - m_width = width ; <nl> - m_height = height ; <nl> - m_size = size ; <nl> - m_software = true ; <nl> - m_configured = true ; <nl> - <nl> - if ( m_mmal_format ! = MMAL_ENCODING_UNKNOWN ) <nl> - { <nl> - m_geo = g_RBP . GetFrameGeometry ( m_mmal_format , alignedWidth , alignedHeight ) ; <nl> - if ( m_mmal_format ! = MMAL_ENCODING_YUVUV128 & & m_mmal_format ! = MMAL_ENCODING_YUVUV64_16 ) <nl> - { <nl> - if ( alignedWidth ) <nl> - { <nl> - m_geo . setStrideY ( alignedWidth * m_geo . getBytesPerPixel ( ) ) ; <nl> - m_geo . setStrideC ( alignedWidth * m_geo . getBytesPerPixel ( ) > > 1 ) ; <nl> - } <nl> - if ( alignedHeight ) <nl> - { <nl> - m_geo . setHeightY ( alignedHeight ) ; <nl> - m_geo . setHeightC ( alignedHeight > > 1 ) ; <nl> - } <nl> - } <nl> - } <nl> - if ( m_size = = 0 ) <nl> - m_size = m_geo . getSize ( ) ; <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s pool : % p % dx % d ( % dx % d ) pix : % d size : % d fmt : % . 4s " , CLASSNAME , __func__ , <nl> - static_cast < void * > ( m_mmal_pool ) , width , height , alignedWidth , alignedHeight , format , size , <nl> - ( char * ) & m_mmal_format ) ; <nl> - } <nl> - <nl> - void CMMALPool : : Configure ( AVPixelFormat format , int size ) <nl> - { <nl> - Configure ( format , 0 , 0 , 0 , 0 , size ) ; <nl> - } <nl> - <nl> - void CMMALPool : : SetDimensions ( int width , int height , const int ( & strides ) [ YuvImage : : MAX_PLANES ] , const int ( & planeOffsets ) [ YuvImage : : MAX_PLANES ] ) <nl> - { <nl> - assert ( m_geo . getBytesPerPixel ( ) ) ; <nl> - int alignedWidth = strides [ 0 ] ? strides [ 0 ] / m_geo . getBytesPerPixel ( ) : width ; <nl> - int alignedHeight = planeOffsets [ 1 ] ? planeOffsets [ 1 ] / strides [ 0 ] : height ; <nl> - Configure ( AV_PIX_FMT_NONE , width , height , alignedWidth , alignedHeight , 0 ) ; <nl> - / / libwv side - by - side UV format <nl> - if ( planeOffsets [ 2 ] - planeOffsets [ 1 ] = = strides [ 1 ] > > 1 ) <nl> - m_mmal_format = MMAL_ENCODING_I420_S ; <nl> - } <nl> - <nl> - inline bool CMMALPool : : IsConfigured ( ) <nl> - { <nl> - CSingleLock lock ( m_critSection ) ; <nl> - return m_configured ; <nl> - } <nl> - <nl> - bool CMMALPool : : IsCompatible ( AVPixelFormat format , int size ) <nl> - { <nl> - CSingleLock lock ( m_critSection ) ; <nl> - uint32_t mmal_format = TranslateFormat ( format ) ; <nl> - if ( m_mmal_format = = MMAL_ENCODING_I420_S & & mmal_format = = MMAL_ENCODING_I420 ) <nl> - return true ; <nl> - if ( m_mmal_format = = mmal_format & & <nl> - m_size = = size ) <nl> - return true ; <nl> - <nl> - return false ; <nl> - } <nl> - <nl> - CVideoBuffer * CMMALPool : : Get ( ) <nl> - { <nl> - return GetBuffer ( 500 ) ; <nl> - } <nl> - <nl> - CMMALBuffer * CMMALPool : : GetBuffer ( uint32_t timeout ) <nl> - { <nl> - MMAL_BUFFER_HEADER_T * buffer = nullptr ; <nl> - CMMALBuffer * omvb = nullptr ; <nl> - int id = - 1 ; <nl> - bool newbuf = false ; <nl> - CGPUMEM * gmem = nullptr ; <nl> - <nl> - if ( m_mmal_pool & & m_mmal_pool - > queue ) <nl> - buffer = mmal_queue_timedwait ( m_mmal_pool - > queue , timeout ) ; <nl> - CSingleLock lock ( m_critSection ) ; <nl> - if ( buffer ) <nl> - { <nl> - mmal_buffer_header_reset ( buffer ) ; <nl> - buffer - > cmd = 0 ; <nl> - buffer - > offset = 0 ; <nl> - buffer - > flags = 0 ; <nl> - buffer - > user_data = 0 ; <nl> - <nl> - if ( ! m_free . empty ( ) ) <nl> - { <nl> - id = m_free . front ( ) ; <nl> - m_free . pop_front ( ) ; <nl> - m_used . push_back ( id ) ; <nl> - omvb = m_all [ id ] ; <nl> - } <nl> - else <nl> - { <nl> - newbuf = true ; <nl> - id = m_all . size ( ) ; <nl> - if ( ! IsSoftware ( ) ) <nl> - { <nl> - CMMALVideoBuffer * vid = new CMMALVideoBuffer ( id ) ; <nl> - omvb = vid ; <nl> - } <nl> - else <nl> - { <nl> - CMMALYUVBuffer * yuv = new CMMALYUVBuffer ( id ) ; <nl> - if ( yuv ) <nl> - { <nl> - assert ( m_size > 0 ) ; <nl> - gmem = yuv - > Allocate ( m_size , ( void * ) yuv ) ; <nl> - if ( ! gmem ) <nl> - { <nl> - delete yuv ; <nl> - yuv = nullptr ; <nl> - } <nl> - } <nl> - omvb = yuv ; <nl> - } <nl> - if ( omvb ) <nl> - { <nl> - m_all . push_back ( omvb ) ; <nl> - m_used . push_back ( id ) ; <nl> - } <nl> - } <nl> - if ( omvb ) <nl> - { <nl> - omvb - > Acquire ( GetPtr ( ) ) ; <nl> - omvb - > m_rendered = false ; <nl> - omvb - > m_state = m_state ; <nl> - buffer - > user_data = omvb ; <nl> - omvb - > mmal_buffer = buffer ; <nl> - omvb - > Update ( ) ; <nl> - assert ( omvb - > Pool ( ) = = GetPtr ( ) ) ; <nl> - } <nl> - } <nl> - if ( timeout > 0 & & ! omvb ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - failed pool : % p omvb : % p mmal : % p timeout : % d " , CLASSNAME , <nl> - __FUNCTION__ , static_cast < void * > ( m_mmal_pool ) , static_cast < void * > ( omvb ) , <nl> - static_cast < void * > ( buffer ) , timeout ) ; <nl> - } <nl> - else if ( VERBOSE & & CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , <nl> - " % s : : % s pool : % p omvb : % p mmal : % p gmem : % p new : % d id : % d to : % d % dx % d ( % dx % d ) size : % d " <nl> - " pool : % p : % p enc : % . 4s " , <nl> - CLASSNAME , __FUNCTION__ , static_cast < void * > ( m_mmal_pool ) , static_cast < void * > ( omvb ) , <nl> - static_cast < void * > ( buffer ) , static_cast < void * > ( gmem ) , newbuf , id , timeout , m_width , <nl> - m_height , AlignedWidth ( ) , AlignedHeight ( ) , buffer ? buffer - > alloc_size : 0 , <nl> - omvb ? static_cast < void * > ( omvb - > Pool ( ) . get ( ) ) : nullptr , <nl> - static_cast < void * > ( GetPtr ( ) . get ( ) ) , ( char * ) & m_mmal_format ) ; <nl> - } <nl> - return omvb ; <nl> - } <nl> - <nl> - void CMMALPool : : Prime ( ) <nl> - { <nl> - CSingleLock lock ( m_critSection ) ; <nl> - CMMALBuffer * omvb ; <nl> - if ( ! m_mmal_pool | | ! m_component ) <nl> - return ; <nl> - MMAL_PORT_T * port = m_input ? m_component - > input [ 0 ] : m_component - > output [ 0 ] ; <nl> - if ( ! port - > is_enabled ) <nl> - return ; <nl> - while ( omvb = GetBuffer ( 0 ) , omvb ) <nl> - { <nl> - if ( VERBOSE & & CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - { <nl> - CLog : : Log ( <nl> - LOGDEBUG , " % s : : % s Send omvb : % p mmal : % p from pool % p to % s len : % d cmd : % x flags : % x pool : % p " , <nl> - CLASSNAME , __func__ , static_cast < void * > ( omvb ) , static_cast < void * > ( omvb - > mmal_buffer ) , <nl> - static_cast < void * > ( m_mmal_pool ) , port - > name , omvb - > mmal_buffer - > length , <nl> - omvb - > mmal_buffer - > cmd , omvb - > mmal_buffer - > flags , static_cast < void * > ( omvb - > Pool ( ) . get ( ) ) ) ; <nl> - } <nl> - MMAL_STATUS_T status = mmal_port_send_buffer ( port , omvb - > mmal_buffer ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( <nl> - LOGERROR , " % s : : % s - Failed to send omvb : % p mmal : % p from pool % p to % s ( status = 0 % x % s ) " , <nl> - CLASSNAME , __func__ , static_cast < void * > ( omvb ) , static_cast < void * > ( omvb - > mmal_buffer ) , <nl> - static_cast < void * > ( m_mmal_pool ) , port - > name , status , mmal_status_to_string ( status ) ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - void CMMALPool : : SetVideoDeintMethod ( std : : string method ) <nl> - { <nl> - CSingleLock lock ( m_critSection ) ; <nl> - if ( m_processInfo ) <nl> - m_processInfo - > SetVideoDeintMethod ( method ) ; <nl> - } <nl> - <nl> - void CMMALPool : : Released ( CVideoBufferManager & videoBufferManager ) <nl> - { <nl> - / * Create dummy component with attached pool * / <nl> - std : : shared_ptr < IVideoBufferPool > pool = std : : make_shared < CMMALPool > ( MMAL_COMPONENT_DEFAULT_VIDEO_DECODER , false , MMAL_NUM_OUTPUT_BUFFERS , 0 , MMAL_ENCODING_UNKNOWN , MMALStateFFDec ) ; <nl> - videoBufferManager . RegisterPool ( pool ) ; <nl> - } <nl> - <nl> - # undef CLASSNAME <nl> - # define CLASSNAME " CMMALRenderer " <nl> - <nl> - CRenderInfo CMMALRenderer : : GetRenderInfo ( ) <nl> - { <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - CRenderInfo info ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s opaque : % p " , CLASSNAME , __func__ , static_cast < void * > ( this ) ) ; <nl> - <nl> - info . max_buffer_size = NUM_BUFFERS ; <nl> - info . optimal_buffer_size = NUM_BUFFERS ; <nl> - info . opaque_pointer = ( void * ) this ; <nl> - <nl> - return info ; <nl> - } <nl> - <nl> - void CMMALRenderer : : vout_input_port_cb ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) <nl> - { <nl> - if ( VERBOSE & & CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s omvb : % p mmal : % p dts : % . 3f pts : % . 3f len : % d cmd : % x flags : % x " , <nl> - CLASSNAME , __func__ , static_cast < void * > ( buffer - > user_data ) , <nl> - static_cast < void * > ( buffer ) , buffer - > dts * 1e - 6 , buffer - > pts * 1e - 6 , buffer - > length , <nl> - buffer - > cmd , buffer - > flags ) ; <nl> - } <nl> - buffer - > length = 0 ; <nl> - mmal_queue_put ( m_queue_process , buffer ) ; <nl> - } <nl> - <nl> - static void vout_input_port_cb_static ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) <nl> - { <nl> - CMMALRenderer * mmal = reinterpret_cast < CMMALRenderer * > ( port - > userdata ) ; <nl> - mmal - > vout_input_port_cb ( port , buffer ) ; <nl> - } <nl> - <nl> - bool CMMALRenderer : : CheckConfigurationVout ( uint32_t width , uint32_t height , uint32_t aligned_width , uint32_t aligned_height , uint32_t encoding ) <nl> - { <nl> - MMAL_STATUS_T status ; <nl> - bool sizeChanged = width ! = m_vout_width | | height ! = m_vout_height | | aligned_width ! = m_vout_aligned_width | | aligned_height ! = m_vout_aligned_height ; <nl> - bool encodingChanged = ! m_vout_input | | ! m_vout_input - > format | | encoding ! = m_vout_input - > format - > encoding ; <nl> - <nl> - if ( ! m_vout ) <nl> - { <nl> - / * Create video renderer * / <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s CreateRenderer " , CLASSNAME , __func__ ) ; <nl> - <nl> - status = mmal_component_create ( MMAL_COMPONENT_DEFAULT_VIDEO_RENDERER , & m_vout ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to create vout component ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_vout_input = m_vout - > input [ 0 ] ; <nl> - <nl> - status = mmal_port_parameter_set_boolean ( m_vout_input , MMAL_PARAMETER_NO_IMAGE_PADDING , MMAL_TRUE ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable no image padding mode on % s ( status = % x % s ) " , CLASSNAME , __func__ , m_vout_input - > name , status , mmal_status_to_string ( status ) ) ; <nl> - <nl> - status = mmal_port_parameter_set_boolean ( m_vout_input , MMAL_PARAMETER_ZERO_COPY , MMAL_TRUE ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable zero copy mode on % s ( status = % x % s ) " , CLASSNAME , __func__ , m_vout_input - > name , status , mmal_status_to_string ( status ) ) ; <nl> - <nl> - m_vout_input - > format - > type = MMAL_ES_TYPE_VIDEO ; <nl> - if ( CONF_FLAGS_YUVCOEF_MASK ( m_iFlags ) = = CONF_FLAGS_YUVCOEF_BT709 ) <nl> - m_vout_input - > format - > es - > video . color_space = MMAL_COLOR_SPACE_ITUR_BT709 ; <nl> - else if ( CONF_FLAGS_YUVCOEF_MASK ( m_iFlags ) = = CONF_FLAGS_YUVCOEF_BT601 ) <nl> - m_vout_input - > format - > es - > video . color_space = MMAL_COLOR_SPACE_ITUR_BT601 ; <nl> - else if ( CONF_FLAGS_YUVCOEF_MASK ( m_iFlags ) = = CONF_FLAGS_YUVCOEF_240M ) <nl> - m_vout_input - > format - > es - > video . color_space = MMAL_COLOR_SPACE_SMPTE240M ; <nl> - } <nl> - <nl> - if ( m_vout_input & & ( sizeChanged | | encodingChanged ) ) <nl> - { <nl> - assert ( m_vout_input ! = nullptr & & m_vout_input - > format ! = nullptr & & m_vout_input - > format - > es ! = nullptr ) ; <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s Changing Vout dimensions from % dx % d ( % dx % d ) to % dx % d ( % dx % d ) % . 4s " , CLASSNAME , __func__ , <nl> - m_vout_width , m_vout_height , m_vout_aligned_width , m_vout_aligned_height , width , height , aligned_width , aligned_height , ( char * ) & encoding ) ; <nl> - <nl> - / / we need to disable port when encoding changes , but not if just resolution changes <nl> - if ( encodingChanged & & m_vout_input - > is_enabled ) <nl> - { <nl> - status = mmal_port_disable ( m_vout_input ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to disable vout input port ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> - m_vout_width = width ; <nl> - m_vout_height = height ; <nl> - m_vout_aligned_width = aligned_width ; <nl> - m_vout_aligned_height = aligned_height ; <nl> - <nl> - m_vout_input - > format - > es - > video . crop . width = width ; <nl> - m_vout_input - > format - > es - > video . crop . height = height ; <nl> - m_vout_input - > format - > es - > video . width = aligned_width ; <nl> - m_vout_input - > format - > es - > video . height = aligned_height ; <nl> - m_vout_input - > format - > encoding = encoding ; <nl> - <nl> - status = mmal_port_format_commit ( m_vout_input ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to commit vout input format ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_vout_input - > is_enabled ) <nl> - { <nl> - m_vout_input - > buffer_num = MMAL_NUM_OUTPUT_BUFFERS ; <nl> - m_vout_input - > buffer_size = m_vout_input - > buffer_size_recommended ; <nl> - m_vout_input - > userdata = ( struct MMAL_PORT_USERDATA_T * ) this ; <nl> - <nl> - status = mmal_port_enable ( m_vout_input , vout_input_port_cb_static ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable vout input port ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - if ( m_vout & & ! m_vout - > is_enabled ) <nl> - { <nl> - status = mmal_component_enable ( m_vout ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable vout component ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_queue_render & & ! CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) - > GetBool ( " videoplayer . usedisplayasclock " ) ) <nl> - { <nl> - m_queue_render = mmal_queue_create ( ) ; <nl> - CThread : : Create ( ) ; <nl> - } <nl> - } <nl> - SetVideoRect ( m_cachedSourceRect , m_cachedDestRect ) ; <nl> - return true ; <nl> - } <nl> - <nl> - CMMALRenderer : : CMMALRenderer ( ) : CThread ( " MMALRenderer " ) , m_processThread ( this , " MMALProcess " ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s " , CLASSNAME , __func__ ) ; <nl> - m_vout = NULL ; <nl> - m_vout_input = NULL ; <nl> - memset ( m_buffers , 0 , sizeof m_buffers ) ; <nl> - m_iFlags = 0 ; <nl> - m_bConfigured = false ; <nl> - m_queue_render = nullptr ; <nl> - m_error = 0 . 0 ; <nl> - m_fps = 0 . 0 ; <nl> - m_lastPts = DVD_NOPTS_VALUE ; <nl> - m_frameInterval = 0 . 0 ; <nl> - m_frameIntervalDiff = 1e5 ; <nl> - m_vsync_count = ~ 0U ; <nl> - m_vout_width = 0 ; <nl> - m_vout_height = 0 ; <nl> - m_vout_aligned_width = 0 ; <nl> - m_vout_aligned_height = 0 ; <nl> - m_deint = NULL ; <nl> - m_deint_input = NULL ; <nl> - m_deint_output = NULL ; <nl> - m_deint_width = 0 ; <nl> - m_deint_height = 0 ; <nl> - m_deint_aligned_width = 0 ; <nl> - m_deint_aligned_height = 0 ; <nl> - m_cachedSourceRect . SetRect ( 0 , 0 , 0 , 0 ) ; <nl> - m_cachedDestRect . SetRect ( 0 , 0 , 0 , 0 ) ; <nl> - m_isPi1 = g_RBP . RaspberryPiVersion ( ) = = 1 ; <nl> - <nl> - m_queue_process = mmal_queue_create ( ) ; <nl> - m_processThread . Create ( ) ; <nl> - } <nl> - <nl> - CMMALRenderer : : ~ CMMALRenderer ( ) <nl> - { <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s " , CLASSNAME , __func__ ) ; <nl> - UnInit ( ) ; <nl> - <nl> - if ( m_queue_process ) <nl> - mmal_queue_put ( m_queue_process , & m_quitpacket ) ; <nl> - <nl> - { <nl> - / / leave the lock to allow other threads to exit <nl> - CSingleExit unlock ( m_sharedSection ) ; <nl> - m_processThread . StopThread ( ) ; <nl> - } <nl> - <nl> - mmal_queue_destroy ( m_queue_process ) ; <nl> - m_queue_process = nullptr ; <nl> - } <nl> - <nl> - <nl> - void CMMALRenderer : : Process ( ) <nl> - { <nl> - bool bStop = false ; <nl> - SetPriority ( THREAD_PRIORITY_ABOVE_NORMAL ) ; <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s - starting " , CLASSNAME , __func__ ) ; <nl> - while ( ! bStop ) <nl> - { <nl> - double dfps = CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) . GetFPS ( ) ; <nl> - double fps = 0 . 0 ; <nl> - double inc = 1 . 0 ; <nl> - g_RBP . WaitVsync ( ) ; <nl> - <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - / / if good enough framerate measure then use it <nl> - if ( dfps > 0 . 0 & & m_frameInterval > 0 . 0 & & m_frameIntervalDiff * 1e - 6 < 1e - 3 ) <nl> - { <nl> - fps = 1e6 / m_frameInterval ; <nl> - inc = fps / dfps ; <nl> - if ( fabs ( inc - 1 . 0 ) < 1e - 2 ) <nl> - inc = 1 . 0 ; <nl> - else if ( fabs ( inc - 0 . 5 ) < 1e - 2 ) <nl> - inc = 0 . 5 ; <nl> - else if ( fabs ( inc - 24 . 0 / 60 . 0 ) < 1e - 2 ) <nl> - inc = 24 . 0 / 60 . 0 ; <nl> - if ( m_deint ) <nl> - inc * = 2 . 0 ; <nl> - } <nl> - / / This algorithm is basically making the decision according to Bresenham ' s line algorithm . Imagine drawing a line where x - axis is display frames , and y - axis is video frames <nl> - m_error + = inc ; <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s - debug vsync : % d queue : % d fps : % . 2f / % . 2f / % . 2f inc : % f diff : % f " , CLASSNAME , __func__ , g_RBP . LastVsync ( ) , mmal_queue_length ( m_queue_render ) , fps , m_fps , dfps , inc , m_error ) ; <nl> - / / we may need to discard frames if queue length gets too high or video frame rate is above display frame rate <nl> - while ( mmal_queue_length ( m_queue_render ) > 2 | | ( mmal_queue_length ( m_queue_render ) > 1 & & m_error > 1 . 0 ) ) <nl> - { <nl> - if ( m_error > 1 . 0 ) <nl> - m_error - = 1 . 0 ; <nl> - MMAL_BUFFER_HEADER_T * buffer = mmal_queue_get ( m_queue_render ) ; <nl> - if ( buffer = = & m_quitpacket ) <nl> - bStop = true ; <nl> - else if ( buffer ) <nl> - { <nl> - CMMALBuffer * omvb = ( CMMALBuffer * ) buffer - > user_data ; <nl> - assert ( buffer = = omvb - > mmal_buffer ) ; <nl> - omvb - > Release ( ) ; <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s - discard omvb : % p mmal : % p vsync : % d queue : % d diff : % f " , <nl> - CLASSNAME , __func__ , static_cast < void * > ( omvb ) , static_cast < void * > ( buffer ) , <nl> - g_RBP . LastVsync ( ) , mmal_queue_length ( m_queue_render ) , m_error ) ; <nl> - } <nl> - } <nl> - / / this is case where we would like to display a new frame <nl> - if ( m_error > 0 . 0 ) <nl> - { <nl> - m_error - = 1 . 0 ; <nl> - MMAL_BUFFER_HEADER_T * buffer = mmal_queue_get ( m_queue_render ) ; <nl> - if ( buffer = = & m_quitpacket ) <nl> - bStop = true ; <nl> - else if ( buffer ) <nl> - { <nl> - CMMALBuffer * omvb = ( CMMALBuffer * ) buffer - > user_data ; <nl> - assert ( buffer = = omvb - > mmal_buffer ) ; <nl> - CheckConfigurationVout ( omvb - > Width ( ) , omvb - > Height ( ) , omvb - > AlignedWidth ( ) , omvb - > AlignedHeight ( ) , omvb - > Encoding ( ) ) ; <nl> - MMAL_STATUS_T status = mmal_port_send_buffer ( m_vout_input , buffer ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - Failed to send omvb : % p mmal : % p to % s ( status = 0 % x % s ) " , <nl> - CLASSNAME , __func__ , static_cast < void * > ( omvb ) , static_cast < void * > ( buffer ) , <nl> - m_vout_input - > name , status , mmal_status_to_string ( status ) ) ; <nl> - } <nl> - } <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s - omvb : % p mmal : % p vsync : % d queue : % d diff : % f " , CLASSNAME , <nl> - __func__ , buffer ? static_cast < void * > ( buffer - > user_data ) : nullptr , <nl> - static_cast < void * > ( buffer ) , g_RBP . LastVsync ( ) , mmal_queue_length ( m_queue_render ) , <nl> - m_error ) ; <nl> - } <nl> - } <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s - stopping " , CLASSNAME , __func__ ) ; <nl> - } <nl> - <nl> - void CMMALRenderer : : Run ( ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s - starting " , CLASSNAME , __func__ ) ; <nl> - while ( 1 ) <nl> - { <nl> - MMAL_BUFFER_HEADER_T * buffer = mmal_queue_wait ( m_queue_process ) ; <nl> - assert ( buffer ) ; <nl> - if ( buffer = = & m_quitpacket ) <nl> - break ; <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - bool kept = false ; <nl> - <nl> - CMMALBuffer * omvb = ( CMMALBuffer * ) buffer - > user_data ; <nl> - if ( VERBOSE & & CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , <nl> - " % s : : % s % s omvb : % p mmal : % p dts : % . 3f pts : % . 3f len : % d cmd : % x flags : % x enc : % . 4s " , <nl> - CLASSNAME , __func__ , omvb ? omvb - > GetStateName ( ) : " " , static_cast < void * > ( omvb ) , <nl> - static_cast < void * > ( buffer ) , buffer - > dts * 1e - 6 , buffer - > pts * 1e - 6 , buffer - > length , <nl> - buffer - > cmd , buffer - > flags , omvb ? ( char * ) & omvb - > Encoding ( ) : " " ) ; <nl> - } <nl> - <nl> - assert ( omvb & & buffer = = omvb - > mmal_buffer ) ; <nl> - assert ( buffer - > cmd = = 0 ) ; <nl> - assert ( ! ( buffer - > flags & ( MMAL_BUFFER_HEADER_FLAG_EOS | MMAL_BUFFER_HEADER_FLAG_TRANSMISSION_FAILED ) ) ) ; <nl> - if ( m_bConfigured ) <nl> - switch ( omvb - > m_state ) <nl> - { <nl> - case MMALStateHWDec : <nl> - case MMALStateFFDec : <nl> - { <nl> - if ( buffer - > length > 0 ) <nl> - { <nl> - int yuv16 = omvb - > Encoding ( ) = = MMAL_ENCODING_I420_16 | | omvb - > Encoding ( ) = = MMAL_ENCODING_YUVUV64_16 ; <nl> - EINTERLACEMETHOD last_interlace_method = m_interlace_method ; <nl> - EINTERLACEMETHOD interlace_method = m_videoSettings . m_InterlaceMethod ; <nl> - if ( interlace_method = = VS_INTERLACEMETHOD_AUTO ) <nl> - { <nl> - interlace_method = VS_INTERLACEMETHOD_MMAL_ADVANCED ; <nl> - / / avoid advanced deinterlace when using software decode and HD resolution <nl> - if ( ( omvb - > m_state = = MMALStateFFDec | | m_isPi1 ) & & omvb - > Width ( ) * omvb - > Height ( ) > 720 * 576 ) <nl> - interlace_method = VS_INTERLACEMETHOD_MMAL_BOB ; <nl> - } <nl> - bool interlace = ( omvb - > mmal_buffer - > flags & MMAL_BUFFER_HEADER_VIDEO_FLAG_INTERLACED ) ? true : false ; <nl> - <nl> - / / advanced deinterlace requires 3 frames of context so disable when showing stills <nl> - if ( omvb - > m_stills ) <nl> - { <nl> - if ( interlace_method = = VS_INTERLACEMETHOD_MMAL_ADVANCED ) <nl> - interlace_method = VS_INTERLACEMETHOD_MMAL_BOB ; <nl> - if ( interlace_method = = VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF ) <nl> - interlace_method = VS_INTERLACEMETHOD_MMAL_BOB_HALF ; <nl> - } <nl> - <nl> - / / we don ' t keep up when running at 60fps in the background so switch to half rate <nl> - if ( ! CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) . IsFullScreenVideo ( ) ) <nl> - { <nl> - if ( interlace_method = = VS_INTERLACEMETHOD_MMAL_ADVANCED ) <nl> - interlace_method = VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF ; <nl> - if ( interlace_method = = VS_INTERLACEMETHOD_MMAL_BOB ) <nl> - interlace_method = VS_INTERLACEMETHOD_MMAL_BOB_HALF ; <nl> - } <nl> - <nl> - if ( interlace_method = = VS_INTERLACEMETHOD_NONE & & ! yuv16 ) <nl> - { <nl> - if ( m_deint_input ) <nl> - DestroyDeinterlace ( ) ; <nl> - } <nl> - <nl> - if ( yuv16 ) <nl> - interlace_method = VS_INTERLACEMETHOD_NONE ; <nl> - <nl> - if ( yuv16 | | ( interlace_method ! = VS_INTERLACEMETHOD_NONE & & ( m_deint_input | | interlace ) ) ) <nl> - CheckConfigurationDeint ( omvb - > Width ( ) , omvb - > Height ( ) , omvb - > AlignedWidth ( ) , omvb - > AlignedHeight ( ) , omvb - > Encoding ( ) , interlace_method , omvb - > BitsPerPixel ( ) ) ; <nl> - <nl> - if ( ! m_deint_input ) <nl> - m_interlace_method = VS_INTERLACEMETHOD_NONE ; <nl> - <nl> - if ( last_interlace_method = = m_interlace_method ) <nl> - ; <nl> - else if ( m_interlace_method = = VS_INTERLACEMETHOD_MMAL_ADVANCED ) <nl> - omvb - > SetVideoDeintMethod ( " adv ( x2 ) " ) ; <nl> - else if ( m_interlace_method = = VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF ) <nl> - omvb - > SetVideoDeintMethod ( " adv ( x1 ) " ) ; <nl> - else if ( m_interlace_method = = VS_INTERLACEMETHOD_MMAL_BOB ) <nl> - omvb - > SetVideoDeintMethod ( " bob ( x2 ) " ) ; <nl> - else if ( m_interlace_method = = VS_INTERLACEMETHOD_MMAL_BOB_HALF ) <nl> - omvb - > SetVideoDeintMethod ( " bob ( x1 ) " ) ; <nl> - else <nl> - omvb - > SetVideoDeintMethod ( " none " ) ; <nl> - <nl> - if ( m_deint_input ) <nl> - { <nl> - MMAL_STATUS_T status = mmal_port_send_buffer ( m_deint_input , omvb - > mmal_buffer ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - Failed to send omvb : % p mmal : % p to % s ( status = 0 % x % s ) " , <nl> - CLASSNAME , __func__ , static_cast < void * > ( omvb ) , <nl> - static_cast < void * > ( omvb - > mmal_buffer ) , m_deint_input - > name , status , <nl> - mmal_status_to_string ( status ) ) ; <nl> - } <nl> - else <nl> - kept = true ; <nl> - } <nl> - else if ( m_queue_render ) <nl> - { <nl> - mmal_queue_put ( m_queue_render , omvb - > mmal_buffer ) ; <nl> - kept = true ; <nl> - } <nl> - else <nl> - { <nl> - CheckConfigurationVout ( omvb - > Width ( ) , omvb - > Height ( ) , omvb - > AlignedWidth ( ) , omvb - > AlignedHeight ( ) , omvb - > Encoding ( ) ) ; <nl> - if ( m_vout_input ) <nl> - { <nl> - MMAL_STATUS_T status = mmal_port_send_buffer ( m_vout_input , omvb - > mmal_buffer ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - Failed to send omvb : % p mmal : % p to % s ( status = 0 % x % s ) " , <nl> - CLASSNAME , __func__ , static_cast < void * > ( omvb ) , <nl> - static_cast < void * > ( omvb - > mmal_buffer ) , m_vout_input - > name , status , <nl> - mmal_status_to_string ( status ) ) ; <nl> - } <nl> - else <nl> - kept = true ; <nl> - } <nl> - } <nl> - } <nl> - break ; <nl> - } <nl> - case MMALStateDeint : <nl> - { <nl> - if ( buffer - > length > 0 ) <nl> - { <nl> - if ( m_queue_render ) <nl> - { <nl> - mmal_queue_put ( m_queue_render , buffer ) ; <nl> - if ( VERBOSE & & CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s send % p to m_queue_render " , CLASSNAME , __func__ , static_cast < void * > ( omvb ) ) ; <nl> - kept = true ; <nl> - } <nl> - else <nl> - { <nl> - CheckConfigurationVout ( omvb - > Width ( ) , omvb - > Height ( ) , omvb - > AlignedWidth ( ) , omvb - > AlignedHeight ( ) , omvb - > Encoding ( ) ) ; <nl> - if ( m_vout_input ) <nl> - { <nl> - if ( VERBOSE & & CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s send % p to m_vout_input " , CLASSNAME , __func__ , static_cast < void * > ( omvb ) ) ; <nl> - MMAL_STATUS_T status = mmal_port_send_buffer ( m_vout_input , buffer ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - Failed to send omvb : % p mmal % : p to % s ( status = 0 % x % s ) " , <nl> - CLASSNAME , __func__ , static_cast < void * > ( omvb ) , static_cast < void * > ( buffer ) , <nl> - m_vout_input - > name , status , mmal_status_to_string ( status ) ) ; <nl> - } <nl> - else <nl> - kept = true ; <nl> - } <nl> - } <nl> - } <nl> - break ; <nl> - } <nl> - default : assert ( 0 ) ; break ; <nl> - } <nl> - if ( ! kept ) <nl> - { <nl> - if ( VERBOSE & & CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - { <nl> - CLog : : Log ( <nl> - LOGDEBUG , <nl> - " % s : : % s % s Not kept : omvb : % p mmal : % p dts : % . 3f pts : % . 3f len : % d cmd : % x flags : % x enc : % . 4s " , <nl> - CLASSNAME , __func__ , omvb ? omvb - > GetStateName ( ) : " " , static_cast < void * > ( omvb ) , <nl> - static_cast < void * > ( buffer ) , buffer - > dts * 1e - 6 , buffer - > pts * 1e - 6 , buffer - > length , <nl> - buffer - > cmd , buffer - > flags , omvb ? ( char * ) & omvb - > Encoding ( ) : " " ) ; <nl> - } <nl> - if ( omvb ) <nl> - omvb - > Release ( ) ; <nl> - else <nl> - { <nl> - mmal_buffer_header_reset ( buffer ) ; <nl> - buffer - > cmd = 0 ; <nl> - mmal_buffer_header_release ( buffer ) ; <nl> - } <nl> - } <nl> - } <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s - stopping " , CLASSNAME , __func__ ) ; <nl> - } <nl> - <nl> - void CMMALRenderer : : UpdateFramerateStats ( double pts ) <nl> - { <nl> - double diff = 0 . 0 ; <nl> - if ( m_lastPts ! = DVD_NOPTS_VALUE & & pts ! = DVD_NOPTS_VALUE & & pts - m_lastPts > 0 . 0 & & pts - m_lastPts < DVD_SEC_TO_TIME ( 1 . / 20 . 0 ) ) <nl> - { <nl> - diff = pts - m_lastPts ; <nl> - if ( m_frameInterval = = 0 . 0 ) <nl> - m_frameInterval = diff ; <nl> - else if ( diff > 0 . 0 ) <nl> - { <nl> - m_frameIntervalDiff = m_frameIntervalDiff * 0 . 9 + 0 . 1 * fabs ( m_frameInterval - diff ) ; <nl> - m_frameInterval = m_frameInterval * 0 . 9 + diff * 0 . 1 ; <nl> - } <nl> - } <nl> - if ( pts ! = DVD_NOPTS_VALUE ) <nl> - m_lastPts = pts ; <nl> - if ( VERBOSE & & CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s pts : % . 3f diff : % . 3f m_frameInterval : % . 6f m_frameIntervalDiff : % . 6f " , CLASSNAME , __func__ , pts * 1e - 6 , diff * 1e - 6 , m_frameInterval * 1e - 6 , m_frameIntervalDiff * 1e - 6 ) ; <nl> - } <nl> - <nl> - void CMMALRenderer : : AddVideoPicture ( const VideoPicture & pic , int id ) <nl> - { <nl> - CMMALBuffer * buffer = dynamic_cast < CMMALBuffer * > ( pic . videoBuffer ) ; <nl> - assert ( buffer ) ; <nl> - if ( VERBOSE & & CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s MMAL - % p ( % p ) % i " , CLASSNAME , __func__ , static_cast < void * > ( buffer ) , <nl> - static_cast < void * > ( buffer - > mmal_buffer ) , id ) ; <nl> - } <nl> - <nl> - assert ( ! m_buffers [ id ] ) ; <nl> - buffer - > Acquire ( ) ; <nl> - m_buffers [ id ] = buffer ; <nl> - UpdateFramerateStats ( pic . pts ) ; <nl> - } <nl> - <nl> - bool CMMALRenderer : : Configure ( const VideoPicture & picture , float fps , unsigned int orientation ) <nl> - { <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - ReleaseBuffers ( ) ; <nl> - <nl> - if ( picture . videoBuffer ) <nl> - m_format = picture . videoBuffer - > GetFormat ( ) ; <nl> - m_sourceWidth = picture . iWidth ; <nl> - m_sourceHeight = picture . iHeight ; <nl> - m_renderOrientation = orientation ; <nl> - <nl> - m_iFlags = GetFlagsChromaPosition ( picture . chroma_position ) | <nl> - GetFlagsColorPrimaries ( picture . color_primaries ) | <nl> - GetFlagsStereoMode ( picture . stereoMode ) ; <nl> - <nl> - m_fps = fps ; <nl> - m_error = 0 . 0 ; <nl> - m_lastPts = DVD_NOPTS_VALUE ; <nl> - m_frameInterval = 0 . 0 ; <nl> - m_frameIntervalDiff = 1e5 ; <nl> - <nl> - / / cause SetVideoRect to trigger - needed after a hdmi mode change <nl> - m_src_rect . SetRect ( 0 , 0 , 0 , 0 ) ; <nl> - m_dst_rect . SetRect ( 0 , 0 , 0 , 0 ) ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s - % dx % d - > % dx % d @ % . 2f flags : % x format : % d orient : % d " , CLASSNAME , __func__ , picture . iWidth , picture . iHeight , picture . iDisplayWidth , picture . iDisplayHeight , fps , m_iFlags , m_format , orientation ) ; <nl> - <nl> - / / calculate the input frame aspect ratio <nl> - CalculateFrameAspectRatio ( picture . iDisplayWidth , picture . iDisplayHeight ) ; <nl> - SetViewMode ( m_videoSettings . m_ViewMode ) ; <nl> - ManageRenderArea ( ) ; <nl> - <nl> - m_bConfigured = true ; <nl> - return true ; <nl> - } <nl> - <nl> - void CMMALRenderer : : ReleaseBuffer ( int id ) <nl> - { <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - CMMALBuffer * omvb = m_buffers [ id ] ; <nl> - if ( VERBOSE & & CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s - MMAL : source : % d omvb : % p mmal : % p " , CLASSNAME , __func__ , id , <nl> - static_cast < void * > ( omvb ) , omvb ? static_cast < void * > ( omvb - > mmal_buffer ) : nullptr ) ; <nl> - } <nl> - if ( m_buffers [ id ] ) <nl> - m_buffers [ id ] - > Release ( ) ; <nl> - m_buffers [ id ] = nullptr ; <nl> - } <nl> - <nl> - bool CMMALRenderer : : Flush ( bool saveBuffers ) <nl> - { <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s " , CLASSNAME , __func__ ) ; <nl> - if ( m_vout_input ) <nl> - mmal_port_flush ( m_vout_input ) ; <nl> - ReleaseBuffers ( ) ; <nl> - <nl> - return false ; <nl> - } <nl> - <nl> - void CMMALRenderer : : Update ( ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s " , CLASSNAME , __func__ ) ; <nl> - if ( ! m_bConfigured ) return ; <nl> - ManageRenderArea ( ) ; <nl> - } <nl> - <nl> - void CMMALRenderer : : RenderUpdate ( int index , int index2 , bool clear , unsigned int flags , unsigned int alpha ) <nl> - { <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - CMMALBuffer * omvb = nullptr ; <nl> - <nl> - if ( ! m_bConfigured ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s - not configured : clear : % d flags : % x alpha : % d source : % d " , CLASSNAME , __func__ , clear , flags , alpha , index ) ; <nl> - goto exit ; <nl> - } <nl> - <nl> - omvb = m_buffers [ index ] ; <nl> - <nl> - if ( CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) . GetStereoView ( ) ! = RENDER_STEREO_VIEW_RIGHT ) <nl> - { <nl> - ManageRenderArea ( ) ; <nl> - CRect view ; <nl> - CBaseRenderer : : GetVideoRect ( m_cachedSourceRect , m_cachedDestRect , view ) ; <nl> - } <nl> - <nl> - / / we only want to upload frames once <nl> - if ( omvb & & omvb - > m_rendered ) <nl> - { <nl> - CLog : : Log ( <nl> - LOGDEBUG , LOGVIDEO , <nl> - " % s : : % s - MMAL : clear : % d flags : % x alpha : % d source : % d omvb : % p mmal : % p mflags : % x skipping " , <nl> - CLASSNAME , __func__ , clear , flags , alpha , index , static_cast < void * > ( omvb ) , <nl> - static_cast < void * > ( omvb - > mmal_buffer ) , omvb - > mmal_buffer - > flags ) ; <nl> - SetVideoRect ( m_cachedSourceRect , m_cachedDestRect ) ; <nl> - goto exit ; <nl> - } <nl> - <nl> - if ( omvb & & omvb - > m_state = = MMALStateBypass ) <nl> - { <nl> - / / dummy buffer from omxplayer <nl> - if ( VERBOSE & & CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s - OMX : clear : % d flags : % x alpha : % d source : % d omvb : % p " , CLASSNAME , <nl> - __func__ , clear , flags , alpha , index , static_cast < void * > ( omvb ) ) ; <nl> - } <nl> - } <nl> - else if ( omvb & & omvb - > mmal_buffer ) <nl> - { <nl> - if ( flags & RENDER_FLAG_TOP ) <nl> - omvb - > mmal_buffer - > flags | = MMAL_BUFFER_HEADER_VIDEO_FLAG_INTERLACED | MMAL_BUFFER_HEADER_VIDEO_FLAG_TOP_FIELD_FIRST ; <nl> - else if ( flags & RENDER_FLAG_BOT ) <nl> - omvb - > mmal_buffer - > flags | = MMAL_BUFFER_HEADER_VIDEO_FLAG_INTERLACED ; <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , <nl> - " % s : : % s - MMAL : clear : % d flags : % x alpha : % d source : % d omvb : % p mmal : % p mflags : % x " <nl> - " len : % d data : % p enc : % . 4s " , <nl> - CLASSNAME , __func__ , clear , flags , alpha , index , static_cast < void * > ( omvb ) , <nl> - static_cast < void * > ( omvb - > mmal_buffer ) , omvb - > mmal_buffer - > flags , <nl> - omvb - > mmal_buffer - > length , static_cast < void * > ( omvb - > mmal_buffer - > data ) , <nl> - ( char * ) & omvb - > Encoding ( ) ) ; <nl> - assert ( omvb - > mmal_buffer & & omvb - > mmal_buffer - > data & & omvb - > mmal_buffer - > length ) ; <nl> - omvb - > Acquire ( ) ; <nl> - omvb - > m_rendered = true ; <nl> - assert ( omvb - > mmal_buffer - > user_data = = omvb ) ; <nl> - mmal_queue_put ( m_queue_process , omvb - > mmal_buffer ) ; <nl> - } <nl> - else <nl> - { <nl> - CLog : : Log ( <nl> - LOGDEBUG , <nl> - " % s : : % s - MMAL : No buffer to update clear : % d flags : % x alpha : % d source : % d omvb : % p mmal : % p " , <nl> - CLASSNAME , __func__ , clear , flags , alpha , index , static_cast < void * > ( omvb ) , <nl> - omvb ? static_cast < void * > ( omvb - > mmal_buffer ) : nullptr ) ; <nl> - } <nl> - <nl> - exit : <nl> - lock . Leave ( ) ; <nl> - uint32_t v = g_RBP . WaitVsync ( m_vsync_count ) ; <nl> - / / allow a frame of slop <nl> - if ( m_vsync_count = = ~ 0U | | ! ( v = = m_vsync_count ) ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s - vsync % d ( + % d ) " , CLASSNAME , __func__ , m_vsync_count , v - m_vsync_count ) ; <nl> - m_vsync_count = v + 1 ; <nl> - } <nl> - else <nl> - m_vsync_count + + ; <nl> - } <nl> - <nl> - void CMMALRenderer : : ReleaseBuffers ( ) <nl> - { <nl> - if ( VERBOSE & & CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s " , CLASSNAME , __func__ ) ; <nl> - for ( int i = 0 ; i < NUM_BUFFERS ; i + + ) <nl> - ReleaseBuffer ( i ) ; <nl> - } <nl> - <nl> - void CMMALRenderer : : UnInitMMAL ( ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s " , CLASSNAME , __func__ ) ; <nl> - <nl> - if ( m_queue_render ) <nl> - { <nl> - mmal_queue_put ( m_queue_render , & m_quitpacket ) ; <nl> - { <nl> - / / leave the lock to allow other threads to exit <nl> - CSingleExit unlock ( m_sharedSection ) ; <nl> - StopThread ( true ) ; <nl> - } <nl> - mmal_queue_destroy ( m_queue_render ) ; <nl> - m_queue_render = nullptr ; <nl> - } <nl> - <nl> - if ( m_vout ) <nl> - { <nl> - mmal_component_disable ( m_vout ) ; <nl> - } <nl> - <nl> - if ( m_vout_input ) <nl> - { <nl> - mmal_port_flush ( m_vout_input ) ; <nl> - mmal_port_disable ( m_vout_input ) ; <nl> - } <nl> - <nl> - ReleaseBuffers ( ) ; <nl> - <nl> - m_vout_input = NULL ; <nl> - <nl> - if ( m_vout ) <nl> - { <nl> - mmal_component_release ( m_vout ) ; <nl> - m_vout = NULL ; <nl> - } <nl> - <nl> - m_src_rect . SetRect ( 0 , 0 , 0 , 0 ) ; <nl> - m_dst_rect . SetRect ( 0 , 0 , 0 , 0 ) ; <nl> - m_video_stereo_mode = RENDER_STEREO_MODE_OFF ; <nl> - m_display_stereo_mode = RENDER_STEREO_MODE_OFF ; <nl> - m_StereoInvert = false ; <nl> - m_vout_width = 0 ; <nl> - m_vout_height = 0 ; <nl> - m_vout_aligned_width = 0 ; <nl> - m_vout_aligned_height = 0 ; <nl> - } <nl> - <nl> - void CMMALRenderer : : UnInit ( ) <nl> - { <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - m_bConfigured = false ; <nl> - DestroyDeinterlace ( ) ; <nl> - UnInitMMAL ( ) ; <nl> - } <nl> - <nl> - bool CMMALRenderer : : RenderCapture ( CRenderCapture * capture ) <nl> - { <nl> - if ( ! m_bConfigured ) <nl> - return false ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s - % p " , CLASSNAME , __func__ , static_cast < void * > ( capture ) ) ; <nl> - <nl> - capture - > BeginRender ( ) ; <nl> - capture - > EndRender ( ) ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> - / / YV12 Texture creation , deletion , copying + clearing <nl> - / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> - <nl> - bool CMMALRenderer : : Supports ( ERENDERFEATURE feature ) <nl> - { <nl> - if ( feature = = RENDERFEATURE_STRETCH | | <nl> - feature = = RENDERFEATURE_ZOOM | | <nl> - feature = = RENDERFEATURE_ROTATION | | <nl> - feature = = RENDERFEATURE_VERTICAL_SHIFT | | <nl> - feature = = RENDERFEATURE_PIXEL_RATIO ) <nl> - return true ; <nl> - <nl> - return false ; <nl> - } <nl> - <nl> - bool CMMALRenderer : : Supports ( ESCALINGMETHOD method ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - void CMMALRenderer : : SetVideoRect ( const CRect & InSrcRect , const CRect & InDestRect ) <nl> - { <nl> - CSingleLock lock ( m_sharedSection ) ; <nl> - <nl> - if ( ! m_vout_input ) <nl> - return ; <nl> - <nl> - CRect SrcRect = InSrcRect , DestRect = InDestRect ; <nl> - RENDER_STEREO_MODE video_stereo_mode = ( m_iFlags & CONF_FLAGS_STEREO_MODE_SBS ) ? RENDER_STEREO_MODE_SPLIT_VERTICAL : <nl> - ( m_iFlags & CONF_FLAGS_STEREO_MODE_TAB ) ? RENDER_STEREO_MODE_SPLIT_HORIZONTAL : RENDER_STEREO_MODE_OFF ; <nl> - bool stereo_invert = ( m_iFlags & CONF_FLAGS_STEREO_CADANCE_RIGHT_LEFT ) ? true : false ; <nl> - RENDER_STEREO_MODE display_stereo_mode = CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) . GetStereoMode ( ) ; <nl> - <nl> - / / ignore video stereo mode when 3D display mode is disabled <nl> - if ( display_stereo_mode = = RENDER_STEREO_MODE_OFF ) <nl> - video_stereo_mode = RENDER_STEREO_MODE_OFF ; <nl> - <nl> - / / fix up transposed video <nl> - if ( m_renderOrientation = = 90 | | m_renderOrientation = = 270 ) <nl> - { <nl> - float newWidth , newHeight ; <nl> - float aspectRatio = GetAspectRatio ( ) ; <nl> - / / clamp width if too wide <nl> - if ( DestRect . Height ( ) > DestRect . Width ( ) ) <nl> - { <nl> - newWidth = DestRect . Width ( ) ; / / clamp to the width of the old dest rect <nl> - newHeight = newWidth * aspectRatio ; <nl> - } <nl> - else / / else clamp to height <nl> - { <nl> - newHeight = DestRect . Height ( ) ; / / clamp to the height of the old dest rect <nl> - newWidth = newHeight / aspectRatio ; <nl> - } <nl> - <nl> - / / calculate the center point of the view and offsets <nl> - float centerX = DestRect . x1 + DestRect . Width ( ) * 0 . 5f ; <nl> - float centerY = DestRect . y1 + DestRect . Height ( ) * 0 . 5f ; <nl> - float diffX = newWidth * 0 . 5f ; <nl> - float diffY = newHeight * 0 . 5f ; <nl> - <nl> - DestRect . x1 = centerX - diffX ; <nl> - DestRect . x2 = centerX + diffX ; <nl> - DestRect . y1 = centerY - diffY ; <nl> - DestRect . y2 = centerY + diffY ; <nl> - } <nl> - <nl> - / / check if destination rect or video view mode has changed <nl> - if ( ! ( m_dst_rect ! = DestRect ) & & ! ( m_src_rect ! = SrcRect ) & & m_video_stereo_mode = = video_stereo_mode & & m_display_stereo_mode = = display_stereo_mode & & m_StereoInvert = = stereo_invert ) <nl> - return ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % d , % d , % d , % d - > % d , % d , % d , % d ( o : % d v : % d d : % d i : % d ) " , CLASSNAME , __func__ , <nl> - ( int ) SrcRect . x1 , ( int ) SrcRect . y1 , ( int ) SrcRect . x2 , ( int ) SrcRect . y2 , <nl> - ( int ) DestRect . x1 , ( int ) DestRect . y1 , ( int ) DestRect . x2 , ( int ) DestRect . y2 , <nl> - m_renderOrientation , video_stereo_mode , display_stereo_mode , stereo_invert ) ; <nl> - <nl> - m_src_rect = SrcRect ; <nl> - m_dst_rect = DestRect ; <nl> - m_video_stereo_mode = video_stereo_mode ; <nl> - m_display_stereo_mode = display_stereo_mode ; <nl> - m_StereoInvert = stereo_invert ; <nl> - <nl> - / / might need to scale up m_dst_rect to display size as video decodes <nl> - / / to separate video plane that is at display size . <nl> - RESOLUTION res = CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) . GetVideoResolution ( ) ; <nl> - CRect gui ( 0 , 0 , CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( res ) . iWidth , CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( res ) . iHeight ) ; <nl> - CRect display ( 0 , 0 , CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( res ) . iScreenWidth , CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( res ) . iScreenHeight ) ; <nl> - <nl> - if ( display_stereo_mode = = RENDER_STEREO_MODE_SPLIT_VERTICAL ) <nl> - { <nl> - float width = DestRect . x2 - DestRect . x1 ; <nl> - DestRect . x1 * = 2 . 0f ; <nl> - DestRect . x2 = DestRect . x1 + 2 . 0f * width ; <nl> - } <nl> - else if ( display_stereo_mode = = RENDER_STEREO_MODE_SPLIT_HORIZONTAL ) <nl> - { <nl> - float height = DestRect . y2 - DestRect . y1 ; <nl> - DestRect . y1 * = 2 . 0f ; <nl> - DestRect . y2 = DestRect . y1 + 2 . 0f * height ; <nl> - } <nl> - <nl> - if ( gui ! = display ) <nl> - { <nl> - float xscale = display . Width ( ) / gui . Width ( ) ; <nl> - float yscale = display . Height ( ) / gui . Height ( ) ; <nl> - DestRect . x1 * = xscale ; <nl> - DestRect . x2 * = xscale ; <nl> - DestRect . y1 * = yscale ; <nl> - DestRect . y2 * = yscale ; <nl> - } <nl> - <nl> - MMAL_DISPLAYREGION_T region ; <nl> - memset ( & region , 0 , sizeof region ) ; <nl> - <nl> - region . set = MMAL_DISPLAY_SET_DEST_RECT | MMAL_DISPLAY_SET_SRC_RECT | MMAL_DISPLAY_SET_FULLSCREEN | MMAL_DISPLAY_SET_NOASPECT | MMAL_DISPLAY_SET_MODE | MMAL_DISPLAY_SET_TRANSFORM ; <nl> - region . dest_rect . x = lrintf ( DestRect . x1 ) ; <nl> - region . dest_rect . y = lrintf ( DestRect . y1 ) ; <nl> - region . dest_rect . width = lrintf ( DestRect . Width ( ) ) ; <nl> - region . dest_rect . height = lrintf ( DestRect . Height ( ) ) ; <nl> - <nl> - region . src_rect . x = lrintf ( SrcRect . x1 ) ; <nl> - region . src_rect . y = lrintf ( SrcRect . y1 ) ; <nl> - region . src_rect . width = lrintf ( SrcRect . Width ( ) ) ; <nl> - region . src_rect . height = lrintf ( SrcRect . Height ( ) ) ; <nl> - <nl> - region . fullscreen = MMAL_FALSE ; <nl> - region . noaspect = MMAL_TRUE ; <nl> - region . mode = MMAL_DISPLAY_MODE_LETTERBOX ; <nl> - <nl> - if ( m_renderOrientation = = 90 ) <nl> - region . transform = MMAL_DISPLAY_ROT90 ; <nl> - else if ( m_renderOrientation = = 180 ) <nl> - region . transform = MMAL_DISPLAY_ROT180 ; <nl> - else if ( m_renderOrientation = = 270 ) <nl> - region . transform = MMAL_DISPLAY_ROT270 ; <nl> - else <nl> - region . transform = MMAL_DISPLAY_ROT0 ; <nl> - <nl> - if ( m_video_stereo_mode = = RENDER_STEREO_MODE_SPLIT_HORIZONTAL ) <nl> - region . transform = ( MMAL_DISPLAYTRANSFORM_T ) ( region . transform | DISPMANX_STEREOSCOPIC_TB ) ; <nl> - else if ( m_video_stereo_mode = = RENDER_STEREO_MODE_SPLIT_VERTICAL ) <nl> - region . transform = ( MMAL_DISPLAYTRANSFORM_T ) ( region . transform | DISPMANX_STEREOSCOPIC_SBS ) ; <nl> - else <nl> - region . transform = ( MMAL_DISPLAYTRANSFORM_T ) ( region . transform | DISPMANX_STEREOSCOPIC_MONO ) ; <nl> - <nl> - if ( m_StereoInvert ) <nl> - region . transform = ( MMAL_DISPLAYTRANSFORM_T ) ( region . transform | DISPMANX_STEREOSCOPIC_INVERT ) ; <nl> - <nl> - MMAL_STATUS_T status = mmal_util_set_display_region ( m_vout_input , & region ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to set display region ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % d , % d , % d , % d - > % d , % d , % d , % d t : % x " , CLASSNAME , __func__ , <nl> - region . src_rect . x , region . src_rect . y , region . src_rect . width , region . src_rect . height , <nl> - region . dest_rect . x , region . dest_rect . y , region . dest_rect . width , region . dest_rect . height , region . transform ) ; <nl> - } <nl> - <nl> - void CMMALRenderer : : deint_input_port_cb ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) <nl> - { <nl> - if ( VERBOSE & & CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s omvb : % p mmal : % p dts : % . 3f pts : % . 3f len : % d cmd : % x flags : % x " , <nl> - CLASSNAME , __func__ , static_cast < void * > ( buffer - > user_data ) , <nl> - static_cast < void * > ( buffer ) , buffer - > dts * 1e - 6 , buffer - > pts * 1e - 6 , buffer - > length , <nl> - buffer - > cmd , buffer - > flags ) ; <nl> - } <nl> - mmal_queue_put ( m_queue_process , buffer ) ; <nl> - } <nl> - <nl> - static void deint_input_port_cb_static ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) <nl> - { <nl> - CMMALRenderer * mmal = reinterpret_cast < CMMALRenderer * > ( port - > userdata ) ; <nl> - mmal - > deint_input_port_cb ( port , buffer ) ; <nl> - } <nl> - <nl> - void CMMALRenderer : : deint_output_port_cb ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) <nl> - { <nl> - if ( VERBOSE & & CServiceBroker : : GetLogging ( ) . CanLogComponent ( LOGVIDEO ) ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s omvb : % p mmal : % p dts : % . 3f pts : % . 3f len : % d cmd : % x flags : % x " , <nl> - CLASSNAME , __func__ , static_cast < void * > ( buffer - > user_data ) , <nl> - static_cast < void * > ( buffer ) , buffer - > dts * 1e - 6 , buffer - > pts * 1e - 6 , buffer - > length , <nl> - buffer - > cmd , buffer - > flags ) ; <nl> - } <nl> - mmal_queue_put ( m_queue_process , buffer ) ; <nl> - } <nl> - <nl> - static void deint_output_port_cb_static ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) <nl> - { <nl> - CMMALRenderer * mmal = reinterpret_cast < CMMALRenderer * > ( port - > userdata ) ; <nl> - mmal - > deint_output_port_cb ( port , buffer ) ; <nl> - } <nl> - <nl> - void CMMALRenderer : : DestroyDeinterlace ( ) <nl> - { <nl> - MMAL_STATUS_T status ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s " , CLASSNAME , __func__ ) ; <nl> - <nl> - / / ( lazily ) destroy pool first so new buffers aren ' t allocated when flushing <nl> - m_deint_output_pool = nullptr ; <nl> - <nl> - if ( m_deint_input & & m_deint_input - > is_enabled ) <nl> - { <nl> - status = mmal_port_disable ( m_deint_input ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to disable deinterlace input port ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - } <nl> - m_deint_input = nullptr ; <nl> - if ( m_deint_output & & m_deint_output - > is_enabled ) <nl> - { <nl> - status = mmal_port_disable ( m_deint_output ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to disable deinterlace output port ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - } <nl> - m_deint_output = nullptr ; <nl> - m_interlace_method = VS_INTERLACEMETHOD_MAX ; <nl> - m_deint_width = 0 ; <nl> - m_deint_height = 0 ; <nl> - m_deint_aligned_width = 0 ; <nl> - m_deint_aligned_height = 0 ; <nl> - m_deint = nullptr ; <nl> - } <nl> - <nl> - bool CMMALRenderer : : CheckConfigurationDeint ( uint32_t width , uint32_t height , uint32_t aligned_width , uint32_t aligned_height , uint32_t encoding , EINTERLACEMETHOD interlace_method , int bitsPerPixel ) <nl> - { <nl> - MMAL_STATUS_T status ; <nl> - bool sizeChanged = width ! = m_deint_width | | height ! = m_deint_height | | aligned_width ! = m_deint_aligned_width | | aligned_height ! = m_deint_aligned_height ; <nl> - bool deinterlaceChanged = interlace_method ! = m_interlace_method ; <nl> - bool encodingChanged = ! m_deint_input | | ! m_deint_input - > format | | m_deint_input - > format - > encoding ! = encoding ; <nl> - bool advanced_deinterlace = interlace_method = = VS_INTERLACEMETHOD_MMAL_ADVANCED | | interlace_method = = VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF ; <nl> - bool half_framerate = interlace_method = = VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF | | interlace_method = = VS_INTERLACEMETHOD_MMAL_BOB_HALF ; <nl> - uint32_t output_encoding = advanced_deinterlace ? MMAL_ENCODING_YUVUV128 : MMAL_ENCODING_I420 ; <nl> - const char * component = interlace_method = = VS_INTERLACEMETHOD_NONE ? " vc . ril . isp " : " vc . ril . image_fx " ; <nl> - <nl> - if ( ! m_bConfigured ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s Unconfigured " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_deint ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , LOGVIDEO , " % s : : % s CreateDeinterlace " , CLASSNAME , __func__ ) ; <nl> - <nl> - / * Create deinterlace component with attached pool * / <nl> - m_deint_output_pool = std : : make_shared < CMMALPool > ( component , false , 3 , 0 , output_encoding , MMALStateDeint ) ; <nl> - if ( ! m_deint_output_pool ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to create pool for deint output " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_deint = m_deint_output_pool - > GetComponent ( ) ; <nl> - m_deint_output = m_deint - > output [ 0 ] ; <nl> - m_deint_input = m_deint - > input [ 0 ] ; <nl> - <nl> - status = mmal_port_parameter_set_boolean ( m_deint_input , MMAL_PARAMETER_ZERO_COPY , MMAL_TRUE ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable zero copy mode on % s ( status = % x % s ) " , CLASSNAME , __func__ , m_deint_input - > name , status , mmal_status_to_string ( status ) ) ; <nl> - } <nl> - <nl> - if ( m_deint_input & & ( sizeChanged | | deinterlaceChanged | | encodingChanged ) ) <nl> - { <nl> - assert ( m_deint_input ! = nullptr & & m_deint_input - > format ! = nullptr & & m_deint_input - > format - > es ! = nullptr ) ; <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s Changing Deint dimensions from % dx % d ( % dx % d ) to % dx % d ( % dx % d ) % . 4s - > % . 4s mode % d - > % d bpp : % d " , CLASSNAME , __func__ , <nl> - m_deint_input - > format - > es - > video . crop . width , m_deint_input - > format - > es - > video . crop . height , <nl> - m_deint_input - > format - > es - > video . width , m_deint_input - > format - > es - > video . height , width , height , aligned_width , aligned_height , <nl> - ( char * ) & m_deint_input - > format - > encoding , ( char * ) & encoding , m_interlace_method , interlace_method , bitsPerPixel ) ; <nl> - <nl> - / / we need to disable port when parameters change <nl> - if ( m_deint_input & & m_deint_input - > is_enabled ) <nl> - { <nl> - status = mmal_port_disable ( m_deint_input ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to disable deint input port ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - if ( m_deint_output & & ( sizeChanged | | deinterlaceChanged | | encodingChanged ) ) <nl> - { <nl> - if ( m_deint_output & & m_deint_output - > is_enabled ) <nl> - { <nl> - status = mmal_port_disable ( m_deint_output ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to disable deint output port ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - if ( m_deint_input & & ( sizeChanged | | deinterlaceChanged | | encodingChanged ) ) <nl> - { <nl> - m_deint_width = width ; <nl> - m_deint_height = height ; <nl> - m_deint_aligned_width = aligned_width ; <nl> - m_deint_aligned_height = aligned_height ; <nl> - <nl> - m_deint_input - > format - > es - > video . crop . width = width ; <nl> - m_deint_input - > format - > es - > video . crop . height = height ; <nl> - m_deint_input - > format - > es - > video . width = aligned_width ; <nl> - m_deint_input - > format - > es - > video . height = aligned_height ; <nl> - m_deint_input - > format - > encoding = encoding ; <nl> - <nl> - status = mmal_port_format_commit ( m_deint_input ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to commit deint input format ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_deint_input - > is_enabled ) <nl> - { <nl> - m_deint_input - > buffer_num = MMAL_NUM_OUTPUT_BUFFERS ; <nl> - m_deint_input - > buffer_size = m_deint_input - > buffer_size_recommended ; <nl> - m_deint_input - > userdata = ( struct MMAL_PORT_USERDATA_T * ) this ; <nl> - <nl> - status = mmal_port_enable ( m_deint_input , deint_input_port_cb_static ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable deint input port ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - <nl> - if ( m_deint_output & & ( sizeChanged | | deinterlaceChanged | | encodingChanged ) ) <nl> - { <nl> - if ( interlace_method ! = VS_INTERLACEMETHOD_NONE ) <nl> - { <nl> - MMAL_PARAMETER_IMAGEFX_PARAMETERS_T imfx_param = { { MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS , sizeof ( imfx_param ) } , <nl> - advanced_deinterlace ? MMAL_PARAM_IMAGEFX_DEINTERLACE_ADV : MMAL_PARAM_IMAGEFX_DEINTERLACE_FAST , 4 , { 5 , 0 , half_framerate , 1 } } ; <nl> - <nl> - status = mmal_port_parameter_set ( m_deint_output , & imfx_param . hdr ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to set deinterlace parameters ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - / / Image_fx assumed 3 frames of context . simple deinterlace doesn ' t require this <nl> - status = mmal_port_parameter_set_uint32 ( m_deint_input , MMAL_PARAMETER_EXTRA_BUFFERS , 6 - 5 + advanced_deinterlace ? 2 : 0 ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable extra buffers on % s ( status = % x % s ) " , CLASSNAME , __func__ , m_deint_input - > name , status , mmal_status_to_string ( status ) ) ; <nl> - } <nl> - else <nl> - { <nl> - / / We need to scale the YUV to 16 - bit <nl> - status = mmal_port_parameter_set_int32 ( m_deint_input , MMAL_PARAMETER_CCM_SHIFT , 16 - bitsPerPixel - 1 ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to configure MMAL_PARAMETER_CCM_SHIFT on % s ( status = % x % s ) " , CLASSNAME , __func__ , m_deint_input - > name , status , mmal_status_to_string ( status ) ) ; <nl> - status = mmal_port_parameter_set_uint32 ( m_deint_output , MMAL_PARAMETER_OUTPUT_SHIFT , 1 ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to configure MMAL_PARAMETER_OUTPUT_SHIFT on % s ( status = % x % s ) " , CLASSNAME , __func__ , m_deint_output - > name , status , mmal_status_to_string ( status ) ) ; <nl> - } <nl> - } <nl> - <nl> - if ( m_deint_output & & ( sizeChanged | | deinterlaceChanged | | encodingChanged ) ) <nl> - { <nl> - m_deint_output - > format - > es - > video . crop . width = width ; <nl> - m_deint_output - > format - > es - > video . crop . height = height ; <nl> - m_deint_output - > format - > es - > video . width = ALIGN_UP ( width , 32 ) ; <nl> - m_deint_output - > format - > es - > video . height = ALIGN_UP ( height , 16 ) ; <nl> - m_deint_output - > format - > encoding = output_encoding ; <nl> - <nl> - status = mmal_port_format_commit ( m_deint_output ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to commit deint output format ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_deint_output - > is_enabled ) <nl> - { <nl> - m_deint_output - > buffer_num = 3 ; <nl> - m_deint_output - > buffer_size = m_deint_output - > buffer_size_recommended ; <nl> - m_deint_output - > userdata = ( struct MMAL_PORT_USERDATA_T * ) this ; <nl> - <nl> - status = mmal_port_enable ( m_deint_output , deint_output_port_cb_static ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable deint output port ( status = % x % s ) " , CLASSNAME , __func__ , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - if ( m_deint_output_pool ) <nl> - m_deint_output_pool - > Configure ( AV_PIX_FMT_NONE , <nl> - m_deint_output - > format - > es - > video . crop . width , m_deint_output - > format - > es - > video . crop . height , <nl> - m_deint_output - > format - > es - > video . width , m_deint_output - > format - > es - > video . height , m_deint_output - > buffer_size ) ; <nl> - } <nl> - <nl> - if ( m_deint & & ! m_deint - > is_enabled ) <nl> - { <nl> - status = mmal_component_enable ( m_deint ) ; <nl> - if ( status ! = MMAL_SUCCESS ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s Failed to enable deinterlacer component % s ( status = % x % s ) " , CLASSNAME , __func__ , m_deint - > name , status , mmal_status_to_string ( status ) ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - m_interlace_method = interlace_method ; <nl> - <nl> - / / give buffers to deint <nl> - if ( m_deint_output_pool ) <nl> - m_deint_output_pool - > Prime ( ) ; <nl> - return true ; <nl> - } <nl> - <nl> - CBaseRenderer * CMMALRenderer : : Create ( CVideoBuffer * buffer ) <nl> - { <nl> - return new CMMALRenderer ( ) ; <nl> - } <nl> - <nl> - bool CMMALRenderer : : Register ( ) <nl> - { <nl> - VIDEOPLAYER : : CRendererFactory : : RegisterRenderer ( " mmal " , CMMALRenderer : : Create ) ; <nl> - return true ; <nl> - } <nl> deleted file mode 100644 <nl> index 4b77f90589f6 . . 000000000000 <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / MMALRenderer . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2005 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # include " . . / BaseRenderer . h " <nl> - # include " . . / RenderCapture . h " <nl> - # include " . . / RenderFlags . h " <nl> - # include " cores / VideoPlayer / DVDStreamInfo . h " <nl> - # include " cores / VideoSettings . h " <nl> - # include " threads / IRunnable . h " <nl> - # include " threads / Thread . h " <nl> - # include " utils / Geometry . h " <nl> - # include " windowing / GraphicContext . h " <nl> - <nl> - # include < vector > <nl> - <nl> - # include < interface / mmal / mmal . h > <nl> - <nl> - / / worst case number of buffers . 12 for decoder . 8 for multi - threading in ffmpeg . NUM_BUFFERS for renderer . <nl> - / / Note , generally these won ' t necessarily result in allocated pictures <nl> - # define MMAL_NUM_OUTPUT_BUFFERS ( 12 + 8 + NUM_BUFFERS ) <nl> - <nl> - struct VideoPicture ; <nl> - class CProcessInfo ; <nl> - <nl> - namespace MMAL { <nl> - <nl> - class CMMALBuffer ; <nl> - <nl> - enum MMALState { MMALStateNone , MMALStateHWDec , MMALStateFFDec , MMALStateDeint , MMALStateBypass , } ; <nl> - <nl> - class CMMALPool : public IVideoBufferPool <nl> - { <nl> - public : <nl> - CMMALPool ( const char * component_name , bool input , uint32_t num_buffers , uint32_t buffer_size , uint32_t encoding , MMALState state ) ; <nl> - ~ CMMALPool ( ) ; <nl> - <nl> - virtual CVideoBuffer * Get ( ) override ; <nl> - virtual void Return ( int id ) override ; <nl> - virtual void Configure ( AVPixelFormat format , int size ) override ; <nl> - virtual bool IsConfigured ( ) override ; <nl> - virtual bool IsCompatible ( AVPixelFormat format , int size ) override ; <nl> - <nl> - void SetDimensions ( int width , int height , const int ( & strides ) [ YuvImage : : MAX_PLANES ] , const int ( & planeOffsets ) [ YuvImage : : MAX_PLANES ] ) ; <nl> - MMAL_COMPONENT_T * GetComponent ( ) { return m_component ; } <nl> - CMMALBuffer * GetBuffer ( uint32_t timeout ) ; <nl> - void Prime ( ) ; <nl> - void SetProcessInfo ( CProcessInfo * processInfo ) { m_processInfo = processInfo ; } <nl> - void Configure ( AVPixelFormat format , int width , int height , int alignedWidth , int alignedHeight , int size ) ; <nl> - bool IsSoftware ( ) { return m_software ; } <nl> - void SetVideoDeintMethod ( std : : string method ) ; <nl> - static uint32_t TranslateFormat ( AVPixelFormat pixfmt ) ; <nl> - virtual int Width ( ) { return m_width ; } <nl> - virtual int Height ( ) { return m_height ; } <nl> - virtual int AlignedWidth ( ) { return m_mmal_format = = MMAL_ENCODING_YUVUV128 | | m_mmal_format = = MMAL_ENCODING_YUVUV64_16 | | m_geo . getBytesPerPixel ( ) = = 0 ? 0 : m_geo . getStrideY ( ) / m_geo . getBytesPerPixel ( ) ; } <nl> - virtual int AlignedHeight ( ) { return m_mmal_format = = MMAL_ENCODING_YUVUV128 | | m_mmal_format = = MMAL_ENCODING_YUVUV64_16 ? 0 : m_geo . getHeightY ( ) ; } <nl> - virtual int BitsPerPixel ( ) { return m_geo . getBitsPerPixel ( ) ; } <nl> - virtual uint32_t & Encoding ( ) { return m_mmal_format ; } <nl> - virtual int Size ( ) { return m_size ; } <nl> - AVRpiZcFrameGeometry & GetGeometry ( ) { return m_geo ; } <nl> - virtual void Released ( CVideoBufferManager & videoBufferManager ) ; <nl> - <nl> - protected : <nl> - int m_width = 0 ; <nl> - int m_height = 0 ; <nl> - bool m_configured = false ; <nl> - CCriticalSection m_critSection ; <nl> - <nl> - std : : vector < CMMALBuffer * > m_all ; <nl> - std : : deque < int > m_used ; <nl> - std : : deque < int > m_free ; <nl> - <nl> - int m_size = 0 ; <nl> - uint32_t m_mmal_format = 0 ; <nl> - bool m_software = false ; <nl> - CProcessInfo * m_processInfo = nullptr ; <nl> - MMALState m_state ; <nl> - bool m_input ; <nl> - MMAL_POOL_T * m_mmal_pool ; <nl> - MMAL_COMPONENT_T * m_component ; <nl> - AVRpiZcFrameGeometry m_geo ; <nl> - struct MMALEncodingTable <nl> - { <nl> - AVPixelFormat pixfmt ; <nl> - uint32_t encoding ; <nl> - } ; <nl> - static std : : vector < MMALEncodingTable > mmal_encoding_table ; <nl> - } ; <nl> - <nl> - / / a generic mmal video frame . May be overridden as either software or hardware decoded buffer <nl> - class CMMALBuffer : public CVideoBuffer <nl> - { <nl> - public : <nl> - CMMALBuffer ( int id ) ; <nl> - virtual ~ CMMALBuffer ( ) ; <nl> - MMAL_BUFFER_HEADER_T * mmal_buffer = nullptr ; <nl> - float m_aspect_ratio = 0 . 0f ; <nl> - MMALState m_state = MMALStateNone ; <nl> - bool m_rendered = false ; <nl> - bool m_stills = false ; <nl> - <nl> - virtual void Unref ( ) ; <nl> - virtual std : : shared_ptr < CMMALPool > Pool ( ) { return std : : dynamic_pointer_cast < CMMALPool > ( m_pool ) ; } ; <nl> - virtual int Width ( ) { return Pool ( ) - > Width ( ) ; } <nl> - virtual int Height ( ) { return Pool ( ) - > Height ( ) ; } <nl> - virtual int AlignedWidth ( ) { return Pool ( ) - > AlignedWidth ( ) ; } <nl> - virtual int AlignedHeight ( ) { return Pool ( ) - > AlignedHeight ( ) ; } <nl> - virtual uint32_t & Encoding ( ) { return Pool ( ) - > Encoding ( ) ; } <nl> - virtual int BitsPerPixel ( ) { return Pool ( ) - > BitsPerPixel ( ) ; } <nl> - virtual void Update ( ) ; <nl> - <nl> - void SetVideoDeintMethod ( std : : string method ) ; <nl> - const char * GetStateName ( ) { <nl> - static const char * names [ ] = { " MMALStateNone " , " MMALStateHWDec " , " MMALStateFFDec " , " MMALStateDeint " , " MMALStateBypass " , } ; <nl> - if ( ( size_t ) m_state < vcos_countof ( names ) ) <nl> - return names [ ( size_t ) m_state ] ; <nl> - else <nl> - return " invalid " ; <nl> - } <nl> - protected : <nl> - } ; <nl> - <nl> - <nl> - class CMMALRenderer : public CBaseRenderer , public CThread , public IRunnable <nl> - { <nl> - public : <nl> - CMMALRenderer ( ) ; <nl> - ~ CMMALRenderer ( ) ; <nl> - <nl> - void Process ( ) ; <nl> - virtual void Update ( ) ; <nl> - <nl> - bool RenderCapture ( CRenderCapture * capture ) ; <nl> - <nl> - / / Player functions <nl> - virtual bool Configure ( const VideoPicture & picture , float fps , unsigned int orientation ) override ; <nl> - virtual void ReleaseBuffer ( int idx ) override ; <nl> - virtual void UnInit ( ) ; <nl> - virtual bool Flush ( bool saveBuffers ) override ; <nl> - virtual bool IsConfigured ( ) override { return m_bConfigured ; } <nl> - virtual void AddVideoPicture ( const VideoPicture & pic , int index ) override ; <nl> - virtual bool IsPictureHW ( const VideoPicture & picture ) override { return false ; } ; <nl> - virtual CRenderInfo GetRenderInfo ( ) override ; <nl> - <nl> - virtual bool SupportsMultiPassRendering ( ) override { return false ; } ; <nl> - virtual bool Supports ( ERENDERFEATURE feature ) override ; <nl> - virtual bool Supports ( ESCALINGMETHOD method ) override ; <nl> - <nl> - virtual void RenderUpdate ( int index , int index2 , bool clear , unsigned int flags , unsigned int alpha ) override ; <nl> - <nl> - virtual void SetVideoRect ( const CRect & SrcRect , const CRect & DestRect ) ; <nl> - virtual bool IsGuiLayer ( ) override { return false ; } <nl> - virtual bool ConfigChanged ( const VideoPicture & picture ) override { return false ; } <nl> - <nl> - void vout_input_port_cb ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) ; <nl> - void deint_input_port_cb ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) ; <nl> - void deint_output_port_cb ( MMAL_PORT_T * port , MMAL_BUFFER_HEADER_T * buffer ) ; <nl> - <nl> - static CBaseRenderer * Create ( CVideoBuffer * buffer ) ; <nl> - static bool Register ( ) ; <nl> - <nl> - protected : <nl> - CMMALBuffer * m_buffers [ NUM_BUFFERS ] ; <nl> - bool m_bConfigured ; <nl> - unsigned int m_extended_format ; <nl> - int m_neededBuffers ; <nl> - <nl> - CRect m_cachedSourceRect ; <nl> - CRect m_cachedDestRect ; <nl> - CRect m_src_rect ; <nl> - CRect m_dst_rect ; <nl> - RENDER_STEREO_MODE m_video_stereo_mode ; <nl> - RENDER_STEREO_MODE m_display_stereo_mode ; <nl> - bool m_StereoInvert ; <nl> - bool m_isPi1 ; <nl> - <nl> - CCriticalSection m_sharedSection ; <nl> - MMAL_COMPONENT_T * m_vout ; <nl> - MMAL_PORT_T * m_vout_input ; <nl> - MMAL_QUEUE_T * m_queue_render ; <nl> - MMAL_QUEUE_T * m_queue_process ; <nl> - CThread m_processThread ; <nl> - MMAL_BUFFER_HEADER_T m_quitpacket ; <nl> - double m_error ; <nl> - double m_lastPts ; <nl> - double m_frameInterval ; <nl> - double m_frameIntervalDiff ; <nl> - uint32_t m_vout_width , m_vout_height , m_vout_aligned_width , m_vout_aligned_height ; <nl> - / / deinterlace <nl> - MMAL_COMPONENT_T * m_deint ; <nl> - MMAL_PORT_T * m_deint_input ; <nl> - MMAL_PORT_T * m_deint_output ; <nl> - std : : shared_ptr < CMMALPool > m_deint_output_pool ; <nl> - MMAL_INTERLACETYPE_T m_interlace_mode ; <nl> - EINTERLACEMETHOD m_interlace_method ; <nl> - uint32_t m_deint_width , m_deint_height , m_deint_aligned_width , m_deint_aligned_height ; <nl> - MMAL_FOURCC_T m_deinterlace_out_encoding ; <nl> - void DestroyDeinterlace ( ) ; <nl> - bool CheckConfigurationDeint ( uint32_t width , uint32_t height , uint32_t aligned_width , uint32_t aligned_height , uint32_t encoding , EINTERLACEMETHOD interlace_method , int bitsPerPixel ) ; <nl> - <nl> - bool CheckConfigurationVout ( uint32_t width , uint32_t height , uint32_t aligned_width , uint32_t aligned_height , uint32_t encoding ) ; <nl> - uint32_t m_vsync_count ; <nl> - void ReleaseBuffers ( ) ; <nl> - void UnInitMMAL ( ) ; <nl> - void UpdateFramerateStats ( double pts ) ; <nl> - virtual void Run ( ) override ; <nl> - } ; <nl> - <nl> - } ; <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / RenderCapture . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / RenderCapture . cpp <nl> bool CRenderCaptureBase : : UseOcclusionQuery ( ) <nl> return true ; <nl> } <nl> <nl> - # if defined ( TARGET_RASPBERRY_PI ) <nl> - <nl> - CRenderCaptureDispmanX : : CRenderCaptureDispmanX ( ) <nl> - { <nl> - m_pixels = nullptr ; <nl> - } <nl> - <nl> - CRenderCaptureDispmanX : : ~ CRenderCaptureDispmanX ( ) <nl> - { <nl> - delete [ ] m_pixels ; <nl> - } <nl> - <nl> - int CRenderCaptureDispmanX : : GetCaptureFormat ( ) <nl> - { <nl> - return CAPTUREFORMAT_BGRA ; <nl> - } <nl> - <nl> - void CRenderCaptureDispmanX : : BeginRender ( ) <nl> - { <nl> - } <nl> - <nl> - void CRenderCaptureDispmanX : : EndRender ( ) <nl> - { <nl> - delete [ ] m_pixels ; <nl> - m_pixels = g_RBP . CaptureDisplay ( m_width , m_height , NULL , true ) ; <nl> - <nl> - SetState ( CAPTURESTATE_DONE ) ; <nl> - } <nl> - <nl> - void * CRenderCaptureDispmanX : : GetRenderBuffer ( ) <nl> - { <nl> - return m_pixels ; <nl> - } <nl> - <nl> - void CRenderCaptureDispmanX : : ReadOut ( ) <nl> - { <nl> - } <nl> - <nl> - # elif defined ( HAS_GL ) | | defined ( HAS_GLES ) <nl> + # if defined ( HAS_GL ) | | defined ( HAS_GLES ) <nl> <nl> CRenderCaptureGL : : CRenderCaptureGL ( ) <nl> { <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / RenderCapture . h <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / RenderCapture . h <nl> class CRenderCaptureBase <nl> bool m_asyncChecked ; <nl> } ; <nl> <nl> - # if defined ( TARGET_RASPBERRY_PI ) <nl> - # include " platform / linux / RBP . h " <nl> - <nl> - class CRenderCaptureDispmanX : public CRenderCaptureBase <nl> - { <nl> - public : <nl> - CRenderCaptureDispmanX ( ) ; <nl> - ~ CRenderCaptureDispmanX ( ) ; <nl> - <nl> - int GetCaptureFormat ( ) ; <nl> - <nl> - void BeginRender ( ) ; <nl> - void EndRender ( ) ; <nl> - void ReadOut ( ) ; <nl> - <nl> - void * GetRenderBuffer ( ) ; <nl> - } ; <nl> - <nl> - / / used instead of typedef CRenderCaptureGL CRenderCapture <nl> - / / since C + + doesn ' t allow you to forward declare a typedef <nl> - class CRenderCapture : public CRenderCaptureDispmanX <nl> - { <nl> - public : <nl> - CRenderCapture ( ) { } ; <nl> - } ; <nl> - <nl> - # elif defined ( HAS_GL ) | | defined ( HAS_GLES ) <nl> + # if defined ( HAS_GL ) | | defined ( HAS_GLES ) <nl> # include " system_gl . h " <nl> <nl> class CRenderCaptureGL : public CRenderCaptureBase <nl> mmm a / xbmc / cores / VideoPlayer / VideoRenderers / RenderManager . h <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / RenderManager . h <nl> class CRenderCapture ; <nl> struct VideoPicture ; <nl> <nl> class CWinRenderer ; <nl> - class CMMALRenderer ; <nl> class CLinuxRenderer ; <nl> class CLinuxRendererGL ; <nl> class CLinuxRendererGLES ; <nl> mmm a / xbmc / cores / VideoSettings . h <nl> ppp b / xbmc / cores / VideoSettings . h <nl> enum EINTERLACEMETHOD <nl> VS_INTERLACEMETHOD_VAAPI_BOB = 22 , <nl> VS_INTERLACEMETHOD_VAAPI_MADI = 23 , <nl> VS_INTERLACEMETHOD_VAAPI_MACI = 24 , <nl> - VS_INTERLACEMETHOD_MMAL_ADVANCED = 25 , <nl> - VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF = 26 , <nl> - VS_INTERLACEMETHOD_MMAL_BOB = 27 , <nl> - VS_INTERLACEMETHOD_MMAL_BOB_HALF = 28 , <nl> VS_INTERLACEMETHOD_DXVA_AUTO = 32 , <nl> VS_INTERLACEMETHOD_MAX / / do not use and keep as last enum value . <nl> } ; <nl> deleted file mode 100644 <nl> index 038274bf719e . . 000000000000 <nl> mmm a / xbmc / cores / omxplayer / CMakeLists . txt <nl> ppp / dev / null <nl> <nl> - set ( SOURCES OMXImage . cpp ) <nl> - <nl> - set ( HEADERS OMXImage . h ) <nl> - <nl> - core_add_library ( omxplayer ) <nl> - target_compile_definitions ( $ { CORE_LIBRARY } PRIVATE - D__STDC_FORMAT_MACROS ) <nl> deleted file mode 100644 <nl> index 1c1a258236f4 . . 000000000000 <nl> mmm a / xbmc / cores / omxplayer / OMXImage . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2010 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # include " OMXImage . h " <nl> - <nl> - # include " Application . h " <nl> - # include " ServiceBroker . h " <nl> - # include " URL . h " <nl> - # include " settings / AdvancedSettings . h " <nl> - # include " settings / DisplaySettings . h " <nl> - # include " settings / Settings . h " <nl> - # include " settings / SettingsComponent . h " <nl> - # include " utils / URIUtils . h " <nl> - # include " utils / log . h " <nl> - # include " windowing / GraphicContext . h " <nl> - # include " windowing / WinSystem . h " <nl> - # include " windowing / rpi / WinSystemRpiGLESContext . h " <nl> - <nl> - # include " platform / linux / RBP . h " <nl> - <nl> - # include < algorithm > <nl> - # include < cassert > <nl> - # include < inttypes . h > <nl> - <nl> - # include < sys / time . h > <nl> - <nl> - # ifdef _DEBUG <nl> - # define CheckError ( ) { GLint result = eglGetError ( ) ; if ( result ! = EGL_SUCCESS ) CLog : : Log ( LOGERROR , " EGL error in % s : % x " , __FUNCTION__ , result ) ; } <nl> - # else <nl> - # define CheckError ( ) <nl> - # endif <nl> - <nl> - # define EXIF_TAG_ORIENTATION 0x0112 <nl> - <nl> - <nl> - / / A helper for restricting threads calling GPU functions to limit memory use <nl> - / / Experimentally , 3 outstanding operations is optimal <nl> - static XbmcThreads : : ConditionVariable g_count_cond ; <nl> - static CCriticalSection g_count_lock ; <nl> - static int g_count_val ; <nl> - <nl> - static void limit_calls_enter ( ) <nl> - { <nl> - CSingleLock lock ( g_count_lock ) ; <nl> - while ( g_count_val > = 3 ) <nl> - g_count_cond . wait ( lock ) ; <nl> - g_count_val + + ; <nl> - } <nl> - <nl> - static void limit_calls_leave ( ) <nl> - { <nl> - CSingleLock lock ( g_count_lock ) ; <nl> - g_count_val - - ; <nl> - g_count_cond . notifyAll ( ) ; <nl> - } <nl> - <nl> - <nl> - # ifdef CLASSNAME <nl> - # undef CLASSNAME <nl> - # endif <nl> - # define CLASSNAME " COMXImage " <nl> - <nl> - using namespace XFILE ; <nl> - <nl> - COMXImage : : COMXImage ( ) <nl> - : CThread ( " CRBPWorker " ) <nl> - { <nl> - m_egl_context = EGL_NO_CONTEXT ; <nl> - } <nl> - <nl> - COMXImage : : ~ COMXImage ( ) <nl> - { <nl> - Deinitialize ( ) ; <nl> - } <nl> - <nl> - void COMXImage : : Initialize ( ) <nl> - { <nl> - Create ( ) ; <nl> - } <nl> - <nl> - void COMXImage : : Deinitialize ( ) <nl> - { <nl> - / / wake up thread so it can quit <nl> - { <nl> - CSingleLock lock ( m_texqueue_lock ) ; <nl> - m_bStop = true ; <nl> - m_texqueue_cond . notifyAll ( ) ; <nl> - } <nl> - if ( IsRunning ( ) ) <nl> - StopThread ( ) ; <nl> - } <nl> - <nl> - bool COMXImage : : CreateThumbnailFromSurface ( unsigned char * buffer , unsigned int width , unsigned int height , <nl> - unsigned int format , unsigned int pitch , const std : : string & destFile ) <nl> - { <nl> - COMXImageEnc omxImageEnc ; <nl> - bool ret = omxImageEnc . CreateThumbnailFromSurface ( buffer , width , height , format , pitch , destFile ) ; <nl> - if ( ! ret ) <nl> - CLog : : Log ( LOGINFO , " % s : unable to create thumbnail % s % dx % d " , __func__ , destFile . c_str ( ) , width , <nl> - height ) ; <nl> - return ret ; <nl> - } <nl> - <nl> - COMXImageFile * COMXImage : : LoadJpeg ( const std : : string & texturePath ) <nl> - { <nl> - COMXImageFile * file = new COMXImageFile ( ) ; <nl> - if ( ! file - > ReadFile ( texturePath ) ) <nl> - { <nl> - CLog : : Log ( LOGINFO , " % s : unable to load % s " , __func__ , CURL : : GetRedacted ( texturePath ) . c_str ( ) ) ; <nl> - delete file ; <nl> - file = NULL ; <nl> - } <nl> - return file ; <nl> - } <nl> - <nl> - void COMXImage : : CloseJpeg ( COMXImageFile * file ) <nl> - { <nl> - delete file ; <nl> - } <nl> - <nl> - bool COMXImage : : DecodeJpeg ( COMXImageFile * file , unsigned int width , unsigned int height , unsigned int stride , void * pixels ) <nl> - { <nl> - bool ret = false ; <nl> - COMXImageDec omx_image ; <nl> - if ( omx_image . Decode ( file - > GetImageBuffer ( ) , file - > GetImageSize ( ) , width , height , stride , pixels ) ) <nl> - { <nl> - assert ( width = = omx_image . GetDecodedWidth ( ) ) ; <nl> - assert ( height = = omx_image . GetDecodedHeight ( ) ) ; <nl> - assert ( stride = = omx_image . GetDecodedStride ( ) ) ; <nl> - ret = true ; <nl> - } <nl> - else <nl> - CLog : : Log ( LOGINFO , " % s : unable to decode % s % dx % d " , __func__ , file - > GetFilename ( ) , width , <nl> - height ) ; <nl> - omx_image . Close ( ) ; <nl> - return ret ; <nl> - } <nl> - <nl> - bool COMXImage : : ClampLimits ( unsigned int & width , unsigned int & height , unsigned int m_width , unsigned int m_height , bool transposed ) <nl> - { <nl> - RESOLUTION_INFO & res_info = CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) . GetVideoResolution ( ) ) ; <nl> - unsigned int max_width = width ; <nl> - unsigned int max_height = height ; <nl> - const unsigned int gui_width = transposed ? res_info . iHeight : res_info . iWidth ; <nl> - const unsigned int gui_height = transposed ? res_info . iWidth : res_info . iHeight ; <nl> - const float aspect = ( float ) m_width / m_height ; <nl> - bool clamped = false ; <nl> - <nl> - if ( max_width = = 0 | | max_height = = 0 ) <nl> - { <nl> - const std : : shared_ptr < CAdvancedSettings > advancedSettings = CServiceBroker : : GetSettingsComponent ( ) - > GetAdvancedSettings ( ) ; <nl> - <nl> - max_height = advancedSettings - > m_imageRes ; <nl> - <nl> - if ( advancedSettings - > m_fanartRes > advancedSettings - > m_imageRes ) <nl> - { / / 16x9 images larger than the fanart res use that rather than the image res <nl> - if ( fabsf ( aspect / ( 16 . 0f / 9 . 0f ) - 1 . 0f ) < = 0 . 01f & & m_height > = advancedSettings - > m_fanartRes ) <nl> - { <nl> - max_height = advancedSettings - > m_fanartRes ; <nl> - } <nl> - } <nl> - max_width = max_height * 16 / 9 ; <nl> - } <nl> - <nl> - if ( gui_width ) <nl> - max_width = std : : min ( max_width , gui_width ) ; <nl> - if ( gui_height ) <nl> - max_height = std : : min ( max_height , gui_height ) ; <nl> - <nl> - max_width = std : : min ( max_width , 2048U ) ; <nl> - max_height = std : : min ( max_height , 2048U ) ; <nl> - <nl> - width = m_width ; <nl> - height = m_height ; <nl> - if ( width > max_width | | height > max_height ) <nl> - { <nl> - if ( ( unsigned int ) ( max_width / aspect + 0 . 5f ) > max_height ) <nl> - max_width = ( unsigned int ) ( max_height * aspect + 0 . 5f ) ; <nl> - else <nl> - max_height = ( unsigned int ) ( max_width / aspect + 0 . 5f ) ; <nl> - width = max_width ; <nl> - height = max_height ; <nl> - clamped = true ; <nl> - } <nl> - <nl> - return clamped ; <nl> - } <nl> - <nl> - bool COMXImage : : CreateThumb ( const std : : string & srcFile , unsigned int maxHeight , unsigned int maxWidth , std : : string & additional_info , const std : : string & destFile ) <nl> - { <nl> - bool okay = false ; <nl> - COMXImageFile file ; <nl> - COMXImageReEnc reenc ; <nl> - void * pDestBuffer ; <nl> - unsigned int nDestSize ; <nl> - int orientation = additional_info = = " flipped " ? 1 : 0 ; <nl> - if ( URIUtils : : HasExtension ( srcFile , " . jpg | . tbn " ) & & file . ReadFile ( srcFile , orientation ) & & reenc . ReEncode ( file , maxWidth , maxHeight , pDestBuffer , nDestSize ) ) <nl> - { <nl> - XFILE : : CFile outfile ; <nl> - if ( outfile . OpenForWrite ( destFile , true ) ) <nl> - { <nl> - outfile . Write ( pDestBuffer , nDestSize ) ; <nl> - outfile . Close ( ) ; <nl> - okay = true ; <nl> - } <nl> - else <nl> - CLog : : Log ( LOGERROR , " % s : can ' t open output file : % s " , __func__ , destFile . c_str ( ) ) ; <nl> - } <nl> - return okay ; <nl> - } <nl> - <nl> - bool COMXImage : : SendMessage ( bool ( * callback ) ( EGLDisplay egl_display , EGLContext egl_context , void * cookie ) , void * cookie ) <nl> - { <nl> - / / we can only call gl functions from the application thread or texture thread <nl> - if ( g_application . IsCurrentThread ( ) ) <nl> - { <nl> - CWinSystemRpiGLESContext * winsystem = static_cast < CWinSystemRpiGLESContext * > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> - return callback ( winsystem - > GetEGLDisplay ( ) , GetEGLContext ( ) , cookie ) ; <nl> - } <nl> - struct callbackinfo mess ; <nl> - mess . callback = callback ; <nl> - mess . cookie = cookie ; <nl> - mess . result = false ; <nl> - mess . sync . Reset ( ) ; <nl> - { <nl> - CSingleLock lock ( m_texqueue_lock ) ; <nl> - m_texqueue . push ( & mess ) ; <nl> - m_texqueue_cond . notifyAll ( ) ; <nl> - } <nl> - / / wait for function to have finished ( in texture thread ) <nl> - mess . sync . Wait ( ) ; <nl> - / / need to ensure texture thread has returned from mess . sync . Set ( ) before we exit and free tex <nl> - CSingleLock lock ( m_texqueue_lock ) ; <nl> - return mess . result ; <nl> - } <nl> - <nl> - <nl> - static bool AllocTextureCallback ( EGLDisplay egl_display , EGLContext egl_context , void * cookie ) <nl> - { <nl> - struct COMXImage : : textureinfo * tex = static_cast < struct COMXImage : : textureinfo * > ( cookie ) ; <nl> - COMXImage * img = static_cast < COMXImage * > ( tex - > parent ) ; <nl> - return img - > AllocTextureInternal ( egl_display , egl_context , tex ) ; <nl> - } <nl> - <nl> - bool COMXImage : : AllocTextureInternal ( EGLDisplay egl_display , EGLContext egl_context , struct textureinfo * tex ) <nl> - { <nl> - glGenTextures ( 1 , ( GLuint * ) & tex - > texture ) ; <nl> - glBindTexture ( GL_TEXTURE_2D , tex - > texture ) ; <nl> - glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER , GL_LINEAR ) ; <nl> - glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MAG_FILTER , GL_LINEAR ) ; <nl> - glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_WRAP_S , GL_CLAMP_TO_EDGE ) ; <nl> - glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_WRAP_T , GL_CLAMP_TO_EDGE ) ; <nl> - GLenum type = CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) - > GetBool ( " videoscreen . textures32 " ) ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT_5_6_5 ; <nl> - glTexImage2D ( GL_TEXTURE_2D , 0 , GL_RGB , tex - > width , tex - > height , 0 , GL_RGB , type , 0 ) ; <nl> - tex - > egl_image = eglCreateImageKHR ( egl_display , egl_context , EGL_GL_TEXTURE_2D_KHR , ( EGLClientBuffer ) tex - > texture , NULL ) ; <nl> - if ( ! tex - > egl_image ) <nl> - CLog : : Log ( LOGDEBUG , " % s : eglCreateImageKHR failed to allocate " , __func__ ) ; <nl> - CheckError ( ) ; <nl> - return true ; <nl> - } <nl> - <nl> - void COMXImage : : GetTexture ( void * userdata , GLuint * texture ) <nl> - { <nl> - struct textureinfo * tex = static_cast < struct textureinfo * > ( userdata ) ; <nl> - * texture = tex - > texture ; <nl> - } <nl> - <nl> - static bool DestroyTextureCallback ( EGLDisplay egl_display , EGLContext egl_context , void * cookie ) <nl> - { <nl> - struct COMXImage : : textureinfo * tex = static_cast < struct COMXImage : : textureinfo * > ( cookie ) ; <nl> - COMXImage * img = static_cast < COMXImage * > ( tex - > parent ) ; <nl> - return img - > DestroyTextureInternal ( egl_display , egl_context , tex ) ; <nl> - } <nl> - <nl> - void COMXImage : : DestroyTexture ( void * userdata ) <nl> - { <nl> - SendMessage ( DestroyTextureCallback , userdata ) ; <nl> - } <nl> - <nl> - bool COMXImage : : DestroyTextureInternal ( EGLDisplay egl_display , EGLContext egl_context , struct textureinfo * tex ) <nl> - { <nl> - bool s = true ; <nl> - if ( tex - > egl_image ) <nl> - { <nl> - s = eglDestroyImageKHR ( egl_display , tex - > egl_image ) ; <nl> - if ( ! s ) <nl> - CLog : : Log ( LOGINFO , " % s : failed to destroy texture " , __func__ ) ; <nl> - } <nl> - if ( tex - > texture ) <nl> - glDeleteTextures ( 1 , ( GLuint * ) & tex - > texture ) ; <nl> - return s ; <nl> - } <nl> - <nl> - bool COMXImage : : DecodeJpegToTexture ( COMXImageFile * file , unsigned int width , unsigned int height , void * * userdata ) <nl> - { <nl> - bool ret = false ; <nl> - COMXTexture omx_image ; <nl> - <nl> - struct textureinfo * tex = new struct textureinfo ; <nl> - if ( ! tex ) <nl> - return NULL ; <nl> - <nl> - tex - > parent = ( void * ) this ; <nl> - tex - > width = width ; <nl> - tex - > height = height ; <nl> - tex - > texture = 0 ; <nl> - tex - > egl_image = NULL ; <nl> - <nl> - SendMessage ( AllocTextureCallback , tex ) ; <nl> - <nl> - if ( tex - > egl_image & & tex - > texture & & omx_image . Decode ( file - > GetImageBuffer ( ) , file - > GetImageSize ( ) , width , height , tex - > egl_image ) ) <nl> - { <nl> - ret = true ; <nl> - * userdata = tex ; <nl> - CLog : : Log ( LOGDEBUG , " % s : decoded % s % dx % d " , __func__ , file - > GetFilename ( ) , width , height ) ; <nl> - } <nl> - else <nl> - { <nl> - CLog : : Log ( LOGINFO , " % s : unable to decode to texture % s % dx % d " , __func__ , file - > GetFilename ( ) , <nl> - width , height ) ; <nl> - DestroyTexture ( tex ) ; <nl> - } <nl> - return ret ; <nl> - } <nl> - <nl> - EGLContext COMXImage : : GetEGLContext ( ) <nl> - { <nl> - CSingleLock lock ( m_texqueue_lock ) ; <nl> - CWinSystemRpiGLESContext * winsystem = static_cast < CWinSystemRpiGLESContext * > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> - if ( g_application . IsCurrentThread ( ) ) <nl> - return winsystem - > GetEGLContext ( ) ; <nl> - if ( m_egl_context = = EGL_NO_CONTEXT ) <nl> - CreateContext ( ) ; <nl> - return m_egl_context ; <nl> - } <nl> - <nl> - static bool ChooseConfig ( EGLDisplay display , const EGLint * configAttrs , EGLConfig * config ) <nl> - { <nl> - EGLBoolean eglStatus = true ; <nl> - EGLint configCount = 0 ; <nl> - EGLConfig * configList = NULL ; <nl> - / / Find out how many configurations suit our needs <nl> - eglStatus = eglChooseConfig ( display , configAttrs , NULL , 0 , & configCount ) ; <nl> - CheckError ( ) ; <nl> - <nl> - if ( ! eglStatus | | ! configCount ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " EGL failed to return any matching configurations : % i " , configCount ) ; <nl> - return false ; <nl> - } <nl> - <nl> - / / Allocate room for the list of matching configurations <nl> - configList = ( EGLConfig * ) malloc ( configCount * sizeof ( EGLConfig ) ) ; <nl> - if ( ! configList ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " EGL failure obtaining configuration list " ) ; <nl> - return false ; <nl> - } <nl> - <nl> - / / Obtain the configuration list from EGL <nl> - eglStatus = eglChooseConfig ( display , configAttrs , configList , configCount , & configCount ) ; <nl> - CheckError ( ) ; <nl> - if ( ! eglStatus | | ! configCount ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " EGL failed to populate configuration list : % d " , eglStatus ) ; <nl> - return false ; <nl> - } <nl> - <nl> - / / Select an EGL configuration that matches the native window <nl> - * config = configList [ 0 ] ; <nl> - <nl> - free ( configList ) ; <nl> - return true ; <nl> - } <nl> - <nl> - void COMXImage : : CreateContext ( ) <nl> - { <nl> - EGLConfig egl_config ; <nl> - CWinSystemRpiGLESContext * winsystem = static_cast < CWinSystemRpiGLESContext * > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> - EGLDisplay egl_display = winsystem - > GetEGLDisplay ( ) ; <nl> - <nl> - eglInitialize ( egl_display , NULL , NULL ) ; <nl> - CheckError ( ) ; <nl> - eglBindAPI ( EGL_OPENGL_ES_API ) ; <nl> - CheckError ( ) ; <nl> - static const EGLint contextAttrs [ ] = { EGL_CONTEXT_CLIENT_VERSION , 2 , EGL_NONE } ; <nl> - static const EGLint configAttrs [ ] = { <nl> - EGL_RED_SIZE , 8 , <nl> - EGL_GREEN_SIZE , 8 , <nl> - EGL_BLUE_SIZE , 8 , <nl> - EGL_ALPHA_SIZE , 8 , <nl> - EGL_DEPTH_SIZE , 16 , <nl> - EGL_STENCIL_SIZE , 0 , <nl> - EGL_SAMPLE_BUFFERS , 0 , <nl> - EGL_SAMPLES , 0 , <nl> - EGL_SURFACE_TYPE , EGL_WINDOW_BIT , <nl> - EGL_RENDERABLE_TYPE , EGL_OPENGL_ES2_BIT , <nl> - EGL_NONE <nl> - } ; <nl> - bool s = ChooseConfig ( egl_display , configAttrs , & egl_config ) ; <nl> - CheckError ( ) ; <nl> - if ( ! s ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : Could not find a compatible configuration " , __FUNCTION__ ) ; <nl> - return ; <nl> - } <nl> - m_egl_context = eglCreateContext ( egl_display , egl_config , winsystem - > GetEGLContext ( ) , contextAttrs ) ; <nl> - CheckError ( ) ; <nl> - if ( m_egl_context = = EGL_NO_CONTEXT ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : Could not create a context " , __FUNCTION__ ) ; <nl> - return ; <nl> - } <nl> - EGLSurface egl_surface = eglCreatePbufferSurface ( egl_display , egl_config , NULL ) ; <nl> - CheckError ( ) ; <nl> - if ( egl_surface = = EGL_NO_SURFACE ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : Could not create a surface " , __FUNCTION__ ) ; <nl> - return ; <nl> - } <nl> - s = eglMakeCurrent ( egl_display , egl_surface , egl_surface , m_egl_context ) ; <nl> - CheckError ( ) ; <nl> - if ( ! s ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : Could not make current " , __FUNCTION__ ) ; <nl> - return ; <nl> - } <nl> - } <nl> - <nl> - void COMXImage : : Process ( ) <nl> - { <nl> - while ( ! m_bStop ) <nl> - { <nl> - CSingleLock lock ( m_texqueue_lock ) ; <nl> - if ( m_texqueue . empty ( ) ) <nl> - { <nl> - m_texqueue_cond . wait ( lock ) ; <nl> - } <nl> - else <nl> - { <nl> - struct callbackinfo * mess = m_texqueue . front ( ) ; <nl> - m_texqueue . pop ( ) ; <nl> - lock . Leave ( ) ; <nl> - <nl> - CWinSystemRpiGLESContext * winsystem = static_cast < CWinSystemRpiGLESContext * > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> - mess - > result = mess - > callback ( winsystem - > GetEGLDisplay ( ) , GetEGLContext ( ) , mess - > cookie ) ; <nl> - { <nl> - CSingleLock lock ( m_texqueue_lock ) ; <nl> - mess - > sync . Set ( ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - void COMXImage : : OnStartup ( ) <nl> - { <nl> - } <nl> - <nl> - void COMXImage : : OnExit ( ) <nl> - { <nl> - } <nl> - <nl> - # ifdef CLASSNAME <nl> - # undef CLASSNAME <nl> - # endif <nl> - # define CLASSNAME " COMXImageFile " <nl> - <nl> - COMXImageFile : : COMXImageFile ( ) <nl> - { <nl> - m_image_size = 0 ; <nl> - m_image_buffer = NULL ; <nl> - m_orientation = 0 ; <nl> - m_width = 0 ; <nl> - m_height = 0 ; <nl> - } <nl> - <nl> - COMXImageFile : : ~ COMXImageFile ( ) <nl> - { <nl> - if ( m_image_buffer ) <nl> - free ( m_image_buffer ) ; <nl> - } <nl> - <nl> - typedef enum { / * JPEG marker codes * / <nl> - M_SOF0 = 0xc0 , <nl> - M_SOF1 = 0xc1 , <nl> - M_SOF2 = 0xc2 , <nl> - M_SOF3 = 0xc3 , <nl> - M_SOF5 = 0xc5 , <nl> - M_SOF6 = 0xc6 , <nl> - M_SOF7 = 0xc7 , <nl> - M_JPG = 0xc8 , <nl> - M_SOF9 = 0xc9 , <nl> - M_SOF10 = 0xca , <nl> - M_SOF11 = 0xcb , <nl> - M_SOF13 = 0xcd , <nl> - M_SOF14 = 0xce , <nl> - M_SOF15 = 0xcf , <nl> - <nl> - M_DHT = 0xc4 , <nl> - M_DAC = 0xcc , <nl> - <nl> - M_RST0 = 0xd0 , <nl> - M_RST1 = 0xd1 , <nl> - M_RST2 = 0xd2 , <nl> - M_RST3 = 0xd3 , <nl> - M_RST4 = 0xd4 , <nl> - M_RST5 = 0xd5 , <nl> - M_RST6 = 0xd6 , <nl> - M_RST7 = 0xd7 , <nl> - <nl> - M_SOI = 0xd8 , <nl> - M_EOI = 0xd9 , <nl> - M_SOS = 0xda , <nl> - M_DQT = 0xdb , <nl> - M_DNL = 0xdc , <nl> - M_DRI = 0xdd , <nl> - M_DHP = 0xde , <nl> - M_EXP = 0xdf , <nl> - <nl> - M_APP0 = 0xe0 , <nl> - M_APP1 = 0xe1 , <nl> - M_APP2 = 0xe2 , <nl> - M_APP3 = 0xe3 , <nl> - M_APP4 = 0xe4 , <nl> - M_APP5 = 0xe5 , <nl> - M_APP6 = 0xe6 , <nl> - M_APP7 = 0xe7 , <nl> - M_APP8 = 0xe8 , <nl> - M_APP9 = 0xe9 , <nl> - M_APP10 = 0xea , <nl> - M_APP11 = 0xeb , <nl> - M_APP12 = 0xec , <nl> - M_APP13 = 0xed , <nl> - M_APP14 = 0xee , <nl> - M_APP15 = 0xef , <nl> - / / extensions <nl> - M_JPG0 = 0xf0 , <nl> - M_JPG1 = 0xf1 , <nl> - M_JPG2 = 0xf2 , <nl> - M_JPG3 = 0xf3 , <nl> - M_JPG4 = 0xf4 , <nl> - M_JPG5 = 0xf5 , <nl> - M_JPG6 = 0xf6 , <nl> - M_JPG7 = 0xf7 , <nl> - M_JPG8 = 0xf8 , <nl> - M_JPG9 = 0xf9 , <nl> - M_JPG10 = 0xfa , <nl> - M_JPG11 = 0xfb , <nl> - M_JPG12 = 0xfc , <nl> - M_JPG13 = 0xfd , <nl> - M_JPG14 = 0xfe , <nl> - M_COM = 0xff , <nl> - <nl> - M_TEM = 0x01 , <nl> - } JPEG_MARKER ; <nl> - <nl> - static uint8_t inline READ8 ( uint8_t * & p ) <nl> - { <nl> - uint8_t r = p [ 0 ] ; <nl> - p + = 1 ; <nl> - return r ; <nl> - } <nl> - <nl> - static uint16_t inline READ16 ( uint8_t * & p ) <nl> - { <nl> - uint16_t r = ( p [ 0 ] < < 8 ) | p [ 1 ] ; <nl> - p + = 2 ; <nl> - return r ; <nl> - } <nl> - <nl> - static uint32_t inline READ32 ( uint8_t * & p ) <nl> - { <nl> - uint32_t r = ( p [ 0 ] < < 24 ) | ( p [ 1 ] < < 16 ) | ( p [ 2 ] < < 8 ) | p [ 3 ] ; <nl> - p + = 4 ; <nl> - return r ; <nl> - } <nl> - <nl> - static void inline SKIPN ( uint8_t * & p , unsigned int n ) <nl> - { <nl> - p + = n ; <nl> - } <nl> - <nl> - OMX_IMAGE_CODINGTYPE COMXImageFile : : GetCodingType ( unsigned int & width , unsigned int & height , int orientation ) <nl> - { <nl> - OMX_IMAGE_CODINGTYPE eCompressionFormat = OMX_IMAGE_CodingMax ; <nl> - bool progressive = false ; <nl> - int components = 0 ; <nl> - m_orientation = 0 ; <nl> - <nl> - if ( ! m_image_size ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s m_image_size unexpected ( % lu ) " , CLASSNAME , __func__ , <nl> - GetFilename ( ) , m_image_size ) ; <nl> - return OMX_IMAGE_CodingMax ; <nl> - } <nl> - <nl> - uint8_t * p = m_image_buffer ; <nl> - uint8_t * q = m_image_buffer + m_image_size ; <nl> - <nl> - / * JPEG Header * / <nl> - if ( READ16 ( p ) = = 0xFFD8 ) <nl> - { <nl> - eCompressionFormat = OMX_IMAGE_CodingJPEG ; <nl> - <nl> - READ8 ( p ) ; <nl> - unsigned char marker = READ8 ( p ) ; <nl> - unsigned short block_size = 0 ; <nl> - bool nMarker = false ; <nl> - <nl> - while ( p < q & & ! progressive ) <nl> - { <nl> - switch ( marker ) <nl> - { <nl> - case M_DQT : <nl> - case M_DNL : <nl> - case M_DHP : <nl> - case M_EXP : <nl> - <nl> - case M_DHT : <nl> - <nl> - case M_SOF0 : <nl> - case M_SOF1 : <nl> - case M_SOF2 : <nl> - case M_SOF3 : <nl> - <nl> - case M_SOF5 : <nl> - case M_SOF6 : <nl> - case M_SOF7 : <nl> - <nl> - case M_JPG : <nl> - case M_SOF9 : <nl> - case M_SOF10 : <nl> - case M_SOF11 : <nl> - <nl> - case M_SOF13 : <nl> - case M_SOF14 : <nl> - case M_SOF15 : <nl> - <nl> - case M_APP0 : <nl> - case M_APP1 : <nl> - case M_APP2 : <nl> - case M_APP3 : <nl> - case M_APP4 : <nl> - case M_APP5 : <nl> - case M_APP6 : <nl> - case M_APP7 : <nl> - case M_APP8 : <nl> - case M_APP9 : <nl> - case M_APP10 : <nl> - case M_APP11 : <nl> - case M_APP12 : <nl> - case M_APP13 : <nl> - case M_APP14 : <nl> - case M_APP15 : <nl> - <nl> - case M_JPG0 : <nl> - case M_JPG1 : <nl> - case M_JPG2 : <nl> - case M_JPG3 : <nl> - case M_JPG4 : <nl> - case M_JPG5 : <nl> - case M_JPG6 : <nl> - case M_JPG7 : <nl> - case M_JPG8 : <nl> - case M_JPG9 : <nl> - case M_JPG10 : <nl> - case M_JPG11 : <nl> - case M_JPG12 : <nl> - case M_JPG13 : <nl> - case M_JPG14 : <nl> - case M_COM : <nl> - block_size = READ16 ( p ) ; <nl> - nMarker = true ; <nl> - break ; <nl> - <nl> - case M_SOS : <nl> - default : <nl> - nMarker = false ; <nl> - break ; <nl> - } <nl> - <nl> - if ( ! nMarker ) <nl> - { <nl> - break ; <nl> - } <nl> - <nl> - if ( marker > = M_SOF0 & & marker < = M_SOF15 & & marker ! = M_DHT & & marker ! = M_DAC ) <nl> - { <nl> - if ( marker = = M_SOF2 | | marker = = M_SOF6 | | marker = = M_SOF10 | | marker = = M_SOF14 ) <nl> - { <nl> - progressive = true ; <nl> - } <nl> - int readBits = 2 ; <nl> - SKIPN ( p , 1 ) ; <nl> - readBits + + ; <nl> - height = READ16 ( p ) ; <nl> - readBits + = 2 ; <nl> - width = READ16 ( p ) ; <nl> - readBits + = 2 ; <nl> - components = READ8 ( p ) ; <nl> - readBits + = 1 ; <nl> - SKIPN ( p , 1 * ( block_size - readBits ) ) ; <nl> - } <nl> - else if ( marker = = M_APP1 ) <nl> - { <nl> - int readBits = 2 ; <nl> - <nl> - / / Exif header <nl> - if ( READ32 ( p ) = = 0x45786966 ) <nl> - { <nl> - bool bMotorola = false ; <nl> - bool bError = false ; <nl> - SKIPN ( p , 1 * 2 ) ; <nl> - readBits + = 2 ; <nl> - <nl> - char o1 = READ8 ( p ) ; <nl> - char o2 = READ8 ( p ) ; <nl> - readBits + = 2 ; <nl> - <nl> - / * Discover byte order * / <nl> - if ( o1 = = ' M ' & & o2 = = ' M ' ) <nl> - bMotorola = true ; <nl> - else if ( o1 = = ' I ' & & o2 = = ' I ' ) <nl> - bMotorola = false ; <nl> - else <nl> - bError = true ; <nl> - <nl> - SKIPN ( p , 1 * 2 ) ; <nl> - readBits + = 2 ; <nl> - <nl> - if ( ! bError ) <nl> - { <nl> - unsigned int offset , a , b , numberOfTags , tagNumber ; <nl> - <nl> - / / Get first IFD offset ( offset to IFD0 ) <nl> - if ( bMotorola ) <nl> - { <nl> - SKIPN ( p , 1 * 2 ) ; <nl> - readBits + = 2 ; <nl> - <nl> - a = READ8 ( p ) ; <nl> - b = READ8 ( p ) ; <nl> - readBits + = 2 ; <nl> - offset = ( a < < 8 ) + b ; <nl> - } <nl> - else <nl> - { <nl> - a = READ8 ( p ) ; <nl> - b = READ8 ( p ) ; <nl> - readBits + = 2 ; <nl> - offset = ( b < < 8 ) + a ; <nl> - <nl> - SKIPN ( p , 1 * 2 ) ; <nl> - readBits + = 2 ; <nl> - } <nl> - <nl> - offset - = 8 ; <nl> - if ( offset > 0 ) <nl> - { <nl> - SKIPN ( p , 1 * offset ) ; <nl> - readBits + = offset ; <nl> - } <nl> - <nl> - / / Get the number of directory entries contained in this IFD <nl> - if ( bMotorola ) <nl> - { <nl> - a = READ8 ( p ) ; <nl> - b = READ8 ( p ) ; <nl> - numberOfTags = ( a < < 8 ) + b ; <nl> - } <nl> - else <nl> - { <nl> - a = READ8 ( p ) ; <nl> - b = READ8 ( p ) ; <nl> - numberOfTags = ( b < < 8 ) + a ; <nl> - } <nl> - readBits + = 2 ; <nl> - <nl> - while ( numberOfTags & & p < q ) <nl> - { <nl> - / / Get Tag number <nl> - if ( bMotorola ) <nl> - { <nl> - a = READ8 ( p ) ; <nl> - b = READ8 ( p ) ; <nl> - tagNumber = ( a < < 8 ) + b ; <nl> - readBits + = 2 ; <nl> - } <nl> - else <nl> - { <nl> - a = READ8 ( p ) ; <nl> - b = READ8 ( p ) ; <nl> - tagNumber = ( b < < 8 ) + a ; <nl> - readBits + = 2 ; <nl> - } <nl> - <nl> - / / found orientation tag <nl> - if ( tagNumber = = EXIF_TAG_ORIENTATION ) <nl> - { <nl> - if ( bMotorola ) <nl> - { <nl> - SKIPN ( p , 1 * 7 ) ; <nl> - readBits + = 7 ; <nl> - m_orientation = READ8 ( p ) - 1 ; <nl> - readBits + = 1 ; <nl> - SKIPN ( p , 1 * 2 ) ; <nl> - readBits + = 2 ; <nl> - } <nl> - else <nl> - { <nl> - SKIPN ( p , 1 * 6 ) ; <nl> - readBits + = 6 ; <nl> - m_orientation = READ8 ( p ) - 1 ; <nl> - readBits + = 1 ; <nl> - SKIPN ( p , 1 * 3 ) ; <nl> - readBits + = 3 ; <nl> - } <nl> - break ; <nl> - } <nl> - else <nl> - { <nl> - SKIPN ( p , 1 * 10 ) ; <nl> - readBits + = 10 ; <nl> - } <nl> - numberOfTags - - ; <nl> - } <nl> - } <nl> - } <nl> - readBits + = 4 ; <nl> - SKIPN ( p , 1 * ( block_size - readBits ) ) ; <nl> - } <nl> - else <nl> - { <nl> - SKIPN ( p , 1 * ( block_size - 2 ) ) ; <nl> - } <nl> - <nl> - READ8 ( p ) ; <nl> - marker = READ8 ( p ) ; <nl> - <nl> - } <nl> - } <nl> - else <nl> - CLog : : Log ( LOGERROR , " % s : : % s error unsupported image format " , CLASSNAME , __func__ ) ; <nl> - <nl> - / / apply input orientation <nl> - m_orientation = m_orientation ^ orientation ; <nl> - if ( m_orientation < 0 | | m_orientation > = 8 ) <nl> - m_orientation = 0 ; <nl> - <nl> - if ( progressive ) <nl> - { <nl> - CLog : : Log ( LOGWARNING , " % s : : % s progressive images not supported by decoder " , CLASSNAME , <nl> - __func__ ) ; <nl> - eCompressionFormat = OMX_IMAGE_CodingMax ; <nl> - } <nl> - <nl> - if ( components > 3 ) <nl> - { <nl> - CLog : : Log ( LOGWARNING , " % s : : % s Only YUV images are supported by decoder " , CLASSNAME , __func__ ) ; <nl> - eCompressionFormat = OMX_IMAGE_CodingMax ; <nl> - } <nl> - <nl> - return eCompressionFormat ; <nl> - } <nl> - <nl> - <nl> - bool COMXImageFile : : ReadFile ( const std : : string & inputFile , int orientation ) <nl> - { <nl> - XFILE : : CFile m_pFile ; <nl> - m_filename = CURL : : GetRedacted ( inputFile ) ; <nl> - if ( ! m_pFile . Open ( inputFile , 0 ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s not found " , CLASSNAME , __func__ , GetFilename ( ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( m_image_buffer ) <nl> - free ( m_image_buffer ) ; <nl> - m_image_buffer = NULL ; <nl> - <nl> - m_image_size = m_pFile . GetLength ( ) ; <nl> - <nl> - if ( ! m_image_size ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s m_image_size zero " , CLASSNAME , __func__ , GetFilename ( ) ) ; <nl> - return false ; <nl> - } <nl> - m_image_buffer = ( uint8_t * ) malloc ( m_image_size ) ; <nl> - if ( ! m_image_buffer ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s m_image_buffer null ( % lu ) " , CLASSNAME , __func__ , GetFilename ( ) , <nl> - m_image_size ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_pFile . Read ( m_image_buffer , m_image_size ) ; <nl> - m_pFile . Close ( ) ; <nl> - <nl> - OMX_IMAGE_CODINGTYPE eCompressionFormat = GetCodingType ( m_width , m_height , orientation ) ; <nl> - if ( eCompressionFormat ! = OMX_IMAGE_CodingJPEG | | m_width < 1 | | m_height < 1 ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % s GetCodingType = 0x % x ( % dx % d ) " , CLASSNAME , __func__ , GetFilename ( ) , <nl> - eCompressionFormat , m_width , m_height ) ; <nl> - return false ; <nl> - } <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - # ifdef CLASSNAME <nl> - # undef CLASSNAME <nl> - # endif <nl> - # define CLASSNAME " COMXImageDec " <nl> - <nl> - COMXImageDec : : COMXImageDec ( ) <nl> - { <nl> - limit_calls_enter ( ) ; <nl> - m_decoded_buffer = NULL ; <nl> - OMX_INIT_STRUCTURE ( m_decoded_format ) ; <nl> - m_success = false ; <nl> - } <nl> - <nl> - COMXImageDec : : ~ COMXImageDec ( ) <nl> - { <nl> - Close ( ) ; <nl> - <nl> - OMX_INIT_STRUCTURE ( m_decoded_format ) ; <nl> - m_decoded_buffer = NULL ; <nl> - limit_calls_leave ( ) ; <nl> - } <nl> - <nl> - void COMXImageDec : : Close ( ) <nl> - { <nl> - CSingleLock lock ( m_OMXSection ) ; <nl> - <nl> - if ( ! m_success ) <nl> - { <nl> - if ( m_omx_decoder . IsInitialized ( ) ) <nl> - { <nl> - m_omx_decoder . SetStateForComponent ( OMX_StateIdle ) ; <nl> - m_omx_decoder . FlushInput ( ) ; <nl> - m_omx_decoder . FreeInputBuffers ( ) ; <nl> - } <nl> - if ( m_omx_resize . IsInitialized ( ) ) <nl> - { <nl> - m_omx_resize . SetStateForComponent ( OMX_StateIdle ) ; <nl> - m_omx_resize . FlushOutput ( ) ; <nl> - m_omx_resize . FreeOutputBuffers ( ) ; <nl> - } <nl> - } <nl> - if ( m_omx_tunnel_decode . IsInitialized ( ) ) <nl> - m_omx_tunnel_decode . Deestablish ( ) ; <nl> - if ( m_omx_decoder . IsInitialized ( ) ) <nl> - m_omx_decoder . Deinitialize ( ) ; <nl> - if ( m_omx_resize . IsInitialized ( ) ) <nl> - m_omx_resize . Deinitialize ( ) ; <nl> - } <nl> - <nl> - bool COMXImageDec : : HandlePortSettingChange ( unsigned int resize_width , unsigned int resize_height , unsigned int resize_stride ) <nl> - { <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - / / on the first port settings changed event , we create the tunnel and alloc the buffer <nl> - if ( ! m_decoded_buffer ) <nl> - { <nl> - OMX_PARAM_PORTDEFINITIONTYPE port_def ; <nl> - OMX_INIT_STRUCTURE ( port_def ) ; <nl> - <nl> - port_def . nPortIndex = m_omx_decoder . GetOutputPort ( ) ; <nl> - m_omx_decoder . GetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - port_def . format . image . nSliceHeight = 16 ; <nl> - m_omx_decoder . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - <nl> - port_def . nPortIndex = m_omx_resize . GetInputPort ( ) ; <nl> - m_omx_resize . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - <nl> - m_omx_tunnel_decode . Initialize ( & m_omx_decoder , m_omx_decoder . GetOutputPort ( ) , & m_omx_resize , m_omx_resize . GetInputPort ( ) ) ; <nl> - <nl> - omx_err = m_omx_tunnel_decode . Establish ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_tunnel_decode . Establish " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - omx_err = m_omx_resize . WaitForEvent ( OMX_EventPortSettingsChanged ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . WaitForEvent = % x " , CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - port_def . nPortIndex = m_omx_resize . GetOutputPort ( ) ; <nl> - m_omx_resize . GetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - <nl> - port_def . nPortIndex = m_omx_resize . GetOutputPort ( ) ; <nl> - port_def . format . image . eCompressionFormat = OMX_IMAGE_CodingUnused ; <nl> - port_def . format . image . eColorFormat = OMX_COLOR_Format32bitARGB8888 ; <nl> - port_def . format . image . nFrameWidth = resize_width ; <nl> - port_def . format . image . nFrameHeight = resize_height ; <nl> - port_def . format . image . nStride = resize_stride ; <nl> - port_def . format . image . nSliceHeight = 0 ; <nl> - port_def . format . image . bFlagErrorConcealment = OMX_FALSE ; <nl> - <nl> - omx_err = m_omx_resize . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . SetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - OMX_INIT_STRUCTURE ( m_decoded_format ) ; <nl> - m_decoded_format . nPortIndex = m_omx_resize . GetOutputPort ( ) ; <nl> - omx_err = m_omx_resize . GetParameter ( OMX_IndexParamPortDefinition , & m_decoded_format ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . GetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - assert ( m_decoded_format . nBufferCountActual = = 1 ) ; <nl> - <nl> - omx_err = m_omx_resize . AllocOutputBuffers ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . AllocOutputBuffers result ( 0x % x ) " , CLASSNAME , <nl> - __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - omx_err = m_omx_resize . SetStateForComponent ( OMX_StateExecuting ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . SetStateForComponent result ( 0x % x ) " , CLASSNAME , <nl> - __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_decoded_buffer = m_omx_resize . GetOutputBuffer ( ) ; <nl> - <nl> - if ( ! m_decoded_buffer ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s no output buffer " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - omx_err = m_omx_resize . FillThisBuffer ( m_decoded_buffer ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize FillThisBuffer result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - m_omx_resize . DecoderFillBufferDone ( m_omx_resize . GetComponent ( ) , m_decoded_buffer ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - / / on subsequent port settings changed event , we just copy the port settings <nl> - else <nl> - { <nl> - / / a little surprising , make a note <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s m_omx_resize second port changed event " , CLASSNAME , __func__ ) ; <nl> - m_omx_decoder . DisablePort ( m_omx_decoder . GetOutputPort ( ) , true ) ; <nl> - m_omx_resize . DisablePort ( m_omx_resize . GetInputPort ( ) , true ) ; <nl> - <nl> - OMX_PARAM_PORTDEFINITIONTYPE port_def ; <nl> - OMX_INIT_STRUCTURE ( port_def ) ; <nl> - <nl> - port_def . nPortIndex = m_omx_decoder . GetOutputPort ( ) ; <nl> - m_omx_decoder . GetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - port_def . nPortIndex = m_omx_resize . GetInputPort ( ) ; <nl> - m_omx_resize . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - <nl> - omx_err = m_omx_resize . WaitForEvent ( OMX_EventPortSettingsChanged ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . WaitForEvent = % x " , CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - m_omx_decoder . EnablePort ( m_omx_decoder . GetOutputPort ( ) , true ) ; <nl> - m_omx_resize . EnablePort ( m_omx_resize . GetInputPort ( ) , true ) ; <nl> - } <nl> - return true ; <nl> - } <nl> - <nl> - bool COMXImageDec : : Decode ( const uint8_t * demuxer_content , unsigned demuxer_bytes , unsigned width , unsigned height , unsigned stride , void * pixels ) <nl> - { <nl> - CSingleLock lock ( m_OMXSection ) ; <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - OMX_BUFFERHEADERTYPE * omx_buffer = NULL ; <nl> - <nl> - if ( ! demuxer_content | | ! demuxer_bytes ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s no input buffer " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_omx_decoder . Initialize ( " OMX . broadcom . image_decode " , OMX_IndexParamImageInit ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error m_omx_decoder . Initialize " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_omx_resize . Initialize ( " OMX . broadcom . resize " , OMX_IndexParamImageInit ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error m_omx_resize . Initialize " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - / / set input format <nl> - OMX_PARAM_PORTDEFINITIONTYPE portParam ; <nl> - OMX_INIT_STRUCTURE ( portParam ) ; <nl> - portParam . nPortIndex = m_omx_decoder . GetInputPort ( ) ; <nl> - <nl> - omx_err = m_omx_decoder . GetParameter ( OMX_IndexParamPortDefinition , & portParam ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error GetParameter : OMX_IndexParamPortDefinition omx_err ( 0x % 08x ) " , <nl> - CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - portParam . nBufferCountActual = portParam . nBufferCountMin ; <nl> - portParam . nBufferSize = std : : max ( portParam . nBufferSize , ALIGN_UP ( demuxer_bytes , portParam . nBufferAlignment ) ) ; <nl> - portParam . format . image . eCompressionFormat = OMX_IMAGE_CodingJPEG ; <nl> - <nl> - omx_err = m_omx_decoder . SetParameter ( OMX_IndexParamPortDefinition , & portParam ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error SetParameter : OMX_IndexParamPortDefinition omx_err ( 0x % 08x ) " , <nl> - CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - omx_err = m_omx_decoder . AllocInputBuffers ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_decoder . AllocInputBuffers result ( 0x % x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - omx_err = m_omx_decoder . SetStateForComponent ( OMX_StateExecuting ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_decoder . SetStateForComponent result ( 0x % x ) " , CLASSNAME , <nl> - __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - while ( demuxer_bytes > 0 | | ! m_decoded_buffer ) <nl> - { <nl> - long timeout = 0 ; <nl> - if ( demuxer_bytes ) <nl> - { <nl> - omx_buffer = m_omx_decoder . GetInputBuffer ( 1000 ) ; <nl> - if ( omx_buffer = = NULL ) <nl> - return false ; <nl> - <nl> - omx_buffer - > nOffset = omx_buffer - > nFlags = 0 ; <nl> - <nl> - omx_buffer - > nFilledLen = ( demuxer_bytes > omx_buffer - > nAllocLen ) ? omx_buffer - > nAllocLen : demuxer_bytes ; <nl> - memcpy ( omx_buffer - > pBuffer , demuxer_content , omx_buffer - > nFilledLen ) ; <nl> - <nl> - demuxer_content + = omx_buffer - > nFilledLen ; <nl> - demuxer_bytes - = omx_buffer - > nFilledLen ; <nl> - <nl> - if ( demuxer_bytes = = 0 ) <nl> - omx_buffer - > nFlags | = OMX_BUFFERFLAG_EOS ; <nl> - <nl> - omx_err = m_omx_decoder . EmptyThisBuffer ( omx_buffer ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s OMX_EmptyThisBuffer ( ) failed with result ( 0x % x ) " , CLASSNAME , <nl> - __func__ , omx_err ) ; <nl> - m_omx_decoder . DecoderEmptyBufferDone ( m_omx_decoder . GetComponent ( ) , omx_buffer ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - if ( ! demuxer_bytes ) <nl> - { <nl> - / / we ' ve submitted all buffers so can wait now <nl> - timeout = 1000 ; <nl> - } <nl> - omx_err = m_omx_decoder . WaitForEvent ( OMX_EventPortSettingsChanged , timeout ) ; <nl> - if ( omx_err = = OMX_ErrorNone ) <nl> - { <nl> - if ( ! HandlePortSettingChange ( width , height , stride ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s HandlePortSettingChange ( ) failed " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - else if ( omx_err = = OMX_ErrorStreamCorrupt ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - image not supported " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - else if ( timeout | | omx_err ! = OMX_ErrorTimeout ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s WaitForEvent : OMX_EventPortSettingsChanged failed ( % x ) " , CLASSNAME , <nl> - __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> - omx_err = m_omx_resize . WaitForOutputDone ( 1000 ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . WaitForOutputDone result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( m_omx_decoder . BadState ( ) ) <nl> - return false ; <nl> - <nl> - memcpy ( ( char * ) pixels , m_decoded_buffer - > pBuffer , stride * height ) ; <nl> - <nl> - m_success = true ; <nl> - Close ( ) ; <nl> - return true ; <nl> - } <nl> - <nl> - # ifdef CLASSNAME <nl> - # undef CLASSNAME <nl> - # endif <nl> - # define CLASSNAME " COMXImageEnc " <nl> - <nl> - COMXImageEnc : : COMXImageEnc ( ) <nl> - { <nl> - limit_calls_enter ( ) ; <nl> - CSingleLock lock ( m_OMXSection ) ; <nl> - OMX_INIT_STRUCTURE ( m_encoded_format ) ; <nl> - m_encoded_buffer = NULL ; <nl> - m_success = false ; <nl> - } <nl> - <nl> - COMXImageEnc : : ~ COMXImageEnc ( ) <nl> - { <nl> - CSingleLock lock ( m_OMXSection ) ; <nl> - <nl> - OMX_INIT_STRUCTURE ( m_encoded_format ) ; <nl> - m_encoded_buffer = NULL ; <nl> - if ( ! m_success ) <nl> - { <nl> - if ( m_omx_encoder . IsInitialized ( ) ) <nl> - { <nl> - m_omx_encoder . SetStateForComponent ( OMX_StateIdle ) ; <nl> - m_omx_encoder . FlushAll ( ) ; <nl> - m_omx_encoder . FreeInputBuffers ( ) ; <nl> - m_omx_encoder . FreeOutputBuffers ( ) ; <nl> - m_omx_encoder . Deinitialize ( ) ; <nl> - } <nl> - } <nl> - limit_calls_leave ( ) ; <nl> - } <nl> - <nl> - bool COMXImageEnc : : Encode ( unsigned char * buffer , int size , unsigned width , unsigned height , unsigned int pitch ) <nl> - { <nl> - CSingleLock lock ( m_OMXSection ) ; <nl> - <nl> - unsigned int demuxer_bytes = 0 ; <nl> - const uint8_t * demuxer_content = NULL ; <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - OMX_BUFFERHEADERTYPE * omx_buffer = NULL ; <nl> - OMX_INIT_STRUCTURE ( m_encoded_format ) ; <nl> - <nl> - if ( pitch = = 0 ) <nl> - pitch = 4 * width ; <nl> - <nl> - if ( ! buffer | | ! size ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error no buffer " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_omx_encoder . Initialize ( " OMX . broadcom . image_encode " , OMX_IndexParamImageInit ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error m_omx_encoder . Initialize " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - OMX_PARAM_PORTDEFINITIONTYPE port_def ; <nl> - OMX_INIT_STRUCTURE ( port_def ) ; <nl> - port_def . nPortIndex = m_omx_encoder . GetInputPort ( ) ; <nl> - <nl> - omx_err = m_omx_encoder . GetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . GetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - port_def . format . image . eCompressionFormat = OMX_IMAGE_CodingUnused ; <nl> - port_def . format . image . eColorFormat = OMX_COLOR_Format32bitARGB8888 ; <nl> - port_def . format . image . nFrameWidth = width ; <nl> - port_def . format . image . nFrameHeight = height ; <nl> - port_def . format . image . nStride = pitch ; <nl> - port_def . format . image . nSliceHeight = ( height + 15 ) & ~ 15 ; <nl> - port_def . format . image . bFlagErrorConcealment = OMX_FALSE ; <nl> - <nl> - omx_err = m_omx_encoder . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . SetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - OMX_INIT_STRUCTURE ( port_def ) ; <nl> - port_def . nPortIndex = m_omx_encoder . GetOutputPort ( ) ; <nl> - <nl> - omx_err = m_omx_encoder . GetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . GetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - port_def . format . image . eCompressionFormat = OMX_IMAGE_CodingJPEG ; <nl> - port_def . format . image . eColorFormat = OMX_COLOR_FormatUnused ; <nl> - port_def . format . image . nFrameWidth = width ; <nl> - port_def . format . image . nFrameHeight = height ; <nl> - port_def . format . image . nStride = 0 ; <nl> - port_def . format . image . nSliceHeight = 0 ; <nl> - port_def . format . image . bFlagErrorConcealment = OMX_FALSE ; <nl> - <nl> - omx_err = m_omx_encoder . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . SetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - OMX_IMAGE_PARAM_QFACTORTYPE qfactor ; <nl> - OMX_INIT_STRUCTURE ( qfactor ) ; <nl> - qfactor . nPortIndex = m_omx_encoder . GetOutputPort ( ) ; <nl> - qfactor . nQFactor = 16 ; <nl> - <nl> - omx_err = m_omx_encoder . SetParameter ( OMX_IndexParamQFactor , & qfactor ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . SetParameter OMX_IndexParamQFactor result ( 0x % x ) " , <nl> - CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - omx_err = m_omx_encoder . AllocInputBuffers ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . AllocInputBuffers result ( 0x % x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - omx_err = m_omx_encoder . AllocOutputBuffers ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . AllocOutputBuffers result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - omx_err = m_omx_encoder . SetStateForComponent ( OMX_StateExecuting ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . SetStateForComponent result ( 0x % x ) " , CLASSNAME , <nl> - __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - demuxer_content = buffer ; <nl> - demuxer_bytes = height * pitch ; <nl> - <nl> - if ( ! demuxer_bytes | | ! demuxer_content ) <nl> - return false ; <nl> - <nl> - while ( demuxer_bytes > 0 ) <nl> - { <nl> - omx_buffer = m_omx_encoder . GetInputBuffer ( 1000 ) ; <nl> - if ( omx_buffer = = NULL ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - omx_buffer - > nOffset = omx_buffer - > nFlags = 0 ; <nl> - <nl> - omx_buffer - > nFilledLen = ( demuxer_bytes > omx_buffer - > nAllocLen ) ? omx_buffer - > nAllocLen : demuxer_bytes ; <nl> - memcpy ( omx_buffer - > pBuffer , demuxer_content , omx_buffer - > nFilledLen ) ; <nl> - <nl> - demuxer_content + = omx_buffer - > nFilledLen ; <nl> - demuxer_bytes - = omx_buffer - > nFilledLen ; <nl> - <nl> - if ( demuxer_bytes = = 0 ) <nl> - omx_buffer - > nFlags | = OMX_BUFFERFLAG_EOS ; <nl> - <nl> - omx_err = m_omx_encoder . EmptyThisBuffer ( omx_buffer ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s OMX_EmptyThisBuffer ( ) failed with result ( 0x % x ) " , CLASSNAME , <nl> - __func__ , omx_err ) ; <nl> - m_omx_encoder . DecoderEmptyBufferDone ( m_omx_encoder . GetComponent ( ) , omx_buffer ) ; <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - m_encoded_buffer = m_omx_encoder . GetOutputBuffer ( ) ; <nl> - <nl> - if ( ! m_encoded_buffer ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s no output buffer " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - omx_err = m_omx_encoder . FillThisBuffer ( m_encoded_buffer ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . FillThisBuffer result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - m_omx_encoder . DecoderFillBufferDone ( m_omx_encoder . GetComponent ( ) , m_encoded_buffer ) ; <nl> - return false ; <nl> - } <nl> - omx_err = m_omx_encoder . WaitForOutputDone ( 2000 ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . WaitForOutputDone result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_encoded_format . nPortIndex = m_omx_encoder . GetOutputPort ( ) ; <nl> - omx_err = m_omx_encoder . GetParameter ( OMX_IndexParamPortDefinition , & m_encoded_format ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . GetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( m_omx_encoder . BadState ( ) ) <nl> - return false ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - bool COMXImageEnc : : CreateThumbnailFromSurface ( unsigned char * buffer , unsigned int width , unsigned int height , <nl> - unsigned int format , unsigned int pitch , const std : : string & destFile ) <nl> - { <nl> - if ( format ! = XB_FMT_A8R8G8B8 | | ! buffer ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s : % s failed format = 0x % x " , CLASSNAME , __func__ , destFile . c_str ( ) , <nl> - format ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! Encode ( buffer , height * pitch , width , height , pitch ) ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s : % s encode failed " , CLASSNAME , __func__ , destFile . c_str ( ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - XFILE : : CFile file ; <nl> - if ( file . OpenForWrite ( destFile , true ) ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s : % s width % d height % d " , CLASSNAME , __func__ , destFile . c_str ( ) , <nl> - width , height ) ; <nl> - <nl> - file . Write ( m_encoded_buffer - > pBuffer , m_encoded_buffer - > nFilledLen ) ; <nl> - file . Close ( ) ; <nl> - return true ; <nl> - } <nl> - <nl> - m_success = true ; <nl> - return false ; <nl> - } <nl> - <nl> - # ifdef CLASSNAME <nl> - # undef CLASSNAME <nl> - # endif <nl> - # define CLASSNAME " COMXReEnc " <nl> - <nl> - COMXImageReEnc : : COMXImageReEnc ( ) <nl> - { <nl> - limit_calls_enter ( ) ; <nl> - m_encoded_buffer = NULL ; <nl> - m_pDestBuffer = NULL ; <nl> - m_nDestAllocSize = 0 ; <nl> - m_success = false ; <nl> - } <nl> - <nl> - COMXImageReEnc : : ~ COMXImageReEnc ( ) <nl> - { <nl> - Close ( ) ; <nl> - if ( m_pDestBuffer ) <nl> - free ( m_pDestBuffer ) ; <nl> - m_pDestBuffer = NULL ; <nl> - m_nDestAllocSize = 0 ; <nl> - limit_calls_leave ( ) ; <nl> - } <nl> - <nl> - void COMXImageReEnc : : Close ( ) <nl> - { <nl> - CSingleLock lock ( m_OMXSection ) ; <nl> - <nl> - if ( ! m_success ) <nl> - { <nl> - if ( m_omx_decoder . IsInitialized ( ) ) <nl> - { <nl> - m_omx_decoder . SetStateForComponent ( OMX_StateIdle ) ; <nl> - m_omx_decoder . FlushInput ( ) ; <nl> - m_omx_decoder . FreeInputBuffers ( ) ; <nl> - } <nl> - if ( m_omx_resize . IsInitialized ( ) ) <nl> - { <nl> - m_omx_resize . SetStateForComponent ( OMX_StateIdle ) ; <nl> - } <nl> - if ( m_omx_encoder . IsInitialized ( ) ) <nl> - { <nl> - m_omx_encoder . SetStateForComponent ( OMX_StateIdle ) ; <nl> - m_omx_encoder . FlushOutput ( ) ; <nl> - m_omx_encoder . FreeOutputBuffers ( ) ; <nl> - } <nl> - } <nl> - if ( m_omx_tunnel_decode . IsInitialized ( ) ) <nl> - m_omx_tunnel_decode . Deestablish ( ) ; <nl> - if ( m_omx_tunnel_resize . IsInitialized ( ) ) <nl> - m_omx_tunnel_resize . Deestablish ( ) ; <nl> - if ( m_omx_decoder . IsInitialized ( ) ) <nl> - m_omx_decoder . Deinitialize ( ) ; <nl> - if ( m_omx_resize . IsInitialized ( ) ) <nl> - m_omx_resize . Deinitialize ( ) ; <nl> - if ( m_omx_encoder . IsInitialized ( ) ) <nl> - m_omx_encoder . Deinitialize ( ) ; <nl> - } <nl> - <nl> - <nl> - <nl> - bool COMXImageReEnc : : HandlePortSettingChange ( unsigned int resize_width , unsigned int resize_height , int orientation , bool port_settings_changed ) <nl> - { <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - / / on the first port settings changed event , we create the tunnel and alloc the buffer <nl> - if ( ! port_settings_changed ) <nl> - { <nl> - OMX_PARAM_PORTDEFINITIONTYPE port_def ; <nl> - OMX_INIT_STRUCTURE ( port_def ) ; <nl> - <nl> - port_def . nPortIndex = m_omx_decoder . GetOutputPort ( ) ; <nl> - m_omx_decoder . GetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_decoder . GetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( resize_width ! = port_def . format . image . nFrameWidth | | resize_height ! = port_def . format . image . nFrameHeight | | ( orientation & 4 ) ) <nl> - { <nl> - if ( ! m_omx_resize . Initialize ( " OMX . broadcom . resize " , OMX_IndexParamImageInit ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error m_omx_resize . Initialize " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> - / / ! @ todo jpeg decoder can decimate by factors of 2 <nl> - port_def . format . image . eColorFormat = OMX_COLOR_FormatYUV420PackedPlanar ; <nl> - if ( m_omx_resize . IsInitialized ( ) ) <nl> - port_def . format . image . nSliceHeight = 16 ; <nl> - else <nl> - port_def . format . image . nSliceHeight = ( resize_height + 15 ) & ~ 15 ; <nl> - <nl> - port_def . format . image . nStride = 0 ; <nl> - <nl> - m_omx_decoder . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_decoder . SetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( m_omx_resize . IsInitialized ( ) ) <nl> - { <nl> - port_def . nPortIndex = m_omx_resize . GetInputPort ( ) ; <nl> - <nl> - m_omx_resize . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . SetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - port_def . nPortIndex = m_omx_resize . GetOutputPort ( ) ; <nl> - m_omx_resize . GetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . GetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - port_def . format . image . eColorFormat = OMX_COLOR_FormatYUV420PackedPlanar ; <nl> - port_def . format . image . nFrameWidth = resize_width ; <nl> - port_def . format . image . nFrameHeight = resize_height ; <nl> - port_def . format . image . nSliceHeight = ( resize_height + 15 ) & ~ 15 ; <nl> - port_def . format . image . nStride = 0 ; <nl> - m_omx_resize . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . SetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> - if ( ! m_omx_encoder . Initialize ( " OMX . broadcom . image_encode " , OMX_IndexParamImageInit ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error m_omx_encoder . Initialize " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - port_def . nPortIndex = m_omx_encoder . GetInputPort ( ) ; <nl> - m_omx_encoder . GetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . GetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - port_def . format . image . eColorFormat = OMX_COLOR_FormatYUV420PackedPlanar ; <nl> - port_def . format . image . nFrameWidth = resize_width ; <nl> - port_def . format . image . nFrameHeight = resize_height ; <nl> - port_def . format . image . nSliceHeight = ( resize_height + 15 ) & ~ 15 ; <nl> - port_def . format . image . nStride = 0 ; <nl> - m_omx_encoder . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . SetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - port_def . nPortIndex = m_omx_encoder . GetOutputPort ( ) ; <nl> - omx_err = m_omx_encoder . GetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . GetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - port_def . format . image . eCompressionFormat = OMX_IMAGE_CodingJPEG ; <nl> - port_def . format . image . eColorFormat = OMX_COLOR_FormatUnused ; <nl> - port_def . format . image . nFrameWidth = resize_width ; <nl> - port_def . format . image . nFrameHeight = resize_height ; <nl> - port_def . format . image . nStride = 0 ; <nl> - port_def . format . image . nSliceHeight = 0 ; <nl> - port_def . format . image . bFlagErrorConcealment = OMX_FALSE ; <nl> - <nl> - omx_err = m_omx_encoder . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . SetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - OMX_IMAGE_PARAM_QFACTORTYPE qfactor ; <nl> - OMX_INIT_STRUCTURE ( qfactor ) ; <nl> - qfactor . nPortIndex = m_omx_encoder . GetOutputPort ( ) ; <nl> - qfactor . nQFactor = 16 ; <nl> - <nl> - omx_err = m_omx_encoder . SetParameter ( OMX_IndexParamQFactor , & qfactor ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . SetParameter OMX_IndexParamQFactor result ( 0x % x ) " , <nl> - CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( orientation ) <nl> - { <nl> - struct { <nl> - / / metadata , these two fields need to be together <nl> - OMX_CONFIG_METADATAITEMTYPE metadata ; <nl> - char metadata_space [ 64 ] ; <nl> - } item ; <nl> - OMX_INIT_STRUCTURE ( item . metadata ) ; <nl> - <nl> - item . metadata . nSize = sizeof ( item ) ; <nl> - item . metadata . eScopeMode = OMX_MetadataScopePortLevel ; <nl> - item . metadata . nScopeSpecifier = m_omx_encoder . GetOutputPort ( ) ; <nl> - item . metadata . nMetadataItemIndex = 0 ; <nl> - item . metadata . eSearchMode = OMX_MetadataSearchValueSizeByIndex ; <nl> - item . metadata . eKeyCharset = OMX_MetadataCharsetASCII ; <nl> - strcpy ( ( char * ) item . metadata . nKey , " IFD0 . Orientation " ) ; <nl> - item . metadata . nKeySizeUsed = strlen ( ( char * ) item . metadata . nKey ) ; <nl> - <nl> - item . metadata . eValueCharset = OMX_MetadataCharsetASCII ; <nl> - item . metadata . sLanguageCountry = 0 ; <nl> - item . metadata . nValueMaxSize = sizeof ( item . metadata_space ) ; <nl> - sprintf ( ( char * ) item . metadata . nValue , " % d " , orientation + 1 ) ; <nl> - item . metadata . nValueSizeUsed = strlen ( ( char * ) item . metadata . nValue ) ; <nl> - <nl> - omx_err = m_omx_encoder . SetParameter ( OMX_IndexConfigMetadataItem , & item ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , <nl> - " % s : : % s m_omx_encoder . SetParameter : OMX_IndexConfigMetadataItem omx_err ( 0x % 08x ) " , <nl> - CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - omx_err = m_omx_encoder . AllocOutputBuffers ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . AllocOutputBuffers result ( 0x % x ) " , CLASSNAME , <nl> - __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( m_omx_resize . IsInitialized ( ) ) <nl> - { <nl> - m_omx_tunnel_decode . Initialize ( & m_omx_decoder , m_omx_decoder . GetOutputPort ( ) , & m_omx_resize , m_omx_resize . GetInputPort ( ) ) ; <nl> - <nl> - omx_err = m_omx_tunnel_decode . Establish ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_tunnel_decode . Establish " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_omx_tunnel_resize . Initialize ( & m_omx_resize , m_omx_resize . GetOutputPort ( ) , & m_omx_encoder , m_omx_encoder . GetInputPort ( ) ) ; <nl> - <nl> - omx_err = m_omx_tunnel_resize . Establish ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_tunnel_resize . Establish " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - omx_err = m_omx_resize . SetStateForComponent ( OMX_StateExecuting ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . SetStateForComponent result ( 0x % x ) " , CLASSNAME , <nl> - __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - m_omx_tunnel_decode . Initialize ( & m_omx_decoder , m_omx_decoder . GetOutputPort ( ) , & m_omx_encoder , m_omx_encoder . GetInputPort ( ) ) ; <nl> - <nl> - omx_err = m_omx_tunnel_decode . Establish ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_tunnel_decode . Establish " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - omx_err = m_omx_encoder . SetStateForComponent ( OMX_StateExecuting ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder . SetStateForComponent result ( 0x % x ) " , CLASSNAME , <nl> - __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( m_omx_encoder . BadState ( ) ) <nl> - return false ; <nl> - } <nl> - / / on subsequent port settings changed event , we just copy the port settings <nl> - else <nl> - { <nl> - / / a little surprising , make a note <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s m_omx_resize second port changed event " , CLASSNAME , __func__ ) ; <nl> - m_omx_decoder . DisablePort ( m_omx_decoder . GetOutputPort ( ) , true ) ; <nl> - if ( m_omx_resize . IsInitialized ( ) ) <nl> - { <nl> - m_omx_resize . DisablePort ( m_omx_resize . GetInputPort ( ) , true ) ; <nl> - <nl> - OMX_PARAM_PORTDEFINITIONTYPE port_def ; <nl> - OMX_INIT_STRUCTURE ( port_def ) ; <nl> - <nl> - port_def . nPortIndex = m_omx_decoder . GetOutputPort ( ) ; <nl> - m_omx_decoder . GetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - port_def . nPortIndex = m_omx_resize . GetInputPort ( ) ; <nl> - m_omx_resize . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - <nl> - omx_err = m_omx_resize . WaitForEvent ( OMX_EventPortSettingsChanged ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . WaitForEvent = % x " , CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - m_omx_resize . EnablePort ( m_omx_resize . GetInputPort ( ) , true ) ; <nl> - } <nl> - m_omx_decoder . EnablePort ( m_omx_decoder . GetOutputPort ( ) , true ) ; <nl> - } <nl> - return true ; <nl> - } <nl> - <nl> - bool COMXImageReEnc : : ReEncode ( COMXImageFile & srcFile , unsigned int maxWidth , unsigned int maxHeight , void * & pDestBuffer , unsigned int & nDestSize ) <nl> - { <nl> - CSingleLock lock ( m_OMXSection ) ; <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - COMXImage : : ClampLimits ( maxWidth , maxHeight , srcFile . GetWidth ( ) , srcFile . GetHeight ( ) , srcFile . GetOrientation ( ) & 4 ) ; <nl> - unsigned int demuxer_bytes = srcFile . GetImageSize ( ) ; <nl> - unsigned char * demuxer_content = ( unsigned char * ) srcFile . GetImageBuffer ( ) ; <nl> - / / initial dest buffer size <nl> - nDestSize = 0 ; <nl> - <nl> - if ( ! demuxer_content | | ! demuxer_bytes ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s no input buffer " , CLASSNAME , __func__ , srcFile . GetFilename ( ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_omx_decoder . Initialize ( " OMX . broadcom . image_decode " , OMX_IndexParamImageInit ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s error m_omx_decoder . Initialize " , CLASSNAME , __func__ , <nl> - srcFile . GetFilename ( ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - / / set input format <nl> - OMX_PARAM_PORTDEFINITIONTYPE portParam ; <nl> - OMX_INIT_STRUCTURE ( portParam ) ; <nl> - portParam . nPortIndex = m_omx_decoder . GetInputPort ( ) ; <nl> - <nl> - omx_err = m_omx_decoder . GetParameter ( OMX_IndexParamPortDefinition , & portParam ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s error GetParameter : OMX_IndexParamPortDefinition omx_err ( 0x % 08x ) " , <nl> - CLASSNAME , __func__ , srcFile . GetFilename ( ) , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - portParam . nBufferCountActual = portParam . nBufferCountMin ; <nl> - portParam . nBufferSize = std : : max ( portParam . nBufferSize , ALIGN_UP ( demuxer_bytes , portParam . nBufferAlignment ) ) ; <nl> - portParam . format . image . eCompressionFormat = OMX_IMAGE_CodingJPEG ; <nl> - <nl> - omx_err = m_omx_decoder . SetParameter ( OMX_IndexParamPortDefinition , & portParam ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s error SetParameter : OMX_IndexParamPortDefinition omx_err ( 0x % 08x ) " , <nl> - CLASSNAME , __func__ , srcFile . GetFilename ( ) , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - omx_err = m_omx_decoder . AllocInputBuffers ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s m_omx_decoder . AllocInputBuffers result ( 0x % x ) " , CLASSNAME , __func__ , srcFile . GetFilename ( ) , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - omx_err = m_omx_decoder . SetStateForComponent ( OMX_StateExecuting ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s m_omx_decoder . SetStateForComponent result ( 0x % x ) " , CLASSNAME , <nl> - __func__ , srcFile . GetFilename ( ) , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - bool port_settings_changed = false , eos = false ; <nl> - while ( demuxer_bytes > 0 | | ! port_settings_changed | | ! eos ) <nl> - { <nl> - long timeout = 0 ; <nl> - if ( demuxer_bytes ) <nl> - { <nl> - OMX_BUFFERHEADERTYPE * omx_buffer = m_omx_decoder . GetInputBuffer ( 1000 ) ; <nl> - if ( omx_buffer ) <nl> - { <nl> - omx_buffer - > nOffset = omx_buffer - > nFlags = 0 ; <nl> - <nl> - omx_buffer - > nFilledLen = ( demuxer_bytes > omx_buffer - > nAllocLen ) ? omx_buffer - > nAllocLen : demuxer_bytes ; <nl> - memcpy ( omx_buffer - > pBuffer , demuxer_content , omx_buffer - > nFilledLen ) ; <nl> - <nl> - demuxer_content + = omx_buffer - > nFilledLen ; <nl> - demuxer_bytes - = omx_buffer - > nFilledLen ; <nl> - if ( demuxer_bytes = = 0 ) <nl> - omx_buffer - > nFlags | = OMX_BUFFERFLAG_EOS ; <nl> - <nl> - omx_err = m_omx_decoder . EmptyThisBuffer ( omx_buffer ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s OMX_EmptyThisBuffer ( ) failed with result ( 0x % x ) " , <nl> - CLASSNAME , __func__ , srcFile . GetFilename ( ) , omx_err ) ; <nl> - m_omx_decoder . DecoderEmptyBufferDone ( m_omx_decoder . GetComponent ( ) , omx_buffer ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - } <nl> - if ( ! demuxer_bytes ) <nl> - { <nl> - / / we ' ve submitted all buffers so can wait now <nl> - timeout = 1000 ; <nl> - } <nl> - <nl> - omx_err = m_omx_decoder . WaitForEvent ( OMX_EventPortSettingsChanged , timeout ) ; <nl> - if ( omx_err = = OMX_ErrorNone ) <nl> - { <nl> - if ( ! HandlePortSettingChange ( maxWidth , maxHeight , srcFile . GetOrientation ( ) , port_settings_changed ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s HandlePortSettingChange ( ) failed " , srcFile . GetFilename ( ) , <nl> - CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - port_settings_changed = true ; <nl> - } <nl> - else if ( omx_err = = OMX_ErrorStreamCorrupt ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s - image not supported " , CLASSNAME , __func__ , srcFile . GetFilename ( ) ) ; <nl> - return false ; <nl> - } <nl> - else if ( timeout | | omx_err ! = OMX_ErrorTimeout ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s WaitForEvent : OMX_EventPortSettingsChanged failed ( % x ) " , <nl> - CLASSNAME , __func__ , srcFile . GetFilename ( ) , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_encoded_buffer & & port_settings_changed & & demuxer_bytes = = 0 ) <nl> - { <nl> - m_encoded_buffer = m_omx_encoder . GetOutputBuffer ( ) ; <nl> - omx_err = m_omx_encoder . FillThisBuffer ( m_encoded_buffer ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s FillThisBuffer ( ) failed ( % x ) " , CLASSNAME , __func__ , <nl> - srcFile . GetFilename ( ) , omx_err ) ; <nl> - m_omx_encoder . DecoderFillBufferDone ( m_omx_encoder . GetComponent ( ) , m_encoded_buffer ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - if ( m_encoded_buffer ) <nl> - { <nl> - omx_err = m_omx_encoder . WaitForOutputDone ( 2000 ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s m_omx_encoder . WaitForOutputDone result ( 0x % x ) " , CLASSNAME , <nl> - __func__ , srcFile . GetFilename ( ) , omx_err ) ; <nl> - return false ; <nl> - } <nl> - if ( ! m_encoded_buffer - > nFilledLen ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s m_omx_encoder . WaitForOutputDone no data " , CLASSNAME , <nl> - __func__ , srcFile . GetFilename ( ) ) ; <nl> - return false ; <nl> - } <nl> - if ( m_encoded_buffer - > nFlags & OMX_BUFFERFLAG_EOS ) <nl> - eos = true ; <nl> - <nl> - if ( nDestSize + m_encoded_buffer - > nFilledLen > m_nDestAllocSize ) <nl> - { <nl> - while ( nDestSize + m_encoded_buffer - > nFilledLen > m_nDestAllocSize ) <nl> - m_nDestAllocSize = std : : max ( 1024U * 1024U , m_nDestAllocSize * 2 ) ; <nl> - m_pDestBuffer = realloc ( m_pDestBuffer , m_nDestAllocSize ) ; <nl> - } <nl> - memcpy ( ( char * ) m_pDestBuffer + nDestSize , m_encoded_buffer - > pBuffer , m_encoded_buffer - > nFilledLen ) ; <nl> - nDestSize + = m_encoded_buffer - > nFilledLen ; <nl> - m_encoded_buffer = NULL ; <nl> - } <nl> - } <nl> - <nl> - if ( m_omx_decoder . BadState ( ) ) <nl> - return false ; <nl> - <nl> - pDestBuffer = m_pDestBuffer ; <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s : % s % dx % d - > % dx % d " , CLASSNAME , __func__ , srcFile . GetFilename ( ) , <nl> - srcFile . GetWidth ( ) , srcFile . GetHeight ( ) , maxWidth , maxHeight ) ; <nl> - <nl> - m_success = true ; <nl> - Close ( ) ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - <nl> - # ifdef CLASSNAME <nl> - # undef CLASSNAME <nl> - # endif <nl> - # define CLASSNAME " COMXTexture " <nl> - <nl> - COMXTexture : : COMXTexture ( ) <nl> - { <nl> - limit_calls_enter ( ) ; <nl> - m_success = false ; <nl> - } <nl> - <nl> - COMXTexture : : ~ COMXTexture ( ) <nl> - { <nl> - Close ( ) ; <nl> - limit_calls_leave ( ) ; <nl> - } <nl> - <nl> - void COMXTexture : : Close ( ) <nl> - { <nl> - CSingleLock lock ( m_OMXSection ) ; <nl> - <nl> - if ( ! m_success ) <nl> - { <nl> - if ( m_omx_decoder . IsInitialized ( ) ) <nl> - { <nl> - m_omx_decoder . SetStateForComponent ( OMX_StateIdle ) ; <nl> - m_omx_decoder . FlushInput ( ) ; <nl> - m_omx_decoder . FreeInputBuffers ( ) ; <nl> - } <nl> - if ( m_omx_egl_render . IsInitialized ( ) ) <nl> - { <nl> - m_omx_egl_render . SetStateForComponent ( OMX_StateIdle ) ; <nl> - m_omx_egl_render . FlushOutput ( ) ; <nl> - m_omx_egl_render . FreeOutputBuffers ( ) ; <nl> - } <nl> - } <nl> - if ( m_omx_tunnel_decode . IsInitialized ( ) ) <nl> - m_omx_tunnel_decode . Deestablish ( ) ; <nl> - if ( m_omx_tunnel_egl . IsInitialized ( ) ) <nl> - m_omx_tunnel_egl . Deestablish ( ) ; <nl> - / / delete components <nl> - if ( m_omx_decoder . IsInitialized ( ) ) <nl> - m_omx_decoder . Deinitialize ( ) ; <nl> - if ( m_omx_resize . IsInitialized ( ) ) <nl> - m_omx_resize . Deinitialize ( ) ; <nl> - if ( m_omx_egl_render . IsInitialized ( ) ) <nl> - m_omx_egl_render . Deinitialize ( ) ; <nl> - } <nl> - <nl> - bool COMXTexture : : HandlePortSettingChange ( unsigned int resize_width , unsigned int resize_height , void * egl_image , bool port_settings_changed ) <nl> - { <nl> - CWinSystemRpiGLESContext * winsystem = static_cast < CWinSystemRpiGLESContext * > ( CServiceBroker : : GetWinSystem ( ) ) ; <nl> - EGLDisplay egl_display = winsystem - > GetEGLDisplay ( ) ; <nl> - OMX_ERRORTYPE omx_err ; <nl> - <nl> - if ( port_settings_changed ) <nl> - CLog : : Log ( LOGERROR , " % s : : % s Unexpected second port_settings_changed call " , CLASSNAME , __func__ ) ; <nl> - <nl> - OMX_PARAM_PORTDEFINITIONTYPE port_def ; <nl> - OMX_INIT_STRUCTURE ( port_def ) ; <nl> - <nl> - port_def . nPortIndex = m_omx_decoder . GetOutputPort ( ) ; <nl> - omx_err = m_omx_decoder . GetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_decoder . GetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - / / ! @ todo jpeg decoder can decimate by factors of 2 <nl> - port_def . format . image . eColorFormat = OMX_COLOR_FormatYUV420PackedPlanar ; <nl> - port_def . format . image . nSliceHeight = 16 ; <nl> - port_def . format . image . nStride = 0 ; <nl> - <nl> - omx_err = m_omx_decoder . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_decoder . SetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - if ( resize_width ! = port_def . format . image . nFrameWidth | | resize_height ! = port_def . format . image . nFrameHeight ) <nl> - { <nl> - if ( ! m_omx_resize . Initialize ( " OMX . broadcom . resize " , OMX_IndexParamImageInit ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error m_omx_resize . Initialize " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - if ( m_omx_resize . IsInitialized ( ) ) <nl> - { <nl> - port_def . nPortIndex = m_omx_resize . GetInputPort ( ) ; <nl> - <nl> - omx_err = m_omx_resize . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . SetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - port_def . nPortIndex = m_omx_resize . GetOutputPort ( ) ; <nl> - omx_err = m_omx_resize . GetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . GetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - port_def . format . image . eColorFormat = OMX_COLOR_FormatYUV420PackedPlanar ; <nl> - port_def . format . image . nFrameWidth = resize_width ; <nl> - port_def . format . image . nFrameHeight = resize_height ; <nl> - port_def . format . image . nSliceHeight = 16 ; <nl> - port_def . format . image . nStride = 0 ; <nl> - omx_err = m_omx_resize . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . SetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - if ( ! m_omx_egl_render . Initialize ( " OMX . broadcom . egl_render " , OMX_IndexParamVideoInit ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error m_omx_egl_render . Initialize " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - port_def . nPortIndex = m_omx_egl_render . GetOutputPort ( ) ; <nl> - omx_err = m_omx_egl_render . GetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_egl_render . SetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - port_def . nBufferCountActual = 1 ; <nl> - port_def . format . video . pNativeWindow = egl_display ; <nl> - <nl> - omx_err = m_omx_egl_render . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_egl_render . SetParameter result ( 0x % x ) " , CLASSNAME , __func__ , <nl> - omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - omx_err = m_omx_egl_render . UseEGLImage ( & m_egl_buffer , m_omx_egl_render . GetOutputPort ( ) , NULL , egl_image ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error m_omx_egl_render . UseEGLImage ( % x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - if ( m_omx_resize . IsInitialized ( ) ) <nl> - { <nl> - m_omx_tunnel_decode . Initialize ( & m_omx_decoder , m_omx_decoder . GetOutputPort ( ) , & m_omx_resize , m_omx_resize . GetInputPort ( ) ) ; <nl> - <nl> - omx_err = m_omx_tunnel_decode . Establish ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_tunnel_decode . Establish ( % x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_omx_tunnel_egl . Initialize ( & m_omx_resize , m_omx_resize . GetOutputPort ( ) , & m_omx_egl_render , m_omx_egl_render . GetInputPort ( ) ) ; <nl> - <nl> - omx_err = m_omx_tunnel_egl . Establish ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_tunnel_egl . Establish ( % x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - omx_err = m_omx_resize . SetStateForComponent ( OMX_StateExecuting ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error m_omx_egl_render . GetParameter ( % x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - m_omx_tunnel_decode . Initialize ( & m_omx_decoder , m_omx_decoder . GetOutputPort ( ) , & m_omx_egl_render , m_omx_egl_render . GetInputPort ( ) ) ; <nl> - <nl> - omx_err = m_omx_tunnel_decode . Establish ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_tunnel_decode . Establish ( % x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> - omx_err = m_omx_egl_render . SetStateForComponent ( OMX_StateExecuting ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error m_omx_egl_render . SetStateForComponent ( % x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - bool COMXTexture : : Decode ( const uint8_t * demuxer_content , unsigned demuxer_bytes , unsigned int width , unsigned int height , void * egl_image ) <nl> - { <nl> - CSingleLock lock ( m_OMXSection ) ; <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - if ( ! demuxer_content | | ! demuxer_bytes ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s no input buffer " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_omx_decoder . Initialize ( " OMX . broadcom . image_decode " , OMX_IndexParamImageInit ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error m_omx_decoder . Initialize " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - / / set input format <nl> - OMX_PARAM_PORTDEFINITIONTYPE portParam ; <nl> - OMX_INIT_STRUCTURE ( portParam ) ; <nl> - portParam . nPortIndex = m_omx_decoder . GetInputPort ( ) ; <nl> - <nl> - omx_err = m_omx_decoder . GetParameter ( OMX_IndexParamPortDefinition , & portParam ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error GetParameter : OMX_IndexParamPortDefinition omx_err ( 0x % 08x ) " , <nl> - CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - portParam . nBufferCountActual = portParam . nBufferCountMin ; <nl> - portParam . nBufferSize = std : : max ( portParam . nBufferSize , ALIGN_UP ( demuxer_bytes , portParam . nBufferAlignment ) ) ; <nl> - portParam . format . image . eCompressionFormat = OMX_IMAGE_CodingJPEG ; <nl> - <nl> - omx_err = m_omx_decoder . SetParameter ( OMX_IndexParamPortDefinition , & portParam ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error SetParameter : OMX_IndexParamPortDefinition omx_err ( 0x % 08x ) " , <nl> - CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - omx_err = m_omx_decoder . AllocInputBuffers ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - Error alloc buffers ( % x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - omx_err = m_omx_decoder . SetStateForComponent ( OMX_StateExecuting ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error m_omx_sched . SetStateForComponent ( % x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - bool port_settings_changed = false ; <nl> - bool eos = false ; <nl> - while ( demuxer_bytes > 0 | | ! port_settings_changed | | ! eos ) <nl> - { <nl> - long timeout = 0 ; <nl> - if ( demuxer_bytes ) <nl> - { <nl> - OMX_BUFFERHEADERTYPE * omx_buffer = m_omx_decoder . GetInputBuffer ( 1000 ) ; <nl> - if ( omx_buffer ) <nl> - { <nl> - omx_buffer - > nOffset = omx_buffer - > nFlags = 0 ; <nl> - <nl> - omx_buffer - > nFilledLen = ( demuxer_bytes > omx_buffer - > nAllocLen ) ? omx_buffer - > nAllocLen : demuxer_bytes ; <nl> - memcpy ( omx_buffer - > pBuffer , demuxer_content , omx_buffer - > nFilledLen ) ; <nl> - <nl> - demuxer_content + = omx_buffer - > nFilledLen ; <nl> - demuxer_bytes - = omx_buffer - > nFilledLen ; <nl> - <nl> - if ( demuxer_bytes = = 0 ) <nl> - omx_buffer - > nFlags | = OMX_BUFFERFLAG_EOS ; <nl> - <nl> - omx_err = m_omx_decoder . EmptyThisBuffer ( omx_buffer ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - m_omx_decoder . OMX_EmptyThisBuffer ( % x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - m_omx_decoder . DecoderEmptyBufferDone ( m_omx_decoder . GetComponent ( ) , omx_buffer ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - } <nl> - if ( ! demuxer_bytes ) <nl> - { <nl> - / / we ' ve submitted all buffers so can wait now <nl> - timeout = 1000 ; <nl> - } <nl> - <nl> - omx_err = m_omx_decoder . WaitForEvent ( OMX_EventPortSettingsChanged , timeout ) ; <nl> - if ( omx_err = = OMX_ErrorNone ) <nl> - { <nl> - if ( ! HandlePortSettingChange ( width , height , egl_image , port_settings_changed ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - HandlePortSettingChange failed ( % x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - port_settings_changed = true ; <nl> - } <nl> - else if ( omx_err = = OMX_ErrorStreamCorrupt ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - image not supported " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - else if ( timeout | | omx_err ! = OMX_ErrorTimeout ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s WaitForEvent : OMX_EventPortSettingsChanged failed ( % x ) " , CLASSNAME , <nl> - __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( port_settings_changed & & m_egl_buffer & & demuxer_bytes = = 0 & & ! eos ) <nl> - { <nl> - OMX_BUFFERHEADERTYPE * omx_buffer = m_omx_egl_render . GetOutputBuffer ( ) ; <nl> - if ( ! omx_buffer ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s GetOutputBuffer failed " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - if ( omx_buffer ! = m_egl_buffer ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error m_omx_egl_render . GetOutputBuffer ( % p , % p ) " , CLASSNAME , <nl> - __func__ , static_cast < void * > ( omx_buffer ) , static_cast < void * > ( m_egl_buffer ) ) ; <nl> - return false ; <nl> - } <nl> - <nl> - omx_err = m_omx_egl_render . FillThisBuffer ( m_egl_buffer ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error m_omx_egl_render . FillThisBuffer ( % x ) " , CLASSNAME , __func__ , omx_err ) ; <nl> - m_omx_egl_render . DecoderFillBufferDone ( m_omx_egl_render . GetComponent ( ) , m_egl_buffer ) ; <nl> - return false ; <nl> - } <nl> - <nl> - omx_err = m_omx_egl_render . WaitForOutputDone ( 2000 ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_egl_render . WaitForOutputDone result ( 0x % x ) " , CLASSNAME , <nl> - __func__ , omx_err ) ; <nl> - return false ; <nl> - } <nl> - eos = true ; <nl> - } <nl> - } <nl> - m_success = true ; <nl> - Close ( ) ; <nl> - return true ; <nl> - } <nl> - <nl> - COMXImage g_OMXImage ; <nl> deleted file mode 100644 <nl> index 474346c18e95 . . 000000000000 <nl> mmm a / xbmc / cores / omxplayer / OMXImage . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2010 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # include " OMXCore . h " <nl> - # include " filesystem / File . h " <nl> - # include " guilib / XBTF . h " <nl> - # include " threads / Thread . h " <nl> - <nl> - # include < EGL / egl . h > <nl> - # include < EGL / eglext . h > <nl> - # include < IL / OMX_Video . h > <nl> - <nl> - # include " system_gl . h " <nl> - <nl> - class COMXImageFile ; <nl> - <nl> - class COMXImage : public CThread <nl> - { <nl> - struct callbackinfo { <nl> - CEvent sync ; <nl> - bool ( * callback ) ( EGLDisplay egl_display , EGLContext egl_context , void * cookie ) ; <nl> - void * cookie ; <nl> - bool result ; <nl> - } ; <nl> - protected : <nl> - virtual void OnStartup ( ) ; <nl> - virtual void OnExit ( ) ; <nl> - virtual void Process ( ) ; <nl> - public : <nl> - struct textureinfo { <nl> - int width , height ; <nl> - GLuint texture ; <nl> - EGLImageKHR egl_image ; <nl> - void * parent ; <nl> - } ; <nl> - COMXImage ( ) ; <nl> - virtual ~ COMXImage ( ) ; <nl> - void Initialize ( ) ; <nl> - void Deinitialize ( ) ; <nl> - static COMXImageFile * LoadJpeg ( const std : : string & texturePath ) ; <nl> - static void CloseJpeg ( COMXImageFile * file ) ; <nl> - <nl> - static bool DecodeJpeg ( COMXImageFile * file , unsigned int maxWidth , unsigned int maxHeight , unsigned int stride , void * pixels ) ; <nl> - static bool CreateThumbnailFromSurface ( unsigned char * buffer , unsigned int width , unsigned int height , <nl> - unsigned int format , unsigned int pitch , const std : : string & destFile ) ; <nl> - static bool ClampLimits ( unsigned int & width , unsigned int & height , unsigned int m_width , unsigned int m_height , bool transposed = false ) ; <nl> - static bool CreateThumb ( const std : : string & srcFile , unsigned int width , unsigned int height , std : : string & additional_info , const std : : string & destFile ) ; <nl> - bool SendMessage ( bool ( * callback ) ( EGLDisplay egl_display , EGLContext egl_context , void * cookie ) , void * cookie ) ; <nl> - bool DecodeJpegToTexture ( COMXImageFile * file , unsigned int width , unsigned int height , void * * userdata ) ; <nl> - void DestroyTexture ( void * userdata ) ; <nl> - void GetTexture ( void * userdata , GLuint * texture ) ; <nl> - bool AllocTextureInternal ( EGLDisplay egl_display , EGLContext egl_context , struct textureinfo * tex ) ; <nl> - bool DestroyTextureInternal ( EGLDisplay egl_display , EGLContext egl_context , struct textureinfo * tex ) ; <nl> - private : <nl> - EGLContext m_egl_context ; <nl> - <nl> - void CreateContext ( ) ; <nl> - EGLContext GetEGLContext ( ) ; <nl> - CCriticalSection m_texqueue_lock ; <nl> - XbmcThreads : : ConditionVariable m_texqueue_cond ; <nl> - std : : queue < struct callbackinfo * > m_texqueue ; <nl> - } ; <nl> - <nl> - class COMXImageFile <nl> - { <nl> - public : <nl> - COMXImageFile ( ) ; <nl> - virtual ~ COMXImageFile ( ) ; <nl> - bool ReadFile ( const std : : string & inputFile , int orientation = 0 ) ; <nl> - int GetOrientation ( ) const { return m_orientation ; } ; <nl> - unsigned int GetWidth ( ) const { return m_width ; } ; <nl> - unsigned int GetHeight ( ) const { return m_height ; } ; <nl> - unsigned long GetImageSize ( ) const { return m_image_size ; } ; <nl> - const uint8_t * GetImageBuffer ( ) const { return ( const uint8_t * ) m_image_buffer ; } ; <nl> - const char * GetFilename ( ) const { return m_filename . c_str ( ) ; } ; <nl> - protected : <nl> - OMX_IMAGE_CODINGTYPE GetCodingType ( unsigned int & width , unsigned int & height , int orientation ) ; <nl> - uint8_t * m_image_buffer ; <nl> - unsigned long m_image_size ; <nl> - unsigned int m_width ; <nl> - unsigned int m_height ; <nl> - int m_orientation ; <nl> - std : : string m_filename ; <nl> - } ; <nl> - <nl> - class COMXImageDec <nl> - { <nl> - public : <nl> - COMXImageDec ( ) ; <nl> - virtual ~ COMXImageDec ( ) ; <nl> - <nl> - / / Required overrides <nl> - void Close ( ) ; <nl> - bool Decode ( const uint8_t * data , unsigned size , unsigned int width , unsigned int height , unsigned stride , void * pixels ) ; <nl> - unsigned int GetDecodedWidth ( ) const { return ( unsigned int ) m_decoded_format . format . image . nFrameWidth ; } ; <nl> - unsigned int GetDecodedHeight ( ) const { return ( unsigned int ) m_decoded_format . format . image . nFrameHeight ; } ; <nl> - unsigned int GetDecodedStride ( ) const { return ( unsigned int ) m_decoded_format . format . image . nStride ; } ; <nl> - protected : <nl> - bool HandlePortSettingChange ( unsigned int resize_width , unsigned int resize_height , unsigned int resize_stride ) ; <nl> - / / Components <nl> - COMXCoreComponent m_omx_decoder ; <nl> - COMXCoreComponent m_omx_resize ; <nl> - COMXCoreTunnel m_omx_tunnel_decode ; <nl> - OMX_BUFFERHEADERTYPE * m_decoded_buffer ; <nl> - OMX_PARAM_PORTDEFINITIONTYPE m_decoded_format ; <nl> - CCriticalSection m_OMXSection ; <nl> - bool m_success ; <nl> - } ; <nl> - <nl> - class COMXImageEnc <nl> - { <nl> - public : <nl> - COMXImageEnc ( ) ; <nl> - virtual ~ COMXImageEnc ( ) ; <nl> - <nl> - / / Required overrides <nl> - bool CreateThumbnailFromSurface ( unsigned char * buffer , unsigned int width , unsigned int height , <nl> - unsigned int format , unsigned int pitch , const std : : string & destFile ) ; <nl> - protected : <nl> - bool Encode ( unsigned char * buffer , int size , unsigned int width , unsigned int height , unsigned int pitch ) ; <nl> - / / Components <nl> - COMXCoreComponent m_omx_encoder ; <nl> - OMX_BUFFERHEADERTYPE * m_encoded_buffer ; <nl> - OMX_PARAM_PORTDEFINITIONTYPE m_encoded_format ; <nl> - CCriticalSection m_OMXSection ; <nl> - bool m_success ; <nl> - } ; <nl> - <nl> - class COMXImageReEnc <nl> - { <nl> - public : <nl> - COMXImageReEnc ( ) ; <nl> - virtual ~ COMXImageReEnc ( ) ; <nl> - <nl> - / / Required overrides <nl> - void Close ( ) ; <nl> - bool ReEncode ( COMXImageFile & srcFile , unsigned int width , unsigned int height , void * & pDestBuffer , unsigned int & nDestSize ) ; <nl> - protected : <nl> - bool HandlePortSettingChange ( unsigned int resize_width , unsigned int resize_height , int orientation , bool port_settings_changed ) ; <nl> - / / Components <nl> - COMXCoreComponent m_omx_decoder ; <nl> - COMXCoreComponent m_omx_resize ; <nl> - COMXCoreComponent m_omx_encoder ; <nl> - COMXCoreTunnel m_omx_tunnel_decode ; <nl> - COMXCoreTunnel m_omx_tunnel_resize ; <nl> - OMX_BUFFERHEADERTYPE * m_encoded_buffer ; <nl> - CCriticalSection m_OMXSection ; <nl> - void * m_pDestBuffer ; <nl> - unsigned int m_nDestAllocSize ; <nl> - bool m_success ; <nl> - } ; <nl> - <nl> - class COMXTexture <nl> - { <nl> - public : <nl> - COMXTexture ( ) ; <nl> - virtual ~ COMXTexture ( ) ; <nl> - <nl> - / / Required overrides <nl> - void Close ( void ) ; <nl> - bool Decode ( const uint8_t * data , unsigned size , unsigned int width , unsigned int height , void * egl_image ) ; <nl> - protected : <nl> - bool HandlePortSettingChange ( unsigned int resize_width , unsigned int resize_height , void * egl_image , bool port_settings_changed ) ; <nl> - <nl> - / / Components <nl> - COMXCoreComponent m_omx_decoder ; <nl> - COMXCoreComponent m_omx_resize ; <nl> - COMXCoreComponent m_omx_egl_render ; <nl> - <nl> - COMXCoreTunnel m_omx_tunnel_decode ; <nl> - COMXCoreTunnel m_omx_tunnel_egl ; <nl> - <nl> - OMX_BUFFERHEADERTYPE * m_egl_buffer ; <nl> - CCriticalSection m_OMXSection ; <nl> - bool m_success ; <nl> - } ; <nl> - <nl> - extern COMXImage g_OMXImage ; <nl> mmm a / xbmc / guilib / CMakeLists . txt <nl> ppp b / xbmc / guilib / CMakeLists . txt <nl> if ( OPENGLES_FOUND ) <nl> TextureGL . h ) <nl> endif ( ) <nl> <nl> - if ( CORE_PLATFORM_NAME_LC STREQUAL rbpi ) <nl> - list ( APPEND SOURCES TexturePi . cpp ) <nl> - list ( APPEND HEADERS TexturePi . h ) <nl> - endif ( ) <nl> - <nl> if ( CORE_SYSTEM_NAME STREQUAL windows OR CORE_SYSTEM_NAME STREQUAL windowsstore ) <nl> list ( APPEND SOURCES D3DResource . cpp <nl> DirectXGraphics . cpp <nl> mmm a / xbmc / guilib / Texture . h <nl> ppp b / xbmc / guilib / Texture . h <nl> class CBaseTexture <nl> bool m_bCacheMemory = false ; <nl> } ; <nl> <nl> - # if defined ( TARGET_RASPBERRY_PI ) <nl> - # include " TexturePi . h " <nl> - # define CTexture CPiTexture <nl> - # elif defined ( HAS_GL ) | | defined ( HAS_GLES ) <nl> + # if defined ( HAS_GL ) | | defined ( HAS_GLES ) <nl> # include " TextureGL . h " <nl> # define CTexture CGLTexture <nl> # elif defined ( HAS_DX ) <nl> deleted file mode 100644 <nl> index dc7ebdd5c78f . . 000000000000 <nl> mmm a / xbmc / guilib / TexturePi . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2013 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # include " Texture . h " <nl> - # include " cores / omxplayer / OMXImage . h " <nl> - # include " guilib / TextureManager . h " <nl> - # include " utils / GLUtils . h " <nl> - # include " utils / URIUtils . h " <nl> - # include " utils / log . h " <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * CPiTexture * / <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - CPiTexture : : CPiTexture ( unsigned int width , unsigned int height , unsigned int format ) <nl> - : CGLTexture ( width , height , format ) <nl> - { <nl> - m_egl_image = NULL ; <nl> - } <nl> - <nl> - CPiTexture : : ~ CPiTexture ( ) <nl> - { <nl> - if ( m_egl_image ) <nl> - { <nl> - g_OMXImage . DestroyTexture ( m_egl_image ) ; <nl> - m_egl_image = NULL ; <nl> - } <nl> - } <nl> - <nl> - void CPiTexture : : Allocate ( unsigned int width , unsigned int height , unsigned int format ) <nl> - { <nl> - if ( m_egl_image ) <nl> - { <nl> - m_imageWidth = m_originalWidth = width ; <nl> - m_imageHeight = m_originalHeight = height ; <nl> - m_format = format ; <nl> - m_orientation = 0 ; <nl> - <nl> - m_textureWidth = m_imageWidth ; <nl> - m_textureHeight = m_imageHeight ; <nl> - return ; <nl> - } <nl> - return CGLTexture : : Allocate ( width , height , format ) ; <nl> - } <nl> - <nl> - void CPiTexture : : CreateTextureObject ( ) <nl> - { <nl> - if ( m_egl_image & & ! m_texture ) <nl> - { <nl> - g_OMXImage . GetTexture ( m_egl_image , & m_texture ) ; <nl> - return ; <nl> - } <nl> - CGLTexture : : CreateTextureObject ( ) ; <nl> - } <nl> - <nl> - void CPiTexture : : LoadToGPU ( ) <nl> - { <nl> - if ( m_egl_image ) <nl> - { <nl> - if ( m_loadedToGPU ) <nl> - { <nl> - / / nothing to load - probably same image ( no change ) <nl> - return ; <nl> - } <nl> - if ( m_texture = = 0 ) <nl> - { <nl> - / / Have OpenGL generate a texture object handle for us <nl> - / / this happens only one time - the first time the texture is loaded <nl> - CreateTextureObject ( ) ; <nl> - } <nl> - <nl> - / / Bind the texture object <nl> - glBindTexture ( GL_TEXTURE_2D , m_texture ) ; <nl> - <nl> - if ( IsMipmapped ( ) ) { <nl> - glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER , GL_LINEAR_MIPMAP_LINEAR ) ; <nl> - glGenerateMipmap ( GL_TEXTURE_2D ) ; <nl> - } <nl> - m_loadedToGPU = true ; <nl> - return ; <nl> - } <nl> - CGLTexture : : LoadToGPU ( ) ; <nl> - } <nl> - <nl> - void CPiTexture : : Update ( unsigned int width , unsigned int height , unsigned int pitch , unsigned int format , const unsigned char * pixels , bool loadToGPU ) <nl> - { <nl> - if ( m_egl_image ) <nl> - { <nl> - if ( loadToGPU ) <nl> - LoadToGPU ( ) ; <nl> - return ; <nl> - } <nl> - CGLTexture : : Update ( width , height , pitch , format , pixels , loadToGPU ) ; <nl> - } <nl> - <nl> - bool CPiTexture : : LoadFromFileInternal ( const std : : string & texturePath , unsigned int maxWidth , unsigned int maxHeight , bool requirePixels , const std : : string & strMimeType ) <nl> - { <nl> - if ( URIUtils : : HasExtension ( texturePath , " . jpg | . tbn " ) ) <nl> - { <nl> - COMXImageFile * file = g_OMXImage . LoadJpeg ( texturePath ) ; <nl> - if ( file ) <nl> - { <nl> - bool okay = false ; <nl> - int orientation = file - > GetOrientation ( ) ; <nl> - / / limit the sizes of jpegs ( even if we fail to decode ) <nl> - g_OMXImage . ClampLimits ( maxWidth , maxHeight , file - > GetWidth ( ) , file - > GetHeight ( ) , orientation & 4 ) ; <nl> - <nl> - if ( requirePixels ) <nl> - { <nl> - Allocate ( maxWidth , maxHeight , XB_FMT_A8R8G8B8 ) ; <nl> - if ( m_pixels & & COMXImage : : DecodeJpeg ( file , maxWidth , GetRows ( ) , GetPitch ( ) , ( void * ) m_pixels ) ) <nl> - okay = true ; <nl> - } <nl> - else <nl> - { <nl> - if ( g_OMXImage . DecodeJpegToTexture ( file , maxWidth , maxHeight , & m_egl_image ) & & m_egl_image ) <nl> - { <nl> - Allocate ( maxWidth , maxHeight , XB_FMT_A8R8G8B8 ) ; <nl> - okay = true ; <nl> - } <nl> - } <nl> - g_OMXImage . CloseJpeg ( file ) ; <nl> - if ( okay ) <nl> - { <nl> - m_hasAlpha = false ; <nl> - m_orientation = orientation ; <nl> - return true ; <nl> - } <nl> - } <nl> - } <nl> - return CGLTexture : : LoadFromFileInternal ( texturePath , maxWidth , maxHeight , requirePixels ) ; <nl> - } <nl> deleted file mode 100644 <nl> index 96ac1784744e . . 000000000000 <nl> mmm a / xbmc / guilib / TexturePi . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2013 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # include " TextureGL . h " <nl> - <nl> - # include " system_gl . h " <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * CGLTexture * / <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - class CPiTexture : public CGLTexture <nl> - { <nl> - public : <nl> - CPiTexture ( unsigned int width = 0 , unsigned int height = 0 , unsigned int format = XB_FMT_A8R8G8B8 ) ; <nl> - virtual ~ CPiTexture ( ) ; <nl> - void CreateTextureObject ( ) ; <nl> - void LoadToGPU ( ) ; <nl> - void Update ( unsigned int width , unsigned int height , unsigned int pitch , unsigned int format , const unsigned char * pixels , bool loadToGPU ) ; <nl> - void Allocate ( unsigned int width , unsigned int height , unsigned int format ) ; <nl> - bool LoadFromFileInternal ( const std : : string & texturePath , unsigned int maxWidth , unsigned int maxHeight , bool requirePixels , const std : : string & strMimeType = " " ) ; <nl> - <nl> - protected : <nl> - <nl> - private : <nl> - void * m_egl_image ; <nl> - } ; <nl> mmm a / xbmc / guilib / guiinfo / GUIInfoLabels . h <nl> ppp b / xbmc / guilib / guiinfo / GUIInfoLabels . h <nl> <nl> # define SYSTEM_PLATFORM_DARWIN_IOS 745 <nl> # define SYSTEM_PLATFORM_UWP 746 <nl> # define SYSTEM_PLATFORM_ANDROID 747 <nl> - # define SYSTEM_PLATFORM_LINUX_RASPBERRY_PI 748 <nl> + / / previously used by rpi 748 <nl> # define SYSTEM_PLATFORM_WIN10 749 <nl> <nl> # define SYSTEM_CAN_POWERDOWN 750 <nl> mmm a / xbmc / guilib / guiinfo / SystemGUIInfo . cpp <nl> ppp b / xbmc / guilib / guiinfo / SystemGUIInfo . cpp <nl> bool CSystemGUIInfo : : GetBool ( bool & value , const CGUIListItem * gitem , int context <nl> value = true ; <nl> # else <nl> value = false ; <nl> - # endif <nl> - return true ; <nl> - case SYSTEM_PLATFORM_LINUX_RASPBERRY_PI : <nl> - # if defined ( TARGET_RASPBERRY_PI ) <nl> - value = true ; <nl> - # else <nl> - value = false ; <nl> # endif <nl> return true ; <nl> case SYSTEM_MEDIA_DVD : <nl> mmm a / xbmc / peripherals / PeripheralTypes . h <nl> ppp b / xbmc / peripherals / PeripheralTypes . h <nl> enum PeripheralBusType <nl> PERIPHERAL_BUS_UNKNOWN = 0 , <nl> PERIPHERAL_BUS_USB , <nl> PERIPHERAL_BUS_PCI , <nl> - PERIPHERAL_BUS_RPI , <nl> PERIPHERAL_BUS_CEC , <nl> PERIPHERAL_BUS_ADDON , <nl> # ifdef TARGET_ANDROID <nl> class PeripheralTypeTranslator <nl> return " usb " ; <nl> case PERIPHERAL_BUS_PCI : <nl> return " pci " ; <nl> - case PERIPHERAL_BUS_RPI : <nl> - return " rpi " ; <nl> case PERIPHERAL_BUS_CEC : <nl> return " cec " ; <nl> case PERIPHERAL_BUS_ADDON : <nl> class PeripheralTypeTranslator <nl> return PERIPHERAL_BUS_USB ; <nl> else if ( strTypeLowerCase = = " pci " ) <nl> return PERIPHERAL_BUS_PCI ; <nl> - else if ( strTypeLowerCase = = " rpi " ) <nl> - return PERIPHERAL_BUS_RPI ; <nl> else if ( strTypeLowerCase = = " cec " ) <nl> return PERIPHERAL_BUS_CEC ; <nl> else if ( strTypeLowerCase = = " addon " ) <nl> mmm a / xbmc / peripherals / bus / virtual / PeripheralBusCEC . cpp <nl> ppp b / xbmc / peripherals / bus / virtual / PeripheralBusCEC . cpp <nl> bool CPeripheralBusCEC : : PerformDeviceScan ( PeripheralScanResults & results ) <nl> case ADAPTERTYPE_P8_DAUGHTERBOARD : <nl> result . m_mappedBusType = PERIPHERAL_BUS_USB ; <nl> break ; <nl> - case ADAPTERTYPE_RPI : <nl> - result . m_mappedBusType = PERIPHERAL_BUS_RPI ; <nl> - / * * the Pi ' s adapter cannot be removed , no need to rescan * / <nl> - m_bNeedsPolling = false ; <nl> - break ; <nl> default : <nl> break ; <nl> } <nl> mmm a / xbmc / pictures / Picture . cpp <nl> ppp b / xbmc / pictures / Picture . cpp <nl> <nl> # include " utils / URIUtils . h " <nl> # include " guilib / Texture . h " <nl> # include " guilib / imagefactory . h " <nl> - # if defined ( TARGET_RASPBERRY_PI ) <nl> - # include " cores / omxplayer / OMXImage . h " <nl> - # endif <nl> <nl> extern " C " { <nl> # include < libswscale / swscale . h > <nl> bool CPicture : : GetThumbnailFromSurface ( const unsigned char * buffer , int width , i <nl> bool CPicture : : CreateThumbnailFromSurface ( const unsigned char * buffer , int width , int height , int stride , const std : : string & thumbFile ) <nl> { <nl> CLog : : Log ( LOGDEBUG , " cached image ' % s ' size % dx % d " , CURL : : GetRedacted ( thumbFile ) . c_str ( ) , width , height ) ; <nl> - if ( URIUtils : : HasExtension ( thumbFile , " . jpg " ) ) <nl> - { <nl> - # if defined ( TARGET_RASPBERRY_PI ) <nl> - if ( COMXImage : : CreateThumbnailFromSurface ( const_cast < unsigned char * > ( buffer ) , width , height , XB_FMT_A8R8G8B8 , stride , thumbFile . c_str ( ) ) ) <nl> - return true ; <nl> - # endif <nl> - } <nl> <nl> unsigned char * thumb = NULL ; <nl> unsigned int thumbsize = 0 ; <nl> mmm a / xbmc / platform / linux / CMakeLists . txt <nl> ppp b / xbmc / platform / linux / CMakeLists . txt <nl> if ( DBUS_FOUND ) <nl> DBusUtil . h ) <nl> endif ( ) <nl> <nl> - if ( CORE_PLATFORM_NAME_LC STREQUAL rbpi ) <nl> - list ( APPEND SOURCES RBP . cpp <nl> - OMXCore . cpp <nl> - ScreenshotSurfaceRBP . cpp ) <nl> - list ( APPEND HEADERS RBP . h <nl> - DllBCM . h <nl> - DllOMX . h <nl> - OMXCore . h <nl> - ScreenshotSurfaceRBP . h ) <nl> - endif ( ) <nl> - <nl> core_add_library ( linuxsupport ) <nl> deleted file mode 100644 <nl> index e04bf0e99e1f . . 000000000000 <nl> mmm a / xbmc / platform / linux / DllBCM . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2005 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # ifndef __GNUC__ <nl> - # pragma warning ( push ) <nl> - # pragma warning ( disable : 4244 ) <nl> - # endif <nl> - <nl> - extern " C " { <nl> - # include < bcm_host . h > <nl> - } <nl> - <nl> - # include " DynamicDll . h " <nl> - # include " utils / log . h " <nl> - <nl> - # define USE_EXTERNAL_LIBBCM_HOST 1 <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - class DllBcmHostInterface <nl> - { <nl> - public : <nl> - virtual ~ DllBcmHostInterface ( ) { } <nl> - <nl> - virtual void bcm_host_init ( ) = 0 ; <nl> - virtual void bcm_host_deinit ( ) = 0 ; <nl> - virtual int32_t graphics_get_display_size ( const uint16_t display_number , uint32_t * width , uint32_t * height ) = 0 ; <nl> - virtual int vc_tv_power_off ( ) = 0 ; <nl> - virtual int vc_tv_sdtv_power_on ( SDTV_MODE_T mode , SDTV_OPTIONS_T * options ) = 0 ; <nl> - virtual int vc_tv_hdmi_power_on_preferred ( ) = 0 ; <nl> - virtual int vc_tv_hdmi_power_on_best ( uint32_t width , uint32_t height , uint32_t frame_rate , <nl> - HDMI_INTERLACED_T scan_mode , EDID_MODE_MATCH_FLAG_T match_flags ) = 0 ; <nl> - virtual int vc_tv_hdmi_power_on_best_3d ( uint32_t width , uint32_t height , uint32_t frame_rate , <nl> - HDMI_INTERLACED_T scan_mode , EDID_MODE_MATCH_FLAG_T match_flags ) = 0 ; <nl> - <nl> - virtual int vc_tv_hdmi_get_supported_modes_new ( HDMI_RES_GROUP_T group , TV_SUPPORTED_MODE_NEW_T * supported_modes , <nl> - uint32_t max_supported_modes , HDMI_RES_GROUP_T * preferred_group , <nl> - uint32_t * preferred_mode ) = 0 ; <nl> - virtual int vc_tv_hdmi_power_on_explicit_new ( HDMI_MODE_T mode , HDMI_RES_GROUP_T group , uint32_t code ) = 0 ; <nl> - virtual int vc_tv_hdmi_set_property ( const HDMI_PROPERTY_PARAM_T * property ) = 0 ; <nl> - virtual int vc_tv_get_display_state ( TV_DISPLAY_STATE_T * tvstate ) = 0 ; <nl> - virtual int vc_tv_show_info ( uint32_t show ) = 0 ; <nl> - virtual int vc_gencmd ( char * response , int maxlen , const char * string ) = 0 ; <nl> - virtual void vc_tv_register_callback ( TVSERVICE_CALLBACK_T callback , void * callback_data ) = 0 ; <nl> - virtual void vc_tv_unregister_callback ( TVSERVICE_CALLBACK_T callback ) = 0 ; <nl> - virtual void vc_cec_register_callback ( CECSERVICE_CALLBACK_T callback , void * callback_data ) = 0 ; <nl> - / / virtual void vc_cec_unregister_callback ( CECSERVICE_CALLBACK_T callback ) = 0 ; <nl> - virtual DISPMANX_DISPLAY_HANDLE_T vc_dispmanx_display_open ( uint32_t device ) = 0 ; <nl> - virtual DISPMANX_UPDATE_HANDLE_T vc_dispmanx_update_start ( int32_t priority ) = 0 ; <nl> - virtual DISPMANX_ELEMENT_HANDLE_T vc_dispmanx_element_add ( DISPMANX_UPDATE_HANDLE_T update , DISPMANX_DISPLAY_HANDLE_T display , <nl> - int32_t layer , const VC_RECT_T * dest_rect , DISPMANX_RESOURCE_HANDLE_T src , <nl> - const VC_RECT_T * src_rect , DISPMANX_PROTECTION_T protection , <nl> - VC_DISPMANX_ALPHA_T * alpha , <nl> - DISPMANX_CLAMP_T * clamp , DISPMANX_TRANSFORM_T transform ) = 0 ; <nl> - virtual int vc_dispmanx_update_submit_sync ( DISPMANX_UPDATE_HANDLE_T update ) = 0 ; <nl> - virtual int vc_dispmanx_update_submit ( DISPMANX_UPDATE_HANDLE_T update , DISPMANX_CALLBACK_FUNC_T cb_func , void * cb_arg ) = 0 ; <nl> - <nl> - virtual int vc_dispmanx_element_remove ( DISPMANX_UPDATE_HANDLE_T update , DISPMANX_ELEMENT_HANDLE_T element ) = 0 ; <nl> - virtual int vc_dispmanx_element_change_attributes ( DISPMANX_UPDATE_HANDLE_T update , <nl> - DISPMANX_ELEMENT_HANDLE_T element , <nl> - uint32_t change_flags , <nl> - int32_t layer , <nl> - uint8_t opacity , <nl> - const VC_RECT_T * dest_rect , <nl> - const VC_RECT_T * src_rect , <nl> - DISPMANX_RESOURCE_HANDLE_T mask , <nl> - DISPMANX_TRANSFORM_T transform ) = 0 ; <nl> - virtual int vc_dispmanx_display_close ( DISPMANX_DISPLAY_HANDLE_T display ) = 0 ; <nl> - virtual int vc_dispmanx_display_get_info ( DISPMANX_DISPLAY_HANDLE_T display , DISPMANX_MODEINFO_T * pinfo ) = 0 ; <nl> - virtual int vc_dispmanx_display_set_background ( DISPMANX_UPDATE_HANDLE_T update , DISPMANX_DISPLAY_HANDLE_T display , <nl> - uint8_t red , uint8_t green , uint8_t blue ) = 0 ; <nl> - virtual int vc_tv_hdmi_audio_supported ( uint32_t audio_format , uint32_t num_channels , <nl> - EDID_AudioSampleRate fs , uint32_t bitrate ) = 0 ; <nl> - } ; <nl> - <nl> - # if defined ( USE_EXTERNAL_LIBBCM_HOST ) <nl> - class DllBcmHost : public DllDynamic , DllBcmHostInterface <nl> - { <nl> - public : <nl> - virtual void bcm_host_init ( ) <nl> - { return : : bcm_host_init ( ) ; } ; <nl> - virtual void bcm_host_deinit ( ) <nl> - { return : : bcm_host_deinit ( ) ; } ; <nl> - virtual int32_t graphics_get_display_size ( const uint16_t display_number , uint32_t * width , uint32_t * height ) <nl> - { return : : graphics_get_display_size ( display_number , width , height ) ; } ; <nl> - virtual int vc_tv_power_off ( ) <nl> - { return : : vc_tv_power_off ( ) ; } <nl> - virtual int vc_tv_sdtv_power_on ( SDTV_MODE_T mode , SDTV_OPTIONS_T * options ) <nl> - { return : : vc_tv_sdtv_power_on ( mode , options ) ; } <nl> - virtual int vc_tv_hdmi_power_on_preferred ( ) <nl> - { return : : vc_tv_hdmi_power_on_preferred ( ) ; } <nl> - virtual int vc_tv_hdmi_power_on_best ( uint32_t width , uint32_t height , uint32_t frame_rate , <nl> - HDMI_INTERLACED_T scan_mode , EDID_MODE_MATCH_FLAG_T match_flags ) <nl> - { return : : vc_tv_hdmi_power_on_best ( width , height , frame_rate , scan_mode , match_flags ) ; } ; <nl> - virtual int vc_tv_hdmi_power_on_best_3d ( uint32_t width , uint32_t height , uint32_t frame_rate , <nl> - HDMI_INTERLACED_T scan_mode , EDID_MODE_MATCH_FLAG_T match_flags ) <nl> - { return : : vc_tv_hdmi_power_on_best_3d ( width , height , frame_rate , scan_mode , match_flags ) ; } ; <nl> - virtual int vc_tv_hdmi_get_supported_modes_new ( HDMI_RES_GROUP_T group , TV_SUPPORTED_MODE_NEW_T * supported_modes , <nl> - uint32_t max_supported_modes , HDMI_RES_GROUP_T * preferred_group , <nl> - uint32_t * preferred_mode ) <nl> - { return : : vc_tv_hdmi_get_supported_modes_new ( group , supported_modes , max_supported_modes , preferred_group , preferred_mode ) ; } ; <nl> - virtual int vc_tv_hdmi_power_on_explicit_new ( HDMI_MODE_T mode , HDMI_RES_GROUP_T group , uint32_t code ) <nl> - { return : : vc_tv_hdmi_power_on_explicit_new ( mode , group , code ) ; } ; <nl> - virtual int vc_tv_hdmi_set_property ( const HDMI_PROPERTY_PARAM_T * property ) <nl> - { return : : vc_tv_hdmi_set_property ( property ) ; } ; <nl> - virtual int vc_tv_get_display_state ( TV_DISPLAY_STATE_T * tvstate ) <nl> - { return : : vc_tv_get_display_state ( tvstate ) ; } ; <nl> - virtual int vc_tv_show_info ( uint32_t show ) <nl> - { return : : vc_tv_show_info ( show ) ; } ; <nl> - virtual int vc_gencmd ( char * response , int maxlen , const char * string ) <nl> - { return : : vc_gencmd ( response , maxlen , string ) ; } ; <nl> - virtual void vc_tv_register_callback ( TVSERVICE_CALLBACK_T callback , void * callback_data ) <nl> - { : : vc_tv_register_callback ( callback , callback_data ) ; } ; <nl> - virtual void vc_tv_unregister_callback ( TVSERVICE_CALLBACK_T callback ) <nl> - { : : vc_tv_unregister_callback ( callback ) ; } ; <nl> - virtual void vc_cec_register_callback ( CECSERVICE_CALLBACK_T callback , void * callback_data ) <nl> - { : : vc_cec_register_callback ( callback , callback_data ) ; } ; <nl> - / / virtual void vc_cec_unregister_callback ( CECSERVICE_CALLBACK_T callback ) <nl> - / / { : : vc_cec_unregister_callback ( callback ) ; } ; <nl> - virtual DISPMANX_DISPLAY_HANDLE_T vc_dispmanx_display_open ( uint32_t device ) <nl> - { return : : vc_dispmanx_display_open ( device ) ; } ; <nl> - virtual DISPMANX_UPDATE_HANDLE_T vc_dispmanx_update_start ( int32_t priority ) <nl> - { return : : vc_dispmanx_update_start ( priority ) ; } ; <nl> - virtual DISPMANX_ELEMENT_HANDLE_T vc_dispmanx_element_add ( DISPMANX_UPDATE_HANDLE_T update , DISPMANX_DISPLAY_HANDLE_T display , <nl> - int32_t layer , const VC_RECT_T * dest_rect , DISPMANX_RESOURCE_HANDLE_T src , <nl> - const VC_RECT_T * src_rect , DISPMANX_PROTECTION_T protection , <nl> - VC_DISPMANX_ALPHA_T * alpha , <nl> - DISPMANX_CLAMP_T * clamp , DISPMANX_TRANSFORM_T transform ) <nl> - { return : : vc_dispmanx_element_add ( update , display , layer , dest_rect , src , src_rect , protection , alpha , clamp , transform ) ; } ; <nl> - virtual int vc_dispmanx_update_submit_sync ( DISPMANX_UPDATE_HANDLE_T update ) <nl> - { return : : vc_dispmanx_update_submit_sync ( update ) ; } ; <nl> - virtual int vc_dispmanx_update_submit ( DISPMANX_UPDATE_HANDLE_T update , DISPMANX_CALLBACK_FUNC_T cb_func , void * cb_arg ) <nl> - { return : : vc_dispmanx_update_submit ( update , cb_func , cb_arg ) ; } ; <nl> - virtual int vc_dispmanx_element_remove ( DISPMANX_UPDATE_HANDLE_T update , DISPMANX_ELEMENT_HANDLE_T element ) <nl> - { return : : vc_dispmanx_element_remove ( update , element ) ; } ; <nl> - virtual int vc_dispmanx_element_change_attributes ( DISPMANX_UPDATE_HANDLE_T update , <nl> - DISPMANX_ELEMENT_HANDLE_T element , <nl> - uint32_t change_flags , <nl> - int32_t layer , <nl> - uint8_t opacity , <nl> - const VC_RECT_T * dest_rect , <nl> - const VC_RECT_T * src_rect , <nl> - DISPMANX_RESOURCE_HANDLE_T mask , <nl> - DISPMANX_TRANSFORM_T transform ) <nl> - { return : : vc_dispmanx_element_change_attributes ( update , element , change_flags , layer , opacity , dest_rect , src_rect , mask , transform ) ; } ; <nl> - virtual int vc_dispmanx_display_close ( DISPMANX_DISPLAY_HANDLE_T display ) <nl> - { return : : vc_dispmanx_display_close ( display ) ; } ; <nl> - virtual int vc_dispmanx_display_get_info ( DISPMANX_DISPLAY_HANDLE_T display , DISPMANX_MODEINFO_T * pinfo ) <nl> - { return : : vc_dispmanx_display_get_info ( display , pinfo ) ; } ; <nl> - virtual int vc_dispmanx_display_set_background ( DISPMANX_UPDATE_HANDLE_T update , DISPMANX_DISPLAY_HANDLE_T display , <nl> - uint8_t red , uint8_t green , uint8_t blue ) <nl> - { return : : vc_dispmanx_display_set_background ( update , display , red , green , blue ) ; } ; <nl> - virtual int vc_tv_hdmi_audio_supported ( uint32_t audio_format , uint32_t num_channels , <nl> - EDID_AudioSampleRate fs , uint32_t bitrate ) <nl> - { return : : vc_tv_hdmi_audio_supported ( audio_format , num_channels , fs , bitrate ) ; } ; <nl> - virtual bool ResolveExports ( ) <nl> - { return true ; } <nl> - virtual bool Load ( ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " DllBcm : Using omx system library " ) ; <nl> - return true ; <nl> - } <nl> - virtual void Unload ( ) { } <nl> - } ; <nl> - # else <nl> - class DllBcmHost : public DllDynamic , DllBcmHostInterface <nl> - { <nl> - DECLARE_DLL_WRAPPER ( DllBcmHost , " / opt / vc / lib / libbcm_host . so " ) <nl> - <nl> - DEFINE_METHOD0 ( void , bcm_host_init ) <nl> - DEFINE_METHOD0 ( void , bcm_host_deinit ) <nl> - DEFINE_METHOD3 ( int32_t , graphics_get_display_size , ( const uint16_t p1 , uint32_t * p2 , uint32_t * p3 ) ) <nl> - DEFINE_METHOD5 ( int , vc_tv_hdmi_power_on_best , ( uint32_t p1 , uint32_t p2 , uint32_t p3 , <nl> - HDMI_INTERLACED_T p4 , EDID_MODE_MATCH_FLAG_T p5 ) ) <nl> - DEFINE_METHOD5 ( int , vc_tv_hdmi_power_on_best_3d , ( uint32_t p1 , uint32_t p2 , uint32_t p3 , <nl> - HDMI_INTERLACED_T p4 , EDID_MODE_MATCH_FLAG_T p5 ) ) <nl> - DEFINE_METHOD5 ( int , vc_tv_hdmi_get_supported_modes_new , ( HDMI_RES_GROUP_T p1 , TV_SUPPORTED_MODE_NEW_T * p2 , <nl> - uint32_t p3 , HDMI_RES_GROUP_T * p4 , uint32_t * p5 ) ) <nl> - DEFINE_METHOD3 ( int , vc_tv_hdmi_power_on_explicit_new , ( HDMI_MODE_T p1 , HDMI_RES_GROUP_T p2 , uint32_t p3 ) ) <nl> - DEFINE_METHOD1 ( int , vc_tv_hdmi_set_property , ( const HDMI_PROPERTY_PARAM_T * property ) ) <nl> - DEFINE_METHOD1 ( int , vc_tv_get_display_state , ( TV_DISPLAY_STATE_T * p1 ) ) <nl> - DEFINE_METHOD1 ( int , vc_tv_show_info , ( uint32_t p1 ) ) <nl> - DEFINE_METHOD3 ( int , vc_gencmd , ( char * p1 , int p2 , const char * p3 ) ) <nl> - <nl> - DEFINE_METHOD2 ( void , vc_tv_register_callback , ( TVSERVICE_CALLBACK_T p1 , void * p2 ) ) <nl> - DEFINE_METHOD1 ( void , vc_tv_unregister_callback , ( TVSERVICE_CALLBACK_T p1 ) ) <nl> - <nl> - DEFINE_METHOD2 ( void , vc_cec_register_callback , ( CECSERVICE_CALLBACK_T p1 , void * p2 ) ) <nl> - / / DEFINE_METHOD1 ( void , vc_cec_unregister_callback , ( CECSERVICE_CALLBACK_T p1 ) ) <nl> - DEFINE_METHOD1 ( DISPMANX_DISPLAY_HANDLE_T , vc_dispmanx_display_open , ( uint32_t p1 ) ) <nl> - DEFINE_METHOD1 ( DISPMANX_UPDATE_HANDLE_T , vc_dispmanx_update_start , ( int32_t p1 ) ) <nl> - DEFINE_METHOD10 ( DISPMANX_ELEMENT_HANDLE_T , vc_dispmanx_element_add , ( DISPMANX_UPDATE_HANDLE_T p1 , DISPMANX_DISPLAY_HANDLE_T p2 , <nl> - int32_t p3 , const VC_RECT_T * p4 , DISPMANX_RESOURCE_HANDLE_T p5 , <nl> - const VC_RECT_T * p6 , DISPMANX_PROTECTION_T p7 , <nl> - VC_DISPMANX_ALPHA_T * p8 , <nl> - DISPMANX_CLAMP_T * p9 , DISPMANX_TRANSFORM_T p10 ) ) <nl> - DEFINE_METHOD1 ( int , vc_dispmanx_update_submit_sync , ( DISPMANX_UPDATE_HANDLE_T p1 ) ) <nl> - DEFINE_METHOD3 ( int , vc_dispmanx_update_submit , ( DISPMANX_UPDATE_HANDLE_T p1 , DISPMANX_CALLBACK_FUNC_T p2 , void * p3 ) ) <nl> - DEFINE_METHOD2 ( int , vc_dispmanx_element_remove , ( DISPMANX_UPDATE_HANDLE_T p1 , DISPMANX_ELEMENT_HANDLE_T p2 ) ) <nl> - DEFINE_METHOD9 ( int , vc_dispmanx_element_change_attributes , ( DISPMANX_UPDATE_HANDLE_T p1 , <nl> - DISPMANX_ELEMENT_HANDLE_T p2 , <nl> - uint32_t p3 , <nl> - int32_t p4 , <nl> - uint8_t p5 , <nl> - const VC_RECT_T * p6 , <nl> - const VC_RECT_T * p7rect , <nl> - DISPMANX_RESOURCE_HANDLE_T p8 , <nl> - DISPMANX_TRANSFORM_T p9 ) ) <nl> - DEFINE_METHOD1 ( int , vc_dispmanx_display_close , ( DISPMANX_DISPLAY_HANDLE_T p1 ) ) <nl> - DEFINE_METHOD2 ( int , vc_dispmanx_display_get_info , ( DISPMANX_DISPLAY_HANDLE_T p1 , DISPMANX_MODEINFO_T * p2 ) ) <nl> - DEFINE_METHOD5 ( int , vc_dispmanx_display_set_background , ( DISPMANX_UPDATE_HANDLE_T p1 , DISPMANX_DISPLAY_HANDLE_T p2 , <nl> - uint8_t p3 , uint8_t p4 , uint8_t p5 ) ) <nl> - DEFINE_METHOD4 ( int , vc_tv_hdmi_audio_supported , ( uint32_t p1 , uint32_t p2 , EDID_AudioSampleRate p3 , uint32_t p4 ) ) <nl> - <nl> - BEGIN_METHOD_RESOLVE ( ) <nl> - RESOLVE_METHOD ( bcm_host_init ) <nl> - RESOLVE_METHOD ( bcm_host_deinit ) <nl> - RESOLVE_METHOD ( graphics_get_display_size ) <nl> - RESOLVE_METHOD ( vc_tv_hdmi_power_on_best ) <nl> - RESOLVE_METHOD ( vc_tv_hdmi_power_on_best_3d ) <nl> - RESOLVE_METHOD ( vc_tv_hdmi_get_supported_modes_new ) <nl> - RESOLVE_METHOD ( vc_tv_hdmi_power_on_explicit_new ) <nl> - RESOLVE_METHOD ( vc_tv_hdmi_set_property ) <nl> - RESOLVE_METHOD ( vc_tv_get_display_state ) <nl> - RESOLVE_METHOD ( vc_tv_show_info ) <nl> - RESOLVE_METHOD ( vc_gencmd ) <nl> - RESOLVE_METHOD ( vc_tv_register_callback ) <nl> - RESOLVE_METHOD ( vc_tv_unregister_callback ) <nl> - RESOLVE_METHOD ( vc_cec_register_callback ) <nl> - / / RESOLVE_METHOD ( vc_cec_unregister_callback ) <nl> - RESOLVE_METHOD ( vc_dispmanx_display_open ) <nl> - RESOLVE_METHOD ( vc_dispmanx_update_start ) <nl> - RESOLVE_METHOD ( vc_dispmanx_element_add ) <nl> - RESOLVE_METHOD ( vc_dispmanx_update_submit_sync ) <nl> - RESOLVE_METHOD ( vc_dispmanx_update_submit ) <nl> - RESOLVE_METHOD ( vc_dispmanx_element_remove ) <nl> - RESOLVE_METHOD ( vc_dispmanx_element_change_attributes ) <nl> - RESOLVE_METHOD ( vc_dispmanx_display_close ) <nl> - RESOLVE_METHOD ( vc_dispmanx_display_get_info ) <nl> - RESOLVE_METHOD ( vc_dispmanx_display_set_background ) <nl> - RESOLVE_METHOD ( vc_tv_hdmi_audio_supported ) <nl> - END_METHOD_RESOLVE ( ) <nl> - <nl> - public : <nl> - virtual bool Load ( ) <nl> - { <nl> - return DllDynamic : : Load ( ) ; <nl> - } <nl> - } ; <nl> - # endif <nl> deleted file mode 100644 <nl> index 76437968278b . . 000000000000 <nl> mmm a / xbmc / platform / linux / DllOMX . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2005 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # ifndef __GNUC__ <nl> - # pragma warning ( push ) <nl> - # pragma warning ( disable : 4244 ) <nl> - # endif <nl> - <nl> - # include " DynamicDll . h " <nl> - # include " utils / log . h " <nl> - <nl> - # include < IL / OMX_Core . h > <nl> - # include < IL / OMX_Component . h > <nl> - # include < IL / OMX_Index . h > <nl> - # include < IL / OMX_Image . h > <nl> - # include < IL / OMX_Video . h > <nl> - # include < IL / OMX_Broadcom . h > <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - class DllOMXInterface <nl> - { <nl> - public : <nl> - virtual ~ DllOMXInterface ( ) { } <nl> - <nl> - virtual OMX_ERRORTYPE OMX_Init ( void ) = 0 ; <nl> - virtual OMX_ERRORTYPE OMX_Deinit ( void ) = 0 ; <nl> - virtual OMX_ERRORTYPE OMX_GetHandle ( OMX_HANDLETYPE * pHandle , OMX_STRING cComponentName , OMX_PTR pAppData , OMX_CALLBACKTYPE * pCallBacks ) = 0 ; <nl> - virtual OMX_ERRORTYPE OMX_FreeHandle ( OMX_HANDLETYPE hComponent ) = 0 ; <nl> - virtual OMX_ERRORTYPE OMX_GetComponentsOfRole ( OMX_STRING role , OMX_U32 * pNumComps , OMX_U8 * * compNames ) = 0 ; <nl> - virtual OMX_ERRORTYPE OMX_GetRolesOfComponent ( OMX_STRING compName , OMX_U32 * pNumRoles , OMX_U8 * * roles ) = 0 ; <nl> - virtual OMX_ERRORTYPE OMX_ComponentNameEnum ( OMX_STRING cComponentName , OMX_U32 nNameLength , OMX_U32 nIndex ) = 0 ; <nl> - virtual OMX_ERRORTYPE OMX_SetupTunnel ( OMX_HANDLETYPE hOutput , OMX_U32 nPortOutput , OMX_HANDLETYPE hInput , OMX_U32 nPortInput ) = 0 ; <nl> - <nl> - } ; <nl> - <nl> - # if ( defined USE_EXTERNAL_OMX ) <nl> - class DllOMX : public DllDynamic , DllOMXInterface <nl> - { <nl> - public : <nl> - virtual OMX_ERRORTYPE OMX_Init ( void ) <nl> - { return : : OMX_Init ( ) ; } ; <nl> - virtual OMX_ERRORTYPE OMX_Deinit ( void ) <nl> - { return : : OMX_Deinit ( ) ; } ; <nl> - virtual OMX_ERRORTYPE OMX_GetHandle ( OMX_HANDLETYPE * pHandle , OMX_STRING cComponentName , OMX_PTR pAppData , OMX_CALLBACKTYPE * pCallBacks ) <nl> - { return : : OMX_GetHandle ( pHandle , cComponentName , pAppData , pCallBacks ) ; } ; <nl> - virtual OMX_ERRORTYPE OMX_FreeHandle ( OMX_HANDLETYPE hComponent ) <nl> - { return : : OMX_FreeHandle ( hComponent ) ; } ; <nl> - virtual OMX_ERRORTYPE OMX_GetComponentsOfRole ( OMX_STRING role , OMX_U32 * pNumComps , OMX_U8 * * compNames ) <nl> - { return : : OMX_GetComponentsOfRole ( role , pNumComps , compNames ) ; } ; <nl> - virtual OMX_ERRORTYPE OMX_GetRolesOfComponent ( OMX_STRING compName , OMX_U32 * pNumRoles , OMX_U8 * * roles ) <nl> - { return : : OMX_GetRolesOfComponent ( compName , pNumRoles , roles ) ; } ; <nl> - virtual OMX_ERRORTYPE OMX_ComponentNameEnum ( OMX_STRING cComponentName , OMX_U32 nNameLength , OMX_U32 nIndex ) <nl> - { return : : OMX_ComponentNameEnum ( cComponentName , nNameLength , nIndex ) ; } ; <nl> - virtual OMX_ERRORTYPE OMX_SetupTunnel ( OMX_HANDLETYPE hOutput , OMX_U32 nPortOutput , OMX_HANDLETYPE hInput , OMX_U32 nPortInput ) <nl> - { return : : OMX_SetupTunnel ( hOutput , nPortOutput , hInput , nPortInput ) ; } ; <nl> - virtual bool ResolveExports ( ) <nl> - { return true ; } <nl> - virtual bool Load ( ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " DllOMX : Using omx system library " ) ; <nl> - return true ; <nl> - } <nl> - virtual void Unload ( ) { } <nl> - } ; <nl> - # else <nl> - class DllOMX : public DllDynamic , DllOMXInterface <nl> - { <nl> - DECLARE_DLL_WRAPPER ( DllOMX , " libopenmaxil . so " ) <nl> - <nl> - DEFINE_METHOD0 ( OMX_ERRORTYPE , OMX_Init ) <nl> - DEFINE_METHOD0 ( OMX_ERRORTYPE , OMX_Deinit ) <nl> - DEFINE_METHOD4 ( OMX_ERRORTYPE , OMX_GetHandle , ( OMX_HANDLETYPE * p1 , OMX_STRING p2 , OMX_PTR p3 , OMX_CALLBACKTYPE * p4 ) ) <nl> - DEFINE_METHOD1 ( OMX_ERRORTYPE , OMX_FreeHandle , ( OMX_HANDLETYPE p1 ) ) <nl> - DEFINE_METHOD3 ( OMX_ERRORTYPE , OMX_GetComponentsOfRole , ( OMX_STRING p1 , OMX_U32 * p2 , OMX_U8 * * p3 ) ) <nl> - DEFINE_METHOD3 ( OMX_ERRORTYPE , OMX_GetRolesOfComponent , ( OMX_STRING p1 , OMX_U32 * p2 , OMX_U8 * * p3 ) ) <nl> - DEFINE_METHOD3 ( OMX_ERRORTYPE , OMX_ComponentNameEnum , ( OMX_STRING p1 , OMX_U32 p2 , OMX_U32 p3 ) ) <nl> - DEFINE_METHOD4 ( OMX_ERRORTYPE , OMX_SetupTunnel , ( OMX_HANDLETYPE p1 , OMX_U32 p2 , OMX_HANDLETYPE p3 , OMX_U32 p4 ) ) ; <nl> - BEGIN_METHOD_RESOLVE ( ) <nl> - RESOLVE_METHOD ( OMX_Init ) <nl> - RESOLVE_METHOD ( OMX_Deinit ) <nl> - RESOLVE_METHOD ( OMX_GetHandle ) <nl> - RESOLVE_METHOD ( OMX_FreeHandle ) <nl> - RESOLVE_METHOD ( OMX_GetComponentsOfRole ) <nl> - RESOLVE_METHOD ( OMX_GetRolesOfComponent ) <nl> - RESOLVE_METHOD ( OMX_ComponentNameEnum ) <nl> - RESOLVE_METHOD ( OMX_SetupTunnel ) <nl> - END_METHOD_RESOLVE ( ) <nl> - <nl> - public : <nl> - virtual bool Load ( ) <nl> - { <nl> - return DllDynamic : : Load ( ) ; <nl> - } <nl> - } ; <nl> - # endif <nl> deleted file mode 100644 <nl> index b2eb3acf4544 . . 000000000000 <nl> mmm a / xbmc / platform / linux / OMXCore . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2010 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # include " OMXCore . h " <nl> - <nl> - # include " utils / log . h " <nl> - <nl> - # include " platform / linux / RBP . h " <nl> - <nl> - # include < cassert > <nl> - # include < math . h > <nl> - <nl> - # include < sys / time . h > <nl> - <nl> - / / # define OMX_DEBUG_EVENTS <nl> - / / # define OMX_DEBUG_EVENTHANDLER <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - # define CLASSNAME " COMXCoreComponent " <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - static void add_timespecs ( struct timespec & time , long millisecs ) <nl> - { <nl> - long long nsec = time . tv_nsec + ( long long ) millisecs * 1000000 ; <nl> - while ( nsec > 1000000000 ) <nl> - { <nl> - time . tv_sec + = 1 ; <nl> - nsec - = 1000000000 ; <nl> - } <nl> - time . tv_nsec = nsec ; <nl> - } <nl> - <nl> - <nl> - COMXCoreTunnel : : COMXCoreTunnel ( ) <nl> - { <nl> - m_src_component = NULL ; <nl> - m_dst_component = NULL ; <nl> - m_src_port = 0 ; <nl> - m_dst_port = 0 ; <nl> - m_tunnel_set = false ; <nl> - m_DllOMX = g_RBP . GetDllOMX ( ) ; <nl> - } <nl> - <nl> - COMXCoreTunnel : : ~ COMXCoreTunnel ( ) <nl> - { <nl> - } <nl> - <nl> - void COMXCoreTunnel : : Initialize ( COMXCoreComponent * src_component , unsigned int src_port , COMXCoreComponent * dst_component , unsigned int dst_port ) <nl> - { <nl> - m_src_component = src_component ; <nl> - m_src_port = src_port ; <nl> - m_dst_component = dst_component ; <nl> - m_dst_port = dst_port ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreTunnel : : Deestablish ( bool noWait ) <nl> - { <nl> - if ( ! m_src_component | | ! m_dst_component | | ! IsInitialized ( ) ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - if ( m_src_component - > GetComponent ( ) ) <nl> - { <nl> - omx_err = m_src_component - > DisablePort ( m_src_port , false ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreTunnel : : Deestablish - Error disable port % d on component % s omx_err ( 0x % 08x ) " , <nl> - m_src_port , m_src_component - > GetName ( ) . c_str ( ) , ( int ) omx_err ) ; <nl> - } <nl> - } <nl> - <nl> - if ( m_dst_component - > GetComponent ( ) ) <nl> - { <nl> - omx_err = m_dst_component - > DisablePort ( m_dst_port , false ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreTunnel : : Deestablish - Error disable port % d on component % s omx_err ( 0x % 08x ) " , <nl> - m_dst_port , m_dst_component - > GetName ( ) . c_str ( ) , ( int ) omx_err ) ; <nl> - } <nl> - } <nl> - <nl> - if ( m_src_component - > GetComponent ( ) ) <nl> - { <nl> - omx_err = m_src_component - > WaitForCommand ( OMX_CommandPortDisable , m_src_port ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreTunnel : : Deestablish - Error WaitForCommand port % d on component % s omx_err ( 0x % 08x ) " , <nl> - m_dst_port , m_src_component - > GetName ( ) . c_str ( ) , ( int ) omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - } <nl> - <nl> - if ( m_dst_component - > GetComponent ( ) ) <nl> - { <nl> - omx_err = m_dst_component - > WaitForCommand ( OMX_CommandPortDisable , m_dst_port ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreTunnel : : Deestablish - Error WaitForCommand port % d on component % s omx_err ( 0x % 08x ) " , <nl> - m_dst_port , m_dst_component - > GetName ( ) . c_str ( ) , ( int ) omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - } <nl> - <nl> - if ( m_src_component - > GetComponent ( ) ) <nl> - { <nl> - omx_err = m_DllOMX - > OMX_SetupTunnel ( m_src_component - > GetComponent ( ) , m_src_port , NULL , 0 ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , <nl> - " COMXCoreTunnel : : Deestablish - could not unset tunnel on comp src % s port % d " <nl> - " omx_err ( 0x % 08x ) " , <nl> - m_src_component - > GetName ( ) . c_str ( ) , m_src_port , ( int ) omx_err ) ; <nl> - } <nl> - } <nl> - <nl> - if ( m_dst_component - > GetComponent ( ) ) <nl> - { <nl> - omx_err = m_DllOMX - > OMX_SetupTunnel ( m_dst_component - > GetComponent ( ) , m_dst_port , NULL , 0 ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , <nl> - " COMXCoreTunnel : : Deestablish - could not unset tunnel on comp dst % s port % d " <nl> - " omx_err ( 0x % 08x ) " , <nl> - m_dst_component - > GetName ( ) . c_str ( ) , m_dst_port , ( int ) omx_err ) ; <nl> - } <nl> - } <nl> - <nl> - m_tunnel_set = false ; <nl> - <nl> - return OMX_ErrorNone ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreTunnel : : Establish ( bool enable_ports / * = true * / , bool disable_ports / * = false * / ) <nl> - { <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - OMX_PARAM_U32TYPE param ; <nl> - OMX_INIT_STRUCTURE ( param ) ; <nl> - <nl> - if ( ! m_src_component | | ! m_dst_component ) <nl> - { <nl> - return OMX_ErrorUndefined ; <nl> - } <nl> - <nl> - if ( m_src_component - > GetState ( ) = = OMX_StateLoaded ) <nl> - { <nl> - omx_err = m_src_component - > SetStateForComponent ( OMX_StateIdle ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreTunnel : : Establish - Error setting state to idle % s omx_err ( 0x % 08x ) " , <nl> - m_src_component - > GetName ( ) . c_str ( ) , ( int ) omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - } <nl> - <nl> - if ( m_src_component - > GetComponent ( ) & & disable_ports ) <nl> - { <nl> - omx_err = m_src_component - > DisablePort ( m_src_port , false ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreTunnel : : Establish - Error disable port % d on component % s omx_err ( 0x % 08x ) " , <nl> - m_src_port , m_src_component - > GetName ( ) . c_str ( ) , ( int ) omx_err ) ; <nl> - } <nl> - } <nl> - <nl> - if ( m_dst_component - > GetComponent ( ) & & disable_ports ) <nl> - { <nl> - omx_err = m_dst_component - > DisablePort ( m_dst_port , false ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreTunnel : : Establish - Error disable port % d on component % s omx_err ( 0x % 08x ) " , <nl> - m_dst_port , m_dst_component - > GetName ( ) . c_str ( ) , ( int ) omx_err ) ; <nl> - } <nl> - } <nl> - <nl> - if ( m_src_component - > GetComponent ( ) & & disable_ports ) <nl> - { <nl> - omx_err = m_src_component - > WaitForCommand ( OMX_CommandPortDisable , m_src_port ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreTunnel : : Establish - Error WaitForCommand port % d on component % s omx_err ( 0x % 08x ) " , <nl> - m_dst_port , m_src_component - > GetName ( ) . c_str ( ) , ( int ) omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - } <nl> - <nl> - if ( m_dst_component - > GetComponent ( ) & & disable_ports ) <nl> - { <nl> - omx_err = m_dst_component - > WaitForCommand ( OMX_CommandPortDisable , m_dst_port ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreTunnel : : Establish - Error WaitForCommand port % d on component % s omx_err ( 0x % 08x ) " , <nl> - m_dst_port , m_dst_component - > GetName ( ) . c_str ( ) , ( int ) omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - } <nl> - <nl> - if ( m_src_component - > GetComponent ( ) & & m_dst_component - > GetComponent ( ) ) <nl> - { <nl> - omx_err = m_DllOMX - > OMX_SetupTunnel ( m_src_component - > GetComponent ( ) , m_src_port , m_dst_component - > GetComponent ( ) , m_dst_port ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , <nl> - " COMXCoreTunnel : : Establish - could not setup tunnel src % s port % d dst % s port % d " <nl> - " omx_err ( 0x % 08x ) " , <nl> - m_src_component - > GetName ( ) . c_str ( ) , m_src_port , m_dst_component - > GetName ( ) . c_str ( ) , <nl> - m_dst_port , ( int ) omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreTunnel : : Establish - could not setup tunnel " ) ; <nl> - return OMX_ErrorUndefined ; <nl> - } <nl> - <nl> - m_tunnel_set = true ; <nl> - <nl> - if ( m_src_component - > GetComponent ( ) & & enable_ports ) <nl> - { <nl> - omx_err = m_src_component - > EnablePort ( m_src_port , false ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreTunnel : : Establish - Error enable port % d on component % s omx_err ( 0x % 08x ) " , <nl> - m_src_port , m_src_component - > GetName ( ) . c_str ( ) , ( int ) omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - } <nl> - <nl> - if ( m_dst_component - > GetComponent ( ) & & enable_ports ) <nl> - { <nl> - omx_err = m_dst_component - > EnablePort ( m_dst_port , false ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreTunnel : : Establish - Error enable port % d on component % s omx_err ( 0x % 08x ) " , <nl> - m_dst_port , m_dst_component - > GetName ( ) . c_str ( ) , ( int ) omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - } <nl> - <nl> - if ( m_dst_component - > GetComponent ( ) & & enable_ports ) <nl> - { <nl> - omx_err = m_dst_component - > WaitForCommand ( OMX_CommandPortEnable , m_dst_port ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - return omx_err ; <nl> - } <nl> - <nl> - if ( m_dst_component - > GetState ( ) = = OMX_StateLoaded ) <nl> - { <nl> - omx_err = m_dst_component - > SetStateForComponent ( OMX_StateIdle ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : Establish - Error setting state to idle % s omx_err ( 0x % 08x ) " , <nl> - m_src_component - > GetName ( ) . c_str ( ) , ( int ) omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - if ( m_src_component - > GetComponent ( ) & & enable_ports ) <nl> - { <nl> - omx_err = m_src_component - > WaitForCommand ( OMX_CommandPortEnable , m_src_port ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - return omx_err ; <nl> - } <nl> - } <nl> - <nl> - return OMX_ErrorNone ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - COMXCoreComponent : : COMXCoreComponent ( ) <nl> - { <nl> - m_input_port = 0 ; <nl> - m_output_port = 0 ; <nl> - m_handle = NULL ; <nl> - <nl> - m_input_alignment = 0 ; <nl> - m_input_buffer_size = 0 ; <nl> - m_input_buffer_count = 0 ; <nl> - <nl> - m_output_alignment = 0 ; <nl> - m_output_buffer_size = 0 ; <nl> - m_output_buffer_count = 0 ; <nl> - m_flush_input = false ; <nl> - m_flush_output = false ; <nl> - m_resource_error = false ; <nl> - <nl> - m_eos = false ; <nl> - <nl> - m_exit = false ; <nl> - <nl> - m_omx_events . clear ( ) ; <nl> - m_ignore_error = OMX_ErrorNone ; <nl> - <nl> - pthread_mutex_init ( & m_omx_input_mutex , NULL ) ; <nl> - pthread_mutex_init ( & m_omx_output_mutex , NULL ) ; <nl> - pthread_mutex_init ( & m_omx_event_mutex , NULL ) ; <nl> - pthread_mutex_init ( & m_omx_eos_mutex , NULL ) ; <nl> - pthread_cond_init ( & m_input_buffer_cond , NULL ) ; <nl> - pthread_cond_init ( & m_output_buffer_cond , NULL ) ; <nl> - pthread_cond_init ( & m_omx_event_cond , NULL ) ; <nl> - <nl> - m_DllOMX = g_RBP . GetDllOMX ( ) ; <nl> - } <nl> - <nl> - COMXCoreComponent : : ~ COMXCoreComponent ( ) <nl> - { <nl> - Deinitialize ( ) ; <nl> - <nl> - pthread_mutex_destroy ( & m_omx_input_mutex ) ; <nl> - pthread_mutex_destroy ( & m_omx_output_mutex ) ; <nl> - pthread_mutex_destroy ( & m_omx_event_mutex ) ; <nl> - pthread_mutex_destroy ( & m_omx_eos_mutex ) ; <nl> - pthread_cond_destroy ( & m_input_buffer_cond ) ; <nl> - pthread_cond_destroy ( & m_output_buffer_cond ) ; <nl> - pthread_cond_destroy ( & m_omx_event_cond ) ; <nl> - } <nl> - <nl> - void COMXCoreComponent : : TransitionToStateLoaded ( ) <nl> - { <nl> - if ( ! m_handle ) <nl> - return ; <nl> - <nl> - if ( GetState ( ) ! = OMX_StateLoaded & & GetState ( ) ! = OMX_StateIdle ) <nl> - SetStateForComponent ( OMX_StateIdle ) ; <nl> - <nl> - if ( GetState ( ) ! = OMX_StateLoaded ) <nl> - SetStateForComponent ( OMX_StateLoaded ) ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : EmptyThisBuffer ( OMX_BUFFERHEADERTYPE * omx_buffer ) <nl> - { <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " COMXCoreComponent : : EmptyThisBuffer component ( % s ) % p " , <nl> - m_componentName . c_str ( ) , omx_buffer ) ; <nl> - # endif <nl> - if ( ! m_handle | | ! omx_buffer ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - omx_err = OMX_EmptyThisBuffer ( m_handle , omx_buffer ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , <nl> - " COMXCoreComponent : : EmptyThisBuffer component ( % s ) - failed with result ( 0x % x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - } <nl> - <nl> - return omx_err ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : FillThisBuffer ( OMX_BUFFERHEADERTYPE * omx_buffer ) <nl> - { <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " COMXCoreComponent : : FillThisBuffer component ( % s ) % p " , m_componentName . c_str ( ) , <nl> - omx_buffer ) ; <nl> - # endif <nl> - if ( ! m_handle | | ! omx_buffer ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - omx_err = OMX_FillThisBuffer ( m_handle , omx_buffer ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , <nl> - " COMXCoreComponent : : FillThisBuffer component ( % s ) - failed with result ( 0x % x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - } <nl> - <nl> - return omx_err ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : FreeOutputBuffer ( OMX_BUFFERHEADERTYPE * omx_buffer ) <nl> - { <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - if ( ! m_handle | | ! omx_buffer ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - omx_err = OMX_FreeBuffer ( m_handle , m_output_port , omx_buffer ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , <nl> - " COMXCoreComponent : : FreeOutputBuffer component ( % s ) - failed with result ( 0x % x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - } <nl> - <nl> - return omx_err ; <nl> - } <nl> - <nl> - void COMXCoreComponent : : FlushAll ( ) <nl> - { <nl> - FlushInput ( ) ; <nl> - FlushOutput ( ) ; <nl> - } <nl> - <nl> - void COMXCoreComponent : : FlushInput ( ) <nl> - { <nl> - if ( ! m_handle | | m_resource_error ) <nl> - return ; <nl> - <nl> - OMX_ERRORTYPE omx_err = OMX_SendCommand ( m_handle , OMX_CommandFlush , m_input_port , NULL ) ; <nl> - <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : FlushInput - Error on component % s omx_err ( 0x % 08x ) " , <nl> - m_componentName . c_str ( ) , ( int ) omx_err ) ; <nl> - } <nl> - WaitForCommand ( OMX_CommandFlush , m_input_port ) ; <nl> - } <nl> - <nl> - void COMXCoreComponent : : FlushOutput ( ) <nl> - { <nl> - if ( ! m_handle | | m_resource_error ) <nl> - return ; <nl> - <nl> - OMX_ERRORTYPE omx_err = OMX_SendCommand ( m_handle , OMX_CommandFlush , m_output_port , NULL ) ; <nl> - <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : FlushOutput - Error on component % s omx_err ( 0x % 08x ) " , <nl> - m_componentName . c_str ( ) , ( int ) omx_err ) ; <nl> - } <nl> - WaitForCommand ( OMX_CommandFlush , m_output_port ) ; <nl> - } <nl> - <nl> - / / timeout in milliseconds <nl> - OMX_BUFFERHEADERTYPE * COMXCoreComponent : : GetInputBuffer ( long timeout / * = 200 * / ) <nl> - { <nl> - OMX_BUFFERHEADERTYPE * omx_input_buffer = NULL ; <nl> - <nl> - if ( ! m_handle ) <nl> - return NULL ; <nl> - <nl> - pthread_mutex_lock ( & m_omx_input_mutex ) ; <nl> - struct timespec endtime ; <nl> - clock_gettime ( CLOCK_REALTIME , & endtime ) ; <nl> - add_timespecs ( endtime , timeout ) ; <nl> - while ( ! m_flush_input ) <nl> - { <nl> - if ( m_resource_error ) <nl> - break ; <nl> - if ( ! m_omx_input_available . empty ( ) ) <nl> - { <nl> - omx_input_buffer = m_omx_input_available . front ( ) ; <nl> - m_omx_input_available . pop ( ) ; <nl> - break ; <nl> - } <nl> - <nl> - int retcode = pthread_cond_timedwait ( & m_input_buffer_cond , & m_omx_input_mutex , & endtime ) ; <nl> - if ( retcode ! = 0 ) { <nl> - if ( timeout ! = 0 ) <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : GetInputBuffer % s wait event timeout " , <nl> - m_componentName . c_str ( ) ) ; <nl> - break ; <nl> - } <nl> - } <nl> - pthread_mutex_unlock ( & m_omx_input_mutex ) ; <nl> - return omx_input_buffer ; <nl> - } <nl> - <nl> - OMX_BUFFERHEADERTYPE * COMXCoreComponent : : GetOutputBuffer ( long timeout / * = 200 * / ) <nl> - { <nl> - OMX_BUFFERHEADERTYPE * omx_output_buffer = NULL ; <nl> - <nl> - if ( ! m_handle ) <nl> - return NULL ; <nl> - <nl> - pthread_mutex_lock ( & m_omx_output_mutex ) ; <nl> - struct timespec endtime ; <nl> - clock_gettime ( CLOCK_REALTIME , & endtime ) ; <nl> - add_timespecs ( endtime , timeout ) ; <nl> - while ( ! m_flush_output ) <nl> - { <nl> - if ( m_resource_error ) <nl> - break ; <nl> - if ( ! m_omx_output_available . empty ( ) ) <nl> - { <nl> - omx_output_buffer = m_omx_output_available . front ( ) ; <nl> - m_omx_output_available . pop ( ) ; <nl> - break ; <nl> - } <nl> - <nl> - int retcode = pthread_cond_timedwait ( & m_output_buffer_cond , & m_omx_output_mutex , & endtime ) ; <nl> - if ( retcode ! = 0 ) { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : GetOutputBuffer % s wait event timeout " , <nl> - m_componentName . c_str ( ) ) ; <nl> - break ; <nl> - } <nl> - } <nl> - pthread_mutex_unlock ( & m_omx_output_mutex ) ; <nl> - <nl> - return omx_output_buffer ; <nl> - } <nl> - <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : WaitForInputDone ( long timeout / * = 200 * / ) <nl> - { <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - pthread_mutex_lock ( & m_omx_input_mutex ) ; <nl> - struct timespec endtime ; <nl> - clock_gettime ( CLOCK_REALTIME , & endtime ) ; <nl> - add_timespecs ( endtime , timeout ) ; <nl> - while ( m_input_buffer_count ! = m_omx_input_available . size ( ) ) <nl> - { <nl> - if ( m_resource_error ) <nl> - break ; <nl> - int retcode = pthread_cond_timedwait ( & m_input_buffer_cond , & m_omx_input_mutex , & endtime ) ; <nl> - if ( retcode ! = 0 ) { <nl> - if ( timeout ! = 0 ) <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : WaitForInputDone % s wait event timeout " , <nl> - m_componentName . c_str ( ) ) ; <nl> - omx_err = OMX_ErrorTimeout ; <nl> - break ; <nl> - } <nl> - } <nl> - pthread_mutex_unlock ( & m_omx_input_mutex ) ; <nl> - return omx_err ; <nl> - } <nl> - <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : WaitForOutputDone ( long timeout / * = 200 * / ) <nl> - { <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - pthread_mutex_lock ( & m_omx_output_mutex ) ; <nl> - struct timespec endtime ; <nl> - clock_gettime ( CLOCK_REALTIME , & endtime ) ; <nl> - add_timespecs ( endtime , timeout ) ; <nl> - while ( m_output_buffer_count ! = m_omx_output_available . size ( ) ) <nl> - { <nl> - if ( m_resource_error ) <nl> - break ; <nl> - int retcode = pthread_cond_timedwait ( & m_output_buffer_cond , & m_omx_output_mutex , & endtime ) ; <nl> - if ( retcode ! = 0 ) { <nl> - if ( timeout ! = 0 ) <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : WaitForOutputDone % s wait event timeout " , <nl> - m_componentName . c_str ( ) ) ; <nl> - omx_err = OMX_ErrorTimeout ; <nl> - break ; <nl> - } <nl> - } <nl> - pthread_mutex_unlock ( & m_omx_output_mutex ) ; <nl> - return omx_err ; <nl> - } <nl> - <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : AllocInputBuffers ( ) <nl> - { <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - if ( ! m_handle ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - OMX_PARAM_PORTDEFINITIONTYPE portFormat ; <nl> - OMX_INIT_STRUCTURE ( portFormat ) ; <nl> - portFormat . nPortIndex = m_input_port ; <nl> - <nl> - omx_err = OMX_GetParameter ( m_handle , OMX_IndexParamPortDefinition , & portFormat ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - return omx_err ; <nl> - <nl> - if ( GetState ( ) ! = OMX_StateIdle ) <nl> - { <nl> - if ( GetState ( ) ! = OMX_StateLoaded ) <nl> - SetStateForComponent ( OMX_StateLoaded ) ; <nl> - <nl> - SetStateForComponent ( OMX_StateIdle ) ; <nl> - } <nl> - <nl> - omx_err = EnablePort ( m_input_port , false ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - return omx_err ; <nl> - <nl> - m_input_alignment = portFormat . nBufferAlignment ; <nl> - m_input_buffer_count = portFormat . nBufferCountActual ; <nl> - m_input_buffer_size = portFormat . nBufferSize ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , <nl> - " COMXCoreComponent : : AllocInputBuffers component ( % s ) - port ( % d ) , nBufferCountMin ( % u ) , " <nl> - " nBufferCountActual ( % u ) , nBufferSize ( % u ) , nBufferAlignment ( % u ) " , <nl> - m_componentName . c_str ( ) , GetInputPort ( ) , portFormat . nBufferCountMin , <nl> - portFormat . nBufferCountActual , portFormat . nBufferSize , portFormat . nBufferAlignment ) ; <nl> - <nl> - for ( size_t i = 0 ; i < portFormat . nBufferCountActual ; i + + ) <nl> - { <nl> - OMX_BUFFERHEADERTYPE * buffer = NULL ; <nl> - <nl> - omx_err = OMX_AllocateBuffer ( m_handle , & buffer , m_input_port , NULL , portFormat . nBufferSize ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , <nl> - " COMXCoreComponent : : AllocInputBuffers component ( % s ) - OMX_UseBuffer failed with " <nl> - " omx_err ( 0x % x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - buffer - > nInputPortIndex = m_input_port ; <nl> - buffer - > nFilledLen = 0 ; <nl> - buffer - > nOffset = 0 ; <nl> - buffer - > pAppPrivate = ( void * ) i ; <nl> - m_omx_input_buffers . push_back ( buffer ) ; <nl> - m_omx_input_available . push ( buffer ) ; <nl> - } <nl> - <nl> - omx_err = WaitForCommand ( OMX_CommandPortEnable , m_input_port ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , <nl> - " COMXCoreComponent : : AllocInputBuffers WaitForCommand : OMX_CommandPortEnable failed on " <nl> - " % s omx_err ( 0x % 08x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - <nl> - m_flush_input = false ; <nl> - <nl> - return omx_err ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : AllocOutputBuffers ( ) <nl> - { <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - if ( ! m_handle ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - OMX_PARAM_PORTDEFINITIONTYPE portFormat ; <nl> - OMX_INIT_STRUCTURE ( portFormat ) ; <nl> - portFormat . nPortIndex = m_output_port ; <nl> - <nl> - omx_err = OMX_GetParameter ( m_handle , OMX_IndexParamPortDefinition , & portFormat ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - return omx_err ; <nl> - <nl> - if ( GetState ( ) ! = OMX_StateIdle ) <nl> - { <nl> - if ( GetState ( ) ! = OMX_StateLoaded ) <nl> - SetStateForComponent ( OMX_StateLoaded ) ; <nl> - <nl> - SetStateForComponent ( OMX_StateIdle ) ; <nl> - } <nl> - <nl> - omx_err = EnablePort ( m_output_port , false ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - return omx_err ; <nl> - <nl> - m_output_alignment = portFormat . nBufferAlignment ; <nl> - m_output_buffer_count = portFormat . nBufferCountActual ; <nl> - m_output_buffer_size = portFormat . nBufferSize ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , <nl> - " COMXCoreComponent : : AllocOutputBuffers component ( % s ) - port ( % d ) , nBufferCountMin ( % u ) , " <nl> - " nBufferCountActual ( % u ) , nBufferSize ( % u ) nBufferAlignment ( % u ) " , <nl> - m_componentName . c_str ( ) , m_output_port , portFormat . nBufferCountMin , <nl> - portFormat . nBufferCountActual , portFormat . nBufferSize , portFormat . nBufferAlignment ) ; <nl> - <nl> - for ( size_t i = 0 ; i < portFormat . nBufferCountActual ; i + + ) <nl> - { <nl> - OMX_BUFFERHEADERTYPE * buffer = NULL ; <nl> - <nl> - omx_err = OMX_AllocateBuffer ( m_handle , & buffer , m_output_port , NULL , portFormat . nBufferSize ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , <nl> - " COMXCoreComponent : : AllocOutputBuffers component ( % s ) - OMX_UseBuffer failed with " <nl> - " omx_err ( 0x % x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - buffer - > nOutputPortIndex = m_output_port ; <nl> - buffer - > nFilledLen = 0 ; <nl> - buffer - > nOffset = 0 ; <nl> - buffer - > pAppPrivate = ( void * ) i ; <nl> - m_omx_output_buffers . push_back ( buffer ) ; <nl> - m_omx_output_available . push ( buffer ) ; <nl> - } <nl> - <nl> - omx_err = WaitForCommand ( OMX_CommandPortEnable , m_output_port ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , <nl> - " COMXCoreComponent : : AllocOutputBuffers WaitForCommand : OMX_CommandPortEnable failed " <nl> - " on % s omx_err ( 0x % 08x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - <nl> - m_flush_output = false ; <nl> - <nl> - return omx_err ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : FreeInputBuffers ( ) <nl> - { <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - if ( ! m_handle ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - if ( m_omx_input_buffers . empty ( ) ) <nl> - return OMX_ErrorNone ; <nl> - <nl> - m_flush_input = true ; <nl> - <nl> - omx_err = DisablePort ( m_input_port , false ) ; <nl> - <nl> - pthread_mutex_lock ( & m_omx_input_mutex ) ; <nl> - pthread_cond_broadcast ( & m_input_buffer_cond ) ; <nl> - <nl> - for ( size_t i = 0 ; i < m_omx_input_buffers . size ( ) ; i + + ) <nl> - { <nl> - omx_err = OMX_FreeBuffer ( m_handle , m_input_port , m_omx_input_buffers [ i ] ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , <nl> - " COMXCoreComponent : : FreeInputBuffers error deallocate omx input buffer on " <nl> - " component % s omx_err ( 0x % 08x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - } <nl> - } <nl> - pthread_mutex_unlock ( & m_omx_input_mutex ) ; <nl> - <nl> - omx_err = WaitForCommand ( OMX_CommandPortDisable , m_input_port ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , <nl> - " COMXCoreComponent : : FreeInputBuffers WaitForCommand : OMX_CommandPortDisable failed on " <nl> - " % s omx_err ( 0x % 08x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - } <nl> - <nl> - WaitForInputDone ( 1000 ) ; <nl> - <nl> - pthread_mutex_lock ( & m_omx_input_mutex ) ; <nl> - assert ( m_omx_input_buffers . size ( ) = = m_omx_input_available . size ( ) ) ; <nl> - <nl> - m_omx_input_buffers . clear ( ) ; <nl> - <nl> - while ( ! m_omx_input_available . empty ( ) ) <nl> - m_omx_input_available . pop ( ) ; <nl> - <nl> - m_input_alignment = 0 ; <nl> - m_input_buffer_size = 0 ; <nl> - m_input_buffer_count = 0 ; <nl> - <nl> - pthread_mutex_unlock ( & m_omx_input_mutex ) ; <nl> - <nl> - return omx_err ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : FreeOutputBuffers ( ) <nl> - { <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - if ( ! m_handle ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - if ( m_omx_output_buffers . empty ( ) ) <nl> - return OMX_ErrorNone ; <nl> - <nl> - m_flush_output = true ; <nl> - <nl> - omx_err = DisablePort ( m_output_port , false ) ; <nl> - <nl> - pthread_mutex_lock ( & m_omx_output_mutex ) ; <nl> - pthread_cond_broadcast ( & m_output_buffer_cond ) ; <nl> - <nl> - for ( size_t i = 0 ; i < m_omx_output_buffers . size ( ) ; i + + ) <nl> - { <nl> - omx_err = OMX_FreeBuffer ( m_handle , m_output_port , m_omx_output_buffers [ i ] ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , <nl> - " COMXCoreComponent : : FreeOutputBuffers error deallocate omx output buffer on " <nl> - " component % s omx_err ( 0x % 08x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - } <nl> - } <nl> - pthread_mutex_unlock ( & m_omx_output_mutex ) ; <nl> - <nl> - omx_err = WaitForCommand ( OMX_CommandPortDisable , m_output_port ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , <nl> - " COMXCoreComponent : : FreeOutputBuffers WaitForCommand : OMX_CommandPortDisable failed " <nl> - " on % s omx_err ( 0x % 08x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - } <nl> - <nl> - WaitForOutputDone ( 1000 ) ; <nl> - <nl> - pthread_mutex_lock ( & m_omx_output_mutex ) ; <nl> - assert ( m_omx_output_buffers . size ( ) = = m_omx_output_available . size ( ) ) ; <nl> - <nl> - m_omx_output_buffers . clear ( ) ; <nl> - <nl> - while ( ! m_omx_output_available . empty ( ) ) <nl> - m_omx_output_available . pop ( ) ; <nl> - <nl> - m_output_alignment = 0 ; <nl> - m_output_buffer_size = 0 ; <nl> - m_output_buffer_count = 0 ; <nl> - <nl> - pthread_mutex_unlock ( & m_omx_output_mutex ) ; <nl> - <nl> - return omx_err ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : DisableAllPorts ( ) <nl> - { <nl> - if ( ! m_handle ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - OMX_INDEXTYPE idxTypes [ ] = { <nl> - OMX_IndexParamAudioInit , <nl> - OMX_IndexParamImageInit , <nl> - OMX_IndexParamVideoInit , <nl> - OMX_IndexParamOtherInit <nl> - } ; <nl> - <nl> - OMX_PORT_PARAM_TYPE ports ; <nl> - OMX_INIT_STRUCTURE ( ports ) ; <nl> - <nl> - int i ; <nl> - for ( i = 0 ; i < 4 ; i + + ) <nl> - { <nl> - omx_err = OMX_GetParameter ( m_handle , idxTypes [ i ] , & ports ) ; <nl> - if ( omx_err = = OMX_ErrorNone ) { <nl> - <nl> - uint32_t j ; <nl> - for ( j = 0 ; j < ports . nPorts ; j + + ) <nl> - { <nl> - OMX_PARAM_PORTDEFINITIONTYPE portFormat ; <nl> - OMX_INIT_STRUCTURE ( portFormat ) ; <nl> - portFormat . nPortIndex = ports . nStartPortNumber + j ; <nl> - <nl> - omx_err = OMX_GetParameter ( m_handle , OMX_IndexParamPortDefinition , & portFormat ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - if ( portFormat . bEnabled = = OMX_FALSE ) <nl> - continue ; <nl> - } <nl> - <nl> - omx_err = OMX_SendCommand ( m_handle , OMX_CommandPortDisable , ports . nStartPortNumber + j , NULL ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : DisableAllPorts - Error disable port % d on component % s omx_err ( 0x % 08x ) " , <nl> - ( int ) ( ports . nStartPortNumber ) + j , m_componentName . c_str ( ) , ( int ) omx_err ) ; <nl> - } <nl> - omx_err = WaitForCommand ( OMX_CommandPortDisable , ports . nStartPortNumber + j ) ; <nl> - if ( omx_err ! = OMX_ErrorNone & & omx_err ! = OMX_ErrorSameState ) <nl> - return omx_err ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - return OMX_ErrorNone ; <nl> - } <nl> - <nl> - void COMXCoreComponent : : RemoveEvent ( OMX_EVENTTYPE eEvent , OMX_U32 nData1 , OMX_U32 nData2 ) <nl> - { <nl> - for ( std : : vector < omx_event > : : iterator it = m_omx_events . begin ( ) ; it ! = m_omx_events . end ( ) ; ) <nl> - { <nl> - omx_event event = * it ; <nl> - <nl> - if ( event . eEvent = = eEvent & & event . nData1 = = nData1 & & event . nData2 = = nData2 ) <nl> - { <nl> - it = m_omx_events . erase ( it ) ; <nl> - continue ; <nl> - } <nl> - + + it ; <nl> - } <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : AddEvent ( OMX_EVENTTYPE eEvent , OMX_U32 nData1 , OMX_U32 nData2 ) <nl> - { <nl> - omx_event event ; <nl> - <nl> - event . eEvent = eEvent ; <nl> - event . nData1 = nData1 ; <nl> - event . nData2 = nData2 ; <nl> - <nl> - pthread_mutex_lock ( & m_omx_event_mutex ) ; <nl> - RemoveEvent ( eEvent , nData1 , nData2 ) ; <nl> - m_omx_events . push_back ( event ) ; <nl> - / / this allows ( all ) blocked tasks to be awoken <nl> - pthread_cond_broadcast ( & m_omx_event_cond ) ; <nl> - pthread_mutex_unlock ( & m_omx_event_mutex ) ; <nl> - <nl> - # ifdef OMX_DEBUG_EVENTS <nl> - CLog : : Log ( LOGDEBUG , <nl> - " COMXCoreComponent : : AddEvent % s add event event . eEvent 0x % 08x event . nData1 0x % 08x " <nl> - " event . nData2 % d " , <nl> - m_componentName . c_str ( ) , ( int ) event . eEvent , ( int ) event . nData1 , ( int ) event . nData2 ) ; <nl> - # endif <nl> - <nl> - return OMX_ErrorNone ; <nl> - } <nl> - <nl> - / / timeout in milliseconds <nl> - OMX_ERRORTYPE COMXCoreComponent : : WaitForEvent ( OMX_EVENTTYPE eventType , long timeout ) <nl> - { <nl> - # ifdef OMX_DEBUG_EVENTS <nl> - CLog : : Log ( LOGDEBUG , " COMXCoreComponent : : WaitForEvent % s wait event 0x % 08x " , <nl> - m_componentName . c_str ( ) , ( int ) eventType ) ; <nl> - # endif <nl> - <nl> - pthread_mutex_lock ( & m_omx_event_mutex ) ; <nl> - struct timespec endtime ; <nl> - clock_gettime ( CLOCK_REALTIME , & endtime ) ; <nl> - add_timespecs ( endtime , timeout ) ; <nl> - while ( true ) <nl> - { <nl> - for ( std : : vector < omx_event > : : iterator it = m_omx_events . begin ( ) ; it ! = m_omx_events . end ( ) ; + + it ) <nl> - { <nl> - omx_event event = * it ; <nl> - <nl> - # ifdef OMX_DEBUG_EVENTS <nl> - CLog : : Log ( LOGDEBUG , <nl> - " COMXCoreComponent : : WaitForEvent % s inlist event event . eEvent 0x % 08x event . nData1 " <nl> - " 0x % 08x event . nData2 % d " , <nl> - m_componentName . c_str ( ) , ( int ) event . eEvent , ( int ) event . nData1 , ( int ) event . nData2 ) ; <nl> - # endif <nl> - <nl> - <nl> - if ( event . eEvent = = OMX_EventError & & event . nData1 = = ( OMX_U32 ) OMX_ErrorSameState & & event . nData2 = = 1 ) <nl> - { <nl> - # ifdef OMX_DEBUG_EVENTS <nl> - CLog : : Log ( LOGDEBUG , <nl> - " COMXCoreComponent : : WaitForEvent % s remove event event . eEvent 0x % 08x " <nl> - " event . nData1 0x % 08x event . nData2 % d " , <nl> - m_componentName . c_str ( ) , ( int ) event . eEvent , ( int ) event . nData1 , ( int ) event . nData2 ) ; <nl> - # endif <nl> - m_omx_events . erase ( it ) ; <nl> - pthread_mutex_unlock ( & m_omx_event_mutex ) ; <nl> - return OMX_ErrorNone ; <nl> - } <nl> - else if ( event . eEvent = = OMX_EventError ) <nl> - { <nl> - m_omx_events . erase ( it ) ; <nl> - pthread_mutex_unlock ( & m_omx_event_mutex ) ; <nl> - return ( OMX_ERRORTYPE ) event . nData1 ; <nl> - } <nl> - else if ( event . eEvent = = eventType ) <nl> - { <nl> - # ifdef OMX_DEBUG_EVENTS <nl> - CLog : : Log ( LOGDEBUG , <nl> - " COMXCoreComponent : : WaitForEvent % s remove event event . eEvent 0x % 08x " <nl> - " event . nData1 0x % 08x event . nData2 % d " , <nl> - m_componentName . c_str ( ) , ( int ) event . eEvent , ( int ) event . nData1 , ( int ) event . nData2 ) ; <nl> - # endif <nl> - <nl> - m_omx_events . erase ( it ) ; <nl> - pthread_mutex_unlock ( & m_omx_event_mutex ) ; <nl> - return OMX_ErrorNone ; <nl> - } <nl> - } <nl> - <nl> - if ( m_resource_error ) <nl> - break ; <nl> - int retcode = pthread_cond_timedwait ( & m_omx_event_cond , & m_omx_event_mutex , & endtime ) ; <nl> - if ( retcode ! = 0 ) <nl> - { <nl> - if ( timeout > 0 ) <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : WaitForEvent % s wait event 0x % 08x timeout % ld " , <nl> - m_componentName . c_str ( ) , ( int ) eventType , timeout ) ; <nl> - pthread_mutex_unlock ( & m_omx_event_mutex ) ; <nl> - return OMX_ErrorTimeout ; <nl> - } <nl> - } <nl> - pthread_mutex_unlock ( & m_omx_event_mutex ) ; <nl> - return OMX_ErrorNone ; <nl> - } <nl> - <nl> - / / timeout in milliseconds <nl> - OMX_ERRORTYPE COMXCoreComponent : : WaitForCommand ( OMX_U32 command , OMX_U32 nData2 , long timeout ) <nl> - { <nl> - # ifdef OMX_DEBUG_EVENTS <nl> - CLog : : Log ( LOGDEBUG , <nl> - " COMXCoreComponent : : WaitForCommand % s wait event . eEvent 0x % 08x event . command 0x % 08x " <nl> - " event . nData2 % d " , <nl> - m_componentName . c_str ( ) , ( int ) OMX_EventCmdComplete , ( int ) command , ( int ) nData2 ) ; <nl> - # endif <nl> - <nl> - pthread_mutex_lock ( & m_omx_event_mutex ) ; <nl> - struct timespec endtime ; <nl> - clock_gettime ( CLOCK_REALTIME , & endtime ) ; <nl> - add_timespecs ( endtime , timeout ) ; <nl> - while ( true ) <nl> - { <nl> - for ( std : : vector < omx_event > : : iterator it = m_omx_events . begin ( ) ; it ! = m_omx_events . end ( ) ; + + it ) <nl> - { <nl> - omx_event event = * it ; <nl> - <nl> - # ifdef OMX_DEBUG_EVENTS <nl> - CLog : : Log ( LOGDEBUG , <nl> - " COMXCoreComponent : : WaitForCommand % s inlist event event . eEvent 0x % 08x " <nl> - " event . nData1 0x % 08x event . nData2 % d " , <nl> - m_componentName . c_str ( ) , ( int ) event . eEvent , ( int ) event . nData1 , ( int ) event . nData2 ) ; <nl> - # endif <nl> - if ( event . eEvent = = OMX_EventError & & event . nData1 = = ( OMX_U32 ) OMX_ErrorSameState & & event . nData2 = = 1 ) <nl> - { <nl> - # ifdef OMX_DEBUG_EVENTS <nl> - CLog : : Log ( LOGDEBUG , <nl> - " COMXCoreComponent : : WaitForCommand % s remove event event . eEvent 0x % 08x " <nl> - " event . nData1 0x % 08x event . nData2 % d " , <nl> - m_componentName . c_str ( ) , ( int ) event . eEvent , ( int ) event . nData1 , ( int ) event . nData2 ) ; <nl> - # endif <nl> - <nl> - m_omx_events . erase ( it ) ; <nl> - pthread_mutex_unlock ( & m_omx_event_mutex ) ; <nl> - return OMX_ErrorNone ; <nl> - } <nl> - else if ( event . eEvent = = OMX_EventError ) <nl> - { <nl> - m_omx_events . erase ( it ) ; <nl> - pthread_mutex_unlock ( & m_omx_event_mutex ) ; <nl> - return ( OMX_ERRORTYPE ) event . nData1 ; <nl> - } <nl> - else if ( event . eEvent = = OMX_EventCmdComplete & & event . nData1 = = command & & event . nData2 = = nData2 ) <nl> - { <nl> - <nl> - # ifdef OMX_DEBUG_EVENTS <nl> - CLog : : Log ( LOGDEBUG , <nl> - " COMXCoreComponent : : WaitForCommand % s remove event event . eEvent 0x % 08x " <nl> - " event . nData1 0x % 08x event . nData2 % d " , <nl> - m_componentName . c_str ( ) , ( int ) event . eEvent , ( int ) event . nData1 , ( int ) event . nData2 ) ; <nl> - # endif <nl> - <nl> - m_omx_events . erase ( it ) ; <nl> - pthread_mutex_unlock ( & m_omx_event_mutex ) ; <nl> - return OMX_ErrorNone ; <nl> - } <nl> - } <nl> - <nl> - if ( m_resource_error ) <nl> - break ; <nl> - int retcode = pthread_cond_timedwait ( & m_omx_event_cond , & m_omx_event_mutex , & endtime ) ; <nl> - if ( retcode ! = 0 ) { <nl> - CLog : : Log ( LOGERROR , <nl> - " COMXCoreComponent : : WaitForCommand % s wait timeout event . eEvent 0x % 08x " <nl> - " event . command 0x % 08x event . nData2 % d " , <nl> - m_componentName . c_str ( ) , ( int ) OMX_EventCmdComplete , ( int ) command , ( int ) nData2 ) ; <nl> - <nl> - pthread_mutex_unlock ( & m_omx_event_mutex ) ; <nl> - return OMX_ErrorTimeout ; <nl> - } <nl> - } <nl> - pthread_mutex_unlock ( & m_omx_event_mutex ) ; <nl> - return OMX_ErrorNone ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : SetStateForComponent ( OMX_STATETYPE state ) <nl> - { <nl> - if ( ! m_handle ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - OMX_STATETYPE state_actual = OMX_StateMax ; <nl> - <nl> - if ( state = = state_actual ) <nl> - return OMX_ErrorNone ; <nl> - <nl> - omx_err = OMX_SendCommand ( m_handle , OMX_CommandStateSet , state , 0 ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - if ( omx_err = = OMX_ErrorSameState ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : SetStateForComponent - % s same state " , <nl> - m_componentName . c_str ( ) ) ; <nl> - omx_err = OMX_ErrorNone ; <nl> - } <nl> - else <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : SetStateForComponent - % s failed with omx_err ( 0x % x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - omx_err = WaitForCommand ( OMX_CommandStateSet , state ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : WaitForCommand - % s failed with omx_err ( 0x % x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - } <nl> - } <nl> - return omx_err ; <nl> - } <nl> - <nl> - OMX_STATETYPE COMXCoreComponent : : GetState ( ) const <nl> - { <nl> - if ( ! m_handle ) <nl> - return ( OMX_STATETYPE ) 0 ; <nl> - <nl> - OMX_STATETYPE state ; <nl> - <nl> - OMX_GetState ( m_handle , & state ) ; <nl> - return state ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : SetParameter ( OMX_INDEXTYPE paramIndex , OMX_PTR paramStruct ) <nl> - { <nl> - if ( ! m_handle ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - OMX_ERRORTYPE omx_err ; <nl> - <nl> - omx_err = OMX_SetParameter ( m_handle , paramIndex , paramStruct ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : SetParameter - % s failed with omx_err ( 0x % x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - } <nl> - return omx_err ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : GetParameter ( OMX_INDEXTYPE paramIndex , OMX_PTR paramStruct ) const <nl> - { <nl> - if ( ! m_handle ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - OMX_ERRORTYPE omx_err ; <nl> - <nl> - omx_err = OMX_GetParameter ( m_handle , paramIndex , paramStruct ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : GetParameter - % s failed with omx_err ( 0x % x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - } <nl> - return omx_err ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : SetConfig ( OMX_INDEXTYPE configIndex , OMX_PTR configStruct ) <nl> - { <nl> - if ( ! m_handle ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - OMX_ERRORTYPE omx_err ; <nl> - <nl> - omx_err = OMX_SetConfig ( m_handle , configIndex , configStruct ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : SetConfig - % s failed with omx_err ( 0x % x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - } <nl> - return omx_err ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : GetConfig ( OMX_INDEXTYPE configIndex , OMX_PTR configStruct ) const <nl> - { <nl> - if ( ! m_handle ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - OMX_ERRORTYPE omx_err ; <nl> - <nl> - omx_err = OMX_GetConfig ( m_handle , configIndex , configStruct ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : GetConfig - % s failed with omx_err ( 0x % x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - } <nl> - return omx_err ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : SendCommand ( OMX_COMMANDTYPE cmd , OMX_U32 cmdParam , OMX_PTR cmdParamData ) <nl> - { <nl> - if ( ! m_handle ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - OMX_ERRORTYPE omx_err ; <nl> - <nl> - omx_err = OMX_SendCommand ( m_handle , cmd , cmdParam , cmdParamData ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : SendCommand - % s failed with omx_err ( 0x % x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - } <nl> - return omx_err ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : EnablePort ( unsigned int port , bool wait ) <nl> - { <nl> - if ( ! m_handle ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - OMX_PARAM_PORTDEFINITIONTYPE portFormat ; <nl> - OMX_INIT_STRUCTURE ( portFormat ) ; <nl> - portFormat . nPortIndex = port ; <nl> - <nl> - OMX_ERRORTYPE omx_err = OMX_GetParameter ( m_handle , OMX_IndexParamPortDefinition , & portFormat ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : EnablePort - Error get port % d status on component % s omx_err ( 0x % 08x ) " , <nl> - port , m_componentName . c_str ( ) , ( int ) omx_err ) ; <nl> - } <nl> - <nl> - if ( portFormat . bEnabled = = OMX_FALSE ) <nl> - { <nl> - omx_err = OMX_SendCommand ( m_handle , OMX_CommandPortEnable , port , NULL ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : EnablePort - Error enable port % d on component % s omx_err ( 0x % 08x ) " , <nl> - port , m_componentName . c_str ( ) , ( int ) omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - else <nl> - { <nl> - if ( wait ) <nl> - omx_err = WaitForCommand ( OMX_CommandPortEnable , port ) ; <nl> - } <nl> - } <nl> - return omx_err ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : DisablePort ( unsigned int port , bool wait ) <nl> - { <nl> - if ( ! m_handle ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - OMX_PARAM_PORTDEFINITIONTYPE portFormat ; <nl> - OMX_INIT_STRUCTURE ( portFormat ) ; <nl> - portFormat . nPortIndex = port ; <nl> - <nl> - OMX_ERRORTYPE omx_err = OMX_GetParameter ( m_handle , OMX_IndexParamPortDefinition , & portFormat ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : DisablePort - Error get port % d status on component % s omx_err ( 0x % 08x ) " , <nl> - port , m_componentName . c_str ( ) , ( int ) omx_err ) ; <nl> - } <nl> - <nl> - if ( portFormat . bEnabled = = OMX_TRUE ) <nl> - { <nl> - omx_err = OMX_SendCommand ( m_handle , OMX_CommandPortDisable , port , NULL ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : DIsablePort - Error disable port % d on component % s omx_err ( 0x % 08x ) " , <nl> - port , m_componentName . c_str ( ) , ( int ) omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - else <nl> - { <nl> - if ( wait ) <nl> - omx_err = WaitForCommand ( OMX_CommandPortDisable , port ) ; <nl> - } <nl> - } <nl> - return omx_err ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : UseEGLImage ( OMX_BUFFERHEADERTYPE * * ppBufferHdr , OMX_U32 nPortIndex , OMX_PTR pAppPrivate , void * eglImage ) <nl> - { <nl> - OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> - <nl> - if ( ! m_handle ) <nl> - return OMX_ErrorUndefined ; <nl> - <nl> - OMX_PARAM_PORTDEFINITIONTYPE portFormat ; <nl> - OMX_INIT_STRUCTURE ( portFormat ) ; <nl> - portFormat . nPortIndex = m_output_port ; <nl> - <nl> - omx_err = OMX_GetParameter ( m_handle , OMX_IndexParamPortDefinition , & portFormat ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - return omx_err ; <nl> - <nl> - if ( GetState ( ) ! = OMX_StateIdle ) <nl> - { <nl> - if ( GetState ( ) ! = OMX_StateLoaded ) <nl> - SetStateForComponent ( OMX_StateLoaded ) ; <nl> - <nl> - SetStateForComponent ( OMX_StateIdle ) ; <nl> - } <nl> - <nl> - omx_err = EnablePort ( m_output_port , false ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - % s EnablePort failed with omx_err ( 0x % x ) " , CLASSNAME , __func__ , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - <nl> - m_output_alignment = portFormat . nBufferAlignment ; <nl> - m_output_buffer_count = portFormat . nBufferCountActual ; <nl> - m_output_buffer_size = portFormat . nBufferSize ; <nl> - <nl> - if ( portFormat . nBufferCountActual ! = 1 ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - % s nBufferCountActual unexpected % d " , CLASSNAME , __func__ , <nl> - m_componentName . c_str ( ) , portFormat . nBufferCountActual ) ; <nl> - return omx_err ; <nl> - } <nl> - <nl> - CLog : : Log ( LOGDEBUG , <nl> - " % s : : % s component ( % s ) - port ( % d ) , nBufferCountMin ( % u ) , nBufferCountActual ( % u ) , " <nl> - " nBufferSize ( % u ) nBufferAlignment ( % u ) " , <nl> - CLASSNAME , __func__ , m_componentName . c_str ( ) , m_output_port , portFormat . nBufferCountMin , <nl> - portFormat . nBufferCountActual , portFormat . nBufferSize , portFormat . nBufferAlignment ) ; <nl> - <nl> - for ( size_t i = 0 ; i < portFormat . nBufferCountActual ; i + + ) <nl> - { <nl> - omx_err = OMX_UseEGLImage ( m_handle , ppBufferHdr , nPortIndex , pAppPrivate , eglImage ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - % s failed with omx_err ( 0x % x ) " , CLASSNAME , __func__ , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - <nl> - OMX_BUFFERHEADERTYPE * buffer = * ppBufferHdr ; <nl> - buffer - > nOutputPortIndex = m_output_port ; <nl> - buffer - > nFilledLen = 0 ; <nl> - buffer - > nOffset = 0 ; <nl> - buffer - > pAppPrivate = ( void * ) i ; <nl> - m_omx_output_buffers . push_back ( buffer ) ; <nl> - m_omx_output_available . push ( buffer ) ; <nl> - } <nl> - <nl> - omx_err = WaitForCommand ( OMX_CommandPortEnable , m_output_port ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s - % s EnablePort failed with omx_err ( 0x % x ) " , CLASSNAME , __func__ , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - return omx_err ; <nl> - } <nl> - m_flush_output = false ; <nl> - <nl> - return omx_err ; <nl> - } <nl> - <nl> - bool COMXCoreComponent : : Initialize ( const std : : string & component_name , OMX_INDEXTYPE index ) <nl> - { <nl> - OMX_ERRORTYPE omx_err ; <nl> - <nl> - m_input_port = 0 ; <nl> - m_output_port = 0 ; <nl> - m_handle = NULL ; <nl> - <nl> - m_input_alignment = 0 ; <nl> - m_input_buffer_size = 0 ; <nl> - m_input_buffer_count = 0 ; <nl> - <nl> - m_output_alignment = 0 ; <nl> - m_output_buffer_size = 0 ; <nl> - m_output_buffer_count = 0 ; <nl> - m_flush_input = false ; <nl> - m_flush_output = false ; <nl> - m_resource_error = false ; <nl> - <nl> - m_eos = false ; <nl> - <nl> - m_exit = false ; <nl> - <nl> - m_omx_events . clear ( ) ; <nl> - m_ignore_error = OMX_ErrorNone ; <nl> - <nl> - m_componentName = component_name ; <nl> - <nl> - m_callbacks . EventHandler = & COMXCoreComponent : : DecoderEventHandlerCallback ; <nl> - m_callbacks . EmptyBufferDone = & COMXCoreComponent : : DecoderEmptyBufferDoneCallback ; <nl> - m_callbacks . FillBufferDone = & COMXCoreComponent : : DecoderFillBufferDoneCallback ; <nl> - <nl> - / / Get video component handle setting up callbacks , component is in loaded state on return . <nl> - if ( ! m_handle ) <nl> - { <nl> - omx_err = m_DllOMX - > OMX_GetHandle ( & m_handle , ( char * ) component_name . c_str ( ) , this , & m_callbacks ) ; <nl> - if ( ! m_handle | | omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( <nl> - LOGERROR , <nl> - " COMXCoreComponent : : Initialize - could not get component handle for % s omx_err ( 0x % 08x ) " , <nl> - component_name . c_str ( ) , ( int ) omx_err ) ; <nl> - Deinitialize ( ) ; <nl> - return false ; <nl> - } <nl> - } <nl> - <nl> - OMX_PORT_PARAM_TYPE port_param ; <nl> - OMX_INIT_STRUCTURE ( port_param ) ; <nl> - <nl> - omx_err = OMX_GetParameter ( m_handle , index , & port_param ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( <nl> - LOGERROR , <nl> - " COMXCoreComponent : : Initialize - could not get port_param for component % s omx_err ( 0x % 08x ) " , <nl> - component_name . c_str ( ) , ( int ) omx_err ) ; <nl> - } <nl> - <nl> - omx_err = DisableAllPorts ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , <nl> - " COMXCoreComponent : : Initialize - error disable ports on component % s omx_err ( 0x % 08x ) " , <nl> - component_name . c_str ( ) , ( int ) omx_err ) ; <nl> - } <nl> - <nl> - m_input_port = port_param . nStartPortNumber ; <nl> - m_output_port = m_input_port + 1 ; <nl> - <nl> - if ( m_componentName = = " OMX . broadcom . audio_mixer " ) <nl> - { <nl> - m_input_port = port_param . nStartPortNumber + 1 ; <nl> - m_output_port = port_param . nStartPortNumber ; <nl> - } <nl> - <nl> - if ( m_output_port > port_param . nStartPortNumber + port_param . nPorts - 1 ) <nl> - m_output_port = port_param . nStartPortNumber + port_param . nPorts - 1 ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , " COMXCoreComponent : : Initialize % s input port % d output port % d m_handle % p " , <nl> - m_componentName . c_str ( ) , m_input_port , m_output_port , m_handle ) ; <nl> - <nl> - m_exit = false ; <nl> - m_flush_input = false ; <nl> - m_flush_output = false ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - void COMXCoreComponent : : ResetEos ( ) <nl> - { <nl> - pthread_mutex_lock ( & m_omx_eos_mutex ) ; <nl> - m_eos = false ; <nl> - pthread_mutex_unlock ( & m_omx_eos_mutex ) ; <nl> - } <nl> - <nl> - bool COMXCoreComponent : : Deinitialize ( ) <nl> - { <nl> - OMX_ERRORTYPE omx_err ; <nl> - <nl> - m_exit = true ; <nl> - <nl> - m_flush_input = true ; <nl> - m_flush_output = true ; <nl> - <nl> - if ( m_handle ) <nl> - { <nl> - FlushAll ( ) ; <nl> - <nl> - FreeOutputBuffers ( ) ; <nl> - FreeInputBuffers ( ) ; <nl> - <nl> - TransitionToStateLoaded ( ) ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , " COMXCoreComponent : : Deinitialize : % s handle % p " , m_componentName . c_str ( ) , <nl> - m_handle ) ; <nl> - omx_err = m_DllOMX - > OMX_FreeHandle ( m_handle ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCoreComponent : : Deinitialize - failed to free handle for component % s omx_err ( 0x % 08x ) " , <nl> - m_componentName . c_str ( ) , omx_err ) ; <nl> - } <nl> - m_handle = NULL ; <nl> - <nl> - m_input_port = 0 ; <nl> - m_output_port = 0 ; <nl> - m_componentName = " " ; <nl> - m_resource_error = false ; <nl> - } <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / DecoderEventHandler - - OMX event callback <nl> - OMX_ERRORTYPE COMXCoreComponent : : DecoderEventHandlerCallback ( <nl> - OMX_HANDLETYPE hComponent , <nl> - OMX_PTR pAppData , <nl> - OMX_EVENTTYPE eEvent , <nl> - OMX_U32 nData1 , <nl> - OMX_U32 nData2 , <nl> - OMX_PTR pEventData ) <nl> - { <nl> - if ( ! pAppData ) <nl> - return OMX_ErrorNone ; <nl> - <nl> - COMXCoreComponent * ctx = static_cast < COMXCoreComponent * > ( pAppData ) ; <nl> - return ctx - > DecoderEventHandler ( hComponent , eEvent , nData1 , nData2 , pEventData ) ; <nl> - } <nl> - <nl> - / / DecoderEmptyBufferDone - - OMXCore input buffer has been emptied <nl> - OMX_ERRORTYPE COMXCoreComponent : : DecoderEmptyBufferDoneCallback ( <nl> - OMX_HANDLETYPE hComponent , <nl> - OMX_PTR pAppData , <nl> - OMX_BUFFERHEADERTYPE * pBuffer ) <nl> - { <nl> - if ( ! pAppData ) <nl> - return OMX_ErrorNone ; <nl> - <nl> - COMXCoreComponent * ctx = static_cast < COMXCoreComponent * > ( pAppData ) ; <nl> - return ctx - > DecoderEmptyBufferDone ( hComponent , pBuffer ) ; <nl> - } <nl> - <nl> - / / DecoderFillBufferDone - - OMXCore output buffer has been filled <nl> - OMX_ERRORTYPE COMXCoreComponent : : DecoderFillBufferDoneCallback ( <nl> - OMX_HANDLETYPE hComponent , <nl> - OMX_PTR pAppData , <nl> - OMX_BUFFERHEADERTYPE * pBuffer ) <nl> - { <nl> - if ( ! pAppData ) <nl> - return OMX_ErrorNone ; <nl> - <nl> - COMXCoreComponent * ctx = static_cast < COMXCoreComponent * > ( pAppData ) ; <nl> - return ctx - > DecoderFillBufferDone ( hComponent , pBuffer ) ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : DecoderEmptyBufferDone ( OMX_HANDLETYPE hComponent , OMX_BUFFERHEADERTYPE * pBuffer ) <nl> - { <nl> - if ( m_exit ) <nl> - return OMX_ErrorNone ; <nl> - <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " COMXCoreComponent : : DecoderEmptyBufferDone component ( % s ) % p % d / % d " , <nl> - m_componentName . c_str ( ) , pBuffer , m_omx_input_available . size ( ) , m_input_buffer_count ) ; <nl> - # endif <nl> - pthread_mutex_lock ( & m_omx_input_mutex ) ; <nl> - m_omx_input_available . push ( pBuffer ) ; <nl> - <nl> - / / this allows ( all ) blocked tasks to be awoken <nl> - pthread_cond_broadcast ( & m_input_buffer_cond ) ; <nl> - <nl> - pthread_mutex_unlock ( & m_omx_input_mutex ) ; <nl> - <nl> - return OMX_ErrorNone ; <nl> - } <nl> - <nl> - OMX_ERRORTYPE COMXCoreComponent : : DecoderFillBufferDone ( OMX_HANDLETYPE hComponent , OMX_BUFFERHEADERTYPE * pBuffer ) <nl> - { <nl> - if ( m_exit ) <nl> - return OMX_ErrorNone ; <nl> - <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " COMXCoreComponent : : DecoderFillBufferDone component ( % s ) % p % d / % d " , <nl> - m_componentName . c_str ( ) , pBuffer , m_omx_output_available . size ( ) , m_output_buffer_count ) ; <nl> - # endif <nl> - pthread_mutex_lock ( & m_omx_output_mutex ) ; <nl> - m_omx_output_available . push ( pBuffer ) ; <nl> - <nl> - / / this allows ( all ) blocked tasks to be awoken <nl> - pthread_cond_broadcast ( & m_output_buffer_cond ) ; <nl> - <nl> - pthread_mutex_unlock ( & m_omx_output_mutex ) ; <nl> - <nl> - return OMX_ErrorNone ; <nl> - } <nl> - <nl> - / / DecoderEmptyBufferDone - - OMXCore input buffer has been emptied <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Component event handler - - OMX event callback <nl> - OMX_ERRORTYPE COMXCoreComponent : : DecoderEventHandler ( <nl> - OMX_HANDLETYPE hComponent , <nl> - OMX_EVENTTYPE eEvent , <nl> - OMX_U32 nData1 , <nl> - OMX_U32 nData2 , <nl> - OMX_PTR pEventData ) <nl> - { <nl> - # ifdef OMX_DEBUG_EVENTS <nl> - CLog : : Log ( LOGDEBUG , <nl> - " COMXCoreComponent : : % s - % s eEvent ( 0x % x ) , nData1 ( 0x % x ) , nData2 ( 0x % x ) , pEventData ( 0x % p ) \ n " , <nl> - __func__ , GetName ( ) . c_str ( ) , eEvent , nData1 , nData2 , pEventData ) ; <nl> - # endif <nl> - <nl> - / / if the error is expected , then we can skip it <nl> - if ( eEvent = = OMX_EventError & & ( OMX_S32 ) nData1 = = m_ignore_error ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , <nl> - " COMXCoreComponent : : % s - % s Ignoring expected event : eEvent ( 0x % x ) , nData1 ( 0x % x ) , nData2 ( 0x % x ) , pEventData ( 0x % p ) \ n " , <nl> - __func__ , GetName ( ) . c_str ( ) , eEvent , nData1 , nData2 , pEventData ) ; <nl> - m_ignore_error = OMX_ErrorNone ; <nl> - return OMX_ErrorNone ; <nl> - } <nl> - AddEvent ( eEvent , nData1 , nData2 ) ; <nl> - <nl> - switch ( eEvent ) <nl> - { <nl> - case OMX_EventCmdComplete : <nl> - <nl> - switch ( nData1 ) <nl> - { <nl> - case OMX_CommandStateSet : <nl> - switch ( ( int ) nData2 ) <nl> - { <nl> - case OMX_StateInvalid : <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % s - OMX_StateInvalid " , CLASSNAME , __func__ , <nl> - GetName ( ) . c_str ( ) ) ; <nl> - # endif <nl> - break ; <nl> - case OMX_StateLoaded : <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % s - OMX_StateLoaded " , CLASSNAME , __func__ , <nl> - GetName ( ) . c_str ( ) ) ; <nl> - # endif <nl> - break ; <nl> - case OMX_StateIdle : <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % s - OMX_StateIdle " , CLASSNAME , __func__ , <nl> - GetName ( ) . c_str ( ) ) ; <nl> - # endif <nl> - break ; <nl> - case OMX_StateExecuting : <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % s - OMX_StateExecuting " , CLASSNAME , __func__ , <nl> - GetName ( ) . c_str ( ) ) ; <nl> - # endif <nl> - break ; <nl> - case OMX_StatePause : <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % s - OMX_StatePause " , CLASSNAME , __func__ , <nl> - GetName ( ) . c_str ( ) ) ; <nl> - # endif <nl> - break ; <nl> - case OMX_StateWaitForResources : <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % s - OMX_StateWaitForResources " , CLASSNAME , __func__ , <nl> - GetName ( ) . c_str ( ) ) ; <nl> - # endif <nl> - break ; <nl> - default : <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , <nl> - " % s : : % s % s - Unknown OMX_Statexxxxx , state ( % d ) \ n " , CLASSNAME , __func__ , GetName ( ) . c_str ( ) , ( int ) nData2 ) ; <nl> - # endif <nl> - break ; <nl> - } <nl> - break ; <nl> - case OMX_CommandFlush : <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % s - OMX_CommandFlush , port % d " , CLASSNAME , __func__ , <nl> - GetName ( ) . c_str ( ) , ( int ) nData2 ) ; <nl> - # endif <nl> - break ; <nl> - case OMX_CommandPortDisable : <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % s - OMX_CommandPortDisable , nData1 ( 0x % x ) , port % d " , <nl> - CLASSNAME , __func__ , GetName ( ) . c_str ( ) , nData1 , ( int ) nData2 ) ; <nl> - # endif <nl> - break ; <nl> - case OMX_CommandPortEnable : <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % s - OMX_CommandPortEnable , nData1 ( 0x % x ) , port % d " , CLASSNAME , <nl> - __func__ , GetName ( ) . c_str ( ) , nData1 , ( int ) nData2 ) ; <nl> - # endif <nl> - break ; <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - case OMX_CommandMarkBuffer : <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % s - OMX_CommandMarkBuffer , nData1 ( 0x % x ) , port % d " , CLASSNAME , <nl> - __func__ , GetName ( ) . c_str ( ) , nData1 , ( int ) nData2 ) ; <nl> - break ; <nl> - # endif <nl> - } <nl> - break ; <nl> - case OMX_EventBufferFlag : <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % s - OMX_EventBufferFlag ( input ) " , CLASSNAME , __func__ , <nl> - GetName ( ) . c_str ( ) ) ; <nl> - # endif <nl> - if ( nData2 & OMX_BUFFERFLAG_EOS ) <nl> - { <nl> - pthread_mutex_lock ( & m_omx_eos_mutex ) ; <nl> - m_eos = true ; <nl> - pthread_mutex_unlock ( & m_omx_eos_mutex ) ; <nl> - } <nl> - break ; <nl> - case OMX_EventPortSettingsChanged : <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % s - OMX_EventPortSettingsChanged ( output ) " , CLASSNAME , __func__ , <nl> - GetName ( ) . c_str ( ) ) ; <nl> - # endif <nl> - break ; <nl> - case OMX_EventParamOrConfigChanged : <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % s - OMX_EventParamOrConfigChanged ( output ) " , CLASSNAME , __func__ , <nl> - GetName ( ) . c_str ( ) ) ; <nl> - # endif <nl> - break ; <nl> - # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - case OMX_EventMark : <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % s - OMX_EventMark " , CLASSNAME , __func__ , GetName ( ) . c_str ( ) ) ; <nl> - break ; <nl> - case OMX_EventResourcesAcquired : <nl> - CLog : : Log ( LOGDEBUG , " % s : : % s % s - OMX_EventResourcesAcquired " , CLASSNAME , __func__ , <nl> - GetName ( ) . c_str ( ) ) ; <nl> - break ; <nl> - # endif <nl> - case OMX_EventError : <nl> - switch ( ( OMX_S32 ) nData1 ) <nl> - { <nl> - case OMX_ErrorSameState : <nl> - / / # if defined ( OMX_DEBUG_EVENTHANDLER ) <nl> - / / CLog : : Log ( LOGERROR , " % s : : % s % s - OMX_ErrorSameState , same state " , CLASSNAME , __func__ , GetName ( ) . c_str ( ) ) ; <nl> - / / # endif <nl> - break ; <nl> - case OMX_ErrorInsufficientResources : <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s - OMX_ErrorInsufficientResources , insufficient resources " , <nl> - CLASSNAME , __func__ , GetName ( ) . c_str ( ) ) ; <nl> - m_resource_error = true ; <nl> - break ; <nl> - case OMX_ErrorFormatNotDetected : <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s - OMX_ErrorFormatNotDetected , cannot parse input stream " , <nl> - CLASSNAME , __func__ , GetName ( ) . c_str ( ) ) ; <nl> - break ; <nl> - case OMX_ErrorPortUnpopulated : <nl> - CLog : : Log ( LOGWARNING , " % s : : % s % s - OMX_ErrorPortUnpopulated port % d " , CLASSNAME , __func__ , <nl> - GetName ( ) . c_str ( ) , ( int ) nData2 ) ; <nl> - break ; <nl> - case OMX_ErrorStreamCorrupt : <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s - OMX_ErrorStreamCorrupt , Bitstream corrupt " , CLASSNAME , <nl> - __func__ , GetName ( ) . c_str ( ) ) ; <nl> - m_resource_error = true ; <nl> - break ; <nl> - case OMX_ErrorUnsupportedSetting : <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s - OMX_ErrorUnsupportedSetting , unsupported setting " , <nl> - CLASSNAME , __func__ , GetName ( ) . c_str ( ) ) ; <nl> - break ; <nl> - default : <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s - OMX_EventError detected , nData1 ( 0x % x ) , port % d " , <nl> - CLASSNAME , __func__ , GetName ( ) . c_str ( ) , nData1 , ( int ) nData2 ) ; <nl> - break ; <nl> - } <nl> - / / wake things up <nl> - if ( m_resource_error ) <nl> - { <nl> - pthread_cond_broadcast ( & m_output_buffer_cond ) ; <nl> - pthread_cond_broadcast ( & m_input_buffer_cond ) ; <nl> - pthread_cond_broadcast ( & m_omx_event_cond ) ; <nl> - } <nl> - break ; <nl> - default : <nl> - CLog : : Log ( LOGWARNING , " % s : : % s % s - Unknown eEvent ( 0x % x ) , nData1 ( 0x % x ) , port % d " , CLASSNAME , <nl> - __func__ , GetName ( ) . c_str ( ) , eEvent , nData1 , ( int ) nData2 ) ; <nl> - break ; <nl> - } <nl> - <nl> - return OMX_ErrorNone ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - COMXCore : : COMXCore ( ) <nl> - { <nl> - m_is_open = false ; <nl> - <nl> - m_DllOMX = new DllOMX ( ) ; <nl> - } <nl> - <nl> - COMXCore : : ~ COMXCore ( ) <nl> - { <nl> - delete m_DllOMX ; <nl> - } <nl> - <nl> - bool COMXCore : : Initialize ( ) <nl> - { <nl> - if ( ! m_DllOMX - > Load ( ) ) <nl> - return false ; <nl> - <nl> - OMX_ERRORTYPE omx_err = m_DllOMX - > OMX_Init ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCore : : Initialize - OMXCore failed to init , omx_err ( 0x % 08x ) " , omx_err ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_is_open = true ; <nl> - return true ; <nl> - } <nl> - <nl> - void COMXCore : : Deinitialize ( ) <nl> - { <nl> - if ( m_is_open ) <nl> - { <nl> - OMX_ERRORTYPE omx_err = m_DllOMX - > OMX_Deinit ( ) ; <nl> - if ( omx_err ! = OMX_ErrorNone ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " COMXCore : : Deinitialize - OMXCore failed to deinit , omx_err ( 0x % 08x ) " , omx_err ) ; <nl> - } <nl> - m_DllOMX - > Unload ( ) ; <nl> - } <nl> - } <nl> deleted file mode 100644 <nl> index 84d043469ba9 . . 000000000000 <nl> mmm a / xbmc / platform / linux / OMXCore . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2010 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # include < string > <nl> - # include < queue > <nl> - # include < vector > <nl> - <nl> - / / ! @ todo should this be in configure <nl> - # ifndef OMX_SKIP64BIT <nl> - # define OMX_SKIP64BIT <nl> - # endif <nl> - <nl> - # include " DllOMX . h " <nl> - <nl> - # include < semaphore . h > <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / debug spew defines <nl> - # if 0 <nl> - # define OMX_DEBUG_VERBOSE <nl> - # define OMX_DEBUG_EVENTHANDLER <nl> - # endif <nl> - <nl> - # define OMX_INIT_STRUCTURE ( a ) \ <nl> - memset ( & ( a ) , 0 , sizeof ( a ) ) ; \ <nl> - ( a ) . nSize = sizeof ( a ) ; \ <nl> - ( a ) . nVersion . s . nVersionMajor = OMX_VERSION_MAJOR ; \ <nl> - ( a ) . nVersion . s . nVersionMinor = OMX_VERSION_MINOR ; \ <nl> - ( a ) . nVersion . s . nRevision = OMX_VERSION_REVISION ; \ <nl> - ( a ) . nVersion . s . nStep = OMX_VERSION_STEP <nl> - <nl> - # define OMX_MAX_PORTS 10 <nl> - <nl> - typedef struct omx_event { <nl> - OMX_EVENTTYPE eEvent ; <nl> - OMX_U32 nData1 ; <nl> - OMX_U32 nData2 ; <nl> - } omx_event ; <nl> - <nl> - class COMXCore ; <nl> - class COMXCoreComponent ; <nl> - class COMXCoreTunnel ; <nl> - class COMXCoreClock ; <nl> - <nl> - class COMXCoreTunnel <nl> - { <nl> - public : <nl> - COMXCoreTunnel ( ) ; <nl> - ~ COMXCoreTunnel ( ) ; <nl> - <nl> - void Initialize ( COMXCoreComponent * src_component , unsigned int src_port , COMXCoreComponent * dst_component , unsigned int dst_port ) ; <nl> - bool IsInitialized ( ) const { return m_tunnel_set ; } <nl> - OMX_ERRORTYPE Deestablish ( bool noWait = false ) ; <nl> - OMX_ERRORTYPE Establish ( bool enable_ports = true , bool disable_ports = false ) ; <nl> - private : <nl> - COMXCoreComponent * m_src_component ; <nl> - COMXCoreComponent * m_dst_component ; <nl> - unsigned int m_src_port ; <nl> - unsigned int m_dst_port ; <nl> - DllOMX * m_DllOMX ; <nl> - bool m_tunnel_set ; <nl> - } ; <nl> - <nl> - class COMXCoreComponent <nl> - { <nl> - public : <nl> - COMXCoreComponent ( ) ; <nl> - ~ COMXCoreComponent ( ) ; <nl> - <nl> - OMX_HANDLETYPE GetComponent ( ) const { return m_handle ; } <nl> - unsigned int GetInputPort ( ) const { return m_input_port ; } <nl> - unsigned int GetOutputPort ( ) const { return m_output_port ; } <nl> - std : : string GetName ( ) const { return m_componentName ; } <nl> - <nl> - OMX_ERRORTYPE DisableAllPorts ( ) ; <nl> - void RemoveEvent ( OMX_EVENTTYPE eEvent , OMX_U32 nData1 , OMX_U32 nData2 ) ; <nl> - OMX_ERRORTYPE AddEvent ( OMX_EVENTTYPE eEvent , OMX_U32 nData1 , OMX_U32 nData2 ) ; <nl> - OMX_ERRORTYPE WaitForEvent ( OMX_EVENTTYPE event , long timeout = 300 ) ; <nl> - OMX_ERRORTYPE WaitForCommand ( OMX_U32 command , OMX_U32 nData2 , long timeout = 2000 ) ; <nl> - OMX_ERRORTYPE SetStateForComponent ( OMX_STATETYPE state ) ; <nl> - OMX_STATETYPE GetState ( ) const ; <nl> - OMX_ERRORTYPE SetParameter ( OMX_INDEXTYPE paramIndex , OMX_PTR paramStruct ) ; <nl> - OMX_ERRORTYPE GetParameter ( OMX_INDEXTYPE paramIndex , OMX_PTR paramStruct ) const ; <nl> - OMX_ERRORTYPE SetConfig ( OMX_INDEXTYPE configIndex , OMX_PTR configStruct ) ; <nl> - OMX_ERRORTYPE GetConfig ( OMX_INDEXTYPE configIndex , OMX_PTR configStruct ) const ; <nl> - OMX_ERRORTYPE SendCommand ( OMX_COMMANDTYPE cmd , OMX_U32 cmdParam , OMX_PTR cmdParamData ) ; <nl> - OMX_ERRORTYPE EnablePort ( unsigned int port , bool wait = true ) ; <nl> - OMX_ERRORTYPE DisablePort ( unsigned int port , bool wait = true ) ; <nl> - OMX_ERRORTYPE UseEGLImage ( OMX_BUFFERHEADERTYPE * * ppBufferHdr , OMX_U32 nPortIndex , OMX_PTR pAppPrivate , void * eglImage ) ; <nl> - <nl> - bool Initialize ( const std : : string & component_name , OMX_INDEXTYPE index ) ; <nl> - bool IsInitialized ( ) const { return m_handle ! = NULL ; } <nl> - bool Deinitialize ( ) ; <nl> - <nl> - / / OMXCore Decoder delegate callback routines . <nl> - static OMX_ERRORTYPE DecoderEventHandlerCallback ( OMX_HANDLETYPE hComponent , OMX_PTR pAppData , <nl> - OMX_EVENTTYPE eEvent , OMX_U32 nData1 , OMX_U32 nData2 , OMX_PTR pEventData ) ; <nl> - static OMX_ERRORTYPE DecoderEmptyBufferDoneCallback ( <nl> - OMX_HANDLETYPE hComponent , OMX_PTR pAppData , OMX_BUFFERHEADERTYPE * pBuffer ) ; <nl> - static OMX_ERRORTYPE DecoderFillBufferDoneCallback ( <nl> - OMX_HANDLETYPE hComponent , OMX_PTR pAppData , OMX_BUFFERHEADERTYPE * pBufferHeader ) ; <nl> - <nl> - / / OMXCore decoder callback routines . <nl> - OMX_ERRORTYPE DecoderEventHandler ( OMX_HANDLETYPE hComponent , <nl> - OMX_EVENTTYPE eEvent , OMX_U32 nData1 , OMX_U32 nData2 , OMX_PTR pEventData ) ; <nl> - OMX_ERRORTYPE DecoderEmptyBufferDone ( <nl> - OMX_HANDLETYPE hComponent , OMX_BUFFERHEADERTYPE * pBuffer ) ; <nl> - OMX_ERRORTYPE DecoderFillBufferDone ( <nl> - OMX_HANDLETYPE hComponent , OMX_BUFFERHEADERTYPE * pBuffer ) ; <nl> - <nl> - void TransitionToStateLoaded ( ) ; <nl> - <nl> - OMX_ERRORTYPE EmptyThisBuffer ( OMX_BUFFERHEADERTYPE * omx_buffer ) ; <nl> - OMX_ERRORTYPE FillThisBuffer ( OMX_BUFFERHEADERTYPE * omx_buffer ) ; <nl> - OMX_ERRORTYPE FreeOutputBuffer ( OMX_BUFFERHEADERTYPE * omx_buffer ) ; <nl> - <nl> - unsigned int GetInputBufferSize ( ) const { return m_input_buffer_count * m_input_buffer_size ; } <nl> - unsigned int GetOutputBufferSize ( ) const { return m_output_buffer_count * m_output_buffer_size ; } <nl> - <nl> - unsigned int GetInputBufferSpace ( ) const { return m_omx_input_available . size ( ) * m_input_buffer_size ; } <nl> - unsigned int GetOutputBufferSpace ( ) const { return m_omx_output_available . size ( ) * m_output_buffer_size ; } <nl> - <nl> - void FlushAll ( ) ; <nl> - void FlushInput ( ) ; <nl> - void FlushOutput ( ) ; <nl> - <nl> - OMX_BUFFERHEADERTYPE * GetInputBuffer ( long timeout = 200 ) ; <nl> - OMX_BUFFERHEADERTYPE * GetOutputBuffer ( long timeout = 200 ) ; <nl> - <nl> - OMX_ERRORTYPE AllocInputBuffers ( ) ; <nl> - OMX_ERRORTYPE AllocOutputBuffers ( ) ; <nl> - <nl> - OMX_ERRORTYPE FreeInputBuffers ( ) ; <nl> - OMX_ERRORTYPE FreeOutputBuffers ( ) ; <nl> - <nl> - OMX_ERRORTYPE WaitForInputDone ( long timeout = 200 ) ; <nl> - OMX_ERRORTYPE WaitForOutputDone ( long timeout = 200 ) ; <nl> - <nl> - bool IsEOS ( ) const { return m_eos ; } <nl> - bool BadState ( ) const { return m_resource_error ; } <nl> - void ResetEos ( ) ; <nl> - void IgnoreNextError ( OMX_S32 error ) { m_ignore_error = error ; } <nl> - <nl> - private : <nl> - OMX_HANDLETYPE m_handle ; <nl> - unsigned int m_input_port ; <nl> - unsigned int m_output_port ; <nl> - std : : string m_componentName ; <nl> - pthread_mutex_t m_omx_event_mutex ; <nl> - pthread_mutex_t m_omx_eos_mutex ; <nl> - std : : vector < omx_event > m_omx_events ; <nl> - OMX_S32 m_ignore_error ; <nl> - <nl> - OMX_CALLBACKTYPE m_callbacks ; <nl> - <nl> - / / OMXCore input buffers ( demuxer packets ) <nl> - pthread_mutex_t m_omx_input_mutex ; <nl> - std : : queue < OMX_BUFFERHEADERTYPE * > m_omx_input_available ; <nl> - std : : vector < OMX_BUFFERHEADERTYPE * > m_omx_input_buffers ; <nl> - unsigned int m_input_alignment ; <nl> - unsigned int m_input_buffer_size ; <nl> - unsigned int m_input_buffer_count ; <nl> - <nl> - / / OMXCore output buffers ( video frames ) <nl> - pthread_mutex_t m_omx_output_mutex ; <nl> - std : : queue < OMX_BUFFERHEADERTYPE * > m_omx_output_available ; <nl> - std : : vector < OMX_BUFFERHEADERTYPE * > m_omx_output_buffers ; <nl> - unsigned int m_output_alignment ; <nl> - unsigned int m_output_buffer_size ; <nl> - unsigned int m_output_buffer_count ; <nl> - <nl> - bool m_exit ; <nl> - DllOMX * m_DllOMX ; <nl> - pthread_cond_t m_input_buffer_cond ; <nl> - pthread_cond_t m_output_buffer_cond ; <nl> - pthread_cond_t m_omx_event_cond ; <nl> - bool m_eos ; <nl> - bool m_flush_input ; <nl> - bool m_flush_output ; <nl> - bool m_resource_error ; <nl> - } ; <nl> - <nl> - class COMXCore <nl> - { <nl> - public : <nl> - COMXCore ( ) ; <nl> - ~ COMXCore ( ) ; <nl> - <nl> - / / initialize OMXCore and get decoder component <nl> - bool Initialize ( ) ; <nl> - void Deinitialize ( ) ; <nl> - DllOMX * GetDll ( ) { return m_DllOMX ; } <nl> - <nl> - protected : <nl> - bool m_is_open ; <nl> - DllOMX * m_DllOMX ; <nl> - } ; <nl> deleted file mode 100644 <nl> index f750fa065643 . . 000000000000 <nl> mmm a / xbmc / platform / linux / RBP . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2005 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # include " RBP . h " <nl> - <nl> - # include " ServiceBroker . h " <nl> - # include " cores / omxplayer / OMXImage . h " <nl> - # include " rpi / rpi_user_vcsm . h " <nl> - # include " settings / Settings . h " <nl> - # include " settings / SettingsComponent . h " <nl> - # include " utils / TimeUtils . h " <nl> - # include " utils / log . h " <nl> - <nl> - # include < assert . h > <nl> - <nl> - # include < interface / mmal / mmal . h > <nl> - # include < sys / ioctl . h > <nl> - <nl> - # define MAJOR_NUM 100 <nl> - # define IOCTL_MBOX_PROPERTY _IOWR ( MAJOR_NUM , 0 , char * ) <nl> - # define DEVICE_FILE_NAME " / dev / vcio " <nl> - <nl> - static int mbox_open ( ) ; <nl> - static void mbox_close ( int file_desc ) ; <nl> - <nl> - typedef struct vc_image_extra_uv_s { <nl> - void * u , * v ; <nl> - int vpitch ; <nl> - } VC_IMAGE_EXTRA_UV_T ; <nl> - <nl> - typedef union { <nl> - VC_IMAGE_EXTRA_UV_T uv ; <nl> - } VC_IMAGE_EXTRA_T ; <nl> - <nl> - struct VC_IMAGE_T { <nl> - unsigned short type ; / * should restrict to 16 bits * / <nl> - unsigned short info ; / * format - specific info ; zero for VC02 behaviour * / <nl> - unsigned short width ; / * width in pixels * / <nl> - unsigned short height ; / * height in pixels * / <nl> - int pitch ; / * pitch of image_data array in bytes * / <nl> - int size ; / * number of bytes available in image_data array * / <nl> - void * image_data ; / * pixel data * / <nl> - VC_IMAGE_EXTRA_T extra ; / * extra data like palette pointer * / <nl> - void * metadata ; / * metadata header for the image * / <nl> - void * pool_object ; / * nonNULL if image was allocated from a vc_pool * / <nl> - uint32_t mem_handle ; / * the mem handle for relocatable memory storage * / <nl> - int metadata_size ; / * size of metadata of each channel in bytes * / <nl> - int channel_offset ; / * offset of consecutive channels in bytes * / <nl> - uint32_t video_timestamp ; / * 90000 Hz RTP times domain - derived from audio timestamp * / <nl> - uint8_t num_channels ; / * number of channels ( 2 for stereo ) * / <nl> - uint8_t current_channel ; / * the channel this header is currently pointing to * / <nl> - uint8_t linked_multichann_flag ; / * Indicate the header has the linked - multichannel structure * / <nl> - uint8_t is_channel_linked ; / * Track if the above structure is been used to link the header <nl> - into a linked - mulitchannel image * / <nl> - uint8_t channel_index ; / * index of the channel this header represents while <nl> - it is being linked . * / <nl> - uint8_t _dummy [ 3 ] ; / * pad struct to 64 bytes * / <nl> - } ; <nl> - typedef int vc_image_t_size_check [ ( sizeof ( VC_IMAGE_T ) = = 64 ) * 2 - 1 ] ; <nl> - <nl> - CRBP : : CRBP ( ) <nl> - { <nl> - m_initialized = false ; <nl> - m_omx_initialized = false ; <nl> - m_DllBcmHost = new DllBcmHost ( ) ; <nl> - m_OMX = new COMXCore ( ) ; <nl> - m_display = DISPMANX_NO_HANDLE ; <nl> - m_mb = mbox_open ( ) ; <nl> - vcsm_init ( ) ; <nl> - m_vsync_count = 0 ; <nl> - m_vsync_time = 0 ; <nl> - } <nl> - <nl> - CRBP : : ~ CRBP ( ) <nl> - { <nl> - Deinitialize ( ) ; <nl> - delete m_OMX ; <nl> - delete m_DllBcmHost ; <nl> - } <nl> - <nl> - bool CRBP : : Initialize ( ) <nl> - { <nl> - CSingleLock lock ( m_critSection ) ; <nl> - if ( m_initialized ) <nl> - return true ; <nl> - <nl> - m_initialized = m_DllBcmHost - > Load ( ) ; <nl> - if ( ! m_initialized ) <nl> - return false ; <nl> - <nl> - m_DllBcmHost - > bcm_host_init ( ) ; <nl> - <nl> - m_omx_initialized = m_OMX - > Initialize ( ) ; <nl> - if ( ! m_omx_initialized ) <nl> - return false ; <nl> - <nl> - char response [ 80 ] = " " ; <nl> - m_arm_mem = 0 ; <nl> - m_gpu_mem = 0 ; <nl> - m_codec_mpg2_enabled = false ; <nl> - m_codec_wvc1_enabled = false ; <nl> - <nl> - if ( vc_gencmd ( response , sizeof response , " get_mem arm " ) = = 0 ) <nl> - vc_gencmd_number_property ( response , " arm " , & m_arm_mem ) ; <nl> - if ( vc_gencmd ( response , sizeof response , " get_mem gpu " ) = = 0 ) <nl> - vc_gencmd_number_property ( response , " gpu " , & m_gpu_mem ) ; <nl> - <nl> - if ( vc_gencmd ( response , sizeof response , " codec_enabled MPG2 " ) = = 0 ) <nl> - m_codec_mpg2_enabled = strcmp ( " MPG2 = enabled " , response ) = = 0 ; <nl> - if ( vc_gencmd ( response , sizeof response , " codec_enabled WVC1 " ) = = 0 ) <nl> - m_codec_wvc1_enabled = strcmp ( " WVC1 = enabled " , response ) = = 0 ; <nl> - <nl> - if ( m_gpu_mem < 128 ) <nl> - setenv ( " V3D_DOUBLE_BUFFER " , " 1 " , 1 ) ; <nl> - <nl> - m_gui_resolution_limit = CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) - > GetInt ( " videoscreen . limitgui " ) ; <nl> - if ( ! m_gui_resolution_limit ) <nl> - m_gui_resolution_limit = m_gpu_mem < 128 ? 720 : 1080 ; <nl> - <nl> - g_OMXImage . Initialize ( ) ; <nl> - m_omx_image_init = true ; <nl> - return true ; <nl> - } <nl> - <nl> - void CRBP : : LogFirmwareVersion ( ) <nl> - { <nl> - char response [ 1024 ] ; <nl> - m_DllBcmHost - > vc_gencmd ( response , sizeof response , " version " ) ; <nl> - response [ sizeof ( response ) - 1 ] = ' \ 0 ' ; <nl> - CLog : : Log ( LOGINFO , " Raspberry PI firmware version : % s " , response ) ; <nl> - CLog : : Log ( LOGINFO , " ARM mem : % dMB GPU mem : % dMB MPG2 : % d WVC1 : % d " , m_arm_mem , m_gpu_mem , <nl> - m_codec_mpg2_enabled , m_codec_wvc1_enabled ) ; <nl> - m_DllBcmHost - > vc_gencmd ( response , sizeof response , " get_config int " ) ; <nl> - response [ sizeof ( response ) - 1 ] = ' \ 0 ' ; <nl> - CLog : : Log ( LOGINFO , " Config : \ n % s " , response ) ; <nl> - m_DllBcmHost - > vc_gencmd ( response , sizeof response , " get_config str " ) ; <nl> - response [ sizeof ( response ) - 1 ] = ' \ 0 ' ; <nl> - CLog : : Log ( LOGINFO , " Config : \ n % s " , response ) ; <nl> - } <nl> - <nl> - static void vsync_callback_static ( DISPMANX_UPDATE_HANDLE_T u , void * arg ) <nl> - { <nl> - CRBP * rbp = reinterpret_cast < CRBP * > ( arg ) ; <nl> - rbp - > VSyncCallback ( ) ; <nl> - } <nl> - <nl> - DISPMANX_DISPLAY_HANDLE_T CRBP : : OpenDisplay ( uint32_t device ) <nl> - { <nl> - CSingleLock lock ( m_critSection ) ; <nl> - if ( m_display = = DISPMANX_NO_HANDLE ) <nl> - { <nl> - m_display = vc_dispmanx_display_open ( 0 / * screen * / ) ; <nl> - int s = vc_dispmanx_vsync_callback ( m_display , vsync_callback_static , ( void * ) this ) ; <nl> - assert ( s = = 0 ) ; <nl> - } <nl> - return m_display ; <nl> - } <nl> - <nl> - void CRBP : : CloseDisplay ( DISPMANX_DISPLAY_HANDLE_T display ) <nl> - { <nl> - CSingleLock lock ( m_critSection ) ; <nl> - assert ( display = = m_display ) ; <nl> - int s = vc_dispmanx_vsync_callback ( m_display , NULL , NULL ) ; <nl> - assert ( s = = 0 ) ; <nl> - vc_dispmanx_display_close ( m_display ) ; <nl> - m_display = DISPMANX_NO_HANDLE ; <nl> - } <nl> - <nl> - void CRBP : : GetDisplaySize ( int & width , int & height ) <nl> - { <nl> - CSingleLock lock ( m_critSection ) ; <nl> - DISPMANX_MODEINFO_T info ; <nl> - if ( m_display ! = DISPMANX_NO_HANDLE & & vc_dispmanx_display_get_info ( m_display , & info ) = = 0 ) <nl> - { <nl> - width = info . width ; <nl> - height = info . height ; <nl> - } <nl> - else <nl> - { <nl> - width = 0 ; <nl> - height = 0 ; <nl> - } <nl> - } <nl> - <nl> - unsigned char * CRBP : : CaptureDisplay ( int width , int height , int * pstride , bool swap_red_blue , bool video_only ) <nl> - { <nl> - DISPMANX_RESOURCE_HANDLE_T resource ; <nl> - VC_RECT_T rect ; <nl> - unsigned char * image = NULL ; <nl> - uint32_t vc_image_ptr ; <nl> - int stride ; <nl> - uint32_t flags = 0 ; <nl> - <nl> - if ( video_only ) <nl> - flags | = DISPMANX_SNAPSHOT_NO_RGB | DISPMANX_SNAPSHOT_FILL ; <nl> - if ( swap_red_blue ) <nl> - flags | = DISPMANX_SNAPSHOT_SWAP_RED_BLUE ; <nl> - if ( ! pstride ) <nl> - flags | = DISPMANX_SNAPSHOT_PACK ; <nl> - <nl> - stride = ( ( width + 15 ) & ~ 15 ) * 4 ; <nl> - <nl> - CSingleLock lock ( m_critSection ) ; <nl> - if ( m_display ! = DISPMANX_NO_HANDLE ) <nl> - { <nl> - image = new unsigned char [ height * stride ] ; <nl> - resource = vc_dispmanx_resource_create ( VC_IMAGE_RGBA32 , width , height , & vc_image_ptr ) ; <nl> - <nl> - vc_dispmanx_snapshot ( m_display , resource , ( DISPMANX_TRANSFORM_T ) flags ) ; <nl> - <nl> - vc_dispmanx_rect_set ( & rect , 0 , 0 , width , height ) ; <nl> - vc_dispmanx_resource_read_data ( resource , & rect , image , stride ) ; <nl> - vc_dispmanx_resource_delete ( resource ) ; <nl> - } <nl> - if ( pstride ) <nl> - * pstride = stride ; <nl> - return image ; <nl> - } <nl> - <nl> - void CRBP : : VSyncCallback ( ) <nl> - { <nl> - CSingleLock lock ( m_vsync_lock ) ; <nl> - m_vsync_count + + ; <nl> - m_vsync_time = CurrentHostCounter ( ) ; <nl> - m_vsync_cond . notifyAll ( ) ; <nl> - } <nl> - <nl> - uint32_t CRBP : : WaitVsync ( uint32_t target ) <nl> - { <nl> - CSingleLock vlock ( m_vsync_lock ) ; <nl> - DISPMANX_DISPLAY_HANDLE_T display = m_display ; <nl> - XbmcThreads : : EndTime delay ( 50 ) ; <nl> - if ( target = = ~ 0U ) <nl> - target = m_vsync_count + 1 ; <nl> - while ( ! delay . IsTimePast ( ) ) <nl> - { <nl> - if ( ( signed ) ( m_vsync_count - target ) > = 0 ) <nl> - break ; <nl> - if ( ! m_vsync_cond . wait ( vlock , delay . MillisLeft ( ) ) ) <nl> - break ; <nl> - } <nl> - if ( ( signed ) ( m_vsync_count - target ) < 0 ) <nl> - CLog : : Log ( LOGDEBUG , " CRBP : : % s no vsync % d / % d display : % x ( % x ) delay : % d " , __FUNCTION__ , m_vsync_count , target , m_display , display , delay . MillisLeft ( ) ) ; <nl> - <nl> - return m_vsync_count ; <nl> - } <nl> - <nl> - uint32_t CRBP : : LastVsync ( int64_t & time ) <nl> - { <nl> - CSingleLock lock ( m_vsync_lock ) ; <nl> - time = m_vsync_time ; <nl> - return m_vsync_count ; <nl> - } <nl> - <nl> - uint32_t CRBP : : LastVsync ( ) <nl> - { <nl> - int64_t time = 0 ; <nl> - return LastVsync ( time ) ; <nl> - } <nl> - <nl> - void CRBP : : Deinitialize ( ) <nl> - { <nl> - if ( m_omx_image_init ) <nl> - g_OMXImage . Deinitialize ( ) ; <nl> - <nl> - if ( m_omx_initialized ) <nl> - m_OMX - > Deinitialize ( ) ; <nl> - <nl> - m_DllBcmHost - > bcm_host_deinit ( ) ; <nl> - <nl> - if ( m_initialized ) <nl> - m_DllBcmHost - > Unload ( ) ; <nl> - <nl> - m_omx_image_init = false ; <nl> - m_initialized = false ; <nl> - m_omx_initialized = false ; <nl> - if ( m_mb ) <nl> - mbox_close ( m_mb ) ; <nl> - m_mb = 0 ; <nl> - vcsm_exit ( ) ; <nl> - } <nl> - <nl> - static int mbox_property ( int file_desc , void * buf ) <nl> - { <nl> - int ret_val = ioctl ( file_desc , IOCTL_MBOX_PROPERTY , buf ) ; <nl> - <nl> - if ( ret_val < 0 ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : ioctl_set_msg failed : % d " , __FUNCTION__ , ret_val ) ; <nl> - } <nl> - return ret_val ; <nl> - } <nl> - <nl> - static int mbox_open ( ) <nl> - { <nl> - int file_desc ; <nl> - <nl> - / / open a char device file used for communicating with kernel mbox driver <nl> - file_desc = open ( DEVICE_FILE_NAME , 0 ) ; <nl> - if ( file_desc < 0 ) <nl> - CLog : : Log ( LOGERROR , " % s : Can ' t open device file : % s ( % d ) " , __FUNCTION__ , DEVICE_FILE_NAME , file_desc ) ; <nl> - <nl> - return file_desc ; <nl> - } <nl> - <nl> - static void mbox_close ( int file_desc ) <nl> - { <nl> - close ( file_desc ) ; <nl> - } <nl> - <nl> - static unsigned mem_lock ( int file_desc , unsigned handle ) <nl> - { <nl> - int i = 0 ; <nl> - unsigned p [ 32 ] ; <nl> - p [ i + + ] = 0 ; / / size <nl> - p [ i + + ] = 0x00000000 ; / / process request <nl> - <nl> - p [ i + + ] = 0x3000d ; / / ( the tag id ) <nl> - p [ i + + ] = 4 ; / / ( size of the buffer ) <nl> - p [ i + + ] = 4 ; / / ( size of the data ) <nl> - p [ i + + ] = handle ; <nl> - <nl> - p [ i + + ] = 0x00000000 ; / / end tag <nl> - p [ 0 ] = i * sizeof * p ; / / actual size <nl> - <nl> - mbox_property ( file_desc , p ) ; <nl> - return p [ 5 ] ; <nl> - } <nl> - <nl> - static unsigned mem_unlock ( int file_desc , unsigned handle ) <nl> - { <nl> - int i = 0 ; <nl> - unsigned p [ 32 ] ; <nl> - p [ i + + ] = 0 ; / / size <nl> - p [ i + + ] = 0x00000000 ; / / process request <nl> - <nl> - p [ i + + ] = 0x3000e ; / / ( the tag id ) <nl> - p [ i + + ] = 4 ; / / ( size of the buffer ) <nl> - p [ i + + ] = 4 ; / / ( size of the data ) <nl> - p [ i + + ] = handle ; <nl> - <nl> - p [ i + + ] = 0x00000000 ; / / end tag <nl> - p [ 0 ] = i * sizeof * p ; / / actual size <nl> - <nl> - mbox_property ( file_desc , p ) ; <nl> - return p [ 5 ] ; <nl> - } <nl> - <nl> - <nl> - # define GET_VCIMAGE_PARAMS 0x30044 <nl> - static int get_image_params ( int file_desc , VC_IMAGE_T * img ) <nl> - { <nl> - uint32_t buf [ sizeof ( * img ) / sizeof ( uint32_t ) + 32 ] ; <nl> - uint32_t * p = buf ; <nl> - void * rimg ; <nl> - int rv ; <nl> - <nl> - * p + + = 0 ; / / size <nl> - * p + + = 0 ; / / process request <nl> - * p + + = GET_VCIMAGE_PARAMS ; <nl> - * p + + = sizeof ( * img ) ; <nl> - * p + + = sizeof ( * img ) ; <nl> - rimg = p ; <nl> - memcpy ( p , img , sizeof ( * img ) ) ; <nl> - p + = sizeof ( * img ) / sizeof ( * p ) ; <nl> - * p + + = 0 ; / / End tag <nl> - buf [ 0 ] = ( p - buf ) * sizeof ( * p ) ; <nl> - <nl> - rv = mbox_property ( file_desc , buf ) ; <nl> - memcpy ( img , rimg , sizeof ( * img ) ) ; <nl> - <nl> - return rv ; <nl> - } <nl> - <nl> - CGPUMEM : : CGPUMEM ( unsigned int numbytes , bool cached ) <nl> - { <nl> - m_numbytes = numbytes ; <nl> - m_vcsm_handle = vcsm_malloc_cache ( numbytes , static_cast < VCSM_CACHE_TYPE_T > ( 0x80 | static_cast < unsigned > ( cached ? VCSM_CACHE_TYPE_HOST : VCSM_CACHE_TYPE_NONE ) ) , const_cast < char * > ( " CGPUMEM " ) ) ; <nl> - if ( m_vcsm_handle ) <nl> - m_vc_handle = vcsm_vc_hdl_from_hdl ( m_vcsm_handle ) ; <nl> - if ( m_vc_handle ) <nl> - m_arm = vcsm_lock ( m_vcsm_handle ) ; <nl> - if ( m_arm ) <nl> - m_vc = mem_lock ( g_RBP . GetMBox ( ) , m_vc_handle ) ; <nl> - } <nl> - <nl> - CGPUMEM : : ~ CGPUMEM ( ) <nl> - { <nl> - if ( m_vc_handle ) <nl> - mem_unlock ( g_RBP . GetMBox ( ) , m_vc_handle ) ; <nl> - if ( m_arm ) <nl> - vcsm_unlock_ptr ( m_arm ) ; <nl> - if ( m_vcsm_handle ) <nl> - vcsm_free ( m_vcsm_handle ) ; <nl> - } <nl> - <nl> - / / Call this to clean and invalidate a region of memory <nl> - void CGPUMEM : : Flush ( ) <nl> - { <nl> - struct vcsm_user_clean_invalid_s iocache = { } ; <nl> - iocache . s [ 0 ] . handle = m_vcsm_handle ; <nl> - iocache . s [ 0 ] . cmd = 3 ; / / clean + invalidate <nl> - iocache . s [ 0 ] . addr = ( int ) m_arm ; <nl> - iocache . s [ 0 ] . size = m_numbytes ; <nl> - vcsm_clean_invalid ( & iocache ) ; <nl> - } <nl> - <nl> - AVRpiZcFrameGeometry CRBP : : GetFrameGeometry ( uint32_t encoding , unsigned short video_width , unsigned short video_height ) <nl> - { <nl> - AVRpiZcFrameGeometry geo ; <nl> - geo . setStripes ( 1 ) ; <nl> - geo . setBitsPerPixel ( 8 ) ; <nl> - <nl> - switch ( encoding ) <nl> - { <nl> - case MMAL_ENCODING_RGBA : case MMAL_ENCODING_BGRA : <nl> - geo . setBitsPerPixel ( 32 ) ; <nl> - geo . setStrideY ( video_width * geo . getBytesPerPixel ( ) ) ; <nl> - geo . setHeightY ( video_height ) ; <nl> - break ; <nl> - case MMAL_ENCODING_RGB24 : case MMAL_ENCODING_BGR24 : <nl> - geo . setBitsPerPixel ( 32 ) ; <nl> - geo . setStrideY ( video_width * geo . getBytesPerPixel ( ) ) ; <nl> - geo . setHeightY ( video_height ) ; <nl> - break ; <nl> - case MMAL_ENCODING_RGB16 : case MMAL_ENCODING_BGR16 : <nl> - geo . setBitsPerPixel ( 16 ) ; <nl> - geo . setStrideY ( video_width * geo . getBytesPerPixel ( ) ) ; <nl> - geo . setHeightY ( video_height ) ; <nl> - break ; <nl> - case MMAL_ENCODING_I420 : <nl> - case MMAL_ENCODING_I420_S : <nl> - geo . setStrideY ( ( video_width + 31 ) & ~ 31 ) ; <nl> - geo . setStrideC ( geo . getStrideY ( ) > > 1 ) ; <nl> - geo . setHeightY ( ( video_height + 15 ) & ~ 15 ) ; <nl> - geo . setHeightC ( geo . getHeightY ( ) > > 1 ) ; <nl> - geo . setPlanesC ( 2 ) ; <nl> - break ; <nl> - case MMAL_ENCODING_I420_16 : <nl> - geo . setBitsPerPixel ( 10 ) ; <nl> - geo . setStrideY ( ( ( video_width + 31 ) & ~ 31 ) * geo . getBytesPerPixel ( ) ) ; <nl> - geo . setStrideC ( geo . getStrideY ( ) > > 1 ) ; <nl> - geo . setHeightY ( ( video_height + 15 ) & ~ 15 ) ; <nl> - geo . setHeightC ( geo . getHeightY ( ) > > 1 ) ; <nl> - geo . setPlanesC ( 2 ) ; <nl> - break ; <nl> - case MMAL_ENCODING_OPAQUE : <nl> - geo . setStrideY ( video_width ) ; <nl> - geo . setHeightY ( video_height ) ; <nl> - break ; <nl> - case MMAL_ENCODING_YUVUV128 : <nl> - { <nl> - VC_IMAGE_T img = { } ; <nl> - img . type = VC_IMAGE_YUV_UV ; <nl> - img . width = video_width ; <nl> - img . height = video_height ; <nl> - int rc = get_image_params ( GetMBox ( ) , & img ) ; <nl> - assert ( rc = = 0 ) ; <nl> - const unsigned int stripe_w = 128 ; <nl> - geo . setStrideY ( stripe_w ) ; <nl> - geo . setStrideC ( stripe_w ) ; <nl> - geo . setHeightY ( ( ( intptr_t ) img . extra . uv . u - ( intptr_t ) img . image_data ) / stripe_w ) ; <nl> - geo . setHeightC ( img . pitch / stripe_w - geo . getHeightY ( ) ) ; <nl> - geo . setPlanesC ( 1 ) ; <nl> - geo . setStripes ( ( video_width + stripe_w - 1 ) / stripe_w ) ; <nl> - break ; <nl> - } <nl> - case MMAL_ENCODING_YUVUV64_16 : <nl> - { <nl> - VC_IMAGE_T img = { } ; <nl> - img . type = VC_IMAGE_YUV_UV_16 ; <nl> - img . width = video_width ; <nl> - img . height = video_height ; <nl> - int rc = get_image_params ( GetMBox ( ) , & img ) ; <nl> - assert ( rc = = 0 ) ; <nl> - const unsigned int stripe_w = 128 ; <nl> - geo . setBitsPerPixel ( 10 ) ; <nl> - geo . setStrideY ( stripe_w ) ; <nl> - geo . setStrideC ( stripe_w ) ; <nl> - geo . setHeightY ( ( ( intptr_t ) img . extra . uv . u - ( intptr_t ) img . image_data ) / stripe_w ) ; <nl> - geo . setHeightC ( img . pitch / stripe_w - geo . getHeightY ( ) ) ; <nl> - geo . setPlanesC ( 1 ) ; <nl> - geo . setStripes ( ( video_width * 2 + stripe_w - 1 ) / stripe_w ) ; <nl> - break ; <nl> - } <nl> - default : assert ( 0 ) ; <nl> - } <nl> - return geo ; <nl> - } <nl> deleted file mode 100644 <nl> index f56e7b5f9176 . . 000000000000 <nl> mmm a / xbmc / platform / linux / RBP . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2005 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # ifndef USE_VCHIQ_ARM <nl> - # define USE_VCHIQ_ARM <nl> - # endif <nl> - # ifndef __VIDEOCORE4__ <nl> - # define __VIDEOCORE4__ <nl> - # endif <nl> - # ifndef HAVE_VMCS_CONFIG <nl> - # define HAVE_VMCS_CONFIG <nl> - # endif <nl> - <nl> - # include " DllBCM . h " <nl> - # include " OMXCore . h " <nl> - # include " ServiceBroker . h " <nl> - # include " threads / CriticalSection . h " <nl> - # include " threads / Event . h " <nl> - # include " utils / CPUInfo . h " <nl> - <nl> - class AVRpiZcFrameGeometry <nl> - { <nl> - public : <nl> - unsigned int getStrideY ( ) { return stride_y ; } <nl> - unsigned int getHeightY ( ) { return height_y ; } <nl> - unsigned int getStrideC ( ) { return stride_c ; } <nl> - unsigned int getHeightC ( ) { return height_c ; } <nl> - unsigned int getPlanesC ( ) { return planes_c ; } <nl> - unsigned int getStripes ( ) { return stripes ; } <nl> - unsigned int getBitsPerPixel ( ) { return bits_per_pixel ; } <nl> - unsigned int getBytesPerPixel ( ) { return ( bits_per_pixel + 7 ) > > 3 ; } <nl> - unsigned int getSizeY ( ) { return stride_y * height_y ; } <nl> - unsigned int getSizeC ( ) { return stride_c * height_c ; } <nl> - unsigned int getSize ( ) { return ( getSizeY ( ) + getSizeC ( ) * getPlanesC ( ) ) * getStripes ( ) ; } <nl> - void setStrideY ( unsigned int v ) { stride_y = v ; } <nl> - void setHeightY ( unsigned int v ) { height_y = v ; } <nl> - void setStrideC ( unsigned int v ) { stride_c = v ; } <nl> - void setHeightC ( unsigned int v ) { height_c = v ; } <nl> - void setPlanesC ( unsigned int v ) { planes_c = v ; } <nl> - void setStripes ( unsigned int v ) { stripes = v ; } <nl> - void setBitsPerPixel ( unsigned int v ) { bits_per_pixel = v ; } <nl> - void setBytesPerPixel ( unsigned int v ) { bits_per_pixel = v * 8 ; } <nl> - private : <nl> - unsigned int stride_y = 0 ; <nl> - unsigned int height_y = 0 ; <nl> - unsigned int stride_c = 0 ; <nl> - unsigned int height_c = 0 ; <nl> - unsigned int planes_c = 0 ; <nl> - unsigned int stripes = 0 ; <nl> - unsigned int bits_per_pixel = 0 ; <nl> - } ; <nl> - <nl> - class CGPUMEM <nl> - { <nl> - public : <nl> - CGPUMEM ( unsigned int numbytes , bool cached = true ) ; <nl> - ~ CGPUMEM ( ) ; <nl> - void Flush ( ) ; <nl> - void * m_arm = nullptr ; / / Pointer to memory mapped on ARM side <nl> - int m_vc_handle = 0 ; / / Videocore handle of relocatable memory <nl> - int m_vcsm_handle = 0 ; / / Handle for use by VCSM <nl> - unsigned int m_vc = 0 ; / / Address for use in GPU code <nl> - unsigned int m_numbytes = 0 ; / / Size of memory block <nl> - void * m_opaque = nullptr ; <nl> - } ; <nl> - <nl> - class CRBP <nl> - { <nl> - public : <nl> - CRBP ( ) ; <nl> - ~ CRBP ( ) ; <nl> - <nl> - bool Initialize ( ) ; <nl> - void LogFirmwareVersion ( ) ; <nl> - void Deinitialize ( ) ; <nl> - int GetArmMem ( ) { return m_arm_mem ; } <nl> - int GetGpuMem ( ) { return m_gpu_mem ; } <nl> - bool GetCodecMpg2 ( ) { return m_codec_mpg2_enabled ; } <nl> - int RaspberryPiVersion ( ) { return CServiceBroker : : GetCPUInfo ( ) - > GetCPUCount ( ) = = 1 ? 1 : 2 ; } ; <nl> - bool GetCodecWvc1 ( ) { return m_codec_wvc1_enabled ; } <nl> - void GetDisplaySize ( int & width , int & height ) ; <nl> - DISPMANX_DISPLAY_HANDLE_T OpenDisplay ( uint32_t device ) ; <nl> - void CloseDisplay ( DISPMANX_DISPLAY_HANDLE_T display ) ; <nl> - int GetGUIResolutionLimit ( ) { return m_gui_resolution_limit ; } <nl> - / / stride can be null for packed output <nl> - unsigned char * CaptureDisplay ( int width , int height , int * stride , bool swap_red_blue , bool video_only = true ) ; <nl> - DllOMX * GetDllOMX ( ) { return m_OMX ? m_OMX - > GetDll ( ) : NULL ; } <nl> - uint32_t LastVsync ( int64_t & time ) ; <nl> - uint32_t LastVsync ( ) ; <nl> - uint32_t WaitVsync ( uint32_t target = ~ 0U ) ; <nl> - void VSyncCallback ( ) ; <nl> - int GetMBox ( ) { return m_mb ; } <nl> - AVRpiZcFrameGeometry GetFrameGeometry ( uint32_t encoding , unsigned short video_width , unsigned short video_height ) ; <nl> - <nl> - private : <nl> - DllBcmHost * m_DllBcmHost ; <nl> - bool m_initialized ; <nl> - bool m_omx_initialized ; <nl> - bool m_omx_image_init ; <nl> - int m_arm_mem ; <nl> - int m_gpu_mem ; <nl> - int m_gui_resolution_limit ; <nl> - bool m_codec_mpg2_enabled ; <nl> - bool m_codec_wvc1_enabled ; <nl> - COMXCore * m_OMX ; <nl> - DISPMANX_DISPLAY_HANDLE_T m_display ; <nl> - CCriticalSection m_vsync_lock ; <nl> - XbmcThreads : : ConditionVariable m_vsync_cond ; <nl> - uint32_t m_vsync_count ; <nl> - int64_t m_vsync_time ; <nl> - class DllLibOMXCore ; <nl> - CCriticalSection m_critSection ; <nl> - <nl> - int m_mb ; <nl> - } ; <nl> - <nl> - extern CRBP g_RBP ; <nl> mmm a / xbmc / platform / linux / input / CMakeLists . txt <nl> ppp b / xbmc / platform / linux / input / CMakeLists . txt <nl> if ( LIRCCLIENT_FOUND ) <nl> list ( APPEND HEADERS LIRC . h ) <nl> endif ( ) <nl> <nl> - if ( CORE_PLATFORM_NAME_LC STREQUAL rbpi OR CORE_PLATFORM_NAME_LC STREQUAL gbm ) <nl> + if ( CORE_PLATFORM_NAME_LC STREQUAL gbm ) <nl> if ( LIBINPUT_FOUND ) <nl> list ( APPEND SOURCES LibInputHandler . cpp <nl> LibInputKeyboard . cpp <nl> deleted file mode 100644 <nl> index d967e5ceeb3c . . 000000000000 <nl> mmm a / xbmc / platform / linux / rpi / rpi_user_vcsm . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2015 - 2016 Raspberry Pi ( Trading ) Ltd . <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - / * VideoCore Shared Memory - user interface library . <nl> - * * <nl> - * * This library provides all the necessary abstraction for any application to <nl> - * * make use of the shared memory service which is distributed across a kernel <nl> - * * driver and a videocore service . <nl> - * * <nl> - * * It is an application design decision to choose or not to use this service . <nl> - * * <nl> - * * The logical flow of operations that a user application needs to follow when <nl> - * * using this service is : <nl> - * * <nl> - * * 1 ) Initialize the service . <nl> - * * 2 ) Allocate shared memory blocks . <nl> - * * 3 ) Start using the allocated blocks . <nl> - * * - In order to gain ownership on a block , lock the allocated block , <nl> - * * locking a block returns a valid address that the user application <nl> - * * can access . <nl> - * * - When finished with using the block for the current execution cycle <nl> - * * or function , and so when giving up the ownership , unlock the block . <nl> - * * 4 ) A block can be locked / unlocked as many times required - within or outside <nl> - * * of - a specific execution context . <nl> - * * 5 ) To completely release an allocated block , free it . <nl> - * * 6 ) If the service is no longer required , terminate it . <nl> - * * <nl> - * * <nl> - * * Some generic considerations : <nl> - <nl> - * * Allocating memory blocks . <nl> - * * <nl> - * * Memory blocks can be allocated in different manners depending on the cache <nl> - * * behavior desired . A given block can either be : <nl> - <nl> - * * - Allocated in a non cached fashion all the way through host and videocore . <nl> - * * - Allocated in a cached fashion on host OR videocore . <nl> - * * - Allocated in a cached fashion on host AND videocore . <nl> - * * <nl> - * * It is an application decision to determine how to allocate a block . Evidently <nl> - * * if the application will be doing substantial read / write accesses to a given block , <nl> - * * it is recommended to allocate the block at least in a ' host cached ' fashion for <nl> - * * better results . <nl> - * * <nl> - * * <nl> - * * Locking memory blocks . <nl> - * * <nl> - * * When the memory block has been allocated in a host cached fashion , locking the <nl> - * * memory block ( and so taking ownership of it ) will trigger a cache invalidation . <nl> - * * <nl> - * * For the above reason and when using host cached allocation , it is important that <nl> - * * an application properly implements the lock / unlock mechanism to ensure cache will <nl> - * * stay coherent , otherwise there is no guarantee it will at all be . <nl> - * * <nl> - * * It is possible to dynamically change the host cache behavior ( ie cached or non <nl> - * * cached ) of a given allocation without needing to free and re - allocate the block . <nl> - * * This feature can be useful for such application which requires access to the block <nl> - * * only at certain times and not otherwise . By changing the cache behavior dynamically <nl> - * * the application can optimize performances for a given duration of use . <nl> - * * Such dynamic cache behavior remapping only applies to host cache and not videocore <nl> - * * cache . If one requires to change the videocore cache behavior , then a new block <nl> - * * must be created to replace the old one . <nl> - * * <nl> - * * On successful locking , a valid pointer is returned that the application can use <nl> - * * to access to data inside the block . There is no guarantee that the pointer will <nl> - * * stay valid following the unlock action corresponding to this lock . <nl> - * * <nl> - * * <nl> - * * Unlocking memory blocks . <nl> - * * <nl> - * * When the memory block has been allocated in a host cached fashion , unlocking the <nl> - * * memory block ( and so forgiving its ownership ) will trigger a cache flush unless <nl> - * * explicitly asked not to flush the cache for performances reasons . <nl> - * * <nl> - * * For the above reason and when using host cached allocation , it is important that <nl> - * * an application properly implements the lock / unlock mechanism to ensure cache will <nl> - * * stay coherent , otherwise there is no guarantee it will at all be . <nl> - * * <nl> - * * <nl> - * * A complete API is defined below . <nl> - * / <nl> - <nl> - # ifdef __cplusplus <nl> - extern " C " <nl> - { <nl> - # endif <nl> - <nl> - / * Different status that can be dumped . <nl> - * / <nl> - typedef enum <nl> - { <nl> - VCSM_STATUS_VC_WALK_ALLOC = 0 , / / Walks * all * the allocation on videocore . <nl> - / / Result of the walk is seen in the videocore <nl> - / / log . <nl> - VCSM_STATUS_HOST_WALK_MAP , / / Walks the * full * mapping allocation on host <nl> - / / driver ( ie for all processes ) . Result of <nl> - / / the walk is seen in the kernel log . <nl> - VCSM_STATUS_HOST_WALK_PID_MAP , / / Walks the per process mapping allocation on host <nl> - / / driver ( for current process ) . Result of <nl> - / / the walk is seen in the kernel log . <nl> - VCSM_STATUS_HOST_WALK_PID_ALLOC , / / Walks the per process host allocation on host <nl> - / / driver ( for current process ) . Result of <nl> - / / the walk is seen in the kernel log . <nl> - VCSM_STATUS_VC_MAP_ALL , / / Equivalent to both VCSM_STATUS_VC_WALK_ALLOC and <nl> - / / VCSM_STATUS_HOST_WALK_MAP . <nl> - / / <nl> - VCSM_STATUS_NONE , / / Must be last - invalid . <nl> - <nl> - } VCSM_STATUS_T ; <nl> - <nl> - / * Different kind of cache behavior . <nl> - * / <nl> - typedef enum <nl> - { <nl> - VCSM_CACHE_TYPE_NONE = 0 , / / No caching applies . <nl> - VCSM_CACHE_TYPE_HOST , / / Allocation is cached on host ( user space ) . <nl> - VCSM_CACHE_TYPE_VC , / / Allocation is cached on videocore . <nl> - VCSM_CACHE_TYPE_HOST_AND_VC , / / Allocation is cached on both host and videocore . <nl> - <nl> - } VCSM_CACHE_TYPE_T ; <nl> - <nl> - / * Initialize the vcsm processing . <nl> - * * <nl> - * * Must be called once before attempting to do anything else . <nl> - * * <nl> - * * Returns 0 on success , - 1 on error . <nl> - * / <nl> - int vcsm_init ( void ) ; <nl> - <nl> - <nl> - / * Terminates the vcsm processing . <nl> - * * <nl> - * * Must be called vcsm services are no longer needed , it will <nl> - * * take care of removing any allocation under the current process <nl> - * * control if deemed necessary . <nl> - * / <nl> - void vcsm_exit ( void ) ; <nl> - <nl> - <nl> - / * Queries the status of the the vcsm . <nl> - * * <nl> - * * Triggers dump of various kind of information , see the <nl> - * * different variants specified in VCSM_STATUS_T . <nl> - * * <nl> - * * Pid is optional . <nl> - * / <nl> - void vcsm_status ( VCSM_STATUS_T status , int pid ) ; <nl> - <nl> - <nl> - / * Allocates a non - cached block of memory of size ' size ' via the vcsm memory <nl> - * * allocator . <nl> - * * <nl> - * * Returns : 0 on error <nl> - * * a non - zero opaque handle on success . <nl> - * * <nl> - * * On success , the user must invoke vcsm_lock with the returned opaque <nl> - * * handle to gain access to the memory associated with the opaque handle . <nl> - * * When finished using the memory , the user calls vcsm_unlock_xx ( see those <nl> - * * function definition for more details on the one that can be used ) . <nl> - * * <nl> - * * A well behaved application should make every attempt to lock / unlock <nl> - * * only for the duration it needs to access the memory data associated with <nl> - * * the opaque handle . <nl> - * / <nl> - unsigned int vcsm_malloc ( unsigned int size , char * name ) ; <nl> - <nl> - <nl> - / * Allocates a cached block of memory of size ' size ' via the vcsm memory <nl> - * * allocator , the type of caching requested is passed as argument of the <nl> - * * function call . <nl> - * * <nl> - * * Returns : 0 on error <nl> - * * a non - zero opaque handle on success . <nl> - * * <nl> - * * On success , the user must invoke vcsm_lock with the returned opaque <nl> - * * handle to gain access to the memory associated with the opaque handle . <nl> - * * When finished using the memory , the user calls vcsm_unlock_xx ( see those <nl> - * * function definition for more details on the one that can be used ) . <nl> - * * <nl> - * * A well behaved application should make every attempt to lock / unlock <nl> - * * only for the duration it needs to access the memory data associated with <nl> - * * the opaque handle . <nl> - * / <nl> - unsigned int vcsm_malloc_cache ( unsigned int size , VCSM_CACHE_TYPE_T cache , char * name ) ; <nl> - <nl> - <nl> - / * Shares an allocated block of memory via the vcsm memory allocator . <nl> - * * <nl> - * * Returns : 0 on error <nl> - * * a non - zero opaque handle on success . <nl> - * * <nl> - * * On success , the user must invoke vcsm_lock with the returned opaque <nl> - * * handle to gain access to the memory associated with the opaque handle . <nl> - * * When finished using the memory , the user calls vcsm_unlock_xx ( see those <nl> - * * function definition for more details on the one that can be used ) . <nl> - * * <nl> - * * A well behaved application should make every attempt to lock / unlock <nl> - * * only for the duration it needs to access the memory data associated with <nl> - * * the opaque handle . <nl> - * / <nl> - unsigned int vcsm_malloc_share ( unsigned int handle ) ; <nl> - <nl> - <nl> - / * Resizes a block of memory allocated previously by vcsm_alloc . <nl> - * * <nl> - * * Returns : 0 on success <nl> - * * - errno on error . <nl> - * * <nl> - * * The handle must be unlocked by user prior to attempting any <nl> - * * resize action . <nl> - * * <nl> - * * On error , the original size allocated against the handle <nl> - * * remains available the same way it would be following a <nl> - * * successful vcsm_malloc . <nl> - * / <nl> - int vcsm_resize ( unsigned int handle , unsigned int new_size ) ; <nl> - <nl> - <nl> - / * Frees a block of memory that was successfully allocated by <nl> - * * a prior call the vcms_alloc . <nl> - * * <nl> - * * The handle should be considered invalid upon return from this <nl> - * * call . <nl> - * * <nl> - * * Whether any memory is actually freed up or not as the result of <nl> - * * this call will depends on many factors , if all goes well it will <nl> - * * be freed . If something goes wrong , the memory will likely end up <nl> - * * being freed up as part of the vcsm_exit process . In the end the <nl> - * * memory is guaranteed to be freed one way or another . <nl> - * / <nl> - void vcsm_free ( unsigned int handle ) ; <nl> - <nl> - <nl> - / * Retrieves a videocore opaque handle from a mapped user address <nl> - * * pointer . The videocore handle will correspond to the actual <nl> - * * memory mapped in videocore . <nl> - * * <nl> - * * Returns : 0 on error <nl> - * * a non - zero opaque handle on success . <nl> - * * <nl> - * * Note : the videocore opaque handle is distinct from the user <nl> - * * opaque handle ( allocated via vcsm_malloc ) and it is only <nl> - * * significant for such application which knows what to do <nl> - * * with it , for the others it is just a number with little <nl> - * * use since nothing can be done with it ( in particular <nl> - * * for safety reason it cannot be used to map anything ) . <nl> - * / <nl> - unsigned int vcsm_vc_hdl_from_ptr ( void * usr_ptr ) ; <nl> - <nl> - <nl> - / * Retrieves a videocore opaque handle from a opaque handle <nl> - * * pointer . The videocore handle will correspond to the actual <nl> - * * memory mapped in videocore . <nl> - * * <nl> - * * Returns : 0 on error <nl> - * * a non - zero opaque handle on success . <nl> - * * <nl> - * * Note : the videocore opaque handle is distinct from the user <nl> - * * opaque handle ( allocated via vcsm_malloc ) and it is only <nl> - * * significant for such application which knows what to do <nl> - * * with it , for the others it is just a number with little <nl> - * * use since nothing can be done with it ( in particular <nl> - * * for safety reason it cannot be used to map anything ) . <nl> - * / <nl> - unsigned int vcsm_vc_hdl_from_hdl ( unsigned int handle ) ; <nl> - <nl> - <nl> - / * Retrieves a user opaque handle from a mapped user address <nl> - * * pointer . <nl> - * * <nl> - * * Returns : 0 on error <nl> - * * a non - zero opaque handle on success . <nl> - * / <nl> - unsigned int vcsm_usr_handle ( void * usr_ptr ) ; <nl> - <nl> - <nl> - / * Retrieves a mapped user address from an opaque user <nl> - * * handle . <nl> - * * <nl> - * * Returns : 0 on error <nl> - * * a non - zero address on success . <nl> - * * <nl> - * * On success , the address corresponds to the pointer <nl> - * * which can access the data allocated via the vcsm_malloc <nl> - * * call . <nl> - * / <nl> - void * vcsm_usr_address ( unsigned int handle ) ; <nl> - <nl> - <nl> - / * Locks the memory associated with this opaque handle . <nl> - * * <nl> - * * Returns : NULL on error <nl> - * * a valid pointer on success . <nl> - * * <nl> - * * A user MUST lock the handle received from vcsm_malloc <nl> - * * in order to be able to use the memory associated with it . <nl> - * * <nl> - * * On success , the pointer returned is only valid within <nl> - * * the lock content ( ie until a corresponding vcsm_unlock_xx <nl> - * * is invoked ) . <nl> - * / <nl> - void * vcsm_lock ( unsigned int handle ) ; <nl> - <nl> - <nl> - / * Locks the memory associated with this opaque handle . The lock <nl> - * * also gives a chance to update the * host * cache behavior of the <nl> - * * allocated buffer if so desired . The * videocore * cache behavior <nl> - * * of the allocated buffer cannot be changed by this call and such <nl> - * * attempt will be ignored . <nl> - * * <nl> - * * The system will attempt to honour the cache_update mode request , <nl> - * * the cache_result mode will provide the final answer on which cache <nl> - * * mode is really in use . Failing to change the cache mode will not <nl> - * * result in a failure to lock the buffer as it is an application <nl> - * * decision to choose what to do if ( cache_result ! = cache_update ) <nl> - * * <nl> - * * The value returned in cache_result can only be considered valid if <nl> - * * the returned pointer is non NULL . The cache_result pointer may be <nl> - * * NULL if the application does not care about the actual outcome of <nl> - * * its action with regards to the cache behavior change . <nl> - * * <nl> - * * Returns : NULL on error <nl> - * * a valid pointer on success . <nl> - * * <nl> - * * A user MUST lock the handle received from vcsm_malloc <nl> - * * in order to be able to use the memory associated with it . <nl> - * * <nl> - * * On success , the pointer returned is only valid within <nl> - * * the lock content ( ie until a corresponding vcsm_unlock_xx <nl> - * * is invoked ) . <nl> - * / <nl> - void * vcsm_lock_cache ( unsigned int handle , <nl> - VCSM_CACHE_TYPE_T cache_update , <nl> - VCSM_CACHE_TYPE_T * cache_result ) ; <nl> - <nl> - <nl> - / * Unlocks the memory associated with this user mapped address . <nl> - * * <nl> - * * Returns : 0 on success <nl> - * * - errno on error . <nl> - * * <nl> - * * After unlocking a mapped address , the user should no longer <nl> - * * attempt to reference it . <nl> - * / <nl> - int vcsm_unlock_ptr ( void * usr_ptr ) ; <nl> - <nl> - <nl> - / * Unlocks the memory associated with this user mapped address . <nl> - * * Apply special processing that would override the otherwise <nl> - * * default behavior . <nl> - * * <nl> - * * If ' cache_no_flush ' is specified : <nl> - * * Do not flush cache as the result of the unlock ( if cache <nl> - * * flush was otherwise applicable in this case ) . <nl> - * * <nl> - * * Returns : 0 on success <nl> - * * - errno on error . <nl> - * * <nl> - * * After unlocking a mapped address , the user should no longer <nl> - * * attempt to reference it . <nl> - * / <nl> - int vcsm_unlock_ptr_sp ( void * usr_ptr , int cache_no_flush ) ; <nl> - <nl> - <nl> - / * Unlocks the memory associated with this user opaque handle . <nl> - * * <nl> - * * Returns : 0 on success <nl> - * * - errno on error . <nl> - * * <nl> - * * After unlocking an opaque handle , the user should no longer <nl> - * * attempt to reference the mapped addressed once associated <nl> - * * with it . <nl> - * / <nl> - int vcsm_unlock_hdl ( unsigned int handle ) ; <nl> - <nl> - <nl> - / * Unlocks the memory associated with this user opaque handle . <nl> - * * Apply special processing that would override the otherwise <nl> - * * default behavior . <nl> - * * <nl> - * * If ' cache_no_flush ' is specified : <nl> - * * Do not flush cache as the result of the unlock ( if cache <nl> - * * flush was otherwise applicable in this case ) . <nl> - * * <nl> - * * Returns : 0 on success <nl> - * * - errno on error . <nl> - * * <nl> - * * After unlocking an opaque handle , the user should no longer <nl> - * * attempt to reference the mapped addressed once associated <nl> - * * with it . <nl> - * / <nl> - int vcsm_unlock_hdl_sp ( unsigned int handle , int cache_no_flush ) ; <nl> - <nl> - / * Clean and / or invalidate the memory associated with this user opaque handle <nl> - * * <nl> - * * Returns : non - zero on error <nl> - * * <nl> - * * structure contains a list of flush / invalidate commands . Commands are : <nl> - * * 0 : nop <nl> - * * 1 : invalidate given virtual range in L1 / L2 <nl> - * * 2 : clean given virtual range in L1 / L2 <nl> - * * 3 : clean + invalidate given virtual range in L1 / L2 <nl> - * * 4 : flush all L1 / L2 <nl> - * / <nl> - struct vcsm_user_clean_invalid_s { <nl> - struct { <nl> - unsigned int cmd ; <nl> - unsigned int handle ; <nl> - unsigned int addr ; <nl> - unsigned int size ; <nl> - } s [ 8 ] ; <nl> - } ; <nl> - <nl> - int vcsm_clean_invalid ( struct vcsm_user_clean_invalid_s * s ) ; <nl> - <nl> - # ifdef __cplusplus <nl> - } <nl> - # endif <nl> - <nl> mmm a / xbmc / platform / xbmc . cpp <nl> ppp b / xbmc / platform / xbmc . cpp <nl> <nl> <nl> # include " Application . h " <nl> <nl> - # ifdef TARGET_RASPBERRY_PI <nl> - # include " platform / linux / RBP . h " <nl> - # endif <nl> - <nl> # ifdef TARGET_WINDOWS_DESKTOP <nl> # include " platform / win32 / IMMNotificationClient . h " <nl> # include < mmdeviceapi . h > <nl> extern " C " int XBMC_Run ( bool renderGUI , const CAppParamParser & params ) <nl> return status ; <nl> } <nl> <nl> - # ifdef TARGET_RASPBERRY_PI <nl> - if ( ! g_RBP . Initialize ( ) ) <nl> - return false ; <nl> - g_RBP . LogFirmwareVersion ( ) ; <nl> - # elif defined ( TARGET_ANDROID ) <nl> + # if defined ( TARGET_ANDROID ) <nl> CXBMCApp : : get ( ) - > Initialize ( ) ; <nl> # endif <nl> <nl> extern " C " int XBMC_Run ( bool renderGUI , const CAppParamParser & params ) <nl> } <nl> # endif <nl> <nl> - # ifdef TARGET_RASPBERRY_PI <nl> - g_RBP . Deinitialize ( ) ; <nl> - # elif defined ( TARGET_ANDROID ) <nl> + # if defined ( TARGET_ANDROID ) <nl> CXBMCApp : : get ( ) - > Deinitialize ( ) ; <nl> # endif <nl> <nl> mmm a / xbmc / rendering / gles / RenderSystemGLES . cpp <nl> ppp b / xbmc / rendering / gles / RenderSystemGLES . cpp <nl> bool CRenderSystemGLES : : InitRenderSystem ( ) <nl> <nl> m_RenderExtensions + = " " ; <nl> <nl> - / / ! @ todo remove TARGET_RASPBERRY_PI when Raspberry Pi updates their GL headers <nl> - # if defined ( GL_KHR_debug ) & & defined ( TARGET_LINUX ) & & ! defined ( TARGET_RASPBERRY_PI ) <nl> + # if defined ( GL_KHR_debug ) & & defined ( TARGET_LINUX ) <nl> if ( CServiceBroker : : GetSettingsComponent ( ) - > GetAdvancedSettings ( ) - > m_openGlDebugging ) <nl> { <nl> if ( IsExtSupported ( " GL_KHR_debug " ) ) <nl> mmm a / xbmc / settings / Settings . cpp <nl> ppp b / xbmc / settings / Settings . cpp <nl> <nl> # if defined ( TARGET_DARWIN_EMBEDDED ) <nl> # include " SettingAddon . h " <nl> # endif <nl> - # if defined ( TARGET_RASPBERRY_PI ) <nl> - # include " platform / linux / RBP . h " <nl> - # endif <nl> # include " powermanagement / PowerTypes . h " <nl> # include " profiles / ProfileManager . h " <nl> # include " ServiceBroker . h " <nl> const std : : string CSettings : : SETTING_VIDEOPLAYER_USEVDPAUMPEG4 = " videoplayer . us <nl> const std : : string CSettings : : SETTING_VIDEOPLAYER_USEVDPAUVC1 = " videoplayer . usevdpauvc1 " ; <nl> const std : : string CSettings : : SETTING_VIDEOPLAYER_USEDXVA2 = " videoplayer . usedxva2 " ; <nl> const std : : string CSettings : : SETTING_VIDEOPLAYER_USEVTB = " videoplayer . usevtb " ; <nl> - const std : : string CSettings : : SETTING_VIDEOPLAYER_USEMMAL = " videoplayer . usemmal " ; <nl> const std : : string CSettings : : SETTING_VIDEOPLAYER_USEPRIMEDECODER = " videoplayer . useprimedecoder " ; <nl> const std : : string CSettings : : SETTING_VIDEOPLAYER_USESTAGEFRIGHT = " videoplayer . usestagefright " ; <nl> const std : : string CSettings : : SETTING_VIDEOPLAYER_LIMITGUIUPDATE = " videoplayer . limitguiupdate " ; <nl> bool CSettings : : InitializeDefinitions ( ) <nl> # elif defined ( TARGET_ANDROID ) <nl> if ( CFile : : Exists ( SETTINGS_XML_FOLDER " android . xml " ) & & ! Initialize ( SETTINGS_XML_FOLDER " android . xml " ) ) <nl> CLog : : Log ( LOGFATAL , " Unable to load android - specific settings definitions " ) ; <nl> - # elif defined ( TARGET_RASPBERRY_PI ) <nl> - if ( CFile : : Exists ( SETTINGS_XML_FOLDER " rbp . xml " ) & & ! Initialize ( SETTINGS_XML_FOLDER " rbp . xml " ) ) <nl> - CLog : : Log ( LOGFATAL , " Unable to load rbp - specific settings definitions " ) ; <nl> - if ( g_RBP . RaspberryPiVersion ( ) > 1 & & CFile : : Exists ( SETTINGS_XML_FOLDER " rbp2 . xml " ) & & ! Initialize ( SETTINGS_XML_FOLDER " rbp2 . xml " ) ) <nl> - CLog : : Log ( LOGFATAL , " Unable to load rbp2 - specific settings definitions " ) ; <nl> # elif defined ( TARGET_FREEBSD ) <nl> if ( CFile : : Exists ( SETTINGS_XML_FOLDER " freebsd . xml " ) & & ! Initialize ( SETTINGS_XML_FOLDER " freebsd . xml " ) ) <nl> CLog : : Log ( LOGFATAL , " Unable to load freebsd - specific settings definitions " ) ; <nl> mmm a / xbmc / settings / Settings . h <nl> ppp b / xbmc / settings / Settings . h <nl> class CSettings : public CSettingsBase , public CSettingCreator , public CSettingC <nl> static const std : : string SETTING_VIDEOPLAYER_USEVDPAUVC1 ; <nl> static const std : : string SETTING_VIDEOPLAYER_USEDXVA2 ; <nl> static const std : : string SETTING_VIDEOPLAYER_USEVTB ; <nl> - static const std : : string SETTING_VIDEOPLAYER_USEMMAL ; <nl> static const std : : string SETTING_VIDEOPLAYER_USEPRIMEDECODER ; <nl> static const std : : string SETTING_VIDEOPLAYER_USESTAGEFRIGHT ; <nl> static const std : : string SETTING_VIDEOPLAYER_LIMITGUIUPDATE ; <nl> mmm a / xbmc / utils / EGLUtils . cpp <nl> ppp b / xbmc / utils / EGLUtils . cpp <nl> <nl> <nl> namespace <nl> { <nl> - / / ! @ todo remove when Raspberry Pi updates their EGL headers <nl> - # ifndef EGL_NO_CONFIG_KHR <nl> - # define EGL_NO_CONFIG_KHR static_cast < EGLConfig > ( 0 ) <nl> - # endif <nl> - # ifndef EGL_CONTEXT_PRIORITY_LEVEL_IMG <nl> - # define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100 <nl> - # endif <nl> - # ifndef EGL_CONTEXT_PRIORITY_HIGH_IMG <nl> - # define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101 <nl> - # endif <nl> - # ifndef EGL_CONTEXT_PRIORITY_MEDIUM_IMG <nl> - # define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102 <nl> - # endif <nl> <nl> # define X ( VAL ) std : : make_pair ( VAL , # VAL ) <nl> std : : map < EGLint , const char * > eglAttributes = <nl> std : : map < EGLenum , const char * > eglErrors = <nl> <nl> std : : map < EGLint , const char * > eglErrorType = <nl> { <nl> - / / ! @ todo remove when Raspberry Pi updates their EGL headers <nl> - # if ! defined ( TARGET_RASPBERRY_PI ) <nl> X ( EGL_DEBUG_MSG_CRITICAL_KHR ) , <nl> X ( EGL_DEBUG_MSG_ERROR_KHR ) , <nl> X ( EGL_DEBUG_MSG_WARN_KHR ) , <nl> X ( EGL_DEBUG_MSG_INFO_KHR ) , <nl> - # endif <nl> } ; <nl> # undef X <nl> <nl> } / / namespace <nl> <nl> - / / ! @ todo remove when Raspberry Pi updates their EGL headers <nl> - # if ! defined ( TARGET_RASPBERRY_PI ) <nl> - void EglErrorCallback ( EGLenum error , const char * command , EGLint messageType , EGLLabelKHR threadLabel , EGLLabelKHR objectLabel , const char * message ) <nl> + void EglErrorCallback ( EGLenum error , <nl> + const char * command , <nl> + EGLint messageType , <nl> + EGLLabelKHR threadLabel , <nl> + EGLLabelKHR objectLabel , <nl> + const char * message ) <nl> { <nl> std : : string errorStr ; <nl> std : : string typeStr ; <nl> void EglErrorCallback ( EGLenum error , const char * command , EGLint messageType , EG <nl> <nl> CLog : : Log ( LOGDEBUG , " EGL Debugging : \ nError : { } \ nCommand : { } \ nType : { } \ nMessage : { } " , errorStr , command , typeStr , message ) ; <nl> } <nl> - # endif <nl> <nl> std : : set < std : : string > CEGLUtils : : GetClientExtensions ( ) <nl> { <nl> void CEGLUtils : : Log ( int logLevel , const std : : string & what ) <nl> CEGLContextUtils : : CEGLContextUtils ( EGLenum platform , std : : string const & platformExtension ) <nl> : m_platform { platform } <nl> { <nl> - / / ! @ todo remove when Raspberry Pi updates their EGL headers <nl> - # if ! defined ( TARGET_RASPBERRY_PI ) <nl> if ( CEGLUtils : : HasClientExtension ( " EGL_KHR_debug " ) ) <nl> { <nl> auto eglDebugMessageControl = CEGLUtils : : GetRequiredProcAddress < PFNEGLDEBUGMESSAGECONTROLKHRPROC > ( " eglDebugMessageControlKHR " ) ; <nl> CEGLContextUtils : : CEGLContextUtils ( EGLenum platform , std : : string const & platform <nl> <nl> eglDebugMessageControl ( EglErrorCallback , eglDebugAttribs ) ; <nl> } <nl> - # endif <nl> <nl> m_platformSupported = CEGLUtils : : HasClientExtension ( " EGL_EXT_platform_base " ) & & CEGLUtils : : HasClientExtension ( platformExtension ) ; <nl> } <nl> bool CEGLContextUtils : : CreateContext ( CEGLAttributesVec contextAttribs ) <nl> if ( CEGLUtils : : HasExtension ( m_eglDisplay , " EGL_IMG_context_priority " ) ) <nl> contextAttribs . Add ( { { EGL_CONTEXT_PRIORITY_LEVEL_IMG , EGL_CONTEXT_PRIORITY_HIGH_IMG } } ) ; <nl> <nl> - / / ! @ todo remove when Raspberry Pi updates their EGL headers <nl> - # if ! defined ( TARGET_RASPBERRY_PI ) <nl> if ( CEGLUtils : : HasExtension ( m_eglDisplay , " EGL_KHR_create_context " ) & & <nl> CServiceBroker : : GetSettingsComponent ( ) - > GetAdvancedSettings ( ) - > m_openGlDebugging ) <nl> { <nl> contextAttribs . Add ( { { EGL_CONTEXT_FLAGS_KHR , EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR } } ) ; <nl> } <nl> - # endif <nl> <nl> m_eglContext = eglCreateContext ( m_eglDisplay , eglConfig , <nl> EGL_NO_CONTEXT , contextAttribs . Get ( ) ) ; <nl> mmm a / xbmc / utils / GLUtils . cpp <nl> ppp b / xbmc / utils / GLUtils . cpp <nl> std : : map < GLenum , const char * > glErrors = <nl> # endif <nl> } ; <nl> <nl> - std : : map < GLenum , const char * > glErrorSource = <nl> - { <nl> - / / ! @ todo remove TARGET_RASPBERRY_PI when Raspberry Pi updates their GL headers <nl> - # if defined ( HAS_GLES ) & & defined ( TARGET_LINUX ) & & ! defined ( TARGET_RASPBERRY_PI ) <nl> - X ( GL_DEBUG_SOURCE_API_KHR ) , <nl> - X ( GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR ) , <nl> - X ( GL_DEBUG_SOURCE_SHADER_COMPILER_KHR ) , <nl> - X ( GL_DEBUG_SOURCE_THIRD_PARTY_KHR ) , <nl> - X ( GL_DEBUG_SOURCE_APPLICATION_KHR ) , <nl> - X ( GL_DEBUG_SOURCE_OTHER_KHR ) , <nl> + std : : map < GLenum , const char * > glErrorSource = { <nl> + # if defined ( HAS_GLES ) & & defined ( TARGET_LINUX ) <nl> + X ( GL_DEBUG_SOURCE_API_KHR ) , <nl> + X ( GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR ) , <nl> + X ( GL_DEBUG_SOURCE_SHADER_COMPILER_KHR ) , <nl> + X ( GL_DEBUG_SOURCE_THIRD_PARTY_KHR ) , <nl> + X ( GL_DEBUG_SOURCE_APPLICATION_KHR ) , <nl> + X ( GL_DEBUG_SOURCE_OTHER_KHR ) , <nl> # endif <nl> } ; <nl> <nl> - std : : map < GLenum , const char * > glErrorType = <nl> - { <nl> - / / ! @ todo remove TARGET_RASPBERRY_PI when Raspberry Pi updates their GL headers <nl> - # if defined ( HAS_GLES ) & & defined ( TARGET_LINUX ) & & ! defined ( TARGET_RASPBERRY_PI ) <nl> - X ( GL_DEBUG_TYPE_ERROR_KHR ) , <nl> - X ( GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR ) , <nl> - X ( GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR ) , <nl> - X ( GL_DEBUG_TYPE_PORTABILITY_KHR ) , <nl> - X ( GL_DEBUG_TYPE_PERFORMANCE_KHR ) , <nl> - X ( GL_DEBUG_TYPE_OTHER_KHR ) , <nl> - X ( GL_DEBUG_TYPE_MARKER_KHR ) , <nl> + std : : map < GLenum , const char * > glErrorType = { <nl> + # if defined ( HAS_GLES ) & & defined ( TARGET_LINUX ) <nl> + X ( GL_DEBUG_TYPE_ERROR_KHR ) , <nl> + X ( GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR ) , <nl> + X ( GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR ) , <nl> + X ( GL_DEBUG_TYPE_PORTABILITY_KHR ) , <nl> + X ( GL_DEBUG_TYPE_PERFORMANCE_KHR ) , <nl> + X ( GL_DEBUG_TYPE_OTHER_KHR ) , <nl> + X ( GL_DEBUG_TYPE_MARKER_KHR ) , <nl> # endif <nl> } ; <nl> <nl> - std : : map < GLenum , const char * > glErrorSeverity = <nl> - { <nl> - / / ! @ todo remove TARGET_RASPBERRY_PI when Raspberry Pi updates their GL headers <nl> - # if defined ( HAS_GLES ) & & defined ( TARGET_LINUX ) & & ! defined ( TARGET_RASPBERRY_PI ) <nl> - X ( GL_DEBUG_SEVERITY_HIGH_KHR ) , <nl> - X ( GL_DEBUG_SEVERITY_MEDIUM_KHR ) , <nl> - X ( GL_DEBUG_SEVERITY_LOW_KHR ) , <nl> - X ( GL_DEBUG_SEVERITY_NOTIFICATION_KHR ) , <nl> + std : : map < GLenum , const char * > glErrorSeverity = { <nl> + # if defined ( HAS_GLES ) & & defined ( TARGET_LINUX ) <nl> + X ( GL_DEBUG_SEVERITY_HIGH_KHR ) , <nl> + X ( GL_DEBUG_SEVERITY_MEDIUM_KHR ) , <nl> + X ( GL_DEBUG_SEVERITY_LOW_KHR ) , <nl> + X ( GL_DEBUG_SEVERITY_NOTIFICATION_KHR ) , <nl> # endif <nl> } ; <nl> # undef X <nl> mmm a / xbmc / utils / SystemInfo . cpp <nl> ppp b / xbmc / utils / SystemInfo . cpp <nl> std : : string CSysInfo : : GetUserAgent ( ) <nl> result + = " " + linuxOSName + " / " + GetOsVersion ( ) ; <nl> # endif <nl> <nl> - # ifdef TARGET_RASPBERRY_PI <nl> - result + = " HW_RaspberryPi / 1 . 0 " ; <nl> - # elif defined ( TARGET_DARWIN_EMBEDDED ) <nl> + # if defined ( TARGET_DARWIN_IOS ) <nl> std : : string iDevVer ; <nl> if ( iDevStrDigit = = std : : string : : npos ) <nl> iDevVer = " 0 . 0 " ; <nl> mmm a / xbmc / utils / test / TestSystemInfo . cpp <nl> ppp b / xbmc / utils / test / TestSystemInfo . cpp <nl> TEST_F ( TestSystemInfo , GetUserAgent ) <nl> # endif / / defined ( TARGET_LINUX ) <nl> # endif / / defined ( TARGET_POSIX ) <nl> <nl> - # ifdef TARGET_RASPBERRY_PI <nl> - EXPECT_NE ( std : : string : : npos , g_sysinfo . GetUserAgent ( ) . find ( " XBMC_HW_RaspberryPi / " ) ) < < " ' GetUserAgent ( ) ' must contain ' XBMC_HW_RaspberryPi / ' " ; <nl> - # endif / / TARGET_RASPBERRY_PI <nl> - <nl> EXPECT_NE ( std : : string : : npos , g_sysinfo . GetUserAgent ( ) . find ( " App_Bitness / " ) ) < < " ' GetUserAgent ( ) ' must contain ' App_Bitness / ' " ; <nl> EXPECT_NE ( std : : string : : npos , g_sysinfo . GetUserAgent ( ) . find ( " Version / " ) ) < < " ' GetUserAgent ( ) ' must contain ' Version / ' " ; <nl> } <nl> mmm a / xbmc / video / dialogs / GUIDialogVideoSettings . cpp <nl> ppp b / xbmc / video / dialogs / GUIDialogVideoSettings . cpp <nl> void CGUIDialogVideoSettings : : InitializeSettings ( ) <nl> entries . push_back ( TranslatableIntegerSettingOption ( 16327 , VS_INTERLACEMETHOD_VAAPI_BOB ) ) ; <nl> entries . push_back ( TranslatableIntegerSettingOption ( 16328 , VS_INTERLACEMETHOD_VAAPI_MADI ) ) ; <nl> entries . push_back ( TranslatableIntegerSettingOption ( 16329 , VS_INTERLACEMETHOD_VAAPI_MACI ) ) ; <nl> - entries . push_back ( TranslatableIntegerSettingOption ( 16330 , VS_INTERLACEMETHOD_MMAL_ADVANCED ) ) ; <nl> - entries . push_back ( TranslatableIntegerSettingOption ( 16331 , VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF ) ) ; <nl> - entries . push_back ( TranslatableIntegerSettingOption ( 16332 , VS_INTERLACEMETHOD_MMAL_BOB ) ) ; <nl> - entries . push_back ( TranslatableIntegerSettingOption ( 16333 , VS_INTERLACEMETHOD_MMAL_BOB_HALF ) ) ; <nl> entries . push_back ( TranslatableIntegerSettingOption ( 16320 , VS_INTERLACEMETHOD_DXVA_AUTO ) ) ; <nl> <nl> / * remove unsupported methods * / <nl> deleted file mode 100644 <nl> index f42c6419fc7f . . 000000000000 <nl> mmm a / xbmc / windowing / rpi / CMakeLists . txt <nl> ppp / dev / null <nl> <nl> - set ( SOURCES WinSystemRpi . cpp <nl> - RPIUtils . cpp <nl> - VideoSyncPi . cpp ) <nl> - <nl> - set ( HEADERS WinSystemRpi . h <nl> - RPIUtils . h <nl> - VideoSyncPi . h ) <nl> - <nl> - if ( OPENGLES_FOUND ) <nl> - list ( APPEND SOURCES WinSystemRpiGLESContext . cpp ) <nl> - list ( APPEND HEADERS WinSystemRpiGLESContext . h ) <nl> - endif ( ) <nl> - <nl> - core_add_library ( windowing_Rpi ) <nl> deleted file mode 100644 <nl> index c7a3a719f833 . . 000000000000 <nl> mmm a / xbmc / windowing / rpi / RPIUtils . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2011 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # include " RPIUtils . h " <nl> - <nl> - # include " ServiceBroker . h " <nl> - # include " guilib / StereoscopicsManager . h " <nl> - # include " guilib / gui3d . h " <nl> - # include " rendering / RenderSystem . h " <nl> - # include " settings / Settings . h " <nl> - # include " settings / SettingsComponent . h " <nl> - # include " utils / StringUtils . h " <nl> - # include " utils / log . h " <nl> - # include " windowing / GraphicContext . h " <nl> - <nl> - # include " platform / linux / DllBCM . h " <nl> - # include " platform / linux / RBP . h " <nl> - <nl> - # include < cassert > <nl> - # include < math . h > <nl> - <nl> - # ifndef __VIDEOCORE4__ <nl> - # define __VIDEOCORE4__ <nl> - # endif <nl> - <nl> - # define __VCCOREVER__ 0x04000000 <nl> - <nl> - # define IS_WIDESCREEN ( m ) ( m = = 3 | | m = = 7 | | m = = 9 | | \ <nl> - m = = 11 | | m = = 13 | | m = = 15 | | m = = 18 | | m = = 22 | | \ <nl> - m = = 24 | | m = = 26 | | m = = 28 | | m = = 30 | | m = = 36 | | \ <nl> - m = = 38 | | m = = 43 | | m = = 45 | | m = = 49 | | m = = 51 | | \ <nl> - m = = 53 | | m = = 55 | | m = = 57 | | m = = 59 ) <nl> - <nl> - # define MAKEFLAGS ( group , mode , interlace ) \ <nl> - ( ( ( mode ) < < 24 ) | ( ( group ) < < 16 ) | \ <nl> - ( ( interlace ) ! = 0 ? D3DPRESENTFLAG_INTERLACED : D3DPRESENTFLAG_PROGRESSIVE ) | \ <nl> - ( ( ( group ) = = HDMI_RES_GROUP_CEA & & IS_WIDESCREEN ( mode ) ) ? D3DPRESENTFLAG_WIDESCREEN : 0 ) ) <nl> - <nl> - # define GETFLAGS_GROUP ( f ) ( ( HDMI_RES_GROUP_T ) ( ( ( f ) > > 16 ) & 0xff ) ) <nl> - # define GETFLAGS_MODE ( f ) ( ( ( f ) > > 24 ) & 0xff ) <nl> - <nl> - static void SetResolutionString ( RESOLUTION_INFO & res ) ; <nl> - static SDTV_ASPECT_T get_sdtv_aspect_from_display_aspect ( float display_aspect ) ; <nl> - <nl> - CRPIUtils : : CRPIUtils ( ) <nl> - { <nl> - m_DllBcmHost = new DllBcmHost ; <nl> - m_DllBcmHost - > Load ( ) ; <nl> - <nl> - m_dispman_element = DISPMANX_NO_HANDLE ; <nl> - m_dispman_display = DISPMANX_NO_HANDLE ; <nl> - <nl> - m_height = 1280 ; <nl> - m_width = 720 ; <nl> - m_screen_width = 1280 ; <nl> - m_screen_height = 720 ; <nl> - m_shown = false ; <nl> - <nl> - m_initDesktopRes = true ; <nl> - } <nl> - <nl> - CRPIUtils : : ~ CRPIUtils ( ) <nl> - { <nl> - if ( m_DllBcmHost & & m_DllBcmHost - > IsLoaded ( ) ) <nl> - { <nl> - m_DllBcmHost - > Unload ( ) ; <nl> - } <nl> - <nl> - delete m_DllBcmHost ; <nl> - m_DllBcmHost = NULL ; <nl> - } <nl> - <nl> - bool CRPIUtils : : GetNativeResolution ( RESOLUTION_INFO * res ) const <nl> - { <nl> - * res = m_desktopRes ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - int CRPIUtils : : FindMatchingResolution ( const RESOLUTION_INFO & res , const std : : vector < RESOLUTION_INFO > & resolutions , bool desktop ) <nl> - { <nl> - uint32_t mask = desktop ? D3DPRESENTFLAG_MODEMASK : D3DPRESENTFLAG_MODE3DSBS | D3DPRESENTFLAG_MODE3DTB ; <nl> - for ( int i = 0 ; i < ( int ) resolutions . size ( ) ; i + + ) <nl> - { <nl> - if ( resolutions [ i ] . iScreenWidth = = res . iScreenWidth & & resolutions [ i ] . iScreenHeight = = res . iScreenHeight & & resolutions [ i ] . fRefreshRate = = res . fRefreshRate & & <nl> - ( resolutions [ i ] . dwFlags & mask ) = = ( res . dwFlags & mask ) ) <nl> - { <nl> - return i ; <nl> - } <nl> - } <nl> - return - 1 ; <nl> - } <nl> - <nl> - int CRPIUtils : : AddUniqueResolution ( RESOLUTION_INFO & res , std : : vector < RESOLUTION_INFO > & resolutions , bool desktop / * = false * / ) <nl> - { <nl> - SetResolutionString ( res ) ; <nl> - int i = FindMatchingResolution ( res , resolutions , desktop ) ; <nl> - if ( i > = 0 ) <nl> - { / / don ' t replace a progressive resolution with an interlaced one of same resolution <nl> - if ( ! ( res . dwFlags & D3DPRESENTFLAG_INTERLACED ) ) <nl> - resolutions [ i ] = res ; <nl> - } <nl> - else <nl> - { <nl> - resolutions . push_back ( res ) ; <nl> - } <nl> - return i ; <nl> - } <nl> - <nl> - bool CRPIUtils : : SetNativeResolution ( const RESOLUTION_INFO res , EGLSurface m_nativeWindow ) <nl> - { <nl> - if ( ! m_DllBcmHost | | ! m_nativeWindow ) <nl> - return false ; <nl> - <nl> - DestroyDispmanxWindow ( ) ; <nl> - <nl> - RENDER_STEREO_MODE stereo_mode = CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) . GetStereoMode ( ) ; <nl> - if ( GETFLAGS_GROUP ( res . dwFlags ) & & GETFLAGS_MODE ( res . dwFlags ) ) <nl> - { <nl> - uint32_t mode3d = HDMI_3D_FORMAT_NONE ; <nl> - sem_init ( & m_tv_synced , 0 , 0 ) ; <nl> - m_DllBcmHost - > vc_tv_register_callback ( CallbackTvServiceCallback , this ) ; <nl> - <nl> - if ( stereo_mode = = RENDER_STEREO_MODE_SPLIT_HORIZONTAL | | stereo_mode = = RENDER_STEREO_MODE_SPLIT_VERTICAL ) <nl> - { <nl> - / * inform TV of any 3D settings . Note this property just applies to next hdmi mode change , so no need to call for 2D modes * / <nl> - HDMI_PROPERTY_PARAM_T property ; <nl> - property . property = HDMI_PROPERTY_3D_STRUCTURE ; <nl> - const std : : shared_ptr < CSettings > settings = CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) ; <nl> - if ( settings - > GetBool ( CSettings : : SETTING_VIDEOSCREEN_FRAMEPACKING ) & & <nl> - settings - > GetBool ( CSettings : : SETTING_VIDEOPLAYER_SUPPORTMVC ) & & res . fRefreshRate < = 30 . 0f ) <nl> - property . param1 = HDMI_3D_FORMAT_FRAME_PACKING ; <nl> - else if ( stereo_mode = = RENDER_STEREO_MODE_SPLIT_VERTICAL ) <nl> - property . param1 = HDMI_3D_FORMAT_SBS_HALF ; <nl> - else if ( stereo_mode = = RENDER_STEREO_MODE_SPLIT_HORIZONTAL ) <nl> - property . param1 = HDMI_3D_FORMAT_TB_HALF ; <nl> - else <nl> - property . param1 = HDMI_3D_FORMAT_NONE ; <nl> - property . param2 = 0 ; <nl> - mode3d = property . param1 ; <nl> - vc_tv_hdmi_set_property ( & property ) ; <nl> - } <nl> - <nl> - HDMI_PROPERTY_PARAM_T property ; <nl> - property . property = HDMI_PROPERTY_PIXEL_CLOCK_TYPE ; <nl> - / / if we are closer to ntsc version of framerate , let gpu know <nl> - int iFrameRate = ( int ) ( res . fRefreshRate + 0 . 5f ) ; <nl> - if ( fabsf ( res . fRefreshRate * ( 1001 . 0f / 1000 . 0f ) - iFrameRate ) < fabsf ( res . fRefreshRate - iFrameRate ) ) <nl> - property . param1 = HDMI_PIXEL_CLOCK_TYPE_NTSC ; <nl> - else <nl> - property . param1 = HDMI_PIXEL_CLOCK_TYPE_PAL ; <nl> - property . param2 = 0 ; <nl> - vc_tv_hdmi_set_property ( & property ) ; <nl> - <nl> - int success = m_DllBcmHost - > vc_tv_hdmi_power_on_explicit_new ( HDMI_MODE_HDMI , GETFLAGS_GROUP ( res . dwFlags ) , GETFLAGS_MODE ( res . dwFlags ) ) ; <nl> - <nl> - if ( success = = 0 ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " EGL set HDMI mode ( % d , % d ) = % d % s % s " , GETFLAGS_GROUP ( res . dwFlags ) , <nl> - GETFLAGS_MODE ( res . dwFlags ) , success , <nl> - CStereoscopicsManager : : ConvertGuiStereoModeToString ( stereo_mode ) , <nl> - mode3d = = HDMI_3D_FORMAT_FRAME_PACKING <nl> - ? " FP " <nl> - : mode3d = = HDMI_3D_FORMAT_SBS_HALF <nl> - ? " SBS " <nl> - : mode3d = = HDMI_3D_FORMAT_TB_HALF ? " TB " : " " ) ; <nl> - <nl> - sem_wait ( & m_tv_synced ) ; <nl> - } <nl> - else <nl> - { <nl> - CLog : : Log ( LOGERROR , " EGL failed to set HDMI mode ( % d , % d ) = % d % s % s " , <nl> - GETFLAGS_GROUP ( res . dwFlags ) , GETFLAGS_MODE ( res . dwFlags ) , success , <nl> - CStereoscopicsManager : : ConvertGuiStereoModeToString ( stereo_mode ) , <nl> - mode3d = = HDMI_3D_FORMAT_FRAME_PACKING <nl> - ? " FP " <nl> - : mode3d = = HDMI_3D_FORMAT_SBS_HALF <nl> - ? " SBS " <nl> - : mode3d = = HDMI_3D_FORMAT_TB_HALF ? " TB " : " " ) ; <nl> - } <nl> - m_DllBcmHost - > vc_tv_unregister_callback ( CallbackTvServiceCallback ) ; <nl> - sem_destroy ( & m_tv_synced ) ; <nl> - <nl> - m_desktopRes = res ; <nl> - } <nl> - else if ( ! GETFLAGS_GROUP ( res . dwFlags ) & & GETFLAGS_MODE ( res . dwFlags ) ) <nl> - { <nl> - sem_init ( & m_tv_synced , 0 , 0 ) ; <nl> - m_DllBcmHost - > vc_tv_register_callback ( CallbackTvServiceCallback , this ) ; <nl> - <nl> - SDTV_OPTIONS_T options ; <nl> - options . aspect = get_sdtv_aspect_from_display_aspect ( ( float ) res . iScreenWidth / ( float ) res . iScreenHeight ) ; <nl> - <nl> - int success = m_DllBcmHost - > vc_tv_sdtv_power_on ( ( SDTV_MODE_T ) GETFLAGS_MODE ( res . dwFlags ) , & options ) ; <nl> - <nl> - if ( success = = 0 ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " EGL set SDTV mode ( % d , % d ) = % d " , GETFLAGS_GROUP ( res . dwFlags ) , <nl> - GETFLAGS_MODE ( res . dwFlags ) , success ) ; <nl> - <nl> - sem_wait ( & m_tv_synced ) ; <nl> - } <nl> - else <nl> - { <nl> - CLog : : Log ( LOGERROR , " EGL failed to set SDTV mode ( % d , % d ) = % d " , GETFLAGS_GROUP ( res . dwFlags ) , <nl> - GETFLAGS_MODE ( res . dwFlags ) , success ) ; <nl> - } <nl> - m_DllBcmHost - > vc_tv_unregister_callback ( CallbackTvServiceCallback ) ; <nl> - sem_destroy ( & m_tv_synced ) ; <nl> - <nl> - m_desktopRes = res ; <nl> - } <nl> - <nl> - m_dispman_display = g_RBP . OpenDisplay ( 0 ) ; <nl> - <nl> - m_width = res . iWidth ; <nl> - m_height = res . iHeight ; <nl> - <nl> - m_screen_width = res . iScreenWidth ; <nl> - m_screen_height = res . iScreenHeight ; <nl> - <nl> - VC_RECT_T dst_rect ; <nl> - VC_RECT_T src_rect ; <nl> - <nl> - dst_rect . x = 0 ; <nl> - dst_rect . y = 0 ; <nl> - dst_rect . width = m_screen_width ; <nl> - dst_rect . height = m_screen_height ; <nl> - <nl> - src_rect . x = 0 ; <nl> - src_rect . y = 0 ; <nl> - src_rect . width = m_width < < 16 ; <nl> - src_rect . height = m_height < < 16 ; <nl> - <nl> - VC_DISPMANX_ALPHA_T alpha ; <nl> - memset ( & alpha , 0x0 , sizeof ( VC_DISPMANX_ALPHA_T ) ) ; <nl> - alpha . flags = DISPMANX_FLAGS_ALPHA_FROM_SOURCE ; <nl> - <nl> - DISPMANX_CLAMP_T clamp ; <nl> - memset ( & clamp , 0x0 , sizeof ( DISPMANX_CLAMP_T ) ) ; <nl> - <nl> - DISPMANX_TRANSFORM_T transform = DISPMANX_NO_ROTATE ; <nl> - DISPMANX_UPDATE_HANDLE_T dispman_update = m_DllBcmHost - > vc_dispmanx_update_start ( 0 ) ; <nl> - <nl> - if ( stereo_mode = = RENDER_STEREO_MODE_SPLIT_VERTICAL ) <nl> - transform = DISPMANX_STEREOSCOPIC_SBS ; <nl> - else if ( stereo_mode = = RENDER_STEREO_MODE_SPLIT_HORIZONTAL ) <nl> - transform = DISPMANX_STEREOSCOPIC_TB ; <nl> - else <nl> - transform = DISPMANX_STEREOSCOPIC_MONO ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , " EGL set resolution % dx % d - > % dx % d @ % . 2f fps ( % d , % d ) flags : % x aspect : % . 2f " , <nl> - m_width , m_height , dst_rect . width , dst_rect . height , res . fRefreshRate , <nl> - GETFLAGS_GROUP ( res . dwFlags ) , GETFLAGS_MODE ( res . dwFlags ) , ( int ) res . dwFlags , <nl> - res . fPixelRatio ) ; <nl> - <nl> - m_dispman_element = m_DllBcmHost - > vc_dispmanx_element_add ( dispman_update , <nl> - m_dispman_display , <nl> - 1 , / / layer <nl> - & dst_rect , <nl> - ( DISPMANX_RESOURCE_HANDLE_T ) 0 , / / src <nl> - & src_rect , <nl> - DISPMANX_PROTECTION_NONE , <nl> - & alpha , / / alpha <nl> - & clamp , / / clamp <nl> - transform ) ; / / transform <nl> - <nl> - assert ( m_dispman_element ! = DISPMANX_NO_HANDLE ) ; <nl> - assert ( m_dispman_element ! = ( unsigned ) DISPMANX_INVALID ) ; <nl> - <nl> - memset ( m_nativeWindow , 0 , sizeof ( EGL_DISPMANX_WINDOW_T ) ) ; <nl> - <nl> - EGL_DISPMANX_WINDOW_T * nativeWindow = ( EGL_DISPMANX_WINDOW_T * ) m_nativeWindow ; <nl> - <nl> - nativeWindow - > element = m_dispman_element ; <nl> - nativeWindow - > width = m_width ; <nl> - nativeWindow - > height = m_height ; <nl> - <nl> - m_DllBcmHost - > vc_dispmanx_display_set_background ( dispman_update , m_dispman_display , 0x00 , 0x00 , 0x00 ) ; <nl> - m_DllBcmHost - > vc_dispmanx_update_submit_sync ( dispman_update ) ; <nl> - m_shown = true ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - static float get_display_aspect_ratio ( HDMI_ASPECT_T aspect ) <nl> - { <nl> - float display_aspect ; <nl> - switch ( aspect ) { <nl> - case HDMI_ASPECT_4_3 : display_aspect = 4 . 0 / 3 . 0 ; break ; <nl> - case HDMI_ASPECT_14_9 : display_aspect = 14 . 0 / 9 . 0 ; break ; <nl> - case HDMI_ASPECT_16_9 : display_aspect = 16 . 0 / 9 . 0 ; break ; <nl> - case HDMI_ASPECT_5_4 : display_aspect = 5 . 0 / 4 . 0 ; break ; <nl> - case HDMI_ASPECT_16_10 : display_aspect = 16 . 0 / 10 . 0 ; break ; <nl> - case HDMI_ASPECT_15_9 : display_aspect = 15 . 0 / 9 . 0 ; break ; <nl> - case HDMI_ASPECT_64_27 : display_aspect = 64 . 0 / 27 . 0 ; break ; <nl> - default : display_aspect = 16 . 0 / 9 . 0 ; break ; <nl> - } <nl> - return display_aspect ; <nl> - } <nl> - <nl> - static float get_display_aspect_ratio ( SDTV_ASPECT_T aspect ) <nl> - { <nl> - float display_aspect ; <nl> - switch ( aspect ) { <nl> - case SDTV_ASPECT_4_3 : display_aspect = 4 . 0 / 3 . 0 ; break ; <nl> - case SDTV_ASPECT_14_9 : display_aspect = 14 . 0 / 9 . 0 ; break ; <nl> - case SDTV_ASPECT_16_9 : display_aspect = 16 . 0 / 9 . 0 ; break ; <nl> - default : display_aspect = 4 . 0 / 3 . 0 ; break ; <nl> - } <nl> - return display_aspect ; <nl> - } <nl> - <nl> - static bool ClampToGUIDisplayLimits ( int & width , int & height ) <nl> - { <nl> - float max_height = ( float ) g_RBP . GetGUIResolutionLimit ( ) ; <nl> - float default_ar = 16 . 0f / 9 . 0f ; <nl> - if ( max_height < 540 . 0f | | max_height > 1080 . 0f ) <nl> - max_height = 1080 . 0f ; <nl> - <nl> - float ar = ( float ) width / ( float ) height ; <nl> - float max_width = max_height * default_ar ; <nl> - / / bigger than maximum , so need to clamp <nl> - if ( width > max_width | | height > max_height ) { <nl> - / / wider than max , so clamp width first <nl> - if ( ar > default_ar ) <nl> - { <nl> - width = max_width ; <nl> - height = max_width / ar + 0 . 5f ; <nl> - / / taller than max , so clamp height first <nl> - } else { <nl> - height = max_height ; <nl> - width = max_height * ar + 0 . 5f ; <nl> - } <nl> - return true ; <nl> - } <nl> - <nl> - return false ; <nl> - } <nl> - <nl> - static void SetResolutionString ( RESOLUTION_INFO & res ) <nl> - { <nl> - int gui_width = res . iScreenWidth ; <nl> - int gui_height = res . iScreenHeight ; <nl> - <nl> - ClampToGUIDisplayLimits ( gui_width , gui_height ) ; <nl> - <nl> - res . iWidth = gui_width ; <nl> - res . iHeight = gui_height ; <nl> - <nl> - res . strMode = StringUtils : : Format ( " % dx % d ( % dx % d ) @ % . 2f % s - Full Screen " , res . iScreenWidth , res . iScreenHeight , res . iWidth , res . iHeight , res . fRefreshRate , <nl> - res . dwFlags & D3DPRESENTFLAG_INTERLACED ? " i " : " " ) ; <nl> - } <nl> - <nl> - static SDTV_ASPECT_T get_sdtv_aspect_from_display_aspect ( float display_aspect ) <nl> - { <nl> - SDTV_ASPECT_T aspect ; <nl> - const float delta = 1e - 3 ; <nl> - if ( fabs ( get_display_aspect_ratio ( SDTV_ASPECT_16_9 ) - display_aspect ) < delta ) <nl> - { <nl> - aspect = SDTV_ASPECT_16_9 ; <nl> - } <nl> - else if ( fabs ( get_display_aspect_ratio ( SDTV_ASPECT_14_9 ) - display_aspect ) < delta ) <nl> - { <nl> - aspect = SDTV_ASPECT_14_9 ; <nl> - } <nl> - else <nl> - { <nl> - aspect = SDTV_ASPECT_4_3 ; <nl> - } <nl> - return aspect ; <nl> - } <nl> - <nl> - bool CRPIUtils : : ProbeResolutions ( std : : vector < RESOLUTION_INFO > & resolutions ) <nl> - { <nl> - resolutions . clear ( ) ; <nl> - <nl> - if ( ! m_DllBcmHost ) <nl> - return false ; <nl> - <nl> - / * read initial desktop resolution before probe resolutions . <nl> - * probing will replace the desktop resolution when it finds the same one . <nl> - * we replace it because probing will generate more detailed <nl> - * resolution flags we don ' t get with vc_tv_get_state . <nl> - * / <nl> - <nl> - if ( m_initDesktopRes ) <nl> - { <nl> - TV_DISPLAY_STATE_T tv_state ; <nl> - <nl> - / / get current display settings state <nl> - memset ( & tv_state , 0 , sizeof ( TV_DISPLAY_STATE_T ) ) ; <nl> - m_DllBcmHost - > vc_tv_get_display_state ( & tv_state ) ; <nl> - <nl> - if ( ( tv_state . state & ( VC_HDMI_HDMI | VC_HDMI_DVI ) ) ! = 0 ) / / hdtv <nl> - { <nl> - m_desktopRes . bFullScreen = true ; <nl> - m_desktopRes . iWidth = tv_state . display . hdmi . width ; <nl> - m_desktopRes . iHeight = tv_state . display . hdmi . height ; <nl> - m_desktopRes . iScreenWidth = tv_state . display . hdmi . width ; <nl> - m_desktopRes . iScreenHeight = tv_state . display . hdmi . height ; <nl> - m_desktopRes . dwFlags = MAKEFLAGS ( tv_state . display . hdmi . group , tv_state . display . hdmi . mode , tv_state . display . hdmi . scan_mode ) ; <nl> - m_desktopRes . fPixelRatio = tv_state . display . hdmi . display_options . aspect = = 0 ? 1 . 0f : get_display_aspect_ratio ( ( HDMI_ASPECT_T ) tv_state . display . hdmi . display_options . aspect ) / ( ( float ) m_desktopRes . iScreenWidth / ( float ) m_desktopRes . iScreenHeight ) ; <nl> - HDMI_PROPERTY_PARAM_T property ; <nl> - property . property = HDMI_PROPERTY_PIXEL_CLOCK_TYPE ; <nl> - vc_tv_hdmi_get_property ( & property ) ; <nl> - m_desktopRes . fRefreshRate = property . param1 = = HDMI_PIXEL_CLOCK_TYPE_NTSC ? tv_state . display . hdmi . frame_rate * ( 1000 . 0f / 1001 . 0f ) : tv_state . display . hdmi . frame_rate ; <nl> - } <nl> - else if ( ( tv_state . state & ( VC_SDTV_NTSC | VC_SDTV_PAL ) ) ! = 0 ) / / sdtv <nl> - { <nl> - m_desktopRes . bFullScreen = true ; <nl> - m_desktopRes . iWidth = tv_state . display . sdtv . width ; <nl> - m_desktopRes . iHeight = tv_state . display . sdtv . height ; <nl> - m_desktopRes . iScreenWidth = tv_state . display . sdtv . width ; <nl> - m_desktopRes . iScreenHeight = tv_state . display . sdtv . height ; <nl> - m_desktopRes . dwFlags = MAKEFLAGS ( HDMI_RES_GROUP_INVALID , tv_state . display . sdtv . mode , 1 ) ; <nl> - m_desktopRes . fRefreshRate = ( float ) tv_state . display . sdtv . frame_rate ; <nl> - m_desktopRes . fPixelRatio = tv_state . display . hdmi . display_options . aspect = = 0 ? 1 . 0f : get_display_aspect_ratio ( ( SDTV_ASPECT_T ) tv_state . display . sdtv . display_options . aspect ) / ( ( float ) m_desktopRes . iScreenWidth / ( float ) m_desktopRes . iScreenHeight ) ; <nl> - } <nl> - else if ( ( tv_state . state & VC_LCD_ATTACHED_DEFAULT ) ! = 0 ) / / lcd <nl> - { <nl> - m_desktopRes . bFullScreen = true ; <nl> - m_desktopRes . iWidth = tv_state . display . sdtv . width ; <nl> - m_desktopRes . iHeight = tv_state . display . sdtv . height ; <nl> - m_desktopRes . iScreenWidth = tv_state . display . sdtv . width ; <nl> - m_desktopRes . iScreenHeight = tv_state . display . sdtv . height ; <nl> - m_desktopRes . dwFlags = MAKEFLAGS ( HDMI_RES_GROUP_INVALID , 0 , 0 ) ; <nl> - m_desktopRes . fRefreshRate = ( float ) tv_state . display . sdtv . frame_rate ; <nl> - m_desktopRes . fPixelRatio = tv_state . display . hdmi . display_options . aspect = = 0 ? 1 . 0f : get_display_aspect_ratio ( ( SDTV_ASPECT_T ) tv_state . display . sdtv . display_options . aspect ) / ( ( float ) m_desktopRes . iScreenWidth / ( float ) m_desktopRes . iScreenHeight ) ; <nl> - } <nl> - <nl> - SetResolutionString ( m_desktopRes ) ; <nl> - <nl> - m_initDesktopRes = false ; <nl> - <nl> - m_desktopRes . iSubtitles = ( int ) ( 0 . 965 * m_desktopRes . iHeight ) ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , " EGL initial desktop resolution % s ( % . 2f ) " , m_desktopRes . strMode . c_str ( ) , <nl> - m_desktopRes . fPixelRatio ) ; <nl> - } <nl> - <nl> - if ( GETFLAGS_GROUP ( m_desktopRes . dwFlags ) & & GETFLAGS_MODE ( m_desktopRes . dwFlags ) ) <nl> - { <nl> - GetSupportedModes ( HDMI_RES_GROUP_DMT , resolutions ) ; <nl> - GetSupportedModes ( HDMI_RES_GROUP_CEA , resolutions ) ; <nl> - } <nl> - { <nl> - AddUniqueResolution ( m_desktopRes , resolutions , true ) ; <nl> - CLog : : Log ( LOGDEBUG , " EGL probe resolution % s : % x " , m_desktopRes . strMode . c_str ( ) , <nl> - m_desktopRes . dwFlags ) ; <nl> - } <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - void CRPIUtils : : DestroyDispmanxWindow ( ) <nl> - { <nl> - if ( ! m_DllBcmHost ) <nl> - return ; <nl> - <nl> - DISPMANX_UPDATE_HANDLE_T dispman_update = m_DllBcmHost - > vc_dispmanx_update_start ( 0 ) ; <nl> - <nl> - if ( m_dispman_element ! = DISPMANX_NO_HANDLE ) <nl> - { <nl> - m_DllBcmHost - > vc_dispmanx_element_remove ( dispman_update , m_dispman_element ) ; <nl> - m_dispman_element = DISPMANX_NO_HANDLE ; <nl> - } <nl> - m_DllBcmHost - > vc_dispmanx_update_submit_sync ( dispman_update ) ; <nl> - <nl> - if ( m_dispman_display ! = DISPMANX_NO_HANDLE ) <nl> - { <nl> - g_RBP . CloseDisplay ( m_dispman_display ) ; <nl> - m_dispman_display = DISPMANX_NO_HANDLE ; <nl> - } <nl> - } <nl> - <nl> - void CRPIUtils : : SetVisible ( bool enable ) <nl> - { <nl> - if ( ! m_DllBcmHost | | m_shown = = enable ) <nl> - return ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , " CRPIUtils : : EnableDispmanxWindow ( % d ) " , enable ) ; <nl> - <nl> - DISPMANX_UPDATE_HANDLE_T dispman_update = m_DllBcmHost - > vc_dispmanx_update_start ( 0 ) ; <nl> - <nl> - if ( m_dispman_element ! = DISPMANX_NO_HANDLE ) <nl> - { <nl> - VC_RECT_T dst_rect ; <nl> - if ( enable ) <nl> - { <nl> - dst_rect . x = 0 ; <nl> - dst_rect . y = 0 ; <nl> - dst_rect . width = m_screen_width ; <nl> - dst_rect . height = m_screen_height ; <nl> - } <nl> - else <nl> - { <nl> - dst_rect . x = m_screen_width ; <nl> - dst_rect . y = m_screen_height ; <nl> - dst_rect . width = m_screen_width ; <nl> - dst_rect . height = m_screen_height ; <nl> - } <nl> - m_shown = enable ; <nl> - m_DllBcmHost - > vc_dispmanx_element_change_attributes ( dispman_update , m_dispman_element , <nl> - ( 1 < < 2 ) , 0 , 0 , & dst_rect , nullptr , 0 , DISPMANX_NO_ROTATE ) ; <nl> - } <nl> - m_DllBcmHost - > vc_dispmanx_update_submit ( dispman_update , nullptr , nullptr ) ; <nl> - } <nl> - <nl> - void CRPIUtils : : GetSupportedModes ( HDMI_RES_GROUP_T group , std : : vector < RESOLUTION_INFO > & resolutions ) <nl> - { <nl> - if ( ! m_DllBcmHost ) <nl> - return ; <nl> - <nl> - / / Supported HDMI CEA / DMT resolutions , preferred resolution will be returned <nl> - int32_t num_modes = 0 ; <nl> - HDMI_RES_GROUP_T prefer_group ; <nl> - uint32_t prefer_mode ; <nl> - int i ; <nl> - TV_SUPPORTED_MODE_NEW_T * supported_modes = NULL ; <nl> - / / query the number of modes first <nl> - int max_supported_modes = m_DllBcmHost - > vc_tv_hdmi_get_supported_modes_new ( group , NULL , 0 , & prefer_group , & prefer_mode ) ; <nl> - <nl> - if ( max_supported_modes > 0 ) <nl> - supported_modes = new TV_SUPPORTED_MODE_NEW_T [ max_supported_modes ] ; <nl> - <nl> - if ( supported_modes ) <nl> - { <nl> - num_modes = m_DllBcmHost - > vc_tv_hdmi_get_supported_modes_new ( group , <nl> - supported_modes , max_supported_modes , & prefer_group , & prefer_mode ) ; <nl> - <nl> - CLog : : Log ( LOGDEBUG , " EGL get supported modes ( % d ) = % d , prefer_group = % x , prefer_mode = % x " , group , <nl> - num_modes , prefer_group , prefer_mode ) ; <nl> - } <nl> - <nl> - if ( num_modes > 0 & & prefer_group ! = HDMI_RES_GROUP_INVALID ) <nl> - { <nl> - TV_SUPPORTED_MODE_NEW_T * tv = supported_modes ; <nl> - for ( i = 0 ; i < num_modes ; i + + , tv + + ) <nl> - { <nl> - RESOLUTION_INFO res ; <nl> - <nl> - res . bFullScreen = true ; <nl> - res . dwFlags = MAKEFLAGS ( group , tv - > code , tv - > scan_mode ) ; <nl> - res . fRefreshRate = ( float ) tv - > frame_rate ; <nl> - res . iWidth = tv - > width ; <nl> - res . iHeight = tv - > height ; <nl> - res . iScreenWidth = tv - > width ; <nl> - res . iScreenHeight = tv - > height ; <nl> - res . fPixelRatio = get_display_aspect_ratio ( ( HDMI_ASPECT_T ) tv - > aspect_ratio ) / ( ( float ) res . iScreenWidth / ( float ) res . iScreenHeight ) ; <nl> - res . iSubtitles = ( int ) ( 0 . 965 * res . iHeight ) ; <nl> - <nl> - if ( ! m_desktopRes . dwFlags & & prefer_group = = group & & prefer_mode = = tv - > code ) <nl> - m_desktopRes = res ; <nl> - <nl> - AddUniqueResolution ( res , resolutions ) ; <nl> - CLog : : Log ( LOGDEBUG , " EGL mode % d : % s ( % . 2f ) % s % s : % x " , i , res . strMode , res . fPixelRatio , <nl> - tv - > native ? " N " : " " , tv - > scan_mode ? " I " : " " , int ( tv - > code ) ) ; <nl> - <nl> - if ( tv - > frame_rate = = 24 | | tv - > frame_rate = = 30 | | tv - > frame_rate = = 48 | | tv - > frame_rate = = 60 | | tv - > frame_rate = = 72 ) <nl> - { <nl> - RESOLUTION_INFO res2 = res ; <nl> - res2 . fRefreshRate = ( float ) tv - > frame_rate * ( 1000 . 0f / 1001 . 0f ) ; <nl> - AddUniqueResolution ( res2 , resolutions ) ; <nl> - } <nl> - } <nl> - } <nl> - if ( supported_modes ) <nl> - delete [ ] supported_modes ; <nl> - } <nl> - <nl> - void CRPIUtils : : TvServiceCallback ( uint32_t reason , uint32_t param1 , uint32_t param2 ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " EGL tv_service_callback ( % d , % d , % d ) " , reason , param1 , param2 ) ; <nl> - switch ( reason ) <nl> - { <nl> - case VC_HDMI_UNPLUGGED : <nl> - break ; <nl> - case VC_HDMI_STANDBY : <nl> - break ; <nl> - case VC_SDTV_NTSC : <nl> - case VC_SDTV_PAL : <nl> - case VC_HDMI_HDMI : <nl> - case VC_HDMI_DVI : <nl> - / / Signal we are ready now <nl> - sem_post ( & m_tv_synced ) ; <nl> - break ; <nl> - default : <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - void CRPIUtils : : CallbackTvServiceCallback ( void * userdata , uint32_t reason , uint32_t param1 , uint32_t param2 ) <nl> - { <nl> - CRPIUtils * callback = static_cast < CRPIUtils * > ( userdata ) ; <nl> - callback - > TvServiceCallback ( reason , param1 , param2 ) ; <nl> - } <nl> deleted file mode 100644 <nl> index a90c22397c6e . . 000000000000 <nl> mmm a / xbmc / windowing / rpi / RPIUtils . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2005 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # include " windowing / Resolution . h " <nl> - <nl> - # include " platform / linux / RBP . h " <nl> - <nl> - # include < EGL / egl . h > <nl> - # include < bcm_host . h > <nl> - <nl> - class DllBcmHost ; <nl> - class CRPIUtils <nl> - { <nl> - public : <nl> - CRPIUtils ( ) ; <nl> - virtual ~ CRPIUtils ( ) ; <nl> - virtual void DestroyDispmanxWindow ( ) ; <nl> - virtual void SetVisible ( bool enable ) ; <nl> - virtual bool GetNativeResolution ( RESOLUTION_INFO * res ) const ; <nl> - virtual bool SetNativeResolution ( const RESOLUTION_INFO res , EGLSurface m_nativeWindow ) ; <nl> - virtual bool ProbeResolutions ( std : : vector < RESOLUTION_INFO > & resolutions ) ; <nl> - private : <nl> - DllBcmHost * m_DllBcmHost ; <nl> - DISPMANX_ELEMENT_HANDLE_T m_dispman_display ; <nl> - DISPMANX_ELEMENT_HANDLE_T m_dispman_element ; <nl> - TV_GET_STATE_RESP_T m_tv_state ; <nl> - sem_t m_tv_synced ; <nl> - RESOLUTION_INFO m_desktopRes ; <nl> - int m_width ; <nl> - int m_height ; <nl> - int m_screen_width ; <nl> - int m_screen_height ; <nl> - bool m_shown ; <nl> - <nl> - int m_initDesktopRes ; <nl> - <nl> - void GetSupportedModes ( HDMI_RES_GROUP_T group , std : : vector < RESOLUTION_INFO > & resolutions ) ; <nl> - void TvServiceCallback ( uint32_t reason , uint32_t param1 , uint32_t param2 ) ; <nl> - static void CallbackTvServiceCallback ( void * userdata , uint32_t reason , uint32_t param1 , uint32_t param2 ) ; <nl> - <nl> - int FindMatchingResolution ( const RESOLUTION_INFO & res , const std : : vector < RESOLUTION_INFO > & resolutions , bool desktop ) ; <nl> - int AddUniqueResolution ( RESOLUTION_INFO & res , std : : vector < RESOLUTION_INFO > & resolutions , bool desktop = false ) ; <nl> - } ; <nl> deleted file mode 100644 <nl> index 04f095d28430 . . 000000000000 <nl> mmm a / xbmc / windowing / rpi / VideoSyncPi . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2005 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # include " VideoSyncPi . h " <nl> - <nl> - # include " ServiceBroker . h " <nl> - # include " threads / Thread . h " <nl> - # include " utils / TimeUtils . h " <nl> - # include " utils / log . h " <nl> - # include " windowing / GraphicContext . h " <nl> - # include " windowing / WinSystem . h " <nl> - <nl> - # include " platform / linux / RBP . h " <nl> - <nl> - bool CVideoSyncPi : : Setup ( PUPDATECLOCK func ) <nl> - { <nl> - UpdateClock = func ; <nl> - m_abort = false ; <nl> - CServiceBroker : : GetWinSystem ( ) - > Register ( this ) ; <nl> - CLog : : Log ( LOGDEBUG , " CVideoReferenceClock : setting up RPi " ) ; <nl> - return true ; <nl> - } <nl> - <nl> - void CVideoSyncPi : : Run ( CEvent & stopEvent ) <nl> - { <nl> - CThread * thread = CThread : : GetCurrentThread ( ) ; <nl> - if ( thread ! = nullptr ) <nl> - { <nl> - / * This shouldn ' t be very busy and timing is important so increase priority * / <nl> - thread - > SetPriority ( thread - > GetPriority ( ) + 1 ) ; <nl> - } <nl> - <nl> - while ( ! stopEvent . Signaled ( ) & & ! m_abort ) <nl> - { <nl> - g_RBP . WaitVsync ( ) ; <nl> - uint64_t now = CurrentHostCounter ( ) ; <nl> - UpdateClock ( 1 , now , m_refClock ) ; <nl> - } <nl> - } <nl> - <nl> - void CVideoSyncPi : : Cleanup ( ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " CVideoReferenceClock : cleaning up RPi " ) ; <nl> - CServiceBroker : : GetWinSystem ( ) - > Unregister ( this ) ; <nl> - } <nl> - <nl> - float CVideoSyncPi : : GetFps ( ) <nl> - { <nl> - m_fps = CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) . GetFPS ( ) ; <nl> - CLog : : Log ( LOGDEBUG , " CVideoReferenceClock : fps : % . 2f " , m_fps ) ; <nl> - return m_fps ; <nl> - } <nl> - <nl> - void CVideoSyncPi : : OnResetDisplay ( ) <nl> - { <nl> - m_abort = true ; <nl> - } <nl> - <nl> - void CVideoSyncPi : : RefreshChanged ( ) <nl> - { <nl> - if ( m_fps ! = CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) . GetFPS ( ) ) <nl> - m_abort = true ; <nl> - } <nl> deleted file mode 100644 <nl> index b1c41e85b975 . . 000000000000 <nl> mmm a / xbmc / windowing / rpi / VideoSyncPi . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2005 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # include " guilib / DispResource . h " <nl> - # include " windowing / VideoSync . h " <nl> - <nl> - class CVideoSyncPi : public CVideoSync , IDispResource <nl> - { <nl> - public : <nl> - CVideoSyncPi ( void * clock ) : CVideoSync ( clock ) { } ; <nl> - virtual bool Setup ( PUPDATECLOCK func ) ; <nl> - virtual void Run ( CEvent & stopEvent ) ; <nl> - virtual void Cleanup ( ) ; <nl> - virtual float GetFps ( ) ; <nl> - virtual void OnResetDisplay ( ) ; <nl> - virtual void RefreshChanged ( ) ; <nl> - <nl> - private : <nl> - volatile bool m_abort ; <nl> - } ; <nl> deleted file mode 100644 <nl> index ed506d6dfecf . . 000000000000 <nl> mmm a / xbmc / windowing / rpi / WinSystemRpi . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2005 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # include " WinSystemRpi . h " <nl> - <nl> - # include " ServiceBroker . h " <nl> - # include " cores / AudioEngine / AESinkFactory . h " <nl> - # include " cores / AudioEngine / Sinks / AESinkPi . h " <nl> - # include " guilib / DispResource . h " <nl> - # include " settings / DisplaySettings . h " <nl> - # include " settings / Settings . h " <nl> - # include " settings / SettingsComponent . h " <nl> - # include " utils / log . h " <nl> - # include " windowing / GraphicContext . h " <nl> - # include " windowing / Resolution . h " <nl> - <nl> - # include " platform / linux / DllBCM . h " <nl> - # include " platform / linux / RBP . h " <nl> - # include " platform / linux / powermanagement / LinuxPowerSyscall . h " <nl> - <nl> - # include < float . h > <nl> - # include < string . h > <nl> - <nl> - # include < EGL / egl . h > <nl> - # include < EGL / eglplatform . h > <nl> - <nl> - CWinSystemRpi : : CWinSystemRpi ( ) : <nl> - m_libinput ( new CLibInputHandler ) <nl> - { <nl> - m_nativeDisplay = EGL_NO_DISPLAY ; <nl> - m_nativeWindow = EGL_NO_SURFACE ; <nl> - <nl> - m_displayWidth = 0 ; <nl> - m_displayHeight = 0 ; <nl> - <nl> - m_stereo_mode = RENDER_STEREO_MODE_OFF ; <nl> - m_delayDispReset = false ; <nl> - <nl> - m_rpi = new CRPIUtils ( ) ; <nl> - <nl> - AE : : CAESinkFactory : : ClearSinks ( ) ; <nl> - <nl> - CAESinkPi : : Register ( ) ; <nl> - std : : string envSink ; <nl> - if ( getenv ( " KODI_AE_SINK " ) ) <nl> - envSink = getenv ( " KODI_AE_SINK " ) ; <nl> - <nl> - if ( StringUtils : : EqualsNoCase ( envSink , " PULSE " ) ) <nl> - { <nl> - OPTIONALS : : PulseAudioRegister ( ) ; <nl> - } <nl> - else if ( StringUtils : : EqualsNoCase ( envSink , " ALSA + PULSE " ) ) <nl> - { <nl> - OPTIONALS : : ALSARegister ( ) ; <nl> - OPTIONALS : : PulseAudioRegister ( ) ; <nl> - } <nl> - else <nl> - { <nl> - OPTIONALS : : ALSARegister ( ) ; <nl> - } <nl> - <nl> - CLinuxPowerSyscall : : Register ( ) ; <nl> - m_lirc . reset ( OPTIONALS : : LircRegister ( ) ) ; <nl> - m_libinput - > Start ( ) ; <nl> - } <nl> - <nl> - CWinSystemRpi : : ~ CWinSystemRpi ( ) <nl> - { <nl> - if ( m_nativeWindow ) <nl> - { <nl> - m_nativeWindow = nullptr ; <nl> - } <nl> - <nl> - delete m_rpi ; <nl> - m_rpi = nullptr ; <nl> - } <nl> - <nl> - bool CWinSystemRpi : : InitWindowSystem ( ) <nl> - { <nl> - m_nativeDisplay = EGL_DEFAULT_DISPLAY ; <nl> - <nl> - return CWinSystemBase : : InitWindowSystem ( ) ; <nl> - } <nl> - <nl> - bool CWinSystemRpi : : DestroyWindowSystem ( ) <nl> - { <nl> - return true ; <nl> - } <nl> - <nl> - bool CWinSystemRpi : : CreateNewWindow ( const std : : string & name , <nl> - bool fullScreen , <nl> - RESOLUTION_INFO & res ) <nl> - { <nl> - RESOLUTION_INFO current_resolution ; <nl> - current_resolution . iWidth = current_resolution . iHeight = 0 ; <nl> - RENDER_STEREO_MODE stereo_mode = CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) . GetStereoMode ( ) ; <nl> - <nl> - m_nWidth = res . iWidth ; <nl> - m_nHeight = res . iHeight ; <nl> - m_displayWidth = res . iScreenWidth ; <nl> - m_displayHeight = res . iScreenHeight ; <nl> - m_fRefreshRate = res . fRefreshRate ; <nl> - <nl> - if ( ( m_bWindowCreated & & m_rpi - > GetNativeResolution ( & current_resolution ) ) & & <nl> - current_resolution . iWidth = = res . iWidth & & current_resolution . iHeight = = res . iHeight & & <nl> - current_resolution . iScreenWidth = = res . iScreenWidth & & current_resolution . iScreenHeight = = res . iScreenHeight & & <nl> - m_bFullScreen = = fullScreen & & current_resolution . fRefreshRate = = res . fRefreshRate & & <nl> - ( current_resolution . dwFlags & D3DPRESENTFLAG_MODEMASK ) = = ( res . dwFlags & D3DPRESENTFLAG_MODEMASK ) & & <nl> - m_stereo_mode = = stereo_mode ) <nl> - { <nl> - CLog : : Log ( LOGDEBUG , " CWinSystemEGL : : CreateNewWindow : No need to create a new window " ) ; <nl> - return true ; <nl> - } <nl> - <nl> - int delay = CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) - > GetInt ( " videoscreen . delayrefreshchange " ) ; <nl> - if ( delay > 0 ) <nl> - { <nl> - m_delayDispReset = true ; <nl> - m_dispResetTimer . Set ( delay * 100 ) ; <nl> - } <nl> - <nl> - { <nl> - CSingleLock lock ( m_resourceSection ) ; <nl> - for ( std : : vector < IDispResource * > : : iterator i = m_resources . begin ( ) ; i ! = m_resources . end ( ) ; + + i ) <nl> - { <nl> - ( * i ) - > OnLostDisplay ( ) ; <nl> - } <nl> - } <nl> - <nl> - m_stereo_mode = stereo_mode ; <nl> - m_bFullScreen = fullScreen ; <nl> - <nl> - m_nativeWindow = static_cast < EGLNativeWindowType > ( new EGL_DISPMANX_WINDOW_T ) ; <nl> - <nl> - m_rpi - > SetNativeResolution ( res , m_nativeWindow ) ; <nl> - <nl> - if ( ! m_delayDispReset ) <nl> - { <nl> - CSingleLock lock ( m_resourceSection ) ; <nl> - / / tell any shared resources <nl> - for ( std : : vector < IDispResource * > : : iterator i = m_resources . begin ( ) ; i ! = m_resources . end ( ) ; + + i ) <nl> - { <nl> - ( * i ) - > OnResetDisplay ( ) ; <nl> - } <nl> - } <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - bool CWinSystemRpi : : DestroyWindow ( ) <nl> - { <nl> - m_rpi - > DestroyDispmanxWindow ( ) ; <nl> - m_nativeWindow = nullptr ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - void CWinSystemRpi : : UpdateResolutions ( ) <nl> - { <nl> - CWinSystemBase : : UpdateResolutions ( ) ; <nl> - <nl> - RESOLUTION_INFO resDesktop , curDisplay ; <nl> - std : : vector < RESOLUTION_INFO > resolutions ; <nl> - <nl> - if ( ! m_rpi - > ProbeResolutions ( resolutions ) | | resolutions . empty ( ) ) <nl> - { <nl> - CLog : : Log ( LOGWARNING , " % s : ProbeResolutions failed . " , __FUNCTION__ ) ; <nl> - } <nl> - <nl> - / * ProbeResolutions includes already all resolutions . <nl> - * Only get desktop resolution so we can replace xbmc ' s desktop res <nl> - * / <nl> - if ( m_rpi - > GetNativeResolution ( & curDisplay ) ) <nl> - { <nl> - resDesktop = curDisplay ; <nl> - } <nl> - <nl> - RESOLUTION ResDesktop = RES_INVALID ; <nl> - RESOLUTION res_index = RES_DESKTOP ; <nl> - <nl> - for ( size_t i = 0 ; i < resolutions . size ( ) ; i + + ) <nl> - { <nl> - / / if this is a new setting , <nl> - / / create a new empty setting to fill in . <nl> - if ( ( int ) CDisplaySettings : : GetInstance ( ) . ResolutionInfoSize ( ) < = res_index ) <nl> - { <nl> - RESOLUTION_INFO res ; <nl> - CDisplaySettings : : GetInstance ( ) . AddResolutionInfo ( res ) ; <nl> - } <nl> - <nl> - CServiceBroker : : GetWinSystem ( ) - > GetGfxContext ( ) . ResetOverscan ( resolutions [ i ] ) ; <nl> - CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( res_index ) = resolutions [ i ] ; <nl> - <nl> - CLog : : Log ( LOGINFO , " Found resolution % d x % d with % d x % d % s @ % f Hz " , resolutions [ i ] . iWidth , <nl> - resolutions [ i ] . iHeight , resolutions [ i ] . iScreenWidth , resolutions [ i ] . iScreenHeight , <nl> - resolutions [ i ] . dwFlags & D3DPRESENTFLAG_INTERLACED ? " i " : " " , <nl> - resolutions [ i ] . fRefreshRate ) ; <nl> - <nl> - if ( resDesktop . iWidth = = resolutions [ i ] . iWidth & & <nl> - resDesktop . iHeight = = resolutions [ i ] . iHeight & & <nl> - resDesktop . iScreenWidth = = resolutions [ i ] . iScreenWidth & & <nl> - resDesktop . iScreenHeight = = resolutions [ i ] . iScreenHeight & & <nl> - ( resDesktop . dwFlags & D3DPRESENTFLAG_MODEMASK ) = = ( resolutions [ i ] . dwFlags & D3DPRESENTFLAG_MODEMASK ) & & <nl> - fabs ( resDesktop . fRefreshRate - resolutions [ i ] . fRefreshRate ) < FLT_EPSILON ) <nl> - { <nl> - ResDesktop = res_index ; <nl> - } <nl> - <nl> - res_index = ( RESOLUTION ) ( ( int ) res_index + 1 ) ; <nl> - } <nl> - <nl> - / / set RES_DESKTOP <nl> - if ( ResDesktop ! = RES_INVALID ) <nl> - { <nl> - CLog : : Log ( LOGINFO , " Found ( % dx % d % s @ % f ) at % d , setting to RES_DESKTOP at % d " , resDesktop . iWidth , <nl> - resDesktop . iHeight , resDesktop . dwFlags & D3DPRESENTFLAG_INTERLACED ? " i " : " " , <nl> - resDesktop . fRefreshRate , ( int ) ResDesktop , ( int ) RES_DESKTOP ) ; <nl> - <nl> - CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( RES_DESKTOP ) = CDisplaySettings : : GetInstance ( ) . GetResolutionInfo ( ResDesktop ) ; <nl> - } <nl> - } <nl> - <nl> - bool CWinSystemRpi : : Hide ( ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - bool CWinSystemRpi : : Show ( bool raise ) <nl> - { <nl> - return true ; <nl> - } <nl> - <nl> - void CWinSystemRpi : : SetVisible ( bool visible ) <nl> - { <nl> - m_rpi - > SetVisible ( visible ) ; <nl> - } <nl> - <nl> - void CWinSystemRpi : : Register ( IDispResource * resource ) <nl> - { <nl> - CSingleLock lock ( m_resourceSection ) ; <nl> - m_resources . push_back ( resource ) ; <nl> - } <nl> - <nl> - void CWinSystemRpi : : Unregister ( IDispResource * resource ) <nl> - { <nl> - CSingleLock lock ( m_resourceSection ) ; <nl> - std : : vector < IDispResource * > : : iterator i = find ( m_resources . begin ( ) , m_resources . end ( ) , resource ) ; <nl> - if ( i ! = m_resources . end ( ) ) <nl> - m_resources . erase ( i ) ; <nl> - } <nl> deleted file mode 100644 <nl> index 3c6f6e7477d9 . . 000000000000 <nl> mmm a / xbmc / windowing / rpi / WinSystemRpi . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2005 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # include " RPIUtils . h " <nl> - # include " rendering / gles / RenderSystemGLES . h " <nl> - # include " threads / CriticalSection . h " <nl> - # include " threads / SystemClock . h " <nl> - # include " windowing / WinSystem . h " <nl> - <nl> - # include " platform / freebsd / OptionalsReg . h " <nl> - # include " platform / linux / OptionalsReg . h " <nl> - # include " platform / linux / input / LibInputHandler . h " <nl> - <nl> - # include < EGL / egl . h > <nl> - <nl> - class IDispResource ; <nl> - <nl> - class CWinSystemRpi : public CWinSystemBase <nl> - { <nl> - public : <nl> - CWinSystemRpi ( ) ; <nl> - virtual ~ CWinSystemRpi ( ) ; <nl> - <nl> - bool InitWindowSystem ( ) override ; <nl> - bool DestroyWindowSystem ( ) override ; <nl> - <nl> - bool CreateNewWindow ( const std : : string & name , <nl> - bool fullScreen , <nl> - RESOLUTION_INFO & res ) override ; <nl> - <nl> - bool DestroyWindow ( ) override ; <nl> - void UpdateResolutions ( ) override ; <nl> - <nl> - bool Hide ( ) override ; <nl> - bool Show ( bool raise = true ) override ; <nl> - void SetVisible ( bool visible ) ; <nl> - virtual void Register ( IDispResource * resource ) ; <nl> - virtual void Unregister ( IDispResource * resource ) ; <nl> - protected : <nl> - CRPIUtils * m_rpi ; <nl> - EGLDisplay m_nativeDisplay ; <nl> - EGLSurface m_nativeWindow ; <nl> - <nl> - int m_displayWidth ; <nl> - int m_displayHeight ; <nl> - <nl> - RENDER_STEREO_MODE m_stereo_mode ; <nl> - <nl> - bool m_delayDispReset ; <nl> - XbmcThreads : : EndTime m_dispResetTimer ; <nl> - <nl> - CCriticalSection m_resourceSection ; <nl> - std : : vector < IDispResource * > m_resources ; <nl> - std : : unique_ptr < OPTIONALS : : CLircContainer , OPTIONALS : : delete_CLircContainer > m_lirc ; <nl> - std : : unique_ptr < CLibInputHandler > m_libinput ; <nl> - } ; <nl> deleted file mode 100644 <nl> index 7a3c7ee25afe . . 000000000000 <nl> mmm a / xbmc / windowing / rpi / WinSystemRpiGLESContext . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2005 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # include " WinSystemRpiGLESContext . h " <nl> - <nl> - # include " Application . h " <nl> - # include " ServiceBroker . h " <nl> - # include " VideoSyncPi . h " <nl> - # include " cores / RetroPlayer / process / rbpi / RPProcessInfoPi . h " <nl> - # include " cores / RetroPlayer / rendering / VideoRenderers / RPRendererOpenGLES . h " <nl> - # include " cores / VideoPlayer / DVDCodecs / DVDFactoryCodec . h " <nl> - # include " cores / VideoPlayer / DVDCodecs / Video / MMALCodec . h " <nl> - # include " cores / VideoPlayer / DVDCodecs / Video / MMALFFmpeg . h " <nl> - # include " cores / VideoPlayer / Process / rbpi / ProcessInfoPi . h " <nl> - # include " cores / VideoPlayer / VideoRenderers / RenderFactory . h " <nl> - # include " guilib / GUIComponent . h " <nl> - # include " guilib / GUIWindowManager . h " <nl> - # include " rendering / gles / ScreenshotSurfaceGLES . h " <nl> - # include " utils / log . h " <nl> - <nl> - # include " platform / linux / ScreenshotSurfaceRBP . h " <nl> - <nl> - using namespace KODI ; <nl> - <nl> - <nl> - std : : unique_ptr < CWinSystemBase > CWinSystemBase : : CreateWinSystem ( ) <nl> - { <nl> - std : : unique_ptr < CWinSystemBase > winSystem ( new CWinSystemRpiGLESContext ( ) ) ; <nl> - return winSystem ; <nl> - } <nl> - <nl> - bool CWinSystemRpiGLESContext : : InitWindowSystem ( ) <nl> - { <nl> - if ( ! CWinSystemRpi : : InitWindowSystem ( ) ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_pGLContext . CreateDisplay ( m_nativeDisplay ) ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_pGLContext . InitializeDisplay ( EGL_OPENGL_ES_API ) ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_pGLContext . ChooseConfig ( EGL_OPENGL_ES2_BIT ) ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - CEGLAttributesVec contextAttribs ; <nl> - contextAttribs . Add ( { { EGL_CONTEXT_CLIENT_VERSION , 2 } } ) ; <nl> - <nl> - if ( ! m_pGLContext . CreateContext ( contextAttribs ) ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - CProcessInfoPi : : Register ( ) ; <nl> - RETRO : : CRPProcessInfoPi : : Register ( ) ; <nl> - RETRO : : CRPProcessInfoPi : : RegisterRendererFactory ( new RETRO : : CRendererFactoryOpenGLES ) ; <nl> - CDVDFactoryCodec : : ClearHWAccels ( ) ; <nl> - MMAL : : CDecoder : : Register ( ) ; <nl> - CDVDFactoryCodec : : ClearHWVideoCodecs ( ) ; <nl> - MMAL : : CMMALVideo : : Register ( ) ; <nl> - VIDEOPLAYER : : CRendererFactory : : ClearRenderer ( ) ; <nl> - MMAL : : CMMALRenderer : : Register ( ) ; <nl> - CScreenshotSurfaceGLES : : Register ( ) ; <nl> - CScreenshotSurfaceRBP : : Register ( ) ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - bool CWinSystemRpiGLESContext : : CreateNewWindow ( const std : : string & name , <nl> - bool fullScreen , <nl> - RESOLUTION_INFO & res ) <nl> - { <nl> - m_pGLContext . DestroySurface ( ) ; <nl> - <nl> - if ( ! CWinSystemRpi : : DestroyWindow ( ) ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! CWinSystemRpi : : CreateNewWindow ( name , fullScreen , res ) ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_pGLContext . CreateSurface ( m_nativeWindow ) ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_pGLContext . BindContext ( ) ) <nl> - { <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! m_delayDispReset ) <nl> - { <nl> - CSingleLock lock ( m_resourceSection ) ; <nl> - / / tell any shared resources <nl> - for ( std : : vector < IDispResource * > : : iterator i = m_resources . begin ( ) ; i ! = m_resources . end ( ) ; + + i ) <nl> - ( * i ) - > OnResetDisplay ( ) ; <nl> - } <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - bool CWinSystemRpiGLESContext : : ResizeWindow ( int newWidth , int newHeight , int newLeft , int newTop ) <nl> - { <nl> - CRenderSystemGLES : : ResetRenderSystem ( newWidth , newHeight ) ; <nl> - return true ; <nl> - } <nl> - <nl> - bool CWinSystemRpiGLESContext : : SetFullScreen ( bool fullScreen , RESOLUTION_INFO & res , bool blankOtherDisplays ) <nl> - { <nl> - CreateNewWindow ( " " , fullScreen , res ) ; <nl> - CRenderSystemGLES : : ResetRenderSystem ( res . iWidth , res . iHeight ) ; <nl> - return true ; <nl> - } <nl> - <nl> - void CWinSystemRpiGLESContext : : SetVSyncImpl ( bool enable ) <nl> - { <nl> - if ( ! m_pGLContext . SetVSync ( enable ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s , Could not set egl vsync " , __FUNCTION__ ) ; <nl> - } <nl> - } <nl> - <nl> - void CWinSystemRpiGLESContext : : PresentRenderImpl ( bool rendered ) <nl> - { <nl> - CGUIComponent * gui = CServiceBroker : : GetGUI ( ) ; <nl> - if ( gui ) <nl> - CWinSystemRpi : : SetVisible ( gui - > GetWindowManager ( ) . HasVisibleControls ( ) | | g_application . GetAppPlayer ( ) . IsRenderingGuiLayer ( ) ) ; <nl> - <nl> - if ( m_delayDispReset & & m_dispResetTimer . IsTimePast ( ) ) <nl> - { <nl> - m_delayDispReset = false ; <nl> - CSingleLock lock ( m_resourceSection ) ; <nl> - / / tell any shared resources <nl> - for ( std : : vector < IDispResource * > : : iterator i = m_resources . begin ( ) ; i ! = m_resources . end ( ) ; + + i ) <nl> - ( * i ) - > OnResetDisplay ( ) ; <nl> - } <nl> - if ( ! rendered ) <nl> - return ; <nl> - <nl> - if ( ! m_pGLContext . TrySwapBuffers ( ) ) <nl> - { <nl> - CEGLUtils : : Log ( LOGERROR , " eglSwapBuffers failed " ) ; <nl> - throw std : : runtime_error ( " eglSwapBuffers failed " ) ; <nl> - } <nl> - } <nl> - <nl> - EGLDisplay CWinSystemRpiGLESContext : : GetEGLDisplay ( ) const <nl> - { <nl> - return m_pGLContext . GetEGLDisplay ( ) ; <nl> - } <nl> - <nl> - EGLSurface CWinSystemRpiGLESContext : : GetEGLSurface ( ) const <nl> - { <nl> - return m_pGLContext . GetEGLSurface ( ) ; <nl> - } <nl> - <nl> - EGLContext CWinSystemRpiGLESContext : : GetEGLContext ( ) const <nl> - { <nl> - return m_pGLContext . GetEGLContext ( ) ; <nl> - } <nl> - <nl> - EGLConfig CWinSystemRpiGLESContext : : GetEGLConfig ( ) const <nl> - { <nl> - return m_pGLContext . GetEGLConfig ( ) ; <nl> - } <nl> - <nl> - std : : unique_ptr < CVideoSync > CWinSystemRpiGLESContext : : GetVideoSync ( void * clock ) <nl> - { <nl> - std : : unique_ptr < CVideoSync > pVSync ( new CVideoSyncPi ( clock ) ) ; <nl> - return pVSync ; <nl> - } <nl> - <nl> deleted file mode 100644 <nl> index 0e8ef22a876a . . 000000000000 <nl> mmm a / xbmc / windowing / rpi / WinSystemRpiGLESContext . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( C ) 2005 - 2018 Team Kodi <nl> - * This file is part of Kodi - https : / / kodi . tv <nl> - * <nl> - * SPDX - License - Identifier : GPL - 2 . 0 - or - later <nl> - * See LICENSES / README . md for more information . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # include " WinSystemRpi . h " <nl> - # include " rendering / gles / RenderSystemGLES . h " <nl> - # include " utils / EGLUtils . h " <nl> - <nl> - class CWinSystemRpiGLESContext : public CWinSystemRpi , public CRenderSystemGLES <nl> - { <nl> - public : <nl> - CWinSystemRpiGLESContext ( ) = default ; <nl> - virtual ~ CWinSystemRpiGLESContext ( ) = default ; <nl> - <nl> - / / Implementation of CWinSystemBase via CWinSystemRpi <nl> - CRenderSystemBase * GetRenderSystem ( ) override { return this ; } <nl> - bool InitWindowSystem ( ) override ; <nl> - bool CreateNewWindow ( const std : : string & name , <nl> - bool fullScreen , <nl> - RESOLUTION_INFO & res ) override ; <nl> - <nl> - bool ResizeWindow ( int newWidth , int newHeight , int newLeft , int newTop ) override ; <nl> - bool SetFullScreen ( bool fullScreen , RESOLUTION_INFO & res , bool blankOtherDisplays ) override ; <nl> - <nl> - virtual std : : unique_ptr < CVideoSync > GetVideoSync ( void * clock ) override ; <nl> - <nl> - EGLDisplay GetEGLDisplay ( ) const ; <nl> - EGLSurface GetEGLSurface ( ) const ; <nl> - EGLContext GetEGLContext ( ) const ; <nl> - EGLConfig GetEGLConfig ( ) const ; <nl> - protected : <nl> - void SetVSyncImpl ( bool enable ) override ; <nl> - void PresentRenderImpl ( bool rendered ) override ; <nl> - <nl> - private : <nl> - CEGLContextUtils m_pGLContext ; <nl> - <nl> - } ; <nl> mmm a / xbmc / windows / GUIWindowSystemInfo . cpp <nl> ppp b / xbmc / windows / GUIWindowSystemInfo . cpp <nl> void CGUIWindowSystemInfo : : FrameMove ( ) <nl> SET_CONTROL_LABEL ( i + + , " Serial : " + CServiceBroker : : GetCPUInfo ( ) - > GetCPUSerial ( ) ) ; <nl> # endif <nl> SetControlLabel ( i + + , " % s % s " , 22011 , SYSTEM_CPU_TEMPERATURE ) ; <nl> - # if ( ! defined ( __arm__ ) & & ! defined ( __aarch64__ ) ) | | defined ( TARGET_RASPBERRY_PI ) <nl> + # if ( ! defined ( __arm__ ) & & ! defined ( __aarch64__ ) ) <nl> SetControlLabel ( i + + , " % s % s " , 13284 , SYSTEM_CPUFREQUENCY ) ; <nl> # endif <nl> # if ! ( defined ( __arm__ ) & & defined ( TARGET_LINUX ) ) <nl>
|
Merge pull request from lrusak / rpi - removal
|
xbmc/xbmc
|
811bd4933fbdab9b065c554c8880db4980183b54
|
2020-09-09T18:19:29Z
|
mmm a / tests / test_other . py <nl> ppp b / tests / test_other . py <nl> def build ( ) : <nl> self . assertIdentical ( normal , huge ) <nl> <nl> def test_EM_ASM_ES6 ( self ) : <nl> - # check we show a proper understandable error for JS parse problems <nl> create_test_file ( ' src . cpp ' , r ' ' ' <nl> # include < emscripten . h > <nl> int main ( ) { <nl> EM_ASM ( { <nl> - var x = ( a , b ) = > 5 ; / / valid ES6 ! <nl> + var x = ( a , b ) = > 5 ; / / valid ES6 <nl> + async function y ( ) { } / / valid ES2017 <nl> out ( ' hello ! ' ) ; <nl> } ) ; <nl> } <nl> mmm a / tools / acorn - optimizer . js <nl> ppp b / tools / acorn - optimizer . js <nl> if ( extraInfoStart > 0 ) { <nl> / / Collect all JS code comments to this array so that we can retain them in the outputted code <nl> / / if - - closureFriendly was requested . <nl> var sourceComments = [ ] ; <nl> - var ast = acorn . parse ( input , { ecmaVersion : 6 , preserveParens : closureFriendly , onComment : closureFriendly ? sourceComments : undefined } ) ; <nl> + var ast = acorn . parse ( input , { ecmaVersion : 2018 , preserveParens : closureFriendly , onComment : closureFriendly ? sourceComments : undefined } ) ; <nl> <nl> var minifyWhitespace = false ; <nl> var noPrint = false ; <nl> if ( ! noPrint ) { <nl> } ) ; <nl> print ( output ) ; <nl> } <nl> - <nl>
|
Bump Acorn JS version to ES2018 ( )
|
emscripten-core/emscripten
|
56dc964ce84f9d3c5542b5eb81eb305e039584fa
|
2020-06-17T22:33:25Z
|
mmm a / templates / cocos2dx_files . json <nl> ppp b / templates / cocos2dx_files . json <nl> <nl> " AUTHORS " , <nl> " CHANGELOG " , <nl> " CMakeLists . txt " , <nl> + " README . cmake " , <nl> " README . md " , <nl> - " build / BuildHelpers . CMakeLists . txt " , <nl> " build / android - build . py " , <nl> " build / cocos2d - win32 . vc2012 . sln " , <nl> " build / cocos2d - wp8 . vc2012 . sln " , <nl> <nl> " build / winrt / scripts / templates / wp8_sln_header_template . txt " , <nl> " build / winrt / scripts / winrtconverter . ps1 " , <nl> " build / winrt / wp8_precompiled_shaders . txt " , <nl> + " cmake / BuildHelpers . CMakeLists . txt " , <nl> + " cmake / Modules / CMakeParseArguments . cmake " , <nl> + " cmake / Modules / FindChipmunk . cmake " , <nl> + " cmake / Modules / FindPackageHandleStandardArgs . cmake " , <nl> + " cmake / Modules / FindPackageMessage . cmake " , <nl> + " cmake / Modules / FindWebP . cmake " , <nl> + " cmake / android . toolchain . cmake " , <nl> + " cmake / ios . toolchain . cmake " , <nl> " cocos / 2d / CCAction . cpp " , <nl> " cocos / 2d / CCAction . h " , <nl> " cocos / 2d / CCActionCamera . cpp " , <nl> <nl> " cocos / 2d / CCTransitionProgress . h " , <nl> " cocos / 2d / CCTweenFunction . cpp " , <nl> " cocos / 2d / CCTweenFunction . h " , <nl> + " cocos / 2d / CMakeLists . txt " , <nl> " cocos / 2d / cocos2d . def " , <nl> " cocos / 2d / cocos2d_headers . props " , <nl> " cocos / 2d / cocos2d_winrt . props " , <nl> <nl> " cocos / 3d / CCSprite3D . h " , <nl> " cocos / 3d / CCSprite3DMaterial . cpp " , <nl> " cocos / 3d / CCSprite3DMaterial . h " , <nl> + " cocos / 3d / CMakeLists . txt " , <nl> " cocos / 3d / cocos3d . h " , <nl> " cocos / Android . mk " , <nl> " cocos / CMakeLists . txt " , <nl> " cocos / audio / AudioEngine . cpp " , <nl> + " cocos / audio / CMakeLists . txt " , <nl> " cocos / audio / android / Android . mk " , <nl> " cocos / audio / android / AudioEngine - inl . cpp " , <nl> " cocos / audio / android / AudioEngine - inl . h " , <nl> <nl> " cocos / base / CCValue . cpp " , <nl> " cocos / base / CCValue . h " , <nl> " cocos / base / CCVector . h " , <nl> + " cocos / base / CMakeLists . txt " , <nl> " cocos / base / ObjectFactory . cpp " , <nl> " cocos / base / ObjectFactory . h " , <nl> " cocos / base / TGAlib . cpp " , <nl> <nl> " cocos / deprecated / CCSet . h " , <nl> " cocos / deprecated / CCString . cpp " , <nl> " cocos / deprecated / CCString . h " , <nl> + " cocos / deprecated / CMakeLists . txt " , <nl> " cocos / editor - support / cocosbuilder / Android . mk " , <nl> " cocos / editor - support / cocosbuilder / CCBAnimationManager . cpp " , <nl> " cocos / editor - support / cocosbuilder / CCBAnimationManager . h " , <nl> <nl> " cocos / editor - support / cocosbuilder / CCScrollViewLoader . h " , <nl> " cocos / editor - support / cocosbuilder / CCSpriteLoader . cpp " , <nl> " cocos / editor - support / cocosbuilder / CCSpriteLoader . h " , <nl> + " cocos / editor - support / cocosbuilder / CMakeLists . txt " , <nl> " cocos / editor - support / cocosbuilder / CocosBuilder . h " , <nl> " cocos / editor - support / cocosbuilder / proj . wp8 / libCocosBuilder . vcxproj " , <nl> " cocos / editor - support / cocosbuilder / proj . wp8 / libCocosBuilder . vcxproj . filters " , <nl> <nl> " cocos / editor - support / cocostudio / CCTween . h " , <nl> " cocos / editor - support / cocostudio / CCUtilMath . cpp " , <nl> " cocos / editor - support / cocostudio / CCUtilMath . h " , <nl> + " cocos / editor - support / cocostudio / CMakeLists . txt " , <nl> " cocos / editor - support / cocostudio / CocoLoader . cpp " , <nl> " cocos / editor - support / cocostudio / CocoLoader . h " , <nl> " cocos / editor - support / cocostudio / CocoStudio . h " , <nl> <nl> " cocos / math / CCMathBase . h " , <nl> " cocos / math / CCVertex . cpp " , <nl> " cocos / math / CCVertex . h " , <nl> + " cocos / math / CMakeLists . txt " , <nl> " cocos / math / Mat4 . cpp " , <nl> " cocos / math / Mat4 . h " , <nl> " cocos / math / Mat4 . inl " , <nl> <nl> " cocos / math / Vec4 . h " , <nl> " cocos / math / Vec4 . inl " , <nl> " cocos / network / Android . mk " , <nl> + " cocos / network / CMakeLists . txt " , <nl> " cocos / network / HttpClient . cpp " , <nl> " cocos / network / HttpClient . h " , <nl> " cocos / network / HttpRequest . h " , <nl> <nl> " cocos / physics / CCPhysicsShape . h " , <nl> " cocos / physics / CCPhysicsWorld . cpp " , <nl> " cocos / physics / CCPhysicsWorld . h " , <nl> + " cocos / physics / CMakeLists . txt " , <nl> " cocos / physics / chipmunk / CCPhysicsBodyInfo_chipmunk . cpp " , <nl> " cocos / physics / chipmunk / CCPhysicsBodyInfo_chipmunk . h " , <nl> " cocos / physics / chipmunk / CCPhysicsContactInfo_chipmunk . cpp " , <nl> <nl> " cocos / platform / CCStdC . h " , <nl> " cocos / platform / CCThread . cpp " , <nl> " cocos / platform / CCThread . h " , <nl> + " cocos / platform / CMakeLists . txt " , <nl> " cocos / platform / android / Android . mk " , <nl> " cocos / platform / android / CCApplication - android . cpp " , <nl> " cocos / platform / android / CCApplication - android . h " , <nl> <nl> " cocos / renderer / CCVertexIndexBuffer . h " , <nl> " cocos / renderer / CCVertexIndexData . cpp " , <nl> " cocos / renderer / CCVertexIndexData . h " , <nl> + " cocos / renderer / CMakeLists . txt " , <nl> " cocos / renderer / ccGLStateCache . cpp " , <nl> " cocos / renderer / ccGLStateCache . h " , <nl> " cocos / renderer / ccShader_3D_Color . frag " , <nl> <nl> " cocos / renderer / ccShader_Position_uColor . vert " , <nl> " cocos / renderer / ccShaders . cpp " , <nl> " cocos / renderer / ccShaders . h " , <nl> + " cocos / storage / CMakeLists . txt " , <nl> " cocos / storage / local - storage / Android . mk " , <nl> " cocos / storage / local - storage / LocalStorage - android . cpp " , <nl> " cocos / storage / local - storage / LocalStorage . cpp " , <nl> <nl> " cocos / storage / local - storage / proj . wp8 / libLocalStorage . vcxproj " , <nl> " cocos / storage / local - storage / proj . wp8 / libLocalStorage . vcxproj . filters " , <nl> " cocos / ui / Android . mk " , <nl> + " cocos / ui / CMakeLists . txt " , <nl> " cocos / ui / CocosGUI . cpp " , <nl> " cocos / ui / CocosGUI . h " , <nl> " cocos / ui / GUIDefine . h " , <nl> <nl> " docs / doxygen . config " , <nl> " download - deps . py " , <nl> " extensions / Android . mk " , <nl> + " extensions / CMakeLists . txt " , <nl> " extensions / ExtensionDeprecated . cpp " , <nl> " extensions / ExtensionDeprecated . h " , <nl> " extensions / ExtensionExport . h " , <nl> <nl> " extensions / proj . wp8 / pch . h " , <nl> " external / Box2D / Android . mk " , <nl> " external / Box2D / Box2D . h " , <nl> + " external / Box2D / CMakeLists . txt " , <nl> " external / Box2D / Collision / Shapes / b2ChainShape . cpp " , <nl> " external / Box2D / Collision / Shapes / b2ChainShape . h " , <nl> " external / Box2D / Collision / Shapes / b2CircleShape . cpp " , <nl>
|
Merge pull request from CocosRobot / update_cocosfiles_1412601098
|
cocos2d/cocos2d-x
|
d1a0934e6194a6842d53c5828b47502a0358dfeb
|
2014-10-06T13:26:46Z
|
mmm a / cocos / 2d / cocos2d . vcxproj <nl> ppp b / cocos / 2d / cocos2d . vcxproj <nl> xcopy / Y / Q " $ ( ProjectDir ) . . \ . . \ external \ win32 - specific \ gles \ prebuilt \ * . * " " $ ( Ou <nl> < DebugInformationFormat > ProgramDatabase < / DebugInformationFormat > <nl> < DisableSpecificWarnings > 4267 ; 4251 ; 4244 ; % ( DisableSpecificWarnings ) < / DisableSpecificWarnings > <nl> < MultiProcessorCompilation > true < / MultiProcessorCompilation > <nl> + < CompileAs > CompileAsCpp < / CompileAs > <nl> < / ClCompile > <nl> < PreLinkEvent > <nl> < Command > if not exist " $ ( OutDir ) " mkdir " $ ( OutDir ) " <nl>
|
release c + + compile
|
cocos2d/cocos2d-x
|
d8119321e46c44bb1a07ca552b6f8646eaaa4525
|
2014-03-15T09:30:49Z
|
mmm a / src / compiler / pipeline . cc <nl> ppp b / src / compiler / pipeline . cc <nl> class PipelineData { <nl> sequence ( ) , debug_name_ . get ( ) ) ; <nl> } <nl> <nl> + void BeginPhaseKind ( const char * phase_kind_name ) { <nl> + if ( pipeline_statistics ( ) ! = nullptr ) { <nl> + pipeline_statistics ( ) - > BeginPhaseKind ( phase_kind_name ) ; <nl> + } <nl> + } <nl> + <nl> + void EndPhaseKind ( ) { <nl> + if ( pipeline_statistics ( ) ! = nullptr ) { <nl> + pipeline_statistics ( ) - > EndPhaseKind ( ) ; <nl> + } <nl> + } <nl> + <nl> private : <nl> Isolate * const isolate_ ; <nl> CompilationInfo * const info_ ; <nl> struct VerifyGraphPhase { <nl> } ; <nl> <nl> <nl> - void Pipeline : : BeginPhaseKind ( const char * phase_kind_name ) { <nl> - if ( data_ - > pipeline_statistics ( ) ! = nullptr ) { <nl> - data_ - > pipeline_statistics ( ) - > BeginPhaseKind ( phase_kind_name ) ; <nl> - } <nl> - } <nl> - <nl> - void Pipeline : : EndPhaseKind ( ) { <nl> - if ( data_ - > pipeline_statistics ( ) ! = nullptr ) { <nl> - data_ - > pipeline_statistics ( ) - > EndPhaseKind ( ) ; <nl> - } <nl> - } <nl> - <nl> void Pipeline : : RunPrintAndVerify ( const char * phase , bool untyped ) { <nl> if ( FLAG_trace_turbo ) { <nl> Run < PrintGraphPhase > ( phase ) ; <nl> void Pipeline : : RunPrintAndVerify ( const char * phase , bool untyped ) { <nl> bool Pipeline : : CreateGraph ( ) { <nl> PipelineData * data = this - > data_ ; <nl> <nl> - BeginPhaseKind ( " graph creation " ) ; <nl> + data - > BeginPhaseKind ( " graph creation " ) ; <nl> <nl> if ( FLAG_trace_turbo ) { <nl> OFStream os ( stdout ) ; <nl> bool Pipeline : : CreateGraph ( ) { <nl> <nl> Run < GraphBuilderPhase > ( ) ; <nl> if ( data - > compilation_failed ( ) ) { <nl> - EndPhaseKind ( ) ; <nl> + data - > EndPhaseKind ( ) ; <nl> return false ; <nl> } <nl> RunPrintAndVerify ( " Initial untyped " , true ) ; <nl> bool Pipeline : : CreateGraph ( ) { <nl> Run < TyperPhase > ( & typer ) ; <nl> RunPrintAndVerify ( " Typed " ) ; <nl> <nl> - BeginPhaseKind ( " lowering " ) ; <nl> + data - > BeginPhaseKind ( " lowering " ) ; <nl> <nl> / / Lower JSOperators where we can determine types . <nl> Run < TypedLoweringPhase > ( ) ; <nl> bool Pipeline : : CreateGraph ( ) { <nl> RunPrintAndVerify ( " Untyped " , true ) ; <nl> # endif <nl> <nl> - EndPhaseKind ( ) ; <nl> + data - > EndPhaseKind ( ) ; <nl> <nl> return true ; <nl> } <nl> bool Pipeline : : CreateGraph ( ) { <nl> bool Pipeline : : OptimizeGraph ( Linkage * linkage ) { <nl> PipelineData * data = this - > data_ ; <nl> <nl> - BeginPhaseKind ( " block building " ) ; <nl> + data - > BeginPhaseKind ( " block building " ) ; <nl> <nl> Run < EffectControlLinearizationPhase > ( ) ; <nl> RunPrintAndVerify ( " Effect and control linearized " , true ) ; <nl> bool Pipeline : : OptimizeGraph ( Linkage * linkage ) { <nl> return ScheduleAndSelectInstructions ( linkage ) ; <nl> } <nl> <nl> - Handle < Code > Pipeline : : GenerateCode ( ) { <nl> - PipelineData * data = this - > data_ ; <nl> - <nl> - Linkage linkage ( Linkage : : ComputeIncoming ( data - > instruction_zone ( ) , info ( ) ) ) ; <nl> - <nl> - if ( ! CreateGraph ( ) ) return Handle < Code > : : null ( ) ; <nl> - if ( ! OptimizeGraph ( & linkage ) ) return Handle < Code > : : null ( ) ; <nl> - return GenerateCode ( & linkage ) ; <nl> - } <nl> - <nl> Handle < Code > Pipeline : : GenerateCodeForCodeStub ( Isolate * isolate , <nl> CallDescriptor * call_descriptor , <nl> Graph * graph , Schedule * schedule , <nl> Handle < Code > Pipeline : : GenerateCodeForTesting ( CompilationInfo * info ) { <nl> CreatePipelineStatistics ( info , & zone_pool ) ) ; <nl> PipelineData data ( & zone_pool , info , pipeline_statistics . get ( ) ) ; <nl> Pipeline pipeline ( & data ) ; <nl> - return pipeline . GenerateCode ( ) ; <nl> + <nl> + Linkage linkage ( Linkage : : ComputeIncoming ( data . instruction_zone ( ) , info ) ) ; <nl> + <nl> + if ( ! pipeline . CreateGraph ( ) ) return Handle < Code > : : null ( ) ; <nl> + if ( ! pipeline . OptimizeGraph ( & linkage ) ) return Handle < Code > : : null ( ) ; <nl> + return pipeline . GenerateCode ( & linkage ) ; <nl> } <nl> <nl> / / static <nl> bool Pipeline : : ScheduleAndSelectInstructions ( Linkage * linkage ) { <nl> <nl> data - > DeleteGraphZone ( ) ; <nl> <nl> - BeginPhaseKind ( " register allocation " ) ; <nl> + data - > BeginPhaseKind ( " register allocation " ) ; <nl> <nl> bool run_verifier = FLAG_turbo_verify_allocation ; <nl> <nl> bool Pipeline : : ScheduleAndSelectInstructions ( Linkage * linkage ) { <nl> Run < FrameElisionPhase > ( ) ; <nl> if ( data - > compilation_failed ( ) ) { <nl> info ( ) - > AbortOptimization ( kNotEnoughVirtualRegistersRegalloc ) ; <nl> - EndPhaseKind ( ) ; <nl> + data - > EndPhaseKind ( ) ; <nl> return false ; <nl> } <nl> <nl> bool Pipeline : : ScheduleAndSelectInstructions ( Linkage * linkage ) { <nl> Run < JumpThreadingPhase > ( generate_frame_at_start ) ; <nl> } <nl> <nl> - EndPhaseKind ( ) ; <nl> + data - > EndPhaseKind ( ) ; <nl> <nl> return true ; <nl> } <nl> bool Pipeline : : ScheduleAndSelectInstructions ( Linkage * linkage ) { <nl> Handle < Code > Pipeline : : GenerateCode ( Linkage * linkage ) { <nl> PipelineData * data = this - > data_ ; <nl> <nl> - BeginPhaseKind ( " code generation " ) ; <nl> + data - > BeginPhaseKind ( " code generation " ) ; <nl> <nl> / / Generate final machine code . <nl> Run < GenerateCodePhase > ( linkage ) ; <nl> mmm a / src / compiler / pipeline . h <nl> ppp b / src / compiler / pipeline . h <nl> class Pipeline { <nl> / / Perform the actual code generation and return handle to a code object . <nl> Handle < Code > GenerateCode ( Linkage * linkage ) ; <nl> <nl> - / / Run the entire pipeline and generate a handle to a code object . <nl> - Handle < Code > GenerateCode ( ) ; <nl> - <nl> - void BeginPhaseKind ( const char * phase_kind ) ; <nl> - void EndPhaseKind ( ) ; <nl> bool ScheduleAndSelectInstructions ( Linkage * linkage ) ; <nl> void RunPrintAndVerify ( const char * phase , bool untyped = false ) ; <nl> Handle < Code > ScheduleAndGenerateCode ( CallDescriptor * call_descriptor ) ; <nl>
|
[ turbofan ] Move some member methods off Pipeline .
|
v8/v8
|
7c6ff54e604503905f9d2a683c232551aa95bba4
|
2016-05-03T13:36:22Z
|
mmm a / lib / IDE / SyntaxModel . cpp <nl> ppp b / lib / IDE / SyntaxModel . cpp <nl> struct SyntaxModelContext : : Implementation { <nl> SrcMgr ( SrcFile . getASTContext ( ) . SourceMgr ) { } <nl> } ; <nl> <nl> + static bool canFindSurroundingParens ( ArrayRef < Token > Toks , <nl> + const unsigned Current ) { <nl> + bool LeftOk = false ; <nl> + bool RightOk = false ; <nl> + for ( unsigned Offset = 1 ; ; Offset + + ) { <nl> + if ( Current < Offset | | Current + Offset > = Toks . size ( ) ) <nl> + return false ; <nl> + auto & L = Toks [ Current - Offset ] ; <nl> + auto & R = Toks [ Current + Offset ] ; <nl> + LeftOk | = L . getKind ( ) = = tok : : l_paren ; <nl> + RightOk | = R . getKind ( ) = = tok : : r_paren ; <nl> + if ( LeftOk & & RightOk ) <nl> + return true ; <nl> + } <nl> + llvm_unreachable ( " unreachable exit condition " ) ; <nl> + } <nl> + <nl> SyntaxModelContext : : SyntaxModelContext ( SourceFile & SrcFile ) <nl> : Impl ( * new Implementation ( SrcFile ) ) { <nl> const bool IsPlayground = Impl . LangOpts . Playground ; <nl> SyntaxModelContext : : SyntaxModelContext ( SourceFile & SrcFile ) <nl> Tokens [ I - 1 ] . getKind ( ) = = tok : : comma ) & & <nl> ( Tokens [ I + 1 ] . getKind ( ) = = tok : : colon | | <nl> Tokens [ I + 1 ] . getKind ( ) = = tok : : identifier | | <nl> - Tokens [ I + 1 ] . isKeyword ( ) ) ) { <nl> + Tokens [ I + 1 ] . isKeyword ( ) ) & & <nl> + canFindSurroundingParens ( Tokens , I ) ) { <nl> / / Keywords are allowed as argument labels and should be treated as <nl> / / identifiers . The exception is ' _ ' which is not a name . <nl> Kind = SyntaxNodeKind : : Identifier ; <nl> mmm a / test / IDE / coloring . swift <nl> ppp b / test / IDE / coloring . swift <nl> func foo1 ( ) { <nl> / / CHECK : < kw > _ < / kw > = ( < kw > _ < / kw > : < int > 0 < / int > , < kw > _ < / kw > : < int > 2 < / int > ) <nl> } <nl> <nl> + func foo2 ( O1 : Int ? , O2 : Int ? , O3 : Int ? ) { <nl> + guard let _ = O1 , var _ = O2 , let _ = O3 else { } <nl> + / / CHECK : < kw > guard < / kw > < kw > let < / kw > < kw > _ < / kw > = O1 , < kw > var < / kw > < kw > _ < / kw > = O2 , < kw > let < / kw > < kw > _ < / kw > = O3 < kw > else < / kw > { } <nl> + if let _ = O1 , var _ = O2 , let _ = O3 { } <nl> + / / CHECK : < kw > if < / kw > < kw > let < / kw > < kw > _ < / kw > = O1 , < kw > var < / kw > < kw > _ < / kw > = O2 , < kw > let < / kw > < kw > _ < / kw > = O3 { } <nl> + } <nl> + <nl> / / Keep this as the last test <nl> / * * <nl> Trailing off . . . <nl>
|
[ SyntaxColor ] Respect keywords ' syntax kind when they appear in conditions . ( )
|
apple/swift
|
e6f263fe312f78b6cf88eb542e8daebb2ff08c40
|
2016-09-30T02:36:55Z
|
mmm a / android / sample / BUCK <nl> ppp b / android / sample / BUCK <nl> <nl> # This source code is licensed under the license found in the <nl> # LICENSE - examples file in the root directory of this source tree . <nl> <nl> - load ( " / / tools / build_defs / oss : yoga_defs . bzl " , " ANDROID_RES_TARGET " , " ANDROID_SAMPLE_JAVA_TARGET " , " ANDROID_SAMPLE_RES_TARGET " , " yoga_android_binary " , " yoga_android_resource " ) <nl> load ( " / / tools / build_defs : fb_native_wrapper . bzl " , " fb_native " ) <nl> + load ( " / / tools / build_defs / oss : yoga_defs . bzl " , " ANDROID_RES_TARGET " , " ANDROID_SAMPLE_JAVA_TARGET " , " ANDROID_SAMPLE_RES_TARGET " , " yoga_android_binary " , " yoga_android_resource " ) <nl> <nl> yoga_android_binary ( <nl> name = " sample " , <nl> mmm a / csharp / BUCK <nl> ppp b / csharp / BUCK <nl> <nl> # This source code is licensed under the MIT license found in the <nl> # LICENSE file in the root directory of this source tree . <nl> <nl> + load ( " / / tools / build_defs : fb_native_wrapper . bzl " , " fb_native " ) <nl> load ( <nl> " / / tools / build_defs / oss : yoga_defs . bzl " , <nl> " BASE_COMPILER_FLAGS " , <nl> load ( <nl> " yoga_cxx_library " , <nl> " yoga_dep " , <nl> ) <nl> - load ( " / / tools / build_defs : fb_native_wrapper . bzl " , " fb_native " ) <nl> <nl> COMPILER_FLAGS = BASE_COMPILER_FLAGS + [ " - std = c + + 11 " ] <nl> <nl> mmm a / lib / appcompat / BUCK <nl> ppp b / lib / appcompat / BUCK <nl> <nl> # This source code is licensed under the MIT license found in the <nl> # LICENSE file in the root directory of this source tree . <nl> <nl> - load ( " / / tools / build_defs / oss : yoga_defs . bzl " , " YOGA_ROOTS " ) <nl> load ( " / / tools / build_defs : fb_native_wrapper . bzl " , " fb_native " ) <nl> + load ( " / / tools / build_defs / oss : yoga_defs . bzl " , " YOGA_ROOTS " ) <nl> <nl> fb_native . android_prebuilt_aar ( <nl> name = " appcompat " , <nl> mmm a / lib / soloader / BUCK <nl> ppp b / lib / soloader / BUCK <nl> <nl> # This source code is licensed under the MIT license found in the <nl> # LICENSE file in the root directory of this source tree . <nl> <nl> - load ( " / / tools / build_defs / oss : yoga_defs . bzl " , " YOGA_ROOTS " ) <nl> load ( " / / tools / build_defs : fb_native_wrapper . bzl " , " fb_native " ) <nl> + load ( " / / tools / build_defs / oss : yoga_defs . bzl " , " YOGA_ROOTS " ) <nl> <nl> fb_native . android_prebuilt_aar ( <nl> name = " soloader " , <nl>
|
Reformat xplat build files according to new formatting rules .
|
facebook/yoga
|
34673088749ce252afd392f0ed1eb60246aed945
|
2019-01-11T04:01:02Z
|
mmm a / catch . hpp <nl> ppp b / catch . hpp <nl> <nl> / / Still to be implemented <nl> # define CHECK_NOFAIL ( expr ) / / ! TBD - reports violation , but doesn ' t fail Test <nl> <nl> - using Catch : : Approx ; <nl> + using Catch : : Detail : : Approx ; <nl> <nl> # endif / / TWOBLUECUBES_CATCH_HPP_INCLUDED <nl> mmm a / internal / catch_capture . hpp <nl> ppp b / internal / catch_capture . hpp <nl> inline double catch_max ( double x , double y ) <nl> { <nl> return x > y ? x : y ; <nl> } <nl> - <nl> - class Approx <nl> + namespace Detail <nl> { <nl> - public : <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / ! TBD more generic <nl> - explicit Approx <nl> - ( <nl> - double d <nl> - ) <nl> - : m_d ( d ) <nl> + class Approx <nl> { <nl> - } <nl> + public : <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / ! TBD more generic <nl> + explicit Approx <nl> + ( <nl> + double d <nl> + ) <nl> + : m_d ( d ) <nl> + { <nl> + } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - template < typename T > <nl> - friend bool operator = = <nl> - ( <nl> - const T & lhs , <nl> - const Approx & rhs <nl> - ) <nl> - { <nl> - / / ! TBD Use proper tolerance <nl> - / / From : http : / / realtimecollisiondetection . net / blog / ? p = 89 <nl> - / / see also : http : / / www . cygnus - software . com / papers / comparingfloats / comparingfloats . htm <nl> - return fabs ( lhs - rhs . m_d ) < = catch_max ( CATCH_absTol , CATCH_relTol * catch_max ( fabs ( lhs ) , fabs ( rhs . m_d ) ) ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - template < typename T > <nl> - friend bool operator ! = <nl> - ( <nl> - const T & lhs , <nl> - const Approx & rhs <nl> - ) <nl> - { <nl> - return ! operator = = ( lhs , rhs ) ; <nl> - } <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + template < typename T > <nl> + friend bool operator = = <nl> + ( <nl> + const T & lhs , <nl> + const Approx & rhs <nl> + ) <nl> + { <nl> + / / ! TBD Use proper tolerance <nl> + / / From : http : / / realtimecollisiondetection . net / blog / ? p = 89 <nl> + / / see also : http : / / www . cygnus - software . com / papers / comparingfloats / comparingfloats . htm <nl> + return fabs ( lhs - rhs . m_d ) < = catch_max ( CATCH_absTol , CATCH_relTol * catch_max ( fabs ( lhs ) , fabs ( rhs . m_d ) ) ) ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + template < typename T > <nl> + friend bool operator ! = <nl> + ( <nl> + const T & lhs , <nl> + const Approx & rhs <nl> + ) <nl> + { <nl> + return ! operator = = ( lhs , rhs ) ; <nl> + } <nl> + <nl> + double m_d ; <nl> + } ; <nl> + } <nl> <nl> - double m_d ; <nl> - } ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> template < > <nl> - inline std : : string toString < Approx > <nl> + inline std : : string toString < Detail : : Approx > <nl> ( <nl> - const Approx & value <nl> + const Detail : : Approx & value <nl> ) <nl> { <nl> std : : ostringstream oss ; <nl>
|
Moved Approx into its own namespace to avoid ADL issues with operator = =
|
catchorg/Catch2
|
01db6c4471b555f475a88a2cca75cf35da43da63
|
2011-04-04T06:56:44Z
|
mmm a / tensorflow / core / common_runtime / process_util . cc <nl> ppp b / tensorflow / core / common_runtime / process_util . cc <nl> int32 NumIntraOpThreadsFromEnvironment ( ) { <nl> return ( val & & strings : : safe_strto32 ( val , & num ) ) ? num : 0 ; <nl> } <nl> <nl> + # ifdef INTEL_MKL <nl> + int32 OMPThreadsFromEnvironment ( ) { <nl> + int32 num ; <nl> + const char * val = std : : getenv ( " OMP_NUM_THREADS " ) ; <nl> + return ( val & & strings : : safe_strto32 ( val , & num ) ) ? num : 0 ; <nl> + } <nl> + <nl> + int32 DefaultNumIntraOpThreads ( ) { <nl> + / / Use environment setting if specified ( init once ) <nl> + static int env_num_threads = NumIntraOpThreadsFromEnvironment ( ) ; <nl> + if ( env_num_threads > 0 ) { <nl> + return env_num_threads ; <nl> + } <nl> + <nl> + / / Default to the maximum parallelism for the current process . <nl> + return port : : MaxParallelism ( ) ; <nl> + } <nl> + # endif <nl> int32 NumInterOpThreadsFromSessionOptions ( const SessionOptions & options ) { <nl> const int32 inter_op = options . config . inter_op_parallelism_threads ( ) ; <nl> if ( inter_op > 0 ) return inter_op ; <nl> # ifdef INTEL_MKL <nl> if ( ! DisableMKL ( ) ) { <nl> - / / MKL library executes ops in parallel using OMP threads <nl> - / / Set inter_op conservatively to avoid thread oversubscription that could <nl> - / / lead to severe perf degradations and OMP resource exhaustion <nl> - int mkl_intra_op = 1 ; <nl> - # ifdef _OPENMP <nl> - mkl_intra_op = omp_get_max_threads ( ) ; <nl> - # endif / / _OPENMP <nl> + / / MKL library executes ops in parallel using OMP threads . <nl> + / / Setting inter_op conservatively to avoid thread oversubscription that <nl> + / / could lead to severe perf degradations and OMP resource exhaustion . <nl> + / / Inter ops are set such that mkl_inter_op * mkl_intra_op < = NumCores . <nl> + const int32 intra_op = options . config . intra_op_parallelism_threads ( ) ; <nl> + const int32 omp_max_threads = OMPThreadsFromEnvironment ( ) ; <nl> + const int32 mkl_intra_op = <nl> + ( omp_max_threads > 0 ) <nl> + ? omp_max_threads <nl> + : ( intra_op > 0 ) ? intra_op : DefaultNumIntraOpThreads ( ) ; <nl> DCHECK_GE ( mkl_intra_op , 1 ) ; <nl> const int32 mkl_inter_op = std : : max ( <nl> ( DefaultNumInterOpThreads ( ) + mkl_intra_op - 1 ) / mkl_intra_op , 2 ) ; <nl> void SchedClosure ( std : : function < void ( ) > closure ) { <nl> uint64 id = tracing : : GetUniqueArg ( ) ; <nl> tracing : : RecordEvent ( tracing : : EventCategory : : kScheduleClosure , id ) ; <nl> <nl> - Env : : Default ( ) - > SchedClosure ( [ id , closure = std : : move ( closure ) ] ( ) { <nl> + Env : : Default ( ) - > SchedClosure ( [ id , closure = std : : move ( closure ) ] ( ) { <nl> tracing : : ScopedRegion region ( tracing : : EventCategory : : kRunClosure , id ) ; <nl> closure ( ) ; <nl> } ) ; <nl>
|
Fixing inter op default setting in intel .
|
tensorflow/tensorflow
|
12c32c6749615d8aa9db1a7b8433bca1280e46b9
|
2019-10-25T18:25:52Z
|
mmm a / src / mongo / util / log . cpp <nl> ppp b / src / mongo / util / log . cpp <nl> using namespace std ; <nl> namespace mongo { <nl> <nl> int logLevel = 0 ; <nl> - int tlogLevel = 0 ; <nl> + int tlogLevel = 0 ; / / test log level . so we avoid overchattiness ( somewhat ) in the c + + unit tests <nl> mongo : : mutex Logstream : : mutex ( " Logstream " ) ; <nl> int Logstream : : doneSetup = Logstream : : magicNumber ( ) ; <nl> <nl>
|
comment
|
mongodb/mongo
|
4664de378f0281354067e4623ac6b395395f120c
|
2012-05-08T16:50:35Z
|
mmm a / src / core / memory . cpp <nl> ppp b / src / core / memory . cpp <nl> <nl> namespace Memory { <nl> <nl> static std : : array < u8 , Memory : : VRAM_SIZE > vram ; <nl> - static std : : array < u8 , Memory : : N3DS_EXTRA_RAM_SIZE > n3ds_extra_ram ; <nl> <nl> static PageTable * current_page_table = nullptr ; <nl> <nl> u8 * GetPhysicalPointer ( PAddr address ) { <nl> { IO_AREA_PADDR , IO_AREA_SIZE } , <nl> { DSP_RAM_PADDR , DSP_RAM_SIZE } , <nl> { FCRAM_PADDR , FCRAM_N3DS_SIZE } , <nl> - { N3DS_EXTRA_RAM_PADDR , N3DS_EXTRA_RAM_SIZE } , <nl> } ; <nl> <nl> const auto area = <nl> u8 * GetPhysicalPointer ( PAddr address ) { <nl> } <nl> ASSERT_MSG ( target_pointer ! = nullptr , " Invalid FCRAM address " ) ; <nl> break ; <nl> - case N3DS_EXTRA_RAM_PADDR : <nl> - target_pointer = n3ds_extra_ram . data ( ) + offset_into_region ; <nl> - break ; <nl> default : <nl> UNREACHABLE ( ) ; <nl> } <nl> boost : : optional < PAddr > TryVirtualToPhysicalAddress ( const VAddr addr ) { <nl> return addr - DSP_RAM_VADDR + DSP_RAM_PADDR ; <nl> } else if ( addr > = IO_AREA_VADDR & & addr < IO_AREA_VADDR_END ) { <nl> return addr - IO_AREA_VADDR + IO_AREA_PADDR ; <nl> - } else if ( addr > = N3DS_EXTRA_RAM_VADDR & & addr < N3DS_EXTRA_RAM_VADDR_END ) { <nl> - return addr - N3DS_EXTRA_RAM_VADDR + N3DS_EXTRA_RAM_PADDR ; <nl> } <nl> <nl> return boost : : none ; <nl> boost : : optional < VAddr > PhysicalToVirtualAddress ( const PAddr addr ) { <nl> return addr - DSP_RAM_PADDR + DSP_RAM_VADDR ; <nl> } else if ( addr > = IO_AREA_PADDR & & addr < IO_AREA_PADDR_END ) { <nl> return addr - IO_AREA_PADDR + IO_AREA_VADDR ; <nl> - } else if ( addr > = N3DS_EXTRA_RAM_PADDR & & addr < N3DS_EXTRA_RAM_PADDR_END ) { <nl> - return addr - N3DS_EXTRA_RAM_PADDR + N3DS_EXTRA_RAM_VADDR ; <nl> } <nl> <nl> return boost : : none ; <nl> mmm a / src / core / memory . h <nl> ppp b / src / core / memory . h <nl> enum : PAddr { <nl> VRAM_SIZE = 0x00600000 , / / / < VRAM size ( 6MB ) <nl> VRAM_PADDR_END = VRAM_PADDR + VRAM_SIZE , <nl> <nl> - / / / New 3DS additional memory . Supposedly faster than regular FCRAM . Part of it can be used by <nl> - / / / applications and system modules if mapped via the ExHeader . <nl> - N3DS_EXTRA_RAM_PADDR = 0x1F000000 , <nl> - N3DS_EXTRA_RAM_SIZE = 0x00400000 , / / / < New 3DS additional memory size ( 4MB ) <nl> - N3DS_EXTRA_RAM_PADDR_END = N3DS_EXTRA_RAM_PADDR + N3DS_EXTRA_RAM_SIZE , <nl> - <nl> / / / DSP memory <nl> DSP_RAM_PADDR = 0x1FF00000 , <nl> DSP_RAM_SIZE = 0x00080000 , / / / < DSP memory size ( 512KB ) <nl> enum : PAddr { <nl> FCRAM_SIZE = 0x08000000 , / / / < FCRAM size on the Old 3DS ( 128MB ) <nl> FCRAM_N3DS_SIZE = 0x10000000 , / / / < FCRAM size on the New 3DS ( 256MB ) <nl> FCRAM_PADDR_END = FCRAM_PADDR + FCRAM_SIZE , <nl> - FCRAM_N3DS_PADDR_END = FCRAM_PADDR + FCRAM_N3DS_SIZE , <nl> } ; <nl> <nl> / / / Virtual user - space memory regions <nl> enum : VAddr { <nl> LINEAR_HEAP_SIZE = 0x08000000 , <nl> LINEAR_HEAP_VADDR_END = LINEAR_HEAP_VADDR + LINEAR_HEAP_SIZE , <nl> <nl> - / / / Maps 1 : 1 to New 3DS additional memory <nl> - N3DS_EXTRA_RAM_VADDR = 0x1E800000 , <nl> - N3DS_EXTRA_RAM_VADDR_END = N3DS_EXTRA_RAM_VADDR + N3DS_EXTRA_RAM_SIZE , <nl> - <nl> / / / Maps 1 : 1 to the IO register area . <nl> IO_AREA_VADDR = 0x1EC00000 , <nl> IO_AREA_VADDR_END = IO_AREA_VADDR + IO_AREA_SIZE , <nl>
|
Remove more N3DS References
|
yuzu-emu/yuzu
|
8afdbf6a1fb933d44e0e4d04cc014d0fcd0c8b14
|
2018-03-22T20:25:06Z
|
mmm a / lib / IDE / REPLCodeCompletion . cpp <nl> ppp b / lib / IDE / REPLCodeCompletion . cpp <nl> doCodeCompletion ( SourceFile & SF , StringRef EnteredCode , unsigned * BufferID , <nl> newSF . addImports ( importsWithOptions ) ; <nl> } <nl> <nl> - performTypeChecking ( newSF ) ; <nl> + performImportResolution ( newSF ) ; <nl> + bindExtensions ( newSF ) ; <nl> <nl> performCodeCompletionSecondPass ( newSF , * CompletionCallbacksFactory ) ; <nl> <nl>
|
Merge pull request from CodaFi / replete - with - errors
|
apple/swift
|
423713b187d73d8e163fec36a29151bc8e73bf55
|
2020-04-20T03:07:35Z
|
mmm a / src / gui / Src / BasicView / Disassembly . cpp <nl> ppp b / src / gui / Src / BasicView / Disassembly . cpp <nl> void Disassembly : : expandSelectionUpTo ( dsint to ) <nl> if ( to < mSelection . firstSelectedIndex ) <nl> { <nl> mSelection . fromIndex = to ; <nl> + emit selectionUpdated ( ) ; <nl> } <nl> else if ( to > mSelection . firstSelectedIndex ) <nl> { <nl> mSelection . toIndex = to ; <nl> + emit selectionUpdated ( ) ; <nl> } <nl> else if ( to = = mSelection . firstSelectedIndex ) <nl> { <nl> void Disassembly : : setSingleSelection ( dsint index ) <nl> mSelection . fromIndex = index ; <nl> mSelection . toIndex = getInstructionRVA ( mSelection . fromIndex , 1 ) - 1 ; <nl> emit selectionChanged ( rvaToVa ( index ) ) ; <nl> + emit selectionUpdated ( ) ; <nl> } <nl> <nl> dsint Disassembly : : getInitialSelection ( ) <nl> mmm a / src / gui / Src / BasicView / Disassembly . h <nl> ppp b / src / gui / Src / BasicView / Disassembly . h <nl> class Disassembly : public AbstractTableView <nl> <nl> signals : <nl> void selectionChanged ( dsint parVA ) ; <nl> + void selectionUpdated ( ) ; <nl> void disassembledAt ( dsint parVA , dsint parCIP , bool history , dsint newTableOffset ) ; <nl> void updateWindowTitle ( QString title ) ; <nl> <nl> mmm a / src / gui / Src / Bridge / Bridge . cpp <nl> ppp b / src / gui / Src / Bridge / Bridge . cpp <nl> void Bridge : : CopyToClipboard ( const QString & text ) <nl> { <nl> QClipboard * clipboard = QApplication : : clipboard ( ) ; <nl> clipboard - > setText ( text ) ; <nl> + GuiAddStatusBarMessage ( tr ( " The data has been copied to clipboard . \ n " ) . toUtf8 ( ) . constData ( ) ) ; <nl> } <nl> <nl> void Bridge : : setResult ( dsint result ) <nl> mmm a / src / gui / Src / Gui / CPUDisassembly . cpp <nl> ppp b / src / gui / Src / Gui / CPUDisassembly . cpp <nl> CPUDisassembly : : CPUDisassembly ( CPUWidget * parent ) : Disassembly ( parent ) <nl> connect ( Bridge : : getBridge ( ) , SIGNAL ( dbgStateChanged ( DBGSTATE ) ) , this , SLOT ( debugStateChangedSlot ( DBGSTATE ) ) ) ; <nl> connect ( Bridge : : getBridge ( ) , SIGNAL ( selectionDisasmGet ( SELECTIONDATA * ) ) , this , SLOT ( selectionGetSlot ( SELECTIONDATA * ) ) ) ; <nl> connect ( Bridge : : getBridge ( ) , SIGNAL ( selectionDisasmSet ( const SELECTIONDATA * ) ) , this , SLOT ( selectionSetSlot ( const SELECTIONDATA * ) ) ) ; <nl> + connect ( this , SIGNAL ( selectionUpdated ( ) ) , this , SLOT ( selectionUpdatedSlot ( ) ) ) ; <nl> connect ( Bridge : : getBridge ( ) , SIGNAL ( displayWarning ( QString , QString ) ) , this , SLOT ( displayWarningSlot ( QString , QString ) ) ) ; <nl> connect ( Bridge : : getBridge ( ) , SIGNAL ( focusDisasm ( ) ) , this , SLOT ( setFocus ( ) ) ) ; <nl> <nl> void CPUDisassembly : : selectionSetSlot ( const SELECTIONDATA * selection ) <nl> Bridge : : getBridge ( ) - > setResult ( 1 ) ; <nl> } <nl> <nl> + void CPUDisassembly : : selectionUpdatedSlot ( ) <nl> + { <nl> + QString selStart = ToPtrString ( rvaToVa ( getSelectionStart ( ) ) ) ; <nl> + QString selEnd = ToPtrString ( rvaToVa ( getSelectionEnd ( ) ) ) ; <nl> + QString info = tr ( " Disassembly " ) ; <nl> + char mod [ MAX_MODULE_SIZE ] = " " ; <nl> + if ( DbgFunctions ( ) - > ModNameFromAddr ( rvaToVa ( getSelectionStart ( ) ) , mod , true ) ) <nl> + info = QString ( mod ) + " " ; <nl> + GuiAddStatusBarMessage ( QString ( info + " : " + selStart + " - > " + selEnd + QString ( ) . sprintf ( " ( 0x % . 8X bytes ) \ n " , getSelectionEnd ( ) - getSelectionStart ( ) + 1 ) ) . toUtf8 ( ) . constData ( ) ) ; <nl> + } <nl> + <nl> void CPUDisassembly : : enableHighlightingModeSlot ( ) <nl> { <nl> if ( mHighlightingMode ) <nl> void CPUDisassembly : : copySelectionToFileNoBytesSlot ( ) <nl> <nl> void CPUDisassembly : : copyAddressSlot ( ) <nl> { <nl> - QString addrText = ToPtrString ( rvaToVa ( getInitialSelection ( ) ) ) ; <nl> - Bridge : : CopyToClipboard ( addrText ) ; <nl> + QString clipboard = " " ; <nl> + prepareDataRange ( getSelectionStart ( ) , getSelectionEnd ( ) , [ & ] ( int i , const Instruction_t & inst ) <nl> + { <nl> + clipboard + = ToPtrString ( rvaToVa ( inst . rva ) ) + " \ r \ n " ; <nl> + } ) ; <nl> + Bridge : : CopyToClipboard ( clipboard ) ; <nl> } <nl> <nl> void CPUDisassembly : : copyRvaSlot ( ) <nl> { <nl> - duint addr = rvaToVa ( getInitialSelection ( ) ) ; <nl> - duint base = DbgFunctions ( ) - > ModBaseFromAddr ( addr ) ; <nl> - if ( base ) <nl> + QString clipboard = " " ; <nl> + prepareDataRange ( getSelectionStart ( ) , getSelectionEnd ( ) , [ & ] ( int i , const Instruction_t & inst ) <nl> { <nl> - QString addrText = ToHexString ( addr - base ) ; <nl> - Bridge : : CopyToClipboard ( addrText ) ; <nl> - } <nl> - else <nl> - SimpleWarningBox ( this , tr ( " Error ! " ) , tr ( " Selection not in a module . . . " ) ) ; <nl> + duint addr = rvaToVa ( inst . rva ) ; <nl> + duint base = DbgFunctions ( ) - > ModBaseFromAddr ( addr ) ; <nl> + if ( base ) <nl> + clipboard + = ToHexString ( addr - base ) + " \ r \ n " ; <nl> + else <nl> + SimpleWarningBox ( this , tr ( " Error ! " ) , tr ( " Selection not in a module . . . " ) ) ; <nl> + } ) ; <nl> + Bridge : : CopyToClipboard ( clipboard ) ; <nl> } <nl> <nl> void CPUDisassembly : : copyDisassemblySlot ( ) <nl> mmm a / src / gui / Src / Gui / CPUDisassembly . h <nl> ppp b / src / gui / Src / Gui / CPUDisassembly . h <nl> public slots : <nl> void findGUIDSlot ( ) ; <nl> void selectionGetSlot ( SELECTIONDATA * selection ) ; <nl> void selectionSetSlot ( const SELECTIONDATA * selection ) ; <nl> + void selectionUpdatedSlot ( ) ; <nl> void enableHighlightingModeSlot ( ) ; <nl> void binaryEditSlot ( ) ; <nl> void binaryFillSlot ( ) ; <nl>
|
Disassembler copying and statusbar enhancements ( )
|
x64dbg/x64dbg
|
8da5df6c7e726ffa51548e4a6f245dd891760b8b
|
2016-12-13T12:44:30Z
|
mmm a / tests / test_benchmark . py <nl> ppp b / tests / test_benchmark . py <nl> def __init__ ( self , name , cc , cxx ) : <nl> self . cc = cc <nl> self . cxx = cxx <nl> <nl> - def build ( self , parent , filename , args , shared_args , emcc_args , native_args , native_exec ) : <nl> + def build ( self , parent , filename , args , shared_args , emcc_args , native_args , native_exec , lib_builder ) : <nl> self . parent = parent <nl> + if lib_builder : native_args + = lib_builder ( self . name , native = True , env_init = { ' CC ' : self . cc , ' CXX ' : self . cxx } ) <nl> if not native_exec : <nl> compiler = self . cxx if filename . endswith ( ' cpp ' ) else self . cc <nl> process = Popen ( [ compiler , ' - O2 ' , ' - fno - math - errno ' , filename , ' - o ' , filename + ' . native ' ] + shared_args + native_args , stdout = PIPE , stderr = parent . stderr_redirect ) <nl> def __init__ ( self , name , engine , extra_args = [ ] ) : <nl> self . engine = engine <nl> self . extra_args = extra_args <nl> <nl> - def build ( self , parent , filename , args , shared_args , emcc_args , native_args , native_exec ) : <nl> + def build ( self , parent , filename , args , shared_args , emcc_args , native_args , native_exec , lib_builder ) : <nl> self . filename = filename <nl> + if lib_builder : emcc_args + = lib_builder ( ' js ' , native = False , env_init = { } ) <nl> <nl> open ( ' hardcode . py ' , ' w ' ) . write ( ' ' ' <nl> def process ( filename ) : <nl> def setUpClass ( self ) : <nl> Building . COMPILER = CLANG <nl> Building . COMPILER_TEST_OPTS = [ ] <nl> <nl> - # Pick the JS engine to benchmark . If you specify one , it will be picked . For example , python tests / runner . py benchmark SPIDERMONKEY_ENGINE <nl> - global JS_ENGINE <nl> - JS_ENGINE = Building . JS_ENGINE_OVERRIDE if Building . JS_ENGINE_OVERRIDE is not None else JS_ENGINES [ 0 ] <nl> - print ' Benchmarking JS engine : % s ' % JS_ENGINE <nl> - <nl> - def do_benchmark ( self , name , src , expected_output = ' FAIL ' , args = [ ] , emcc_args = [ ] , native_args = [ ] , shared_args = [ ] , force_c = False , reps = TEST_REPS , native_exec = None , output_parser = None , args_processor = None ) : <nl> + def do_benchmark ( self , name , src , expected_output = ' FAIL ' , args = [ ] , emcc_args = [ ] , native_args = [ ] , shared_args = [ ] , force_c = False , reps = TEST_REPS , native_exec = None , output_parser = None , args_processor = None , lib_builder = None ) : <nl> args = args or [ DEFAULT_ARG ] <nl> if args_processor : args = args_processor ( args ) <nl> <nl> def do_benchmark ( self , name , src , expected_output = ' FAIL ' , args = [ ] , emcc_args = [ ] , <nl> <nl> print <nl> for b in benchmarkers : <nl> - b . build ( self , filename , args , shared_args , emcc_args , native_args , native_exec ) <nl> + b . build ( self , filename , args , shared_args , emcc_args , native_args , native_exec , lib_builder ) <nl> b . bench ( args , output_parser ) <nl> b . display ( benchmarkers [ 0 ] ) <nl> <nl> def test_zzz_lua_binarytrees ( self ) : <nl> <nl> def test_zzz_zlib ( self ) : <nl> src = open ( path_from_root ( ' tests ' , ' zlib ' , ' benchmark . c ' ) , ' r ' ) . read ( ) <nl> - emcc_args = self . get_library ( ' zlib ' , os . path . join ( ' libz . a ' ) , make_args = [ ' libz . a ' ] ) + \ <nl> - [ ' - I ' + path_from_root ( ' tests ' , ' zlib ' ) ] <nl> - native_args = self . get_library ( ' zlib_native ' , os . path . join ( ' libz . a ' ) , make_args = [ ' libz . a ' ] , native = True ) + \ <nl> - [ ' - I ' + path_from_root ( ' tests ' , ' zlib ' ) ] <nl> + def lib_builder ( name , native , env_init ) : <nl> + return self . get_library ( ' zlib ' , os . path . join ( ' libz . a ' ) , make_args = [ ' libz . a ' ] , native = native , cache_name_extra = name , env_init = env_init ) <nl> self . do_benchmark ( ' zlib ' , src , ' ' ' ok . ' ' ' , <nl> - force_c = True , emcc_args = emcc_args , native_args = native_args ) <nl> + force_c = True , shared_args = [ ' - I ' + path_from_root ( ' tests ' , ' zlib ' ) ] , lib_builder = lib_builder ) <nl> <nl> def test_zzz_box2d ( self ) : # Called thus so it runs late in the alphabetical cycle . . . it is long <nl> src = open ( path_from_root ( ' tests ' , ' box2d ' , ' Benchmark . cpp ' ) , ' r ' ) . read ( ) <nl> - <nl> - js_lib = self . get_library ( ' box2d ' , [ os . path . join ( ' box2d . a ' ) ] , configure = None ) <nl> - native_lib = self . get_library ( ' box2d_native ' , [ os . path . join ( ' box2d . a ' ) ] , configure = None , native = True ) <nl> - <nl> - emcc_args = js_lib + [ ' - I ' + path_from_root ( ' tests ' , ' box2d ' ) ] <nl> - native_args = native_lib + [ ' - I ' + path_from_root ( ' tests ' , ' box2d ' ) ] <nl> - <nl> - self . do_benchmark ( ' box2d ' , src , ' frame averages ' , emcc_args = emcc_args , native_args = native_args ) <nl> + def lib_builder ( name , native , env_init ) : <nl> + return self . get_library ( ' box2d ' , [ os . path . join ( ' box2d . a ' ) ] , configure = None , native = native , cache_name_extra = name , env_init = env_init ) <nl> + self . do_benchmark ( ' box2d ' , src , ' frame averages ' , shared_args = [ ' - I ' + path_from_root ( ' tests ' , ' box2d ' ) ] , lib_builder = lib_builder ) <nl> <nl> def test_zzz_bullet ( self ) : # Called thus so it runs late in the alphabetical cycle . . . it is long <nl> src = open ( path_from_root ( ' tests ' , ' bullet ' , ' Demos ' , ' Benchmarks ' , ' BenchmarkDemo . cpp ' ) , ' r ' ) . read ( ) + \ <nl> open ( path_from_root ( ' tests ' , ' bullet ' , ' Demos ' , ' Benchmarks ' , ' main . cpp ' ) , ' r ' ) . read ( ) <nl> <nl> - js_lib = self . get_library ( ' bullet ' , [ os . path . join ( ' src ' , ' . libs ' , ' libBulletDynamics . a ' ) , <nl> + def lib_builder ( name , native , env_init ) : <nl> + return self . get_library ( ' bullet ' , [ os . path . join ( ' src ' , ' . libs ' , ' libBulletDynamics . a ' ) , <nl> os . path . join ( ' src ' , ' . libs ' , ' libBulletCollision . a ' ) , <nl> os . path . join ( ' src ' , ' . libs ' , ' libLinearMath . a ' ) ] , <nl> - configure_args = [ ' - - disable - demos ' , ' - - disable - dependency - tracking ' ] ) <nl> - native_lib = self . get_library ( ' bullet_native ' , [ os . path . join ( ' src ' , ' . libs ' , ' libBulletDynamics . a ' ) , <nl> - os . path . join ( ' src ' , ' . libs ' , ' libBulletCollision . a ' ) , <nl> - os . path . join ( ' src ' , ' . libs ' , ' libLinearMath . a ' ) ] , <nl> - configure_args = [ ' - - disable - demos ' , ' - - disable - dependency - tracking ' ] , <nl> - native = True ) <nl> - <nl> - emcc_args = js_lib + [ ' - I ' + path_from_root ( ' tests ' , ' bullet ' , ' src ' ) , <nl> - ' - I ' + path_from_root ( ' tests ' , ' bullet ' , ' Demos ' , ' Benchmarks ' ) , <nl> - ' - s ' , ' DEAD_FUNCTIONS = [ " __ZSt9terminatev " ] ' ] <nl> - native_args = native_lib + [ ' - I ' + path_from_root ( ' tests ' , ' bullet ' , ' src ' ) , <nl> - ' - I ' + path_from_root ( ' tests ' , ' bullet ' , ' Demos ' , ' Benchmarks ' ) ] <nl> - <nl> - self . do_benchmark ( ' bullet ' , src , ' \ nok . \ n ' , emcc_args = emcc_args , native_args = native_args ) <nl> + configure_args = [ ' - - disable - demos ' , ' - - disable - dependency - tracking ' ] , native = native , cache_name_extra = name , env_init = env_init ) <nl> + <nl> + emcc_args = [ ' - s ' , ' DEAD_FUNCTIONS = [ " __ZSt9terminatev " ] ' ] <nl> + <nl> + self . do_benchmark ( ' bullet ' , src , ' \ nok . \ n ' , emcc_args = emcc_args , shared_args = [ ' - I ' + path_from_root ( ' tests ' , ' bullet ' , ' src ' ) , <nl> + ' - I ' + path_from_root ( ' tests ' , ' bullet ' , ' Demos ' , ' Benchmarks ' ) ] , lib_builder = lib_builder ) <nl> + <nl>
|
fixes to get gcc to work on all benchmarks
|
emscripten-core/emscripten
|
3b2466246537461a2d4811e93c659d23513d5408
|
2013-12-17T00:03:59Z
|
mmm a / fdbclient / FileBackupAgent . actor . cpp <nl> ppp b / fdbclient / FileBackupAgent . actor . cpp <nl> namespace fileBackup { <nl> <nl> / / Avoid unnecessary conflict by prevent taskbucket ' s automatic timeout extension <nl> / / because the following transaction loop extends and updates the task . <nl> - Void _ = wait ( task - > extendMutex . take ( 1 ) ) ; <nl> + Void _ = wait ( task - > extendMutex . take ( ) ) ; <nl> state FlowLock : : Releaser releaser ( task - > extendMutex , 1 ) ; <nl> <nl> loop { <nl> mmm a / fdbclient / TaskBucket . actor . cpp <nl> ppp b / fdbclient / TaskBucket . actor . cpp <nl> class TaskBucketImpl { <nl> Void _ = wait ( delay ( 0 . 8 * ( BUGGIFY ? ( 2 * g_random - > random01 ( ) ) : 1 . 0 ) * ( double ) ( task - > timeoutVersion - ( uint64_t ) versionNow ) / CLIENT_KNOBS - > CORE_VERSIONSPERSECOND ) ) ; <nl> <nl> / / Take the extendMutex lock until we either succeed or stop trying to extend due to failure <nl> - Void _ = wait ( task - > extendMutex . take ( 1 ) ) ; <nl> + Void _ = wait ( task - > extendMutex . take ( ) ) ; <nl> releaser = FlowLock : : Releaser ( task - > extendMutex , 1 ) ; <nl> <nl> loop { <nl> mmm a / fdbrpc / AsyncFileBlobStore . actor . h <nl> ppp b / fdbrpc / AsyncFileBlobStore . actor . h <nl> class AsyncFileBlobStoreWrite : public IAsyncFile , public ReferenceCounted < Async <nl> return Void ( ) ; <nl> <nl> / / Wait for an upload slot to be available <nl> - Void _ = wait ( f - > m_concurrentUploads . take ( 1 ) ) ; <nl> + Void _ = wait ( f - > m_concurrentUploads . take ( ) ) ; <nl> <nl> / / Do the upload , and if it fails forward errors to m_error and also stop if anything else sends an error to m_error <nl> / / Also , hold a releaser for the concurrent upload slot while all that is going on . <nl> mmm a / fdbrpc / AsyncFileReadAhead . actor . h <nl> ppp b / fdbrpc / AsyncFileReadAhead . actor . h <nl> class AsyncFileReadAheadCache : public IAsyncFile , public ReferenceCounted < Async <nl> <nl> / / Read from the underlying file to a CacheBlock <nl> ACTOR static Future < Reference < CacheBlock > > readBlock ( AsyncFileReadAheadCache * f , int length , int64_t offset ) { <nl> - Void _ = wait ( f - > m_max_concurrent_reads . take ( 1 ) ) ; <nl> + Void _ = wait ( f - > m_max_concurrent_reads . take ( ) ) ; <nl> <nl> state Reference < CacheBlock > block ( new CacheBlock ( length ) ) ; <nl> try { <nl> mmm a / fdbrpc / BlobStore . actor . cpp <nl> ppp b / fdbrpc / BlobStore . actor . cpp <nl> ACTOR Future < Reference < HTTP : : Response > > doRequest_impl ( Reference < BlobStoreEndpoi <nl> if ( contentLen > 0 ) <nl> headers [ " Content - Length " ] = format ( " % d " , contentLen ) ; <nl> <nl> - Void _ = wait ( bstore - > concurrentRequests . take ( 1 ) ) ; <nl> + Void _ = wait ( bstore - > concurrentRequests . take ( ) ) ; <nl> state FlowLock : : Releaser globalReleaser ( bstore - > concurrentRequests , 1 ) ; <nl> <nl> state int maxTries = std : : min ( bstore - > knobs . request_tries , bstore - > knobs . connect_tries ) ; <nl> ACTOR Future < Void > writeEntireFileFromBuffer_impl ( Reference < BlobStoreEndpoint > b <nl> if ( contentLen > bstore - > knobs . multipart_max_part_size ) <nl> throw file_too_large ( ) ; <nl> <nl> - Void _ = wait ( bstore - > concurrentUploads . take ( 1 ) ) ; <nl> + Void _ = wait ( bstore - > concurrentUploads . take ( ) ) ; <nl> state FlowLock : : Releaser uploadReleaser ( bstore - > concurrentUploads , 1 ) ; <nl> <nl> std : : string resource = std : : string ( " / " ) + bucket + " / " + object ; <nl> Future < std : : string > BlobStoreEndpoint : : beginMultiPartUpload ( std : : string const & b <nl> } <nl> <nl> ACTOR Future < std : : string > uploadPart_impl ( Reference < BlobStoreEndpoint > bstore , std : : string bucket , std : : string object , std : : string uploadID , unsigned int partNumber , UnsentPacketQueue * pContent , int contentLen , std : : string contentMD5 ) { <nl> - Void _ = wait ( bstore - > concurrentUploads . take ( 1 ) ) ; <nl> + Void _ = wait ( bstore - > concurrentUploads . take ( ) ) ; <nl> state FlowLock : : Releaser uploadReleaser ( bstore - > concurrentUploads , 1 ) ; <nl> <nl> std : : string resource = format ( " / % s / % s ? partNumber = % d & uploadId = % s " , bucket . c_str ( ) , object . c_str ( ) , partNumber , uploadID . c_str ( ) ) ; <nl>
|
Bug fixes , take ( 1 ) is incorrect usage of FlowLock .
|
apple/foundationdb
|
86ae6c09c7bc233d70d29fe09e6b5074c0c33b61
|
2017-12-04T18:20:50Z
|
mmm a / src / treelearner / gpu_tree_learner . cpp <nl> ppp b / src / treelearner / gpu_tree_learner . cpp <nl> void GPUTreeLearner : : AllocateGPUMemory ( ) { <nl> # endif <nl> } <nl> <nl> + std : : string GPUTreeLearner : : GetBuildLog ( const std : : string & opts ) { <nl> + boost : : compute : : program program = boost : : compute : : program : : create_with_source ( kernel_source_ , ctx_ ) ; <nl> + try { <nl> + program . build ( opts ) ; <nl> + } <nl> + catch ( boost : : compute : : opencl_error & e ) { <nl> + auto error_code = e . error_code ( ) ; <nl> + std : : string log ( " No log available . \ n " ) ; <nl> + / / for other types of failure , build log might not be available ; program . build_log ( ) can crash <nl> + if ( error_code = = CL_INVALID_PROGRAM | | error_code = = CL_BUILD_PROGRAM_FAILURE ) { <nl> + try { <nl> + log = program . build_log ( ) ; <nl> + } <nl> + catch ( . . . ) { <nl> + / / Something bad happened . Just return " No log available . " <nl> + } <nl> + } <nl> + return log ; <nl> + } <nl> + / / build is okay , log may contain warnings <nl> + return program . build_log ( ) ; <nl> + } <nl> + <nl> void GPUTreeLearner : : BuildGPUKernels ( ) { <nl> Log : : Info ( " Compiling OpenCL Kernel with % d bins . . . " , device_bin_size_ ) ; <nl> / / destroy any old kernels <nl> void GPUTreeLearner : : BuildGPUKernels ( ) { <nl> histogram_fulldata_kernels_ . resize ( kMaxLogWorkgroupsPerFeature + 1 ) ; <nl> / / currently we don ' t use constant memory <nl> int use_constants = 0 ; <nl> + OMP_INIT_EX ( ) ; <nl> # pragma omp parallel for schedule ( guided ) <nl> for ( int i = 0 ; i < = kMaxLogWorkgroupsPerFeature ; + + i ) { <nl> + OMP_LOOP_EX_BEGIN ( ) ; <nl> boost : : compute : : program program ; <nl> std : : ostringstream opts ; <nl> / / compile the GPU kernel depending if double precision is used , constant hessian is used , etc <nl> void GPUTreeLearner : : BuildGPUKernels ( ) { <nl> program = boost : : compute : : program : : build_with_source ( kernel_source_ , ctx_ , opts . str ( ) ) ; <nl> } <nl> catch ( boost : : compute : : opencl_error & e ) { <nl> - if ( program . build_log ( ) . size ( ) > 0 ) { <nl> - Log : : Fatal ( " GPU program built failure : % s \ n % s " , e . what ( ) , program . build_log ( ) . c_str ( ) ) ; <nl> - } <nl> - else { <nl> - Log : : Fatal ( " GPU program built failure : % s \ nlog unavailable " , e . what ( ) ) ; <nl> + # pragma omp critical <nl> + { <nl> + std : : cerr < < " Build Options : " < < opts . str ( ) < < std : : endl ; <nl> + std : : cerr < < " Build Log : " < < std : : endl < < GetBuildLog ( opts . str ( ) ) < < std : : endl ; <nl> + Log : : Fatal ( " Cannot build GPU program : % s " , e . what ( ) ) ; <nl> } <nl> } <nl> histogram_kernels_ [ i ] = program . create_kernel ( kernel_name_ ) ; <nl> void GPUTreeLearner : : BuildGPUKernels ( ) { <nl> program = boost : : compute : : program : : build_with_source ( kernel_source_ , ctx_ , opts . str ( ) ) ; <nl> } <nl> catch ( boost : : compute : : opencl_error & e ) { <nl> - if ( program . build_log ( ) . size ( ) > 0 ) { <nl> - Log : : Fatal ( " GPU program built failure : % s \ n % s " , e . what ( ) , program . build_log ( ) . c_str ( ) ) ; <nl> - } <nl> - else { <nl> - Log : : Fatal ( " GPU program built failure : % s \ nlog unavailable " , e . what ( ) ) ; <nl> + # pragma omp critical <nl> + { <nl> + std : : cerr < < " Build Options : " < < opts . str ( ) < < std : : endl ; <nl> + std : : cerr < < " Build Log : " < < std : : endl < < GetBuildLog ( opts . str ( ) ) < < std : : endl ; <nl> + Log : : Fatal ( " Cannot build GPU program : % s " , e . what ( ) ) ; <nl> } <nl> } <nl> histogram_allfeats_kernels_ [ i ] = program . create_kernel ( kernel_name_ ) ; <nl> void GPUTreeLearner : : BuildGPUKernels ( ) { <nl> program = boost : : compute : : program : : build_with_source ( kernel_source_ , ctx_ , opts . str ( ) ) ; <nl> } <nl> catch ( boost : : compute : : opencl_error & e ) { <nl> - if ( program . build_log ( ) . size ( ) > 0 ) { <nl> - Log : : Fatal ( " GPU program built failure : % s \ n % s " , e . what ( ) , program . build_log ( ) . c_str ( ) ) ; <nl> - } <nl> - else { <nl> - Log : : Fatal ( " GPU program built failure : % s \ nlog unavailable " , e . what ( ) ) ; <nl> + # pragma omp critical <nl> + { <nl> + std : : cerr < < " Build Options : " < < opts . str ( ) < < std : : endl ; <nl> + std : : cerr < < " Build Log : " < < std : : endl < < GetBuildLog ( opts . str ( ) ) < < std : : endl ; <nl> + Log : : Fatal ( " Cannot build GPU program : % s " , e . what ( ) ) ; <nl> } <nl> } <nl> histogram_fulldata_kernels_ [ i ] = program . create_kernel ( kernel_name_ ) ; <nl> + OMP_LOOP_EX_END ( ) ; <nl> } <nl> + OMP_THROW_EX ( ) ; <nl> Log : : Info ( " GPU programs have been built " ) ; <nl> } <nl> <nl> mmm a / src / treelearner / gpu_tree_learner . h <nl> ppp b / src / treelearner / gpu_tree_learner . h <nl> class GPUTreeLearner : public SerialTreeLearner { <nl> * \ brief Compile OpenCL GPU source code to kernel binaries <nl> * / <nl> void BuildGPUKernels ( ) ; <nl> + <nl> + / * ! <nl> + * \ brief Returns OpenCL kernel build log when compiled with option opts <nl> + * \ param opts OpenCL build options <nl> + * \ return OpenCL build log <nl> + * / <nl> + std : : string GetBuildLog ( const std : : string & opts ) ; <nl> <nl> / * ! <nl> * \ brief Setup GPU kernel arguments , preparing for launching <nl>
|
Better debugging info when OpenCL compilation fails ( )
|
microsoft/LightGBM
|
dbfa16c344705ed1f223c9547f3b98f15577a94e
|
2017-04-24T02:47:46Z
|
mmm a / xbmc / osx / atv2 / XBMCEAGLView . mm <nl> ppp b / xbmc / osx / atv2 / XBMCEAGLView . mm <nl> - ( void ) stopAnimation <nl> - ( void ) runAnimation : ( id ) arg <nl> { <nl> CCocoaAutoPool outerpool ; <nl> - <nl> - / / [ NSThread setThreadPriority : 1 ] <nl> + [ NSThread setThreadPriority : 1 . 0 ] ; <nl> + / * <nl> / / Changing to SCHED_RR is safe under OSX , you don ' t need elevated privileges and the <nl> / / OSX scheduler will monitor SCHED_RR threads and drop to SCHED_OTHER if it detects <nl> / / the thread running away . OSX automatically does this with the CoreAudio audio <nl> - ( void ) runAnimation : ( id ) arg <nl> / / change from default SCHED_OTHER to SCHED_RR <nl> policy = SCHED_RR ; <nl> result = pthread_setschedparam ( pthread_self ( ) , policy , & param ) ; <nl> - <nl> + * / <nl> / / signal we are alive <nl> NSConditionLock * myLock = arg ; <nl> [ myLock lock ] ; <nl> mmm a / xbmc / osx / ios / XBMCEAGLView . mm <nl> ppp b / xbmc / osx / ios / XBMCEAGLView . mm <nl> - ( void ) runAnimation : ( id ) arg <nl> { <nl> CCocoaAutoPool outerpool ; <nl> <nl> - / / [ NSThread setThreadPriority : 1 ] <nl> + [ NSThread setThreadPriority : 1 . 0 ] ; <nl> + / * <nl> / / Changing to SCHED_RR is safe under OSX , you don ' t need elevated privileges and the <nl> / / OSX scheduler will monitor SCHED_RR threads and drop to SCHED_OTHER if it detects <nl> / / the thread running away . OSX automatically does this with the CoreAudio audio <nl> - ( void ) runAnimation : ( id ) arg <nl> / / change from default SCHED_OTHER to SCHED_RR <nl> policy = SCHED_RR ; <nl> result = pthread_setschedparam ( pthread_self ( ) , policy , & param ) ; <nl> - <nl> + * / <nl> / / signal we are alive <nl> NSConditionLock * myLock = arg ; <nl> [ myLock lock ] ; <nl>
|
[ ios ] diddle thread priority using NSThread routines instead of pthread . ty this for a bit and see if we have regressions
|
xbmc/xbmc
|
fd4fb7999a75e4165657fb1874d96ec555382cc9
|
2011-06-23T06:04:54Z
|
mmm a / test / functional / mining_getblocktemplate_longpoll . py <nl> ppp b / test / functional / mining_getblocktemplate_longpoll . py <nl> def set_test_params ( self ) : <nl> <nl> def run_test ( self ) : <nl> self . log . info ( " Warning : this test will take about 70 seconds in the best case . Be patient . " ) <nl> + self . log . info ( " Test that longpollid doesn ' t change between successive getblocktemplate ( ) invocations if nothing else happens " ) <nl> self . nodes [ 0 ] . generate ( 10 ) <nl> template = self . nodes [ 0 ] . getblocktemplate ( { ' rules ' : [ ' segwit ' ] } ) <nl> longpollid = template [ ' longpollid ' ] <nl> - # longpollid should not change between successive invocations if nothing else happens <nl> template2 = self . nodes [ 0 ] . getblocktemplate ( { ' rules ' : [ ' segwit ' ] } ) <nl> assert template2 [ ' longpollid ' ] = = longpollid <nl> <nl> - # Test 1 : test that the longpolling wait if we do nothing <nl> + self . log . info ( " Test that longpoll waits if we do nothing " ) <nl> thr = LongpollThread ( self . nodes [ 0 ] ) <nl> thr . start ( ) <nl> # check that thread still lives <nl> def run_test ( self ) : <nl> assert thr . is_alive ( ) <nl> <nl> miniwallets = [ MiniWallet ( node ) for node in self . nodes ] <nl> - # Test 2 : test that longpoll will terminate if another node generates a block <nl> + self . log . info ( " Test that longpoll will terminate if another node generates a block " ) <nl> miniwallets [ 1 ] . generate ( 1 ) # generate a block on another node <nl> # check that thread will exit now that new transaction entered mempool <nl> thr . join ( 5 ) # wait 5 seconds or until thread exits <nl> assert not thr . is_alive ( ) <nl> <nl> - # Test 3 : test that longpoll will terminate if we generate a block ourselves <nl> + self . log . info ( " Test that longpoll will terminate if we generate a block ourselves " ) <nl> thr = LongpollThread ( self . nodes [ 0 ] ) <nl> thr . start ( ) <nl> miniwallets [ 0 ] . generate ( 1 ) # generate a block on own node <nl> def run_test ( self ) : <nl> self . nodes [ 0 ] . generate ( 100 ) <nl> self . sync_blocks ( ) <nl> <nl> - # Test 4 : test that introducing a new transaction into the mempool will terminate the longpoll <nl> + self . log . info ( " Test that introducing a new transaction into the mempool will terminate the longpoll " ) <nl> thr = LongpollThread ( self . nodes [ 0 ] ) <nl> thr . start ( ) <nl> # generate a random transaction and submit it <nl>
|
test : add logging for mining_getblocktemplate_longpoll . py
|
bitcoin/bitcoin
|
b128b566725a5037fdaea99940d1b9de5553d198
|
2020-10-16T13:41:00Z
|
mmm a / code / online_challenges / src / hackerrank / 3D_aurface_area / 3D_surface_area . cpp <nl> ppp b / code / online_challenges / src / hackerrank / 3D_aurface_area / 3D_surface_area . cpp <nl> <nl> + # include < iostream > <nl> <nl> - # include < iostream > <nl> - <nl> - int main ( ) <nl> - { <nl> - int h , w ; <nl> + int main ( ) { <nl> + int h , w ; <nl> + int a [ 110 ] [ 110 ] ; <nl> std : : cin > > h > > w ; <nl> - int a [ h ] [ w ] ; <nl> - for ( int i = 0 ; i < h ; i + + ) <nl> - { <nl> - for ( int j = 0 ; j < w ; j + + ) <nl> - std : : cin > > a [ i ] [ j ] ; <nl> + for ( int i = 0 ; i < h ; + + i ) { <nl> + for ( int j = 0 ; j < w ; + + j ) <nl> + std : : cin > > a [ i ] [ j ] ; <nl> } <nl> int sum = 0 ; <nl> - for ( int i = 0 ; i < h ; i + + ) <nl> - { <nl> - if ( i = = 0 ) <nl> - { <nl> - for ( int j = 0 ; j < w ; j + + ) <nl> - { <nl> - int temp = 0 ; <nl> - if ( j = = 0 ) <nl> - { <nl> - temp = ( a [ i ] [ j ] - 1 ) * 4 + 6 ; <nl> - sum = sum + temp ; <nl> - } <nl> - <nl> - else <nl> - { <nl> - temp = ( a [ i ] [ j ] - 1 ) * 4 + 6 ; <nl> - int d = std : : min ( a [ i ] [ j - 1 ] , a [ i ] [ j ] ) ; <nl> - temp = temp - ( d * 2 ) ; <nl> - sum = sum + temp ; <nl> - } <nl> - } <nl> - } <nl> - else <nl> - { <nl> - for ( int j = 0 ; j < w ; j + + ) <nl> - { <nl> - int temp = 0 ; <nl> - if ( j = = 0 ) <nl> - { <nl> - temp = ( a [ i ] [ j ] - 1 ) * 4 + 6 ; <nl> - int d = std : : min ( a [ i ] [ j ] , a [ i - 1 ] [ j ] ) ; <nl> - temp = temp - ( d * 2 ) ; <nl> - sum = sum + temp ; <nl> - } <nl> - <nl> - else <nl> - { <nl> - temp = ( a [ i ] [ j ] - 1 ) * 4 + 6 ; <nl> - int d = std : : min ( a [ i ] [ j - 1 ] , a [ i ] [ j ] ) ; <nl> - temp = temp - ( d * 2 ) ; <nl> - d = std : : min ( a [ i ] [ j ] , a [ i - 1 ] [ j ] ) ; <nl> - temp = temp - ( d * 2 ) ; <nl> - sum = sum + temp ; <nl> - } <nl> - } <nl> + for ( int i = 0 ; i < h ; + + i ) { <nl> + if ( i = = 0 ) { <nl> + for ( int j = 0 ; j < w ; + + j ) { <nl> + int temp = 0 ; <nl> + if ( j = = 0 ) { <nl> + temp = ( a [ i ] [ j ] - 1 ) * 4 + 6 ; <nl> + sum = sum + temp ; <nl> + } else { <nl> + temp = ( a [ i ] [ j ] - 1 ) * 4 + 6 ; <nl> + int d = std : : min ( a [ i ] [ j - 1 ] , a [ i ] [ j ] ) ; <nl> + temp = temp - ( d * 2 ) ; <nl> + sum = sum + temp ; <nl> + } <nl> + } <nl> + } else { <nl> + for ( int j = 0 ; j < w ; + + j ) { <nl> + int temp = 0 ; <nl> + if ( j = = 0 ) { <nl> + temp = ( a [ i ] [ j ] - 1 ) * 4 + 6 ; <nl> + int d = std : : min ( a [ i ] [ j ] , a [ i - 1 ] [ j ] ) ; <nl> + temp = temp - ( d * 2 ) ; <nl> + sum = sum + temp ; <nl> + } else { <nl> + temp = ( a [ i ] [ j ] - 1 ) * 4 + 6 ; <nl> + int d = std : : min ( a [ i ] [ j - 1 ] , a [ i ] [ j ] ) ; <nl> + temp = temp - ( d * 2 ) ; <nl> + d = std : : min ( a [ i ] [ j ] , a [ i - 1 ] [ j ] ) ; <nl> + temp = temp - ( d * 2 ) ; <nl> + sum = sum + temp ; <nl> + } <nl> } <nl> + } <nl> <nl> } <nl> - std : : cout < < sum ; <nl> + std : : cout < < sum ; <nl> <nl> return 0 ; <nl> - } <nl> + } <nl>
|
Update 3D_surface_area . cpp
|
OpenGenus/cosmos
|
b97f3b6b2a5d767f9ec139fa7fb667e333e6c37f
|
2019-03-09T16:23:06Z
|
mmm a / Examples / SequenceToSequence / CMUDict / Python / Sequence2Sequence . py <nl> ppp b / Examples / SequenceToSequence / CMUDict / Python / Sequence2Sequence . py <nl> <nl> from cntk . ops . functions import CloneMethod , load_model <nl> from cntk . ops . sequence import broadcast_as <nl> from cntk . graph import find_nodes_by_name <nl> - # from cntk . blocks import LSTM , Stabilizer <nl> - from localblocks import LSTM , Stabilizer <nl> + from cntk . blocks import LSTM , Stabilizer <nl> from cntk . layers import Dense <nl> from cntk . initializer import glorot_uniform <nl> from cntk . utils import log_number_of_parameters , ProgressPrinter <nl>
|
moved back to non - local blocks
|
microsoft/CNTK
|
8bc9ac6fe97bf42caf29eaba4ac449e051b7e6bd
|
2016-12-14T10:50:50Z
|
mmm a / addons / screensaver . xbmc . builtin . slideshow / resources / language / English / strings . xml <nl> ppp b / addons / screensaver . xbmc . builtin . slideshow / resources / language / English / strings . xml <nl> <nl> < string id = " 30002 " > Video Fanart < / string > <nl> < string id = " 30003 " > Music Fanart < / string > <nl> < string id = " 30004 " > Image Folder < / string > <nl> + < string id = " 30005 " > Dim level < / string > <nl> < / strings > <nl> mmm a / addons / screensaver . xbmc . builtin . slideshow / resources / settings . xml <nl> ppp b / addons / screensaver . xbmc . builtin . slideshow / resources / settings . xml <nl> <nl> < settings > <nl> < setting label = " 30000 " type = " enum " id = " type " default = " 0 " lvalues = " 30002 | 30003 | 30004 " / > <nl> < setting label = " 30001 " type = " folder " source = " pictures " id = " path " default = " " enable = " eq ( - 1 , 2 ) " / > <nl> + < setting label = " 30005 " type = " slider " id = " level " range = " 0 , 1 , 100 " default = " 100 " / > <nl> < / settings > <nl> mmm a / xbmc / Application . cpp <nl> ppp b / xbmc / Application . cpp <nl> void CApplication : : RenderScreenSaver ( ) <nl> return ; <nl> <nl> if ( m_screenSaver - > ID ( ) ! = " screensaver . xbmc . builtin . dim " & & <nl> - m_screenSaver - > ID ( ) ! = " screensaver . xbmc . builtin . black " ) <nl> + m_screenSaver - > ID ( ) ! = " screensaver . xbmc . builtin . black " & & <nl> + m_screenSaver - > ID ( ) ! = " screensaver . xbmc . builtin . slideshow " ) <nl> return ; / / nothing to do <nl> <nl> float amount = 1 . 0f ; <nl>
|
added : ticket - Add dim setting to builtin slideshow screensaver . thanks to pilluli
|
xbmc/xbmc
|
c4a3356fa65fa7fe08469d31fc5dfbaf005d7473
|
2011-01-07T13:11:14Z
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.