📄 panelmediatargetnetwork.java
字号:
arrComboAudioTtl[i] = new Choice ();
arrComboAudioTtl[i].addItem ( "1" );
arrComboAudioTtl[i].addItem ( "2" );
arrComboAudioTtl[i].addItem ( "3" );
arrComboAudioTtl[i].addItem ( "4" );
arrComboAudioTtl[i].addItem ( "8" );
arrComboAudioTtl[i].addItem ( "16" );
arrComboAudioTtl[i].addItem ( "32" );
arrComboAudioTtl[i].addItem ( "64" );
arrComboAudioTtl[i].addItem ( "128" );
arrComboAudioTtl[i].addItem ( "255" );
if ( cfgJMApps != null ) {
dataRtp = cfgJMApps.getLastTransmitRtpData ( "Video " + (i + 1) );
if ( dataRtp != null ) {
arrTextVideoTrackAddress[i][0].setText ( dataRtp.strAddress0 );
arrTextVideoTrackAddress[i][1].setText ( dataRtp.strAddress1 );
arrTextVideoTrackAddress[i][2].setText ( dataRtp.strAddress2 );
arrTextVideoTrackAddress[i][3].setText ( dataRtp.strAddress3 );
arrTextVideoPort[i].setText ( dataRtp.strPort );
arrComboVideoTtl[i].select ( dataRtp.strTtl );
}
dataRtp = cfgJMApps.getLastTransmitRtpData ( "Audio " + (i + 1) );
if ( dataRtp != null ) {
arrTextAudioTrackAddress[i][0].setText ( dataRtp.strAddress0 );
arrTextAudioTrackAddress[i][1].setText ( dataRtp.strAddress1 );
arrTextAudioTrackAddress[i][2].setText ( dataRtp.strAddress2 );
arrTextAudioTrackAddress[i][3].setText ( dataRtp.strAddress3 );
arrTextAudioPort[i].setText ( dataRtp.strPort );
arrComboAudioTtl[i].select ( dataRtp.strTtl );
}
}
}
}
public void setTracks ( boolean arrVideoTracksEnabled[], boolean arrAudioTracksEnabled[] ) {
int i, j;
Label label;
Panel panelAddressEntry;
String strAudio = JMFI18N.getResource("jmstudio.export.targetnw.audio");
String strVideo = JMFI18N.getResource("jmstudio.export.targetnw.video");
nVideoCount = arrVideoTracksEnabled.length;
nAudioCount = arrAudioTracksEnabled.length;
panelLabels.removeAll ();
panelAddress.removeAll ();
panelPort.removeAll ();
panelTtl.removeAll ();
label = new Label ( JMFI18N.getResource("jmstudio.export.targetnw.track"), Label.CENTER );
panelLabels.add ( label );
label = new Label ( JMFI18N.getResource("jmstudio.export.targetnw.sessionaddr"), Label.CENTER );
panelAddress.add ( label );
label = new Label ( JMFI18N.getResource("jmstudio.export.targetnw.port"), Label.CENTER );
panelPort.add ( label );
label = new Label ( JMFI18N.getResource("jmstudio.export.targetnw.ttl"), Label.CENTER );
panelTtl.add ( label );
for ( i = 0; i < nVideoCount; i++ ) {
label = new Label ( strVideo + " " + (i + 1), Label.LEFT );
label.setEnabled ( arrVideoTracksEnabled[i] );
panelLabels.add ( label );
panelAddressEntry = new Panel ( new GridLayout(1,0,2,2) );
panelAddress.add ( panelAddressEntry );
for ( j = 0; j < 4; j++ ) {
arrTextVideoTrackAddress[i][j].setEnabled ( arrVideoTracksEnabled[i] );
panelAddressEntry.add ( arrTextVideoTrackAddress[i][j] );
}
arrTextVideoPort[i].setEnabled ( arrVideoTracksEnabled[i] );
panelPort.add ( arrTextVideoPort[i] );
arrComboVideoTtl[i].setEnabled ( arrVideoTracksEnabled[i] );
panelTtl.add ( arrComboVideoTtl[i] );
}
for ( i = 0; i < nAudioCount; i++ ) {
label = new Label ( strAudio + " " + (i + 1), Label.LEFT );
label.setEnabled ( arrAudioTracksEnabled[i] );
panelLabels.add ( label );
panelAddressEntry = new Panel ( new GridLayout(1,0,2,2) );
panelAddress.add ( panelAddressEntry );
for ( j = 0; j < 4; j++ ) {
arrTextAudioTrackAddress[i][j].setEnabled ( arrAudioTracksEnabled[i] );
panelAddressEntry.add ( arrTextAudioTrackAddress[i][j] );
}
arrTextAudioPort[i].setEnabled ( arrAudioTracksEnabled[i] );
panelPort.add ( arrTextAudioPort[i] );
arrComboAudioTtl[i].setEnabled ( arrAudioTracksEnabled[i] );
panelTtl.add ( arrComboAudioTtl[i] );
}
}
public void textValueChanged ( TextEvent event ) {
Object objectSource;
TextField textField;
String strValue;
objectSource = event.getSource ();
if ( objectSource instanceof TextField ) {
textField = (TextField) objectSource;
strValue = textField.getText ();
if ( strValue.length() > 2 )
textField.transferFocus ();
}
}
public boolean checkValidFields ( boolean boolDisplayMessage ) {
int i, j;
int nValue;
String strValue;
for ( i = 0; i < nVideoCount; i++ ) {
for ( j = 0; j < 4; j++ ) {
if ( !arrTextVideoTrackAddress[i][j].isEnabled() )
continue;
strValue = arrTextVideoTrackAddress[i][j].getText ();
try {
nValue = Integer.valueOf(strValue).intValue(); } catch ( Exception exception ) { nValue = -1; } if ( nValue < 0 || nValue > 255 ) { if ( boolDisplayMessage == true ) MessageDialog.createErrorDialog ( getFrame(), JMFI18N.getResource("jmstudio.error.video.sessionaddr") + " " + (i + 1) ); return ( false ); } } if ( !arrTextVideoPort[i].isEnabled() )
continue;
strValue = arrTextVideoPort[i].getText ();
try {
nValue = Integer.valueOf(strValue).intValue(); } catch ( Exception exception ) { nValue = -1; } if ( nValue < 0 || (nValue & 0x0001) == 0x0001 ) {
if ( boolDisplayMessage == true ) MessageDialog.createErrorDialog ( getFrame(), JMFI18N.getResource("jmstudio.error.video.port") + " " + (i + 1) ); return ( false ); }
}
for ( i = 0; i < nAudioCount; i++ ) {
for ( j = 0; j < 4; j++ ) {
if ( !arrTextAudioTrackAddress[i][j].isEnabled() )
continue;
strValue = arrTextAudioTrackAddress[i][j].getText ();
try { nValue = Integer.valueOf(strValue).intValue(); } catch ( Exception exception ) { nValue = -1; } if ( nValue < 0 || nValue > 255 ) { if ( boolDisplayMessage == true ) MessageDialog.createErrorDialog ( getFrame(), JMFI18N.getResource("jmstudio.error.audio.sessionaddr") + " " + (i + 1) ); return ( false ); } } if ( !arrTextAudioPort[i].isEnabled() )
continue;
strValue = arrTextAudioPort[i].getText ();
try {
nValue = Integer.valueOf(strValue).intValue(); } catch ( Exception exception ) { nValue = -1; } if ( nValue < 0 || (nValue & 0x0001) == 0x0001 ) {
if ( boolDisplayMessage == true ) MessageDialog.createErrorDialog ( getFrame(), JMFI18N.getResource("jmstudio.error.audio.port") + " " + (i + 1) ); return ( false ); }
}
return ( true );
}
public void saveData () {
int i;
JMAppsCfg.RtpData dataRtp;
if ( cfgJMApps == null )
return;
for ( i = 0; i < MAX_TRACK_COUNT; i++ ) {
dataRtp = cfgJMApps.createRtpDataObject ();
dataRtp.strAddress0 = arrTextVideoTrackAddress[i][0].getText ();
dataRtp.strAddress1 = arrTextVideoTrackAddress[i][1].getText ();
dataRtp.strAddress2 = arrTextVideoTrackAddress[i][2].getText ();
dataRtp.strAddress3 = arrTextVideoTrackAddress[i][3].getText ();
dataRtp.strPort = arrTextVideoPort[i].getText ();
dataRtp.strTtl = arrComboVideoTtl[i].getSelectedItem ();
cfgJMApps.setLastTransmitRtpData ( dataRtp, "Video " + (i + 1) );
dataRtp = cfgJMApps.createRtpDataObject ();
dataRtp.strAddress0 = arrTextAudioTrackAddress[i][0].getText ();
dataRtp.strAddress1 = arrTextAudioTrackAddress[i][1].getText ();
dataRtp.strAddress2 = arrTextAudioTrackAddress[i][2].getText ();
dataRtp.strAddress3 = arrTextAudioTrackAddress[i][3].getText ();
dataRtp.strPort = arrTextAudioPort[i].getText ();
dataRtp.strTtl = arrComboAudioTtl[i].getSelectedItem ();
cfgJMApps.setLastTransmitRtpData ( dataRtp, "Audio " + (i + 1) );
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -