]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
added support for chapters insertion in tha muxer api
authorJohn Törnblom <john.tornblom@gmail.com>
Tue, 8 Jan 2013 14:37:20 +0000 (15:37 +0100)
committerJohn Törnblom <john.tornblom@gmail.com>
Tue, 8 Jan 2013 21:33:04 +0000 (22:33 +0100)
src/muxer.c
src/muxer.h
src/muxer/muxer_tvh.c

index 2de07edf9dce25ac0c9e6d92137253bbc53d2145..ecf5618cf37c68ef8445fdb90e51cb2213811f29 100644 (file)
@@ -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()
  */
index 6d57cd7f71cd59edc442a39254788167659eec41..7894c3fc7439d36a035ac1b9d3bef1bbf52136f5 100644 (file)
@@ -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);
index 02846ae51b507b047110fbac5b253c5896a5f84e..6d46b91245d7c10480a091a8eff1e276b750577c 100644 (file)
@@ -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;