[vlc-commits] avcodec: allow codec NONE in the table (refs #8887)
Rémi Denis-Courmont
git at videolan.org
Wed Jul 10 18:53:18 CEST 2013
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jul 10 19:52:36 2013 +0300| [a2896580ab0db45158589458441b8fbe271d1eeb] | committer: Rémi Denis-Courmont
avcodec: allow codec NONE in the table (refs #8887)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a2896580ab0db45158589458441b8fbe271d1eeb
---
modules/codec/avcodec/fourcc.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c
index f6a891d..b33e391 100644
--- a/modules/codec/avcodec/fourcc.c
+++ b/modules/codec/avcodec/fourcc.c
@@ -445,15 +445,16 @@ static const struct
{ VLC_CODEC_XSUB, AV_CODEC_ID_XSUB, SPU_ES },
{ VLC_CODEC_SSA, AV_CODEC_ID_SSA, SPU_ES },
{ VLC_CODEC_TELETEXT, AV_CODEC_ID_DVB_TELETEXT, SPU_ES },
-
- { 0, 0, UNKNOWN_ES }
};
+static const size_t codecs_count = sizeof (codecs_table)
+ / sizeof (codecs_table[0]);
+
int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
int *pi_ffmpeg_codec, const char **ppsz_name )
{
i_fourcc = vlc_fourcc_GetCodec( UNKNOWN_ES, i_fourcc );
- for( unsigned i = 0; codecs_table[i].i_fourcc != 0; i++ )
+ for( unsigned i = 0; i < codecs_count; i++ )
{
if( codecs_table[i].i_fourcc == i_fourcc )
{
@@ -470,7 +471,7 @@ int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
int GetVlcFourcc( int i_ffmpeg_codec, int *pi_cat,
vlc_fourcc_t *pi_fourcc, const char **ppsz_name )
{
- for( unsigned i = 0; codecs_table[i].i_codec != 0; i++ )
+ for( unsigned i = 0; i < codecs_count; i++ )
{
if( codecs_table[i].i_codec == i_ffmpeg_codec )
{
More information about the vlc-commits
mailing list