[vlc-commits] ifo: convert to stream filter
Rémi Denis-Courmont
git at videolan.org
Sat Jun 3 20:47:46 CEST 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon May 22 20:42:37 2017 +0300| [b18794b12c0d00c402ae4a232377fa2d2df566a6] | committer: Rémi Denis-Courmont
ifo: convert to stream filter
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b18794b12c0d00c402ae4a232377fa2d2df566a6
---
modules/demux/playlist/ifo.c | 44 +++++++++++++++++----------------------
modules/demux/playlist/playlist.c | 3 +--
2 files changed, 20 insertions(+), 27 deletions(-)
diff --git a/modules/demux/playlist/ifo.c b/modules/demux/playlist/ifo.c
index 201d94e5c1..204a06180e 100644
--- a/modules/demux/playlist/ifo.c
+++ b/modules/demux/playlist/ifo.c
@@ -29,7 +29,7 @@
#endif
#include <vlc_common.h>
-#include <vlc_demux.h>
+#include <vlc_access.h>
#include <assert.h>
#include "playlist.h"
@@ -37,23 +37,23 @@
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int Demux( demux_t *p_demux);
-static int DemuxDVD_VR( demux_t *p_demux);
+static int ReadDVD( stream_t *, input_item_node_t * );
+static int ReadDVD_VR( stream_t *, input_item_node_t * );
/*****************************************************************************
* Import_IFO: main import function
*****************************************************************************/
int Import_IFO( vlc_object_t *p_this )
{
- demux_t *p_demux = (demux_t *)p_this;
+ stream_t *p_demux = (stream_t *)p_this;
CHECK_FILE(p_demux);
- if( !p_demux->psz_file )
+ if( p_demux->psz_filepath == NULL )
return VLC_EGENERIC;
- size_t len = strlen( p_demux->psz_file );
+ size_t len = strlen( p_demux->psz_filepath );
- char *psz_file = p_demux->psz_file + len - strlen( "VIDEO_TS.IFO" );
+ char *psz_file = p_demux->psz_filepath + len - strlen( "VIDEO_TS.IFO" );
/* Valid filenames are :
* - VIDEO_TS.IFO
* - VTS_XX_X.IFO where X are digits
@@ -63,37 +63,34 @@ int Import_IFO( vlc_object_t *p_this )
|| (!strncasecmp( psz_file, "VTS_", 4 )
&& !strcasecmp( psz_file + strlen( "VTS_00_0" ) , ".IFO" ) ) ) )
{
- int i_peek;
const uint8_t *p_peek;
- i_peek = vlc_stream_Peek( p_demux->s, &p_peek, 8 );
+ ssize_t i_peek = vlc_stream_Peek( p_demux->p_source, &p_peek, 8 );
if( i_peek != 8 || memcmp( p_peek, "DVDVIDEO", 8 ) )
return VLC_EGENERIC;
- p_demux->pf_demux = Demux;
+ p_demux->pf_readdir = ReadDVD;
}
/* Valid filename for DVD-VR is VR_MANGR.IFO */
- else if( len >= 12 && !strcmp( &p_demux->psz_file[len-12], "VR_MANGR.IFO" ) )
+ else if( len >= 12 && !strcmp( &p_demux->psz_filepath[len-12], "VR_MANGR.IFO" ) )
{
- int i_peek;
const uint8_t *p_peek;
- i_peek = vlc_stream_Peek( p_demux->s, &p_peek, 8 );
+ ssize_t i_peek = vlc_stream_Peek( p_demux->p_source, &p_peek, 8 );
if( i_peek != 8 || memcmp( p_peek, "DVD_RTR_", 8 ) )
return VLC_EGENERIC;
- p_demux->pf_demux = DemuxDVD_VR;
+ p_demux->pf_readdir = ReadDVD_VR;
}
else
return VLC_EGENERIC;
-// STANDARD_DEMUX_INIT_MSG( "found valid VIDEO_TS.IFO" )
- p_demux->pf_control = Control;
+ p_demux->pf_control = access_vaDirectoryControlHelper;
return VLC_SUCCESS;
}
-static int Demux( demux_t *p_demux )
+static int ReadDVD( stream_t *p_demux, input_item_node_t *node )
{
char *psz_url, *psz_dir;
@@ -104,17 +101,16 @@ static int Demux( demux_t *p_demux )
if( asprintf( &psz_url, "dvd://%s", p_demux->psz_location ) == -1 )
return 0;
- input_item_t *p_current_input = GetCurrentItem(p_demux);
input_item_t *p_input = input_item_New( psz_url, psz_url );
- input_item_PostSubItem( p_current_input, p_input );
+ input_item_node_AppendItem( node, p_input );
input_item_Release( p_input );
free( psz_url );
- return 0; /* Needed for correct operation of go back */
+ return VLC_SUCCESS;
}
-static int DemuxDVD_VR( demux_t *p_demux )
+static int ReadDVD_VR( stream_t *p_demux, input_item_node_t *node )
{
size_t len = strlen( p_demux->psz_location );
char *psz_url = malloc( len + 1 );
@@ -126,13 +122,11 @@ static int DemuxDVD_VR( demux_t *p_demux )
memcpy( psz_url, p_demux->psz_location, len );
memcpy( psz_url + len, "VR_MOVIE.VRO", 13 );
- input_item_t *p_current_input = GetCurrentItem(p_demux);
input_item_t *p_input = input_item_New( psz_url, psz_url );
- input_item_PostSubItem( p_current_input, p_input );
-
+ input_item_node_AppendItem( node, p_input );
input_item_Release( p_input );
free( psz_url );
- return 0; /* Needed for correct operation of go back */
+ return VLC_SUCCESS;
}
diff --git a/modules/demux/playlist/playlist.c b/modules/demux/playlist/playlist.c
index 3370b2d073..fef72a7215 100644
--- a/modules/demux/playlist/playlist.c
+++ b/modules/demux/playlist/playlist.c
@@ -122,8 +122,7 @@ vlc_module_begin ()
set_callbacks( Import_QTL, NULL )
add_submodule ()
set_description( N_("Dummy IFO demux") )
- add_shortcut( "playlist" )
- set_capability( "demux", 12 )
+ set_capability( "stream_filter", 12 )
set_callbacks( Import_IFO, NULL )
add_submodule ()
set_description( N_("iTunes Music Library importer") )
More information about the vlc-commits
mailing list