[vlc-commits] bluray: Add an ES manipulation skeleton.
Hugo Beauzée-Luyssen
git at videolan.org
Mon Apr 16 14:14:22 CEST 2012
vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Mar 8 14:08:30 2012 +0000| [bbca512a1ad84a8cead2d62b59566c20d49086e7] | committer: Hugo Beauzée-Luyssen
bluray: Add an ES manipulation skeleton.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bbca512a1ad84a8cead2d62b59566c20d49086e7
---
modules/access/bluray.c | 68 +++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 66 insertions(+), 2 deletions(-)
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index f63429e..af7aed6 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -112,6 +112,7 @@ struct demux_sys_t
vout_thread_t *p_vout;
/* TS stream */
+ es_out_t *p_out;
stream_t *p_parser;
};
@@ -123,6 +124,8 @@ struct subpicture_updater_sys_t
/*****************************************************************************
* Local prototypes
*****************************************************************************/
+static es_out_t *esOutNew( demux_t *p_demux );
+
static int blurayControl(demux_t *, int, va_list);
static int blurayDemux(demux_t *);
@@ -282,6 +285,11 @@ static int blurayOpen( vlc_object_t *object )
}
}
+ p_sys->p_out = esOutNew( p_demux );
+ if (unlikely(p_sys->p_out == NULL)) {
+ goto error;
+ }
+
blurayResetParser( p_demux );
if (!p_sys->p_parser) {
msg_Err(p_demux, "Failed to create TS demuxer");
@@ -326,7 +334,8 @@ static void blurayClose( vlc_object_t *object )
vlc_object_release(p_sys->p_input);
if (p_sys->p_parser)
stream_Delete(p_sys->p_parser);
-
+ if (p_sys->p_out != NULL)
+ es_out_Delete(p_sys->p_out);
/* Titles */
for (unsigned int i = 0; i < p_sys->i_title; i++)
vlc_input_title_Delete(p_sys->pp_title[i]);
@@ -336,6 +345,61 @@ static void blurayClose( vlc_object_t *object )
}
/*****************************************************************************
+ * Elementary streams handling
+ *****************************************************************************/
+
+struct es_out_sys_t {
+ demux_t *p_demux;
+};
+
+static es_out_id_t *esOutAdd( es_out_t *p_out, const es_format_t *p_fmt )
+{
+ return es_out_Add( p_out->p_sys->p_demux->out, p_fmt );
+}
+
+static int esOutSend( es_out_t *p_out, es_out_id_t *p_es, block_t *p_block )
+{
+ return es_out_Send( p_out->p_sys->p_demux->out, p_es, p_block );
+}
+
+static void esOutDel( es_out_t *p_out, es_out_id_t *p_es )
+{
+ es_out_Del( p_out->p_sys->p_demux->out, p_es );
+}
+
+static int esOutControl( es_out_t *p_out, int i_query, va_list args )
+{
+ return es_out_vaControl( p_out->p_sys->p_demux->out, i_query, args );
+}
+
+static void esOutDestroy( es_out_t *p_out )
+{
+ free( p_out->p_sys );
+ free( p_out );
+}
+
+static es_out_t *esOutNew( demux_t *p_demux )
+{
+ es_out_t *p_out = malloc( sizeof(*p_out) );
+ if ( unlikely(p_out == NULL) )
+ return NULL;
+
+ p_out->pf_add = &esOutAdd;
+ p_out->pf_control = &esOutControl;
+ p_out->pf_del = &esOutDel;
+ p_out->pf_destroy = &esOutDestroy;
+ p_out->pf_send = &esOutSend;
+
+ p_out->p_sys = malloc( sizeof(*p_out->p_sys) );
+ if ( unlikely( p_out->p_sys == NULL ) ) {
+ free( p_out );
+ return NULL;
+ }
+ p_out->p_sys->p_demux = p_demux;
+ return p_out;
+}
+
+/*****************************************************************************
* subpicture_updater_t functions:
*****************************************************************************/
static int subpictureUpdaterValidate( subpicture_t *p_subpic,
@@ -747,7 +811,7 @@ static void blurayResetParser( demux_t *p_demux )
demux_sys_t *p_sys = p_demux->p_sys;
if (p_sys->p_parser)
stream_Delete(p_sys->p_parser);
- p_sys->p_parser = stream_DemuxNew(p_demux, "ts", p_demux->out);
+ p_sys->p_parser = stream_DemuxNew(p_demux, "ts", p_sys->p_out);
if (!p_sys->p_parser) {
msg_Err(p_demux, "Failed to create TS demuxer");
}
More information about the vlc-commits
mailing list