changed git call from https to git readonly
[atutor.git] / mods / atutor_opencaps / opencaps / conversion_service / include / classes / ccformats / cc_Scc_format.php
1 <?php\r
2 /**\r
3  * Scc Class\r
4  */\r
5 class Scc extends CaptionFormat\r
6 {\r
7         private $textStyles = array();\r
8 \r
9         /**\r
10          * Imports a caption string into a CaptionCollection \r
11          *\r
12          * @param String $theCCString the caption file as string\r
13          * @return CaptionCollection $myCcCollection A CaptionCollection Object\r
14          */\r
15         public function importCC($theCCString)\r
16         {\r
17                 $ccTarget = '';\r
18                 \r
19         } // end importCC()\r
20 \r
21         /**\r
22          * Exports a CaptionCollection object into a string\r
23          *\r
24          * @param CaptionCollection $theCollection A CaptionCollection Object\r
25          * @return String $captionString The caption as a String\r
26          */\r
27         public function exportCC($theCollection)\r
28         {\r
29                 /*\r
30                  * <br/>Based on the SCC convertion class by Colin McFadden at <br/>\r
31                  * <a href="http://blog.lib.umn.edu/mcfa0086/discretecosine/2008_10.html">http://blog.lib.umn.edu/mcfa0086/discretecosine/2008_10.html</a>'; \r
32                 */\r
33                 \r
34                 $ccExport = '';\r
35                 \r
36                 $myCollection = $theCollection->getCollection();\r
37                 \r
38                 // include SCC external convertor\r
39                 include("include/classes/ext_SccConvert_class.php");\r
40                 \r
41                 $startTC = "00:00:00:00";\r
42                 \r
43                 //create a SCC captionConvert instance\r
44                 $sccCaptions = new captionConvert($startTC);\r
45 \r
46 \r
47                 // Building Sami caption \r
48                 foreach ($myCollection as $captionObj)\r
49                 {\r
50         \r
51                         //$capCount++;\r
52 \r
53                 $beginTime = $captionObj->getInTime();\r
54                 $captionContents = $captionObj->getCaption();\r
55                 \r
56                 // clean any xml style\r
57                 $toSearch = array('<b>','</b>','<u>','</u>','<i>','</i>','<br/>','<br>','<BR/>','\n',chr(10)); \r
58                 $toReplace = '';\r
59                         $captionContents = str_replace($toSearch,$toReplace,$captionContents);\r
60 \r
61                         // add SCC captions \r
62                 $sccCaptions->addCaption($beginTime, $captionContents);\r
63                         \r
64                         //$fixCap = CcUtil::ccNewLineToBr($captionObj->getCaption(),' <br/>');\r
65        \r
66                 } // end for each caption \r
67                                 \r
68                 // ading caption to String \r
69                 $ccExport .= ''.$sccCaptions->outputCaptions();\r
70 \r
71                 \r
72                 return $ccExport;\r
73                 \r
74         } // end  exportCC()\r
75         \r
76         /**\r
77          * Verify if the caption file is a SAMI caption file \r
78         */\r
79         public function checkFormat($theCCString)\r
80         {\r
81                 \r
82         } // end checkFormat()\r
83 \r
84         /*\r
85          * Here functions to re-define\r
86          */\r
87         public function getName()\r
88         {\r
89                 return 'SCC - Scenarist Closed Caption';\r
90         }\r
91         \r
92         public function getAbout()\r
93         {\r
94                 return 'This caption format is one of the standards in the TV industry. <br>SCC is used by M4V movies targeted for the Apple iPhone, iPod Touch and iPod Nano.<br/> As documented in <a href="http://ncam.wgbh.org/mm/m4vcaps.html">http://ncam.wgbh.org/mm/m4vcaps.html</a>';\r
95         }\r
96         \r
97         public function getVersion()\r
98         {\r
99                 return '1.0';\r
100         }\r
101                 \r
102         public function getFileExtension()\r
103         {\r
104                 return 'scc';\r
105         }\r
106         \r
107         public function getIdPattern()\r
108         {\r
109                 $idPattern = '/(Scenarist_SCC V1.0)/';\r
110                 \r
111                 return $idPattern;\r
112         }\r
113 \r
114         public function allowsTextStyles()\r
115         {\r
116                 return '0';\r
117         }\r
118         \r
119         public function template()\r
120         {\r
121                 $ccTemplate = '\r
122 Scenarist_SCC V1.0\r
123 \r
124 00:00:00:00 942c 942c\r
125 \r
126 00:00:00:-21 94ae 94ae 9420 9420 10d0 10d0 a8c4 d629 2020 57e5 ece3 ef6d e520 f4ef 2061 2080 13d0 13d0 64e5 6def 6e73 f4f2 61f4 e9ef 6e20 efe6 2061 e3e3 e573 73e9 62ec e520 1370 1370 76e9 64e5 efae 2054 e5f8 f420 bc62 3e62 efec 6420 54e5 f8f4 2020 942f 942f\r
127 \r
128 00:00:02:00 94ae 94ae 9420 9420 10d0 10d0 a8c4 d629 2020 5468 e973 20e9 7320 6120 e3ef 6d6d e5f2 e3e9 61ec 2080 13d0 13d0 e6ef f220 c7f2 6170 e56e 75f4 7320 e3e5 f2e5 61ec 2c20 942f 942f\r
129 \r
130 00:00:04:03 94ae 94ae 9420 9420 10d0 10d0 a8c4 d629 2020 f7e9 f468 2061 6464 e564 20e3 ecef 73e5 6420 13d0 13d0 e361 70f4 e9ef 6e73 2020 942f 942f\r
131 \r
132 00:00:05:06 94ae 94ae 9420 9420 10d0 10d0 a8c4 d629 2020 616e 6420 64e5 73e3 f2e9 70f4 e976 e520 76e9 64e5 ef2c 2020 13d0 13d0 2075 73e9 6e67 2073 70e5 e5e3 6820 7379 6ef4 68e5 73e9 7320 1370 1370 f4e5 e368 6eef ecef 6779 ae20 942f 942f\r
133 \r
134 00:00:08:03 94ae 94ae 9420 9420 10d0 10d0 a8c4 d629 2020 c4e5 7075 f479 20c2 61f2 6ee5 7920 46e9 e6e5 2080 13d0 13d0 e56e f4e5 f273 2020 20f4 68e5 20cd 6179 62e5 f2f2 7920 1370 1370 d368 e5f2 e9e6 e6a7 7320 4fe6 e6e9 e3e5 2c20 942f 942f\r
135 \r
136 00:00:11:02 94ae 94ae 9420 9420 10d0 10d0 a8c4 d629 2020 f7e9 f468 2061 20f4 f261 7920 e3ef 6ef4 61e9 6ee9 6e67 2020 13d0 13d0 f468 e520 c7f2 6170 e56e 75f4 7320 62f2 e561 6be6 6173 f4ae 2080 942f 942f\r
137 \r
138 00:00:12:28 94ae 94ae 9420 9420 10d0 10d0 a8c4 d629 2020 d368 e5f2 e9e6 e620 c16e 6479 2054 6179 ecef f220 e973 2080 13d0 13d0 ece5 616e e96e 6720 20ef 6e20 f468 e520 e6f2 ef6e f420 efe6 2068 e973 2080 1370 1370 64e5 736b 2c20 942f 942f\r
139 \r
140 00:00:15:21 94ae 94ae 9420 9420 10d0 10d0 a8c4 d629 2020 f2e5 6164 e96e 6720 f468 e520 6ee5 f773 7061 70e5 f2ae 2080 942f 942f\r
141 \r
142 ';\r
143                 \r
144                 return $ccTemplate;\r
145         }\r
146 \r
147         \r
148 } // end Scc Class\r
149 ?>