added support for chapters insertion in tha muxer api

This commit is contained in:
John Törnblom 2013-01-08 15:37:20 +01:00
parent 153c2f09d8
commit cff10d6663
3 changed files with 32 additions and 0 deletions

View 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()
*/

View 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);

View 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;