设为首页 收藏本站
查看: 498|回复: 0

[经验分享] trunk/ MP4Info/ Box/ ftyp.php

[复制链接]

尚未签到

发表于 2017-3-28 10:26:24 | 显示全部楼层 |阅读模式
  




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231








<?php
/**
*
MP4Info
*  
* @author       Tommy Lacroix <lacroix.tommy@gmail.com>
*
@copyright  Copyright (c) 2006-2009 Tommy Lacroix
* @license       LGPL version 3, http://www.gnu.org/licenses/lgpl.html
*
@package   php-mp4info
* @link        $HeadURL$

*/

//
---
/**
*
4.3 File Type Box (FTYP)
*  
* @author       Tommy Lacroix <lacroix.tommy@gmail.com>
*
@version   1.1.20090611  $Id$

*/

class MP4Info_Box_ftyp extends
MP4Info_Box {

    /**
  
* Major brand
    *
    * @var int


*/

    protected $majorBrand;


/**
    * Minor brand
    *

* @var int

    */

    protected
$minorBrand;

    /**

* Compatible brands
    *
    * @var int[]


*/

    protected $compatibleBrands;


    /**
    * Major Brands' names

*  
    * @var {n:Str,n:Str,...}
    * @static


*/

    protected static $brandNames =
array(

        '3g2a' => '3GPP2
Media (.3G2)',

        '3ge6' => '3GPP
(.3GP) Release 6 MBMS Extended Presentations',

        '3ge7' => '3GPP
(.3GP) Release 7 MBMS Extended Presentations',

        '3gg6' => '3GPP
Release 6 General Profile',

        '3gp1' => '3GPP
Media (.3GP) Release 1 ? (non-existent)',

        '3gp2' => '3GPP
Media (.3GP) Release 2 ? (non-existent)',

        '3gp3' => '3GPP
Media (.3GP) Release 3 ? (non-existent)',

        '3gp4' => '3GPP
Media (.3GP) Release 4',

        '3gp5' => '3GPP
Media (.3GP) Release 5',

        '3gp6' => '3GPP
Media (.3GP) Release 6 Basic Profile',

        '3gr6' => '3GPP
Media (.3GP) Release 6 Progressive Download',

        '3gs6' => '3GPP
Media (.3GP) Release 6 Streaming Servers',

        '3gs7' => '3GPP
Media (.3GP) Release 7 Streaming Servers',

        'avc1' => 'MP4
Base w/ AVC ext [ISO 14496-12:2005]',

        'caep' => 'Canon
Digital Camera',

        'caqv' => 'Casio
Digital Camera',

        'cdes' => 'Convergent
Design',

        'f4v' => 'Video
for Adobe Flash Player 9+ (.F4V)',

        'f4p' => 'Protected
Video for Adobe Flash Player 9+ (.F4P)',

        'f4a' => 'Audio
for Adobe Flash Player 9+ (.F4A)',

        'f4b' => 'Audio
Book for Adobe Flash Player 9+ (.F4B)',

        'isc2' => 'ISMACryp
2.0 Encrypted File',

        'iso2' => 'MP4
Base Media v2 [ISO 14496-12:2005]',

        'isom' => 'MP4
Base Media v1 [IS0 14496-12:2003]',

        'jp2' => 'JPEG
2000 Image (.JP2) [ISO 15444-1 ?]',

        'jp20' => 'Unknown,
from GPAC samples (prob non-existent)',

        'jpm' => 'JPEG
2000 Compound Image (.JPM) [ISO 15444-6]',

        'jpx' => 'JPEG
2000 w/ extensions (.JPX) [ISO 15444-2]',

        'kddi' => '3GPP2
EZmovie for KDDI 3G Cellphones',

        'm4a ' => 'Apple
iTunes AAC-LC (.M4A) Audio',

        'm4b ' => 'Apple
iTunes AAC-LC (.M4B) Audio Book',

        'm4p ' => 'Apple
iTunes AAC-LC (.M4P) AES Protected Audio',

        'm4v ' => 'Apple
iTunes Video (.M4V) Video',

        'm4vh' => 'Apple
TV (.M4V)',

        'm4vp' => 'Apple
iPhone (.M4V)',

        'mj2s' => 'Motion
JPEG 2000 [ISO 15444-3] Simple Profile',

        'mjp2' => 'Motion
JPEG 2000 [ISO 15444-3] General Profile',

        'mmp4' => 'MPEG-4/3GPP
Mobile Profile (.MP4 / .3GP) (for NTT)',

        'mp21' => 'MPEG-21
[ISO/IEC 21000-9]',

        'mp41' => 'MP4
v1 [ISO 14496-1:ch13]',

        'mp42' => 'MP4
v2 [ISO 14496-14]',

        'mp71' => 'MP4
w/ MPEG-7 Metadata [per ISO 14496-12]',

        'mppi' => 'Photo
Player, MAF [ISO/IEC 23000-3]',

        'mqt' => 'Sony
/ Mobile QuickTime (.MQV)',

        'msnv' => 'MPEG-4
(.MP4) for SonyPSP',

        'ndas' => 'MP4
v2 [ISO 14496-14] Nero Digital AAC Audio',

        'ndsc' => 'MPEG-4
(.MP4) Nero Cinema Profile',

        'ndsh' => 'MPEG-4
(.MP4) Nero HDTV Profile',

        'ndsm' => 'MPEG-4
(.MP4) Nero Mobile Profile',

        'ndsp' => 'MPEG-4
(.MP4) Nero Portable Profile',

        'ndss' => 'MPEG-4
(.MP4) Nero Standard Profile',

        'ndxc' => 'H.264/MPEG-4
AVC (.MP4) Nero Cinema Profile',

        'ndxh' => 'H.264/MPEG-4
AVC (.MP4) Nero HDTV Profile',

        'ndxm' => 'H.264/MPEG-4
AVC (.MP4) Nero Mobile Profile',

        'ndxp' => 'H.264/MPEG-4
AVC (.MP4) Nero Portable Profile',

        'ndxs' => 'H.264/MPEG-4
AVC (.MP4) Nero Standard Profile',

        'odcf ' => 'OMA
DCF DRM Format 2.0 (OMA-TS-DRM-DCF-V2_0-20060303-A)',

        'opf2 ' => 'OMA
PDCF DRM Format 2.1 (OMA-TS-DRM-DCF-V2_1-20070724-C)',

        'opx2 ' => 'OMA
PDCF DRM + XBS extensions (OMA-TS-DRM_XBS-V1_0-20070529-C)',

        'qt ' => 'Apple
QuickTime (.MOV/QT)',

        'sdv' => 'SD
Memory Card Video',

    );

     

    /**

* Constructor
    *
    * @author   Tommy Lacroix <lacroix.tommy@gmail.com>

* @param    int                   $totalSize
    * @param    int                   $boxType

* @param    file|string           $data
    * @param    MP4Info_Box           $parent

* @return   MP4Info_Box_ftyp
    * @access   public
    * @throws   MP4Info_Exception


*/   

    public function __construct($totalSize,
$boxType, $data, $parent) {


if (!self::isCompatible($boxType,
$parent)) {

            throw new
MP4Info_Exception('This box isn\'t "ftyp"',MP4Info_Exception::CODE_INCOMPATIBLE,$boxType);


}

        //
Call ancestor

        parent::__construct($totalSize,
$boxType, false, $parent);


        // Get data

     
$data = self::getDataFrom3rd($data,
$totalSize);

        //
Unpack

        $ar = unpack('NmajorBrand/NminorVersion/N*compatibleBrands',$data);


$compatibleBrands = array();

        foreach ($ar as
$k=>$v) {

         
if (substr($k,0,16) == 'compatibleBrands') {


$compatibleBrands[] = $v;


}

        }


        // Save properties


$this->majorBrand = $ar['majorBrand'];


$this->minorVersion = $ar['minorVersion'];


$this->compatibleBrands = $compatibleBrands;


} // Constructor
     


    /**
    * Check if block is compatible with class

*
    * @author   Tommy Lacroix <lacroix.tommy@gmail.com>
    * @param    int  
$boxType
    * @param    MP4Info_Box           $parent

* @return   bool
    * @access   public
    * @static


*/

    static function isCompatible($boxType,
$parent) {

        return
$boxType == 0x66747970;

    } //
isCompatible method
     
     


/**
    * Major brand getter
    *

* @author   Tommy Lacroix <lacroix.tommy@gmail.com>
    * @return   int
    * @access
public

    */

    public function
getMajorBrand() {

        return
$this->majorBrand;

    } //
getMajorBrand method
     


/**
    * Minor version getter
    *

* @author   Tommy Lacroix <lacroix.tommy@gmail.com>
    * @return   int
    * @access
public

    */

    public function
getMinorVersion() {

        return
$this->minorVersion;

    } //
getMinorVersion method
     


/**
    * Compatible brands getter
    *

* @author   Tommy Lacroix <lacroix.tommy@gmail.com>
    * @return   int[]
    * @access
public

    */

    public function
getCompatibleBrands() {

        return
$this->compatibleBrands;

    } //
getCompatibleBrands method
     


/**
    * Convert a brand 32bit code to a string
    *

* @author   Tommy Lacroix <lacroix.tommy@gmail.com>
    * @param    int           $brand

* @return   string
    * @access   public
    * @static


*/

    public static function
brandToString($brand) {

  
if (isset(self::$$brandNames[$brand])) {


return self::$$brandNames[$brand];


} else {

   
return $brand;

        }


} // brandToString method
     


    /**
    * String converter

*
    * @author   Tommy Lacroix <lacroix.tommy@gmail.com>
    * @return   string

* @access   public

    */

    public function
toString() {

        return '[MP4Info_Box_ftyp]';


} // toString method

} //
MP4Info_Box_ftyp method

  http://code.google.com/p/php-mp4info/source/browse/trunk/MP4Info/Box/ftyp.php?spec=svn2&r=2

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-356288-1-1.html 上篇帖子: PHP 对象、数组间的转换 下篇帖子: php中__sleep和__wakeup
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表