]> git.sesse.net Git - vlc/blobdiff - src/misc/fourcc.c
Added a small vlc_fourcc_GetCodecFromString helper.
[vlc] / src / misc / fourcc.c
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 )
 {