]> git.sesse.net Git - vlc/commitdiff
Added a small vlc_fourcc_GetCodecFromString helper.
authorLaurent Aimar <fenrir@videolan.org>
Thu, 14 May 2009 19:35:22 +0000 (21:35 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Fri, 15 May 2009 20:05:37 +0000 (22:05 +0200)
include/vlc_fourcc.h
src/libvlccore.sym
src/misc/fourcc.c

index c212f279f319dfbec4265595f9ea53e08e4e8c34..3a1e8a6d6febe78f378edbca2b6d2943e9636bdc 100644 (file)
 #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.
  */
 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.
  *
index 5d64f41fe10a4fb25e2d4f529cf42ba01b393379..8adf4fb53d8a69102da70b49acec8dee133671eb 100644 (file)
@@ -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
index 5e92e1967569d650f176b3ecaafa23d90def3e81..2690bc871a7df4bdbbc17194256b47483dbac927 100644 (file)
@@ -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 )
 {