const struct dvb_mux_conf *dmc,
uint16_t tsid, const char *network,
const char *logprefix, int enabled,
- int initialscan, const char *identifier);
+ int initialscan, const char *identifier,
+ dvb_satconf_t *satconf);
void dvb_mux_set_networkname(th_dvb_mux_instance_t *tdmi, const char *name);
int polarisation,
const char *satconf);
-int dvb_mux_copy(th_dvb_adapter_t *dst, th_dvb_mux_instance_t *tdmi_src);
+int dvb_mux_copy(th_dvb_adapter_t *dst, th_dvb_mux_instance_t *tdmi_src,
+ dvb_satconf_t *satconf);
/**
* DVB Transport (aka DVB service)
dvb_mux_destroy(tdmi_dst);
LIST_FOREACH(tdmi_src, &src->tda_muxes, tdmi_adapter_link)
- dvb_mux_copy(dst, tdmi_src);
+ dvb_mux_copy(dst, tdmi_src, NULL);
tda_save(dst);
}
th_dvb_mux_instance_t *
dvb_mux_create(th_dvb_adapter_t *tda, const struct dvb_mux_conf *dmc,
uint16_t tsid, const char *network, const char *source,
- int enabled, int initialscan, const char *identifier)
+ int enabled, int initialscan, const char *identifier,
+ dvb_satconf_t *satconf)
{
th_dvb_mux_instance_t *tdmi, *c;
unsigned int hash;
snprintf(buf, sizeof(buf), "%s%d%s%s%s",
tda->tda_identifier, dmc->dmc_fe_params.frequency, qpsktxt,
- dmc->dmc_satconf ? "_satconf_" : "",
- dmc->dmc_satconf ? dmc->dmc_satconf->sc_id : "");
+ (satconf || dmc->dmc_satconf) ? "_satconf_" : "",
+ (satconf ? satconf->sc_id :
+ (dmc->dmc_satconf ? dmc->dmc_satconf->sc_id : "")));
tdmi->tdmi_identifier = strdup(buf);
} else {
memcpy(&tdmi->tdmi_conf, dmc, sizeof(struct dvb_mux_conf));
+ if(satconf)
+ tdmi->tdmi_conf.dmc_satconf = satconf;
if(tdmi->tdmi_conf.dmc_satconf != NULL) {
LIST_INSERT_HEAD(&tdmi->tdmi_conf.dmc_satconf->sc_tdmis,
tdmi, tdmi_satconf_link);
tdmi = dvb_mux_create(tda, &dmc,
tsid, htsmsg_get_str(m, "network"), NULL, enabled, 1,
- identifier);
+ identifier, NULL);
if(tdmi != NULL) {
if((s = htsmsg_get_str(m, "status")) != NULL)
}
dmc.dmc_polarisation = polarisation;
- tdmi = dvb_mux_create(tda, &dmc, 0xffff, NULL, NULL, 1, 1, NULL);
+ tdmi = dvb_mux_create(tda, &dmc, 0xffff, NULL, NULL, 1, 1, NULL, NULL);
if(tdmi == NULL)
return "Mux already exist";
*
*/
int
-dvb_mux_copy(th_dvb_adapter_t *dst, th_dvb_mux_instance_t *tdmi_src)
+dvb_mux_copy(th_dvb_adapter_t *dst, th_dvb_mux_instance_t *tdmi_src,
+ dvb_satconf_t *satconf)
{
th_dvb_mux_instance_t *tdmi_dst;
service_t *t_src, *t_dst;
tdmi_src->tdmi_transport_stream_id,
tdmi_src->tdmi_network,
"copy operation", tdmi_src->tdmi_enabled,
- 1, NULL);
+ 1, NULL, satconf);
if(tdmi_dst == NULL)
return -1; // Already exist
dmc.dmc_satconf = dvb_satconf_entry_find(tda, satconf, 0);
- dvb_mux_create(tda, &dmc, 0xffff, NULL, source, 1, 1, NULL);
+ dvb_mux_create(tda, &dmc, 0xffff, NULL, source, 1, 1, NULL, NULL);
m++;
}
}
dmc.dmc_fe_params.u.qam.fec_inner = fec_tab[ptr[10] & 0x07];
dvb_mux_create(tdmi->tdmi_adapter, &dmc, tsid, NULL,
- "automatic mux discovery", 1, 1, NULL);
+ "automatic mux discovery", 1, 1, NULL, NULL);
return 0;
}
#endif
dvb_mux_create(tdmi->tdmi_adapter, &dmc, tsid, NULL,
- "automatic mux discovery", 1, 1, NULL);
+ "automatic mux discovery", 1, 1, NULL, NULL);
return 0;
}
htsbuf_queue_t *hq = &hc->hc_reply;
th_dvb_adapter_t *tda;
htsmsg_t *out;
+ const char *adapter = http_arg_get(&hc->hc_req_args, "adapter");
pthread_mutex_lock(&global_lock);
- if(remain == NULL ||
- (tda = dvb_adapter_find_by_identifier(remain)) == NULL) {
+ if((remain == NULL ||
+ (tda = dvb_adapter_find_by_identifier(remain)) == NULL) &&
+ (adapter == NULL ||
+ (tda = dvb_adapter_find_by_identifier(adapter)) == NULL)) {
pthread_mutex_unlock(&global_lock);
return 404;
}
th_dvb_adapter_t *tda;
htsmsg_t *in;
const char *entries = http_arg_get(&hc->hc_req_args, "entries");
+ const char *satconf = http_arg_get(&hc->hc_req_args, "satconf");
const char *id;
htsmsg_field_t *f;
th_dvb_mux_instance_t *tdmi;
+ dvb_satconf_t *sc = NULL;
in = entries != NULL ? htsmsg_json_deserialize(entries) : NULL;
return 404;
}
+ if (satconf) {
+ sc = dvb_satconf_entry_find(tda, satconf, 0);
+ if (sc == NULL) {
+ pthread_mutex_unlock(&global_lock);
+ return 404;
+ }
+ }
TAILQ_FOREACH(f, &in->hm_fields, hmf_link) {
if((id = htsmsg_field_get_string(f)) != NULL &&
(tdmi = dvb_mux_find_by_identifier(id)) != NULL &&
tda != tdmi->tdmi_adapter) {
- if(dvb_mux_copy(tda, tdmi)) {
+ if(dvb_mux_copy(tda, tdmi, sc)) {
char buf[100];
dvb_mux_nicename(buf, sizeof(buf), tdmi);
var selectedKeys = grid.selModel.selections.keys;
var target = panel.getForm().getValues('targetID').targetID;
+ if(adapterData.satConf) {
+ var satconf = panel.getForm().getValues('targetSatConfID').targetSatConfID;
+ var mparams = {
+ entries:Ext.encode(selectedKeys),
+ satconf:satconf
+ };
+ } else {
+ var mparams = {
+ entries:Ext.encode(selectedKeys)
+ };
+ }
+
Ext.Ajax.request({
url: "dvb/copymux/" + target,
- params: {
- entries:Ext.encode(selectedKeys)
- },
- failure:function(response,options) {
+ params: mparams,
+ failure:function(response,options) {
Ext.MessageBox.alert('Server Error','Unable to copy');
- },
+ },
success: function() {
win.close();
}
'name'],
baseParams: {sibling: adapterId}
});
+ if(adapterData.satConf) {
+ targetSatConfStore = new Ext.data.JsonStore({
+ root:'entries',
+ id: 'identifier',
+ url:'dvb/satconf',
+ fields: ['identifier',
+ 'name'],
+ baseParams: {adapter: adapterId}
+ });
+ satConf = new Ext.form.ComboBox({
+ store: targetSatConfStore,
+ fieldLabel: 'Target Satellite config',
+ name: 'targetsatconf',
+ hiddenName: 'targetSatConfID',
+ editable: false,
+ allowBlank: false,
+ triggerAction: 'all',
+ mode: 'remote',
+ displayField:'name',
+ valueField:'identifier',
+ emptyText: 'Select target adapter first...'
+ });
+ } else {
+ satConf = null;
+ }
var panel = new Ext.FormPanel({
frame:true,
border:true,
bodyStyle:'padding:5px',
labelAlign: 'right',
- labelWidth: 110,
+ labelWidth: 150,
defaultType: 'textfield',
items: [
mode: 'remote',
displayField:'name',
valueField:'identifier',
- emptyText: 'Select target adapter...'
- })
+ emptyText: 'Select target adapter...',
+ listeners: {
+ 'select': function(combo, value) {
+ if (satConf) {
+ satConf.emptyText = 'Select satellite configuration...';
+ satConf.clearValue();
+ targetSatConfStore.baseParams = {adapter: combo.value};
+ targetSatConfStore.load();
+ satConf.focus();
+ satConf.expand();
+ }
+ }
+ }
+ }),
+ satConf,
],
buttons: [{
text: 'Copy',
title: 'Copy multiplex configuration',
layout: 'fit',
width: 500,
- height: 120,
+ height: 150,
modal: true,
plain: true,
items: panel