From: John Törnblom Date: Tue, 8 Jan 2013 14:37:20 +0000 (+0100) Subject: added support for chapters insertion in tha muxer api X-Git-Tag: v3.5~166 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cff10d66639d0c8be55c747220e65652e597a5e5;p=thirdparty%2Ftvheadend.git added support for chapters insertion in tha muxer api --- diff --git a/src/muxer.c b/src/muxer.c index 2de07edf9..ecf5618cf 100644 --- a/src/muxer.c +++ b/src/muxer.c @@ -308,6 +308,18 @@ muxer_reconfigure(muxer_t *m, const struct streaming_start *ss) } +/** + * sanity wrapper arround m_add_marker() + */ +int +muxer_add_marker(muxer_t *m) +{ + if(!m) + return -1; + + return m->m_add_marker(m); +} + /** * sanity wrapper arround m_open_file() */ diff --git a/src/muxer.h b/src/muxer.h index 6d57cd7f7..7894c3fc7 100644 --- a/src/muxer.h +++ b/src/muxer.h @@ -52,6 +52,7 @@ typedef struct muxer { int (*m_write_pkt) (struct muxer *, // Append a media packet streaming_message_type_t, void *); + int (*m_add_marker) (struct muxer *); // Add a marker (or chapter) int m_errors; // Number of errors muxer_container_type_t m_container; // The type of the container @@ -77,6 +78,7 @@ 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_add_marker (muxer_t *m); int muxer_close (muxer_t *m); int muxer_destroy (muxer_t *m); int muxer_write_meta (muxer_t *m, struct epg_broadcast *eb); diff --git a/src/muxer/muxer_tvh.c b/src/muxer/muxer_tvh.c index 02846ae51..6d46b9124 100644 --- a/src/muxer/muxer_tvh.c +++ b/src/muxer/muxer_tvh.c @@ -81,6 +81,23 @@ tvh_muxer_init(muxer_t* m, const struct streaming_start *ss, const char *name) } +/** + * Insert a new chapter at the current location + */ +static int +tvh_muxer_add_marker(muxer_t* m) +{ + tvh_muxer_t *tm = (tvh_muxer_t*)m; + + if(mk_mux_insert_chapter(tm->tm_ref)) { + tm->m_errors++; + return -1; + } + + return 0; +} + + /** * 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. @@ -216,6 +233,7 @@ tvh_muxer_create(muxer_container_type_t mc) tm->m_mime = tvh_muxer_mime; tm->m_init = tvh_muxer_init; tm->m_reconfigure = tvh_muxer_reconfigure; + tm->m_add_marker = tvh_muxer_add_marker; tm->m_write_meta = tvh_muxer_write_meta; tm->m_write_pkt = tvh_muxer_write_pkt; tm->m_close = tvh_muxer_close;