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.
216 lines
7.2 KiB
216 lines
7.2 KiB
<?php
|
|
require_once('../ajax_asm.php');
|
|
if( $CUser->Data['id'] > 1 ){
|
|
$STREAM = intval( $_POST['STREAM'] );
|
|
$QS = "SELECT * FROM `media_streams` WHERE `id` = {$STREAM}";
|
|
$Result = $DATABASE->Query( $QS, false );
|
|
if( count( $Result ) ){
|
|
$CS = $Result[0];
|
|
if( $CS['source_type'] == 'A' ){
|
|
$Sizes = array();
|
|
$Formats = array();
|
|
if( $CS['source_id'] == 0 ){
|
|
$CMD="v4l2-ctl -d {$CS['mrl']} --list-formats-ext";
|
|
$Data = `$CMD`;
|
|
$TArr = explode( "\n", $Data );
|
|
foreach( $TArr as $R ){
|
|
$CL = trim( $R );
|
|
if( stripos($CL,']:')!== false ){
|
|
$ID = intval( substr( $CL, 1 ) );
|
|
$FCC = substr( $CL, stripos( $CL, ':' ) + 3, 4 );
|
|
$DSC = substr( $CL, stripos( $CL, ':' ) + 9 );
|
|
$Formats[] = array('id'=>$ID, '4cc'=>$FCC, 'desc'=>$DSC );
|
|
};
|
|
if( stripos($CL,'Size:')!== false ){
|
|
$TBarr=explode( ' ', $CL );
|
|
if( intval( $TBarr[1] ) ){
|
|
$ZArr = explode( 'x', $TBarr[1] );
|
|
$Sizes[$TBarr[1]] = array( 'width'=>$ZArr[0], 'height'=>$ZArr[1], 'title'=>$TBarr[1] );
|
|
} else {
|
|
$ZArr = explode( 'x', $TBarr[2] );
|
|
$Sizes[$TBarr[2]] = array( 'width'=>$ZArr[0], 'height'=>$ZArr[1], 'title'=>$TBarr[2] );
|
|
};
|
|
};
|
|
};
|
|
};
|
|
$CMD="v4l2-ctl -d {$CS['mrl']} --list-ctrls-menu";
|
|
$Data = `$CMD`;
|
|
$TArr = explode( "\n", $Data );
|
|
$Controls = array();
|
|
$MFlag = false;
|
|
$MID = 0;
|
|
$id = 0;
|
|
foreach( $TArr as $R ){
|
|
$CL = trim( $R );
|
|
if( stripos( $CL, ':' ) !== false ){
|
|
$ctrl = array();
|
|
$RR = explode( ':', $CL );
|
|
$TArr=explode( ' ', $CL );
|
|
if( stripos( $CL, 'int' )!== false ){
|
|
$ctrl['type'] = 'slider';
|
|
$ctrl['name'] = trim( $TArr[0] );
|
|
$ctrl['name_cod'] = md5( $ctrl['name'] );
|
|
$ctrl['id'] = hexdec( $TArr[1] );
|
|
|
|
$TArr=explode( ' ', $RR[1] );
|
|
$TBrr = explode( '=', $TArr[1] );
|
|
$ctrl['min'] = intval( $TBrr[1] );
|
|
$TBrr = explode( '=', $TArr[2] );
|
|
$ctrl['max'] = intval( $TBrr[1] );
|
|
$TBrr = explode( '=', $TArr[3] );
|
|
$ctrl['step'] = intval( $TBrr[1] );
|
|
$TBrr = explode( '=', $TArr[5] );
|
|
$ctrl['value'] = intval( $TBrr[1] );
|
|
$MFlag = false;
|
|
$Controls[$id] = $ctrl;
|
|
$id++;
|
|
} else if( stripos( $CL, 'bool' )!== false ){
|
|
$ctrl['type'] = 'checkbox';
|
|
$ctrl['name'] = trim( $TArr[0] );
|
|
$ctrl['name_cod'] = md5( $ctrl['name'] );
|
|
$ctrl['id'] = hexdec( $TArr[1] );
|
|
$TArr=explode( ' ', $RR[1] );
|
|
$TBrr = explode( '=', $TArr[2] );
|
|
$ctrl['value'] = intval( $TBrr[1] );
|
|
$MFlag = false;
|
|
$Controls[$id] = $ctrl;
|
|
$id++;
|
|
} else if( stripos( $CL, 'menu' )!== false ){
|
|
$ctrl['type'] = 'combo';
|
|
$ctrl['name'] = trim( $TArr[0] );
|
|
$ctrl['name_cod'] = md5( $ctrl['name'] );
|
|
$ctrl['id'] = hexdec( $TArr[1] );
|
|
$TArr=explode( ' ', $RR[1] );
|
|
$TBrr = explode( '=', $TArr[4] );
|
|
$ctrl['value'] = intval( $TBrr[1] );
|
|
$MFlag = true;
|
|
$MID = $id;
|
|
$Controls[$id] = $ctrl;
|
|
$id++;
|
|
} else {
|
|
if( $MFlag ){
|
|
$ZV = explode( ':', $CL );
|
|
$cmi= array();
|
|
$cmi['id']=intval( $ZV[0] );
|
|
$cmi['text']=trim( $ZV[1] );
|
|
$Controls[$MID]['data'][]=$cmi;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
$CCC = 0;
|
|
$OUT = array();
|
|
if(count( $Formats )){
|
|
$ll = "{
|
|
xtype: 'combo',
|
|
fieldLabel: '". $Labels->GetLabel('_FRAME_FORMAT_') ."',
|
|
lazyRender: true,
|
|
id: 'frmt_id',
|
|
name: 'frame_format',
|
|
mode: 'local',
|
|
forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
|
|
listeners:{ change: function(t,n,o){ changeASS( {$STREAM }, 'frmt_id'); }},
|
|
store: new Ext.data.ArrayStore({
|
|
fields: ['fmt','fmt_txt'],
|
|
data: [";
|
|
$cl = array();
|
|
foreach( $Formats as $F ){
|
|
$cl[]="[{$F['id']},\"{$F['desc']}\"]";
|
|
};
|
|
$ll .= implode( ',', $cl );
|
|
$ll .="]
|
|
}),
|
|
valueField: 'fmt',
|
|
displayField: 'fmt_txt'
|
|
}";
|
|
$OUT[$CCC] = $ll;
|
|
$CCC++;
|
|
};
|
|
if( count( $Sizes ) ){
|
|
$ll = "{
|
|
xtype: 'combo',
|
|
fieldLabel: '". $Labels->GetLabel('_FRAME_SIZE_') ."',
|
|
lazyRender: true,
|
|
id: 'sizes_id',
|
|
name: 'frame_size',
|
|
mode: 'local',
|
|
forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
|
|
listeners:{ change: function(t,n,o){ changeASS( {$STREAM }, 'sizes_id'); }},
|
|
store: new Ext.data.ArrayStore({
|
|
fields: ['size','size_txt'],
|
|
data: [";
|
|
$cl = array();
|
|
$id = 0;
|
|
$csid = 0;
|
|
foreach( $Sizes as $Key=>$Val ){
|
|
if( $Val['width'] == $CS['img_width'] && $Val['height'] == $CS['img_height'] ) $csid = $Key;//$id;
|
|
//$cl[]="[{$id},\"{$Key}\"]";
|
|
$cl[]="[\"{$Key}\",\"{$Key}\"]";
|
|
$id++;
|
|
};
|
|
$ll .= implode( ',', $cl );
|
|
$ll .="]
|
|
}),
|
|
valueField: 'size',
|
|
displayField: 'size_txt',
|
|
value: '{$csid}'
|
|
|
|
}";
|
|
$OUT[$CCC] = $ll;
|
|
$CCC++;
|
|
};
|
|
//print_r( $Controls );
|
|
if( count( $Controls )){
|
|
foreach( $Controls as $CC ){
|
|
$llt = 'change: function(t,n,o)';
|
|
$ll = "{ xtype: '{$CC['type']}', id: '{$CC['id']}', name: '{$CC['name']}', fieldLabel: '".$Labels->GetLabel($CC['name_cod'])."', value: {$CC['value']}, listeners:{ %%%LT%%% { changeASS( {$STREAM }, '{$CC['id']}' ); } }, ";
|
|
switch( $CC['type'] ){
|
|
case 'slider':{
|
|
$ll .= "minValue: {$CC['min']}, maxValue: {$CC['max']}, width: 235 }";
|
|
break;
|
|
};
|
|
case 'checkbox':{
|
|
$llt = 'change: function(t,n,o)';
|
|
if( $CC['value'] == 1 ){
|
|
$ll .= "checked: true }";
|
|
} else {
|
|
$ll .= "checked: false }";
|
|
};
|
|
break;
|
|
};
|
|
case 'combo':{
|
|
$llt = 'select: function(t,r,n)';
|
|
$ll .= "lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({
|
|
fields: ['{$CC['id']}_id','{$CC['id']}_txt'],
|
|
data: [";
|
|
$cl = array();
|
|
foreach( $CC['data'] as $D ) $cl[]="[{$D['id']},\"{$D['text']}\"]";
|
|
$ll .= implode(',', $cl );
|
|
$ll .="]
|
|
}),
|
|
valueField: '{$CC['id']}_id',
|
|
displayField: '{$CC['id']}_txt'
|
|
}";
|
|
break;
|
|
};
|
|
};
|
|
$ll = str_ireplace('%%%LT%%%', $llt, $ll );
|
|
$OUT[$CCC] = $ll;
|
|
$CCC++;
|
|
};
|
|
}; //https://www.waveshare.com/wiki/SIM7600E-H_4G_HAT
|
|
$CCA = implode( ',', $OUT );
|
|
echo "{ xtype: 'form', id:'an_str_edit', frame: false, autoScroll: true, border: false, layout: 'form', labelAlign: 'right', labelWidth: 150, items: [". $CCA ."] }";
|
|
} else {
|
|
echo "{ xtype: 'panel', html: '<center>Incorrect Stream</center>'}";
|
|
};
|
|
} else {
|
|
echo "{ xtype: 'panel', html: '<center>Incorrect Stream</center>'}";
|
|
};
|
|
} else {
|
|
echo "{ xtype: 'panel', html: 'Access Error!'}";
|
|
};
|
|
|
|
//$ v4l2-ctl --set-fmt-video=width=960,height=720
|
|
//$ v4l2-ctl --set-ctrl=focus_auto=0,focus_absolute=0
|
|
?>
|