[vlc-devel] commit: Added a small vlc_fourcc_GetCodecFromString helper. (Laurent Aimar )
git version control
git at videolan.org
Fri May 15 22:07:14 CEST 2009
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu May 14 21:35:22 2009 +0200| [b5625a39634deaa4082b44a326614a5b79b8dc39] | committer: Laurent Aimar
Added a small vlc_fourcc_GetCodecFromString helper.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b5625a39634deaa4082b44a326614a5b79b8dc39
---
include/vlc_fourcc.h | 13 ++++++++++++-
src/libvlccore.sym | 1 +
src/misc/fourcc.c | 9 +++++++++
3 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/include/vlc_fourcc.h b/include/vlc_fourcc.h
index c212f27..3a1e8a6 100644
--- a/include/vlc_fourcc.h
+++ b/include/vlc_fourcc.h
@@ -313,7 +313,7 @@
#define VLC_CODEC_MP3 VLC_FOURCC('m','p','3',' ')
/**
- * It returns the codec associatedto a fourcc within a ES category.
+ * It returns the codec associated to a fourcc within a ES category.
*
* If not found, it will return the given fourcc.
* If found, it will allways be one of the VLC_CODEC_ defined above.
@@ -323,6 +323,17 @@
VLC_EXPORT( vlc_fourcc_t, vlc_fourcc_GetCodec, ( int i_cat, vlc_fourcc_t i_fourcc ) );
/**
+ * It returns the codec associated to a fourcc store in a zero terminated
+ * string.
+ *
+ * If the string is NULL or does not have exactly 4 charateres, it will
+ * return 0, otherwise it behaves like vlc_fourcc_GetCodec.
+ *
+ * Provided for convenience.
+ */
+VLC_EXPORT( vlc_fourcc_t, vlc_fourcc_GetCodecFromString, ( int i_cat, const char * ) );
+
+/**
* It returns the description of the given fourcc or NULL if not found.
*
* You may use UNKNOWN_ES for the ES category if you don't have the information.
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 5d64f41..8adf4fb 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -453,6 +453,7 @@ vlc_event_send
__vlc_execve
vlc_fastmem_register
vlc_fourcc_GetCodec
+vlc_fourcc_GetCodecFromString
vlc_fourcc_GetDescription
vlc_freeaddrinfo
vlc_gai_strerror
diff --git a/src/misc/fourcc.c b/src/misc/fourcc.c
index 5e92e19..2690bc8 100644
--- a/src/misc/fourcc.c
+++ b/src/misc/fourcc.c
@@ -1186,6 +1186,15 @@ vlc_fourcc_t vlc_fourcc_GetCodec( int i_cat, vlc_fourcc_t i_fourcc )
return CreateFourcc( e.p_class );
}
+vlc_fourcc_t vlc_fourcc_GetCodecFromString( int i_cat, const char *psz_fourcc )
+{
+ if( !psz_fourcc || strlen(psz_fourcc) != 4 )
+ return 0;
+ return vlc_fourcc_GetCodec( i_cat,
+ VLC_FOURCC( psz_fourcc[0], psz_fourcc[1],
+ psz_fourcc[2], psz_fourcc[3] ) );
+}
+
/* */
const char *vlc_fourcc_GetDescription( int i_cat, vlc_fourcc_t i_fourcc )
{
More information about the vlc-devel
mailing list