Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
transcoding: added option to enable/disable transcoding from the webif
  • Loading branch information
john-tornblom committed Aug 11, 2013
1 parent e84acea commit 012ed06
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main.c
Expand Up @@ -678,6 +678,7 @@ main(int argc, char **argv)

#if ENABLE_LIBAV
libav_init();
transcoding_init();
#endif

config_init();
Expand Down
37 changes: 37 additions & 0 deletions src/plumbing/transcoding.c
Expand Up @@ -23,6 +23,7 @@
#include <libavutil/dict.h>

#include "tvheadend.h"
#include "settings.h"
#include "streaming.h"
#include "service.h"
#include "packet.h"
Expand Down Expand Up @@ -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;
}
4 changes: 4 additions & 0 deletions src/plumbing/transcoding.h
Expand Up @@ -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);
18 changes: 18 additions & 0 deletions src/webui/extjs.c
Expand Up @@ -52,6 +52,10 @@
#include "timeshift.h"
#include "tvhtime.h"

#if ENABLE_LIBAV
#include "plumbing/transcoding.h"
#endif

/**
*
*/
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down
25 changes: 23 additions & 2 deletions src/webui/static/app/config.js
Expand Up @@ -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
Expand Down Expand Up @@ -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
* ***************************************************************/
Expand Down Expand Up @@ -168,7 +188,8 @@ tvheadend.miscconf = function() {
defaultType : 'textfield',
autoHeight : true,
items : [ language, dvbscanPath,
imagecachePanel, tvhtimePanel ],
imagecachePanel, tvhtimePanel,
transcodingPanel],
tbar : [ saveButton, '->', helpButton ]
});

Expand Down

0 comments on commit 012ed06

Please sign in to comment.