[vlc-devel] [PATCH 1/5] playlist: add DEMUX_BY_EXTENSION_OR_BY_MIMETYPE

Edward Wang edward.c.wang at compdigitec.com
Sun Oct 27 05:39:21 CET 2013


---
 modules/demux/playlist/playlist.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/demux/playlist/playlist.h b/modules/demux/playlist/playlist.h
index e6a1af7..9ae6e30 100644
--- a/modules/demux/playlist/playlist.h
+++ b/modules/demux/playlist/playlist.h
@@ -97,6 +97,15 @@ extern input_item_t * GetCurrentItem(demux_t *p_demux);
         return VLC_EGENERIC; \
     STANDARD_DEMUX_INIT_MSG( msg );
 
+#define DEMUX_BY_EXTENSION_OR_MIMETYPE( ext, mime, msg ) \
+    demux_t *p_demux = (demux_t *)p_this; \
+    char* demux_mimetype = stream_ContentType( p_demux->s ); \
+    if(!( demux_IsPathExtension( p_demux, ext ) || (demux_mimetype && !strcasecmp( mime, demux_mimetype )) )) { \
+        free( demux_mimetype ); \
+        return VLC_EGENERIC; \
+    } \
+    free( demux_mimetype ); \
+    STANDARD_DEMUX_INIT_MSG( msg );
 
 #define CHECK_PEEK( zepeek, size ) do { \
     if( stream_Peek( p_demux->s , &zepeek, size ) < size ){ \
-- 
1.8.4.rc3




More information about the vlc-devel mailing list