Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
7.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. if( $CUser->Data['id'] > 1 ){
  4. $STREAM = intval( $_POST['STREAM'] );
  5. $QS = "SELECT * FROM `media_streams` WHERE `id` = {$STREAM}";
  6. $Result = $DATABASE->Query( $QS, false );
  7. if( count( $Result ) ){
  8. $CS = $Result[0];
  9. if( $CS['source_type'] == 'A' ){
  10. $Sizes = array();
  11. $Formats = array();
  12. if( $CS['source_id'] == 0 ){
  13. $CMD="v4l2-ctl -d {$CS['mrl']} --list-formats-ext";
  14. $Data = `$CMD`;
  15. $TArr = explode( "\n", $Data );
  16. foreach( $TArr as $R ){
  17. $CL = trim( $R );
  18. if( stripos($CL,']:')!== false ){
  19. $ID = intval( substr( $CL, 1 ) );
  20. $FCC = substr( $CL, stripos( $CL, ':' ) + 3, 4 );
  21. $DSC = substr( $CL, stripos( $CL, ':' ) + 9 );
  22. $Formats[] = array('id'=>$ID, '4cc'=>$FCC, 'desc'=>$DSC );
  23. };
  24. if( stripos($CL,'Size:')!== false ){
  25. $TBarr=explode( ' ', $CL );
  26. if( intval( $TBarr[1] ) ){
  27. $ZArr = explode( 'x', $TBarr[1] );
  28. $Sizes[$TBarr[1]] = array( 'width'=>$ZArr[0], 'height'=>$ZArr[1], 'title'=>$TBarr[1] );
  29. } else {
  30. $ZArr = explode( 'x', $TBarr[2] );
  31. $Sizes[$TBarr[2]] = array( 'width'=>$ZArr[0], 'height'=>$ZArr[1], 'title'=>$TBarr[2] );
  32. };
  33. };
  34. };
  35. };
  36. $CMD="v4l2-ctl -d {$CS['mrl']} --list-ctrls-menu";
  37. $Data = `$CMD`;
  38. $TArr = explode( "\n", $Data );
  39. $Controls = array();
  40. $MFlag = false;
  41. $MID = 0;
  42. $id = 0;
  43. foreach( $TArr as $R ){
  44. $CL = trim( $R );
  45. if( stripos( $CL, ':' ) !== false ){
  46. $ctrl = array();
  47. $RR = explode( ':', $CL );
  48. $TArr=explode( ' ', $CL );
  49. if( stripos( $CL, 'int' )!== false ){
  50. $ctrl['type'] = 'slider';
  51. $ctrl['name'] = trim( $TArr[0] );
  52. $ctrl['name_cod'] = md5( $ctrl['name'] );
  53. $ctrl['id'] = hexdec( $TArr[1] );
  54. $TArr=explode( ' ', $RR[1] );
  55. $TBrr = explode( '=', $TArr[1] );
  56. $ctrl['min'] = intval( $TBrr[1] );
  57. $TBrr = explode( '=', $TArr[2] );
  58. $ctrl['max'] = intval( $TBrr[1] );
  59. $TBrr = explode( '=', $TArr[3] );
  60. $ctrl['step'] = intval( $TBrr[1] );
  61. $TBrr = explode( '=', $TArr[5] );
  62. $ctrl['value'] = intval( $TBrr[1] );
  63. $MFlag = false;
  64. $Controls[$id] = $ctrl;
  65. $id++;
  66. } else if( stripos( $CL, 'bool' )!== false ){
  67. $ctrl['type'] = 'checkbox';
  68. $ctrl['name'] = trim( $TArr[0] );
  69. $ctrl['name_cod'] = md5( $ctrl['name'] );
  70. $ctrl['id'] = hexdec( $TArr[1] );
  71. $TArr=explode( ' ', $RR[1] );
  72. $TBrr = explode( '=', $TArr[2] );
  73. $ctrl['value'] = intval( $TBrr[1] );
  74. $MFlag = false;
  75. $Controls[$id] = $ctrl;
  76. $id++;
  77. } else if( stripos( $CL, 'menu' )!== false ){
  78. $ctrl['type'] = 'combo';
  79. $ctrl['name'] = trim( $TArr[0] );
  80. $ctrl['name_cod'] = md5( $ctrl['name'] );
  81. $ctrl['id'] = hexdec( $TArr[1] );
  82. $TArr=explode( ' ', $RR[1] );
  83. $TBrr = explode( '=', $TArr[4] );
  84. $ctrl['value'] = intval( $TBrr[1] );
  85. $MFlag = true;
  86. $MID = $id;
  87. $Controls[$id] = $ctrl;
  88. $id++;
  89. } else {
  90. if( $MFlag ){
  91. $ZV = explode( ':', $CL );
  92. $cmi= array();
  93. $cmi['id']=intval( $ZV[0] );
  94. $cmi['text']=trim( $ZV[1] );
  95. $Controls[$MID]['data'][]=$cmi;
  96. };
  97. };
  98. };
  99. };
  100. $CCC = 0;
  101. $OUT = array();
  102. if(count( $Formats )){
  103. $ll = "{
  104. xtype: 'combo',
  105. fieldLabel: '". $Labels->GetLabel('_FRAME_FORMAT_') ."',
  106. lazyRender: true,
  107. id: 'frmt_id',
  108. name: 'frame_format',
  109. mode: 'local',
  110. forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
  111. listeners:{ change: function(t,n,o){ changeASS( {$STREAM }, 'frmt_id'); }},
  112. store: new Ext.data.ArrayStore({
  113. fields: ['fmt','fmt_txt'],
  114. data: [";
  115. $cl = array();
  116. foreach( $Formats as $F ){
  117. $cl[]="[{$F['id']},\"{$F['desc']}\"]";
  118. };
  119. $ll .= implode( ',', $cl );
  120. $ll .="]
  121. }),
  122. valueField: 'fmt',
  123. displayField: 'fmt_txt'
  124. }";
  125. $OUT[$CCC] = $ll;
  126. $CCC++;
  127. };
  128. if( count( $Sizes ) ){
  129. $ll = "{
  130. xtype: 'combo',
  131. fieldLabel: '". $Labels->GetLabel('_FRAME_SIZE_') ."',
  132. lazyRender: true,
  133. id: 'sizes_id',
  134. name: 'frame_size',
  135. mode: 'local',
  136. forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
  137. listeners:{ change: function(t,n,o){ changeASS( {$STREAM }, 'sizes_id'); }},
  138. store: new Ext.data.ArrayStore({
  139. fields: ['size','size_txt'],
  140. data: [";
  141. $cl = array();
  142. $id = 0;
  143. $csid = 0;
  144. foreach( $Sizes as $Key=>$Val ){
  145. if( $Val['width'] == $CS['img_width'] && $Val['height'] == $CS['img_height'] ) $csid = $Key;//$id;
  146. //$cl[]="[{$id},\"{$Key}\"]";
  147. $cl[]="[\"{$Key}\",\"{$Key}\"]";
  148. $id++;
  149. };
  150. $ll .= implode( ',', $cl );
  151. $ll .="]
  152. }),
  153. valueField: 'size',
  154. displayField: 'size_txt',
  155. value: '{$csid}'
  156. }";
  157. $OUT[$CCC] = $ll;
  158. $CCC++;
  159. };
  160. //print_r( $Controls );
  161. if( count( $Controls )){
  162. foreach( $Controls as $CC ){
  163. $ll = "{ xtype: '{$CC['type']}', id: '{$CC['id']}', name: '{$CC['name']}', fieldLabel: '".$Labels->GetLabel($CC['name_cod'])."', value: {$CC['value']}, listeners:{ change: function(t,n,o){ changeASS( {$STREAM }, '{$CC['id']}' ); } }, ";
  164. switch( $CC['type'] ){
  165. case 'slider':{
  166. $ll .= "minValue: {$CC['min']}, maxValue: {$CC['max']}, width: 235 }";
  167. break;
  168. };
  169. case 'checkbox':{
  170. if( $CC['value'] == 1 ){
  171. $ll .= "checked: true }";
  172. } else {
  173. $ll .= "checked: false }";
  174. };
  175. break;
  176. };
  177. case 'combo':{
  178. $ll .= "lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({
  179. fields: ['{$CC['id']}_id','{$CC['id']}_txt'],
  180. data: [";
  181. $cl = array();
  182. foreach( $CC['data'] as $D ) $cl[]="[{$D['id']},\"{$D['text']}\"]";
  183. $ll .= implode(',', $cl );
  184. $ll .="]
  185. }),
  186. valueField: '{$CC['id']}_id',
  187. displayField: '{$CC['id']}_txt'
  188. }";
  189. break;
  190. };
  191. };
  192. $OUT[$CCC] = $ll;
  193. $CCC++;
  194. };
  195. }; //https://www.waveshare.com/wiki/SIM7600E-H_4G_HAT
  196. $CCA = implode( ',', $OUT );
  197. echo "{ xtype: 'form', id:'an_str_edit', frame: false, autoScroll: true, border: false, layout: 'form', labelAlign: 'right', labelWidth: 150, items: [". $CCA ."] }";
  198. } else {
  199. echo "{ xtype: 'panel', html: '<center>Incorrect Stream</center>'}";
  200. };
  201. } else {
  202. echo "{ xtype: 'panel', html: '<center>Incorrect Stream</center>'}";
  203. };
  204. } else {
  205. echo "{ xtype: 'panel', html: 'Access Error!'}";
  206. };
  207. //$ v4l2-ctl --set-fmt-video=width=960,height=720
  208. //$ v4l2-ctl --set-ctrl=focus_auto=0,focus_absolute=0
  209. ?>