transcoding: added option to enable/disable transcoding from the webif

This commit is contained in:
John Törnblom 2013-08-11 21:19:05 +02:00
parent e84aceace2
commit 012ed060cb
5 changed files with 83 additions and 2 deletions

View file

@ -678,6 +678,7 @@ main(int argc, char **argv)
#if ENABLE_LIBAV
libav_init();
transcoding_init();
#endif
config_init();

View file

@ -23,6 +23,7 @@
#include <libavutil/dict.h>
#include "tvheadend.h"
#include "settings.h"
#include "streaming.h"
#include "service.h"
#include "packet.h"
@ -1361,4 +1362,40 @@ transcoder_get_capabilities(htsmsg_t *array)
}
/*
*
*/
void transcoding_init(void)
{
htsmsg_t *m;
if ((m = hts_settings_load("transcoding"))) {
htsmsg_get_u32(m, "enabled", &transcoding_enabled);
htsmsg_destroy(m);
}
}
/*
*
*/
void transcoding_save(void)
{
htsmsg_t *m = htsmsg_create_map();
htsmsg_add_u32(m, "enabled", transcoding_enabled);
hts_settings_save(m, "transcoding");
}
/*
*
*/
int transcoding_set_enabled(uint32_t e)
{
if (e == transcoding_enabled)
return 0;
transcoding_enabled = e;
return 1;
}

View file

@ -40,3 +40,7 @@ void transcoder_get_capabilities(htsmsg_t *array);
void transcoder_set_properties (streaming_target_t *tr,
transcoder_props_t *prop);
void transcoding_init(void);
void transcoding_save(void);
int transcoding_set_enabled(uint32_t e);

View file

@ -52,6 +52,10 @@
#include "timeshift.h"
#include "tvhtime.h"
#if ENABLE_LIBAV
#include "plumbing/transcoding.h"
#endif
/**
*
*/
@ -2030,6 +2034,11 @@ extjs_config(http_connection_t *hc, const char *remain, void *opaque)
htsmsg_add_u32(m, "tvhtime_ntp_enabled", tvhtime_ntp_enabled);
htsmsg_add_u32(m, "tvhtime_tolerance", tvhtime_tolerance);
/* Transcoding */
#if ENABLE_LIBAV
htsmsg_add_u32(m, "transcoding_enabled", transcoding_enabled);
#endif
pthread_mutex_unlock(&global_lock);
/* Image cache */
@ -2066,6 +2075,15 @@ extjs_config(http_connection_t *hc, const char *remain, void *opaque)
if ((str = http_arg_get(&hc->hc_req_args, "tvhtime_tolerance")))
tvhtime_set_tolerance(atoi(str));
/* Transcoding */
#if ENABLE_LIBAV
save = 0;
if ((str = http_arg_get(&hc->hc_req_args, "transcoding_enabled")))
save |= transcoding_set_enabled(!!str);
if (save)
transcoding_save();
#endif
pthread_mutex_unlock(&global_lock);
/* Image Cache */

View file

@ -41,7 +41,7 @@ tvheadend.miscconf = function() {
'imagecache_enabled', 'imagecache_ok_period',
'imagecache_fail_period', 'imagecache_ignore_sslcert',
'tvhtime_update_enabled', 'tvhtime_ntp_enabled',
'tvhtime_tolerance']);
'tvhtime_tolerance', 'transcoding_enabled']);
/* ****************************************************************
* Form Fields
@ -137,6 +137,26 @@ tvheadend.miscconf = function() {
if (tvheadend.capabilities.indexOf('imagecache') == -1)
imagecachePanel.hide();
/*
* Transcoding
*/
var transcodingEnabled = new Ext.form.Checkbox({
name: 'transcoding_enabled',
fieldLabel: 'Enabled',
});
var transcodingPanel = new Ext.form.FieldSet({
title: 'Transcoding',
width: 700,
autoHeight: true,
collapsible: true,
items : [ transcodingEnabled ]
});
if (tvheadend.capabilities.indexOf('transcoding') == -1)
transcodingPanel.hide();
/* ****************************************************************
* Form
* ***************************************************************/
@ -168,7 +188,8 @@ tvheadend.miscconf = function() {
defaultType : 'textfield',
autoHeight : true,
items : [ language, dvbscanPath,
imagecachePanel, tvhtimePanel ],
imagecachePanel, tvhtimePanel,
transcodingPanel],
tbar : [ saveButton, '->', helpButton ]
});