reconfigure muxes when stream source changes (usually on pmt update).
This commit is contained in:
parent
f3da081bba
commit
bb119bc879
6 changed files with 54 additions and 5 deletions
|
@ -468,6 +468,8 @@ dvr_thread(void *aux)
|
|||
"dvr", "Recording completed: \"%s\"",
|
||||
de->de_filename ?: lang_str_get(de->de_title, NULL));
|
||||
|
||||
} else if(sm->sm_code == SM_CODE_SOURCE_RECONFIGURED) {
|
||||
muxer_reconfigure(de->de_mux, sm->sm_data);
|
||||
} else {
|
||||
|
||||
if(de->de_last_error != sm->sm_code) {
|
||||
|
|
13
src/muxer.c
13
src/muxer.c
|
@ -225,6 +225,19 @@ muxer_init(muxer_t *m, const struct streaming_start *ss, const char *name)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* sanity wrapper arround m_reconfigure()
|
||||
*/
|
||||
int
|
||||
muxer_reconfigure(muxer_t *m, const struct streaming_start *ss)
|
||||
{
|
||||
if(!m || !ss)
|
||||
return -1;
|
||||
|
||||
return m->m_reconfigure(m, ss);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* sanity wrapper arround m_open_file()
|
||||
*/
|
||||
|
|
|
@ -42,6 +42,8 @@ typedef struct muxer {
|
|||
int (*m_init) (struct muxer *, // Init The muxer with streams
|
||||
const struct streaming_start *,
|
||||
const char *);
|
||||
int (*m_reconfigure)(struct muxer *, // Reconfigure the muxer on
|
||||
const struct streaming_start *); // stream changes
|
||||
int (*m_close) (struct muxer *); // Close the muxer
|
||||
void (*m_destroy) (struct muxer *); // Free the memory
|
||||
int (*m_write_meta) (struct muxer *, struct epg_broadcast *); // Append epg data
|
||||
|
@ -65,6 +67,7 @@ muxer_t *muxer_create(struct service *s, muxer_container_type_t mc);
|
|||
int muxer_open_file (muxer_t *m, const char *filename);
|
||||
int muxer_open_stream (muxer_t *m, int fd);
|
||||
int muxer_init (muxer_t *m, const struct streaming_start *ss, const char *name);
|
||||
int muxer_reconfigure (muxer_t *m, const struct streaming_start *ss);
|
||||
int muxer_close (muxer_t *m);
|
||||
int muxer_destroy (muxer_t *m);
|
||||
int muxer_write_meta (muxer_t *m, struct epg_broadcast *eb);
|
||||
|
|
|
@ -90,10 +90,10 @@ pass_muxer_mime(muxer_t* m, const struct streaming_start *ss)
|
|||
|
||||
|
||||
/**
|
||||
* Init the passthrough muxer with streams
|
||||
* Generate the pmt and pat from a streaming start message
|
||||
*/
|
||||
static int
|
||||
pass_muxer_init(muxer_t* m, const struct streaming_start *ss, const char *name)
|
||||
pass_muxer_reconfigure(muxer_t* m, const struct streaming_start *ss)
|
||||
{
|
||||
pass_muxer_t *pm = (pass_muxer_t*)m;
|
||||
|
||||
|
@ -128,6 +128,16 @@ pass_muxer_init(muxer_t* m, const struct streaming_start *ss, const char *name)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Init the passthrough muxer with streams
|
||||
*/
|
||||
static int
|
||||
pass_muxer_init(muxer_t* m, const struct streaming_start *ss, const char *name)
|
||||
{
|
||||
return pass_muxer_reconfigure(m, ss);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Open the muxer as a stream muxer (using a non-seekable socket)
|
||||
*/
|
||||
|
@ -303,6 +313,7 @@ pass_muxer_create(service_t *s, muxer_container_type_t mc)
|
|||
pm->m_open_stream = pass_muxer_open_stream;
|
||||
pm->m_open_file = pass_muxer_open_file;
|
||||
pm->m_init = pass_muxer_init;
|
||||
pm->m_reconfigure = pass_muxer_reconfigure;
|
||||
pm->m_mime = pass_muxer_mime;
|
||||
pm->m_write_meta = pass_muxer_write_meta;
|
||||
pm->m_write_pkt = pass_muxer_write_pkt;
|
||||
|
|
|
@ -79,6 +79,21 @@ tvh_muxer_init(muxer_t* m, const struct streaming_start *ss, const char *name)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Multisegment matroska files do exist but I am not sure if they are supported
|
||||
* by many media players. For now, we'll treat it as an error.
|
||||
*/
|
||||
static int
|
||||
tvh_muxer_reconfigure(muxer_t* m, const struct streaming_start *ss)
|
||||
{
|
||||
tvh_muxer_t *tm = (tvh_muxer_t*)m;
|
||||
|
||||
tm->m_errors++;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Open the muxer as a stream muxer (using a non-seekable socket)
|
||||
*/
|
||||
|
@ -196,6 +211,7 @@ tvh_muxer_create(muxer_container_type_t mc)
|
|||
tm->m_open_file = tvh_muxer_open_file;
|
||||
tm->m_mime = tvh_muxer_mime;
|
||||
tm->m_init = tvh_muxer_init;
|
||||
tm->m_reconfigure = tvh_muxer_reconfigure;
|
||||
tm->m_write_meta = tvh_muxer_write_meta;
|
||||
tm->m_write_pkt = tvh_muxer_write_pkt;
|
||||
tm->m_close = tvh_muxer_close;
|
||||
|
|
|
@ -213,9 +213,13 @@ http_stream_run(http_connection_t *hc, streaming_queue_t *sq,
|
|||
break;
|
||||
|
||||
case SMT_STOP:
|
||||
tvhlog(LOG_WARNING, "webui", "Stop streaming %s, %s", hc->hc_url_orig,
|
||||
streaming_code2txt(sm->sm_code));
|
||||
run = 0;
|
||||
if(sm->sm_code == SM_CODE_SOURCE_RECONFIGURED) {
|
||||
muxer_reconfigure(mux, sm->sm_data);
|
||||
} else {
|
||||
tvhlog(LOG_WARNING, "webui", "Stop streaming %s, %s", hc->hc_url_orig,
|
||||
streaming_code2txt(sm->sm_code));
|
||||
run = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SMT_SERVICE_STATUS:
|
||||
|
|
Loading…
Add table
Reference in a new issue