Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
IoT Platform
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IoT
IoT Platform
Merge requests
!28
length by unit
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
length by unit
Lenght-by-unit
into
staging
Overview
0
Commits
1
Changes
1
Merged
Guilherme Arthur Gerônimo
requested to merge
Lenght-by-unit
into
staging
1 month ago
Overview
0
Commits
1
Changes
1
Expand
0
0
Merge request reports
Compare
staging
staging (base)
and
latest version
latest version
adbb64a9
1 commit,
1 month ago
1 file
+
79
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
bin/smartdata/Unit.php
+
79
−
3
Options
@@ -64,10 +64,8 @@ abstract class Unit
switch
(
$u
&
(
1
<<
31
))
{
case
self
::
DIGITAL
:
return
new
Digital_Unit
(
$u
);
break
;
case
self
::
SI
:
return
new
SI_Unit
(
$u
);
break
;
default
:
throw
new
InvalidUnitException
(
"Invalid Unit: "
.
$u
);
}
@@ -135,6 +133,42 @@ final class TypicalUnit extends Unit
class
Digital_Unit
extends
Unit
{
//const Switch = 0 << 8 | 00 << 0;
//const Direction = 0 << 8 | 01 << 0;
//const On_Off = 0 << 8 | 00 << 0;
//const RFID32 = 1 << 8 | 00 << 0;
const
PCMU
=
2
<<
8
|
0
<<
0
;
const
GSM
=
2
<<
8
|
3
<<
0
;
const
G723
=
2
<<
8
|
4
<<
0
;
const
DVI4_8
=
2
<<
8
|
5
<<
0
;
const
DVI4_16
=
2
<<
8
|
6
<<
0
;
const
LPC
=
2
<<
8
|
7
<<
0
;
const
PCMA
=
2
<<
8
|
8
<<
0
;
const
G722
=
2
<<
8
|
9
<<
0
;
const
L16_2
=
2
<<
8
|
10
<<
0
;
const
L16_1
=
2
<<
8
|
11
<<
0
;
const
QCELP
=
2
<<
8
|
12
<<
0
;
const
CN
=
2
<<
8
|
13
<<
0
;
const
MPA
=
2
<<
8
|
14
<<
0
;
const
G728
=
2
<<
8
|
15
<<
0
;
const
DVI4_11
=
2
<<
8
|
16
<<
0
;
const
DVI4_22
=
2
<<
8
|
17
<<
0
;
const
G729
=
2
<<
8
|
18
<<
0
;
const
CelB
=
2
<<
8
|
25
<<
0
;
const
JPEG
=
2
<<
8
|
26
<<
0
;
const
nv
=
2
<<
8
|
28
<<
0
;
const
H261
=
2
<<
8
|
31
<<
0
;
const
MPV
=
2
<<
8
|
32
<<
0
;
const
MP2T
=
2
<<
8
|
33
<<
0
;
const
H263
=
2
<<
8
|
34
<<
0
;
const
MPEG2TS
=
2
<<
8
|
35
<<
0
;
const
PNG
=
2
<<
8
|
36
<<
0
;
const
RAW_BGR
=
2
<<
8
|
37
<<
0
;
const
PCD_MONOCROMATIC
=
2
<<
8
|
1
<<
0
;
const
PCD_RGB
=
2
<<
8
|
2
<<
0
;
//const MOTION_VECTOR_GLOBAL = 1 << 15 | 0 << 8 | 00 << 00;
//const MOTION_VECTOR_LOCAL = 1 << 15 | 0 << 8 | 00 << 00;
public
function
__get
(
$property
)
{
switch
(
$property
)
{
@@ -143,12 +177,54 @@ class Digital_Unit extends Unit
case
'type'
:
return
((
$this
->
_unit
&
self
::
TYPE
)
>>
16
);
case
'lenght'
:
return
(
$this
->
_unit
&
self
::
LENGHT
);
return
$this
->
_getLengthByUnit
(
$this
->
_unit
);
default
:
return
null
;
}
}
public
function
_getLengthByUnit
(
$unit
)
{
switch
(
$unit
&
self
::
TYPE
>>
16
)
{
case
self
::
PCMU
:
// TODO
case
self
::
GSM
:
case
self
::
G723
:
case
self
::
DVI4_8
:
case
self
::
DVI4_16
:
case
self
::
LPC
:
case
self
::
PCMA
:
case
self
::
G722
:
case
self
::
L16_2
:
case
self
::
L16_1
:
case
self
::
QCELP
:
case
self
::
CN
:
case
self
::
MPA
:
case
self
::
G728
:
case
self
::
DVI4_11
:
case
self
::
DVI4_22
:
case
self
::
G729
:
case
self
::
CelB
:
case
self
::
nv
:
case
self
::
H261
:
case
self
::
MPV
:
case
self
::
MP2T
:
case
self
::
H263
:
case
self
::
MPEG2TS
:
return
(
$this
->
_unit
&
self
::
LENGHT
)
==
1
?
1
:
$this
->
_unit
&
self
::
LENGHT
;
case
self
::
JPEG
:
return
(
$this
->
_unit
&
self
::
LENGHT
)
==
1
?
61440
:
$this
->
_unit
&
self
::
LENGHT
;
case
self
::
PNG
:
return
(
$this
->
_unit
&
self
::
LENGHT
)
==
1
?
1
*
1024
*
1024
:
((
$this
->
_unit
&
self
::
LENGHT
)
==
2
?
4
*
1024
*
1024
:
$this
->
_unit
&
self
::
LENGHT
);
case
self
::
RAW_BGR
:
return
((
$this
->
_unit
&
self
::
LENGHT
)
==
1
?
1920
*
1080
*
3
:
((
$this
->
_unit
&
self
::
LENGHT
)
==
2
?
1920
*
1200
*
3
:
$this
->
_unit
&
self
::
LENGHT
));
case
self
::
PCD_MONOCROMATIC
:
return
((
$this
->
_unit
&
self
::
LENGHT
)
==
1
?
4
*
4
*
32
*
(
100000
*
0.1
)
:
((
$this
->
_unit
&
self
::
LENGHT
)
==
2
?
16
*
2
*
12
*
(
4
*
3
+
1
)
:
$this
->
_unit
&
self
::
LENGHT
));
case
self
::
PCD_RGB
:
return
(
$this
->
_unit
&
self
::
LENGHT
)
==
1
?
1
*
1024
*
1024
:
$this
->
_unit
&
self
::
LENGHT
;
default
:
return
$this
->
_unit
&
self
::
LENGHT
;
}
}
public
function
__toString
()
{
return
"
{
{$this->cod
}
, D, t=
{
$this
->
type
}
, l=
{
$this
->
lenght
}
}"
;
Loading