From f16fcc17768b9d104d90ba3ab1b4fbd57bbec17a Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Fri, 7 Jul 2017 09:33:17 +0200 Subject: [PATCH] vlc_fourcc: add a define for "undf" (unidentified codec) Technically it could be set to 0 Signed-off-by: Jean-Baptiste Kempf --- include/vlc_codecs.h | 4 ++-- include/vlc_fourcc.h | 2 ++ modules/access/live555.cpp | 6 +++--- modules/demux/avformat/demux.c | 2 +- modules/demux/avi/avi.c | 2 +- modules/demux/mkv/matroska_segment_parse.cpp | 14 +++++++------- modules/demux/ogg.c | 6 ++---- src/input/decoder.c | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/vlc_codecs.h b/include/vlc_codecs.h index 950c09fd14..c02cd6df75 100644 --- a/include/vlc_codecs.h +++ b/include/vlc_codecs.h @@ -381,7 +381,7 @@ wave_format_tag_to_fourcc[] = { WAVE_FORMAT_ON2_AVC, VLC_CODEC_ON2AVC, "On2 Audio for Video Codec (VP7)" }, { WAVE_FORMAT_ON2_AVC_2, VLC_CODEC_ON2AVC, "On2 Audio for Video Codec (VP6)" }, - { WAVE_FORMAT_UNKNOWN, VLC_FOURCC( 'u', 'n', 'd', 'f' ), "Unknown" } + { WAVE_FORMAT_UNKNOWN, VLC_CODEC_UNKNOWN, "Unknown" } }; static inline void wf_tag_to_fourcc( uint16_t i_tag, vlc_fourcc_t *fcc, @@ -421,7 +421,7 @@ sub_format_tag_to_fourcc[] = { VLC_AMBISONIC_SUBTYPE_PCM, VLC_FOURCC( 'a', 'r', 'a', 'w' ), "Ambisonic B format (PCM)" }, { VLC_AMBISONIC_SUBTYPE_IEEE_FLOAT, VLC_FOURCC( 'a', 'f', 'l', 't' ), "Ambisonic B format (IEEE float)" }, { VLC_KSDATAFORMAT_SUBTYPE_ATRAC3P, VLC_CODEC_ATRAC3P, "Sony Atrac3+" }, - { VLC_KSDATAFORMAT_SUBTYPE_UNKNOWN, VLC_FOURCC( 'u', 'n', 'd', 'f' ), "Unknown" } + { VLC_KSDATAFORMAT_SUBTYPE_UNKNOWN, VLC_CODEC_UNKNOWN, "Unknown" } }; static inline int guidcmpbase( const GUID *s1, const GUID *s2 ) diff --git a/include/vlc_fourcc.h b/include/vlc_fourcc.h index b4c4d26bc7..ea96d50591 100644 --- a/include/vlc_fourcc.h +++ b/include/vlc_fourcc.h @@ -24,6 +24,8 @@ #ifndef VLC_FOURCC_H #define VLC_FOURCC_H 1 +#define VLC_CODEC_UNKNOWN VLC_FOURCC('u','n','d','f') + /* Video codec */ #define VLC_CODEC_MPGV VLC_FOURCC('m','p','g','v') #define VLC_CODEC_MP4V VLC_FOURCC('m','p','4','v') diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp index a071f53e82..c259455ac9 100644 --- a/modules/access/live555.cpp +++ b/modules/access/live555.cpp @@ -854,7 +854,7 @@ static int SessionsSetup( demux_t *p_demux ) /* Value taken from mplayer */ if( !strcmp( sub->mediumName(), "audio" ) ) { - es_format_Init( &tk->fmt, AUDIO_ES, VLC_FOURCC('u','n','d','f') ); + es_format_Init( &tk->fmt, AUDIO_ES, VLC_CODEC_UNKNOWN ); tk->fmt.audio.i_channels = sub->numChannels(); tk->fmt.audio.i_rate = sub->rtpTimestampFrequency(); @@ -1001,7 +1001,7 @@ static int SessionsSetup( demux_t *p_demux ) } else if( !strcmp( sub->mediumName(), "video" ) ) { - es_format_Init( &tk->fmt, VIDEO_ES, VLC_FOURCC('u','n','d','f') ); + es_format_Init( &tk->fmt, VIDEO_ES, VLC_CODEC_UNKNOWN ); if( !strcmp( sub->codecName(), "MPV" ) ) { tk->fmt.i_codec = VLC_CODEC_MPGV; @@ -1149,7 +1149,7 @@ static int SessionsSetup( demux_t *p_demux ) } else if( !strcmp( sub->mediumName(), "text" ) ) { - es_format_Init( &tk->fmt, SPU_ES, VLC_FOURCC('u','n','d','f') ); + es_format_Init( &tk->fmt, SPU_ES, VLC_CODEC_UNKNOWN ); if( !strcmp( sub->codecName(), "T140" ) ) { diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c index 5206c36ca2..5bee83b00b 100644 --- a/modules/demux/avformat/demux.c +++ b/modules/demux/avformat/demux.c @@ -360,7 +360,7 @@ int OpenDemux( vlc_object_t *p_this ) const char *psz_type = "unknown"; vlc_fourcc_t fcc = GetVlcFourcc( cp->codec_id ); if( !fcc ) - fcc = VLC_FOURCC( 'u', 'n', 'd', 'f' ); + fcc = VLC_CODEC_UNKNOWN; /* Do not use the cover art as a stream */ if( s->disposition == AV_DISPOSITION_ATTACHED_PIC ) diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c index da8a9f640a..c0f47ac1a8 100644 --- a/modules/demux/avi/avi.c +++ b/modules/demux/avi/avi.c @@ -2141,7 +2141,7 @@ vlc_fourcc_t AVI_FourccGetCodec( unsigned int i_cat, vlc_fourcc_t i_codec ) case VIDEO_ES: return vlc_fourcc_GetCodec( i_cat, i_codec ); default: - return VLC_FOURCC( 'u', 'n', 'd', 'f' ); + return VLC_CODEC_UNKNOWN; } } diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp index d640bc4b29..63a9d0cf58 100644 --- a/modules/demux/mkv/matroska_segment_parse.cpp +++ b/modules/demux/mkv/matroska_segment_parse.cpp @@ -1335,7 +1335,7 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk ) if( p_tk->codec.empty() ) { msg_Err( &sys.demuxer, "Empty codec id" ); - p_tk->fmt.i_codec = VLC_FOURCC( 'u', 'n', 'd', 'f' ); + p_tk->fmt.i_codec = VLC_CODEC_UNKNOWN; return 0; } @@ -1356,7 +1356,7 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk ) if( vars.p_tk->i_extra_data < (int)sizeof( VLC_BITMAPINFOHEADER ) ) { msg_Err(vars.p_demuxer, "missing/invalid VLC_BITMAPINFOHEADER" ); - vars.p_fmt->i_codec = VLC_FOURCC( 'u', 'n', 'd', 'f' ); + vars.p_fmt->i_codec = VLC_CODEC_UNKNOWN; } else { @@ -1511,7 +1511,7 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk ) if( p_tk->i_extra_data < (int)sizeof( WAVEFORMATEX ) ) { msg_Err( vars.p_demuxer, "missing/invalid WAVEFORMATEX" ); - p_tk->fmt.i_codec = VLC_FOURCC( 'u', 'n', 'd', 'f' ); + p_tk->fmt.i_codec = VLC_CODEC_UNKNOWN; } else { @@ -1541,7 +1541,7 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk ) /* FIXME should we use Samples */ if( p_tk->fmt.audio.i_channels > 2 && - ( p_tk->fmt.i_codec != VLC_FOURCC( 'u', 'n', 'd', 'f' ) ) ) + ( p_tk->fmt.i_codec != VLC_CODEC_UNKNOWN ) ) { uint32_t wfextcm = GetDWLE( &p_wext->dwChannelMask ); int match; @@ -1575,7 +1575,7 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk ) } } - if( p_tk->fmt.i_codec == VLC_FOURCC( 'u', 'n', 'd', 'f' ) ) + if( p_tk->fmt.i_codec == VLC_CODEC_UNKNOWN ) msg_Err( vars.p_demuxer, "Unrecognized wf tag: 0x%x", GetWLE( &p_wf->wFormatTag ) ); } p_fmt->b_packetized = !p_fmt->audio.i_blockalign; @@ -1743,7 +1743,7 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk ) if( memcmp( p, ".ra", 3 ) ) { msg_Err( vars.p_demuxer, "Invalid Real ExtraData 0x%4.4s", (char *)p ); - vars.p_tk->fmt.i_codec = VLC_FOURCC( 'u', 'n', 'd', 'f' ); + vars.p_tk->fmt.i_codec = VLC_CODEC_UNKNOWN; return false; } @@ -1923,7 +1923,7 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk ) } S_CASE_DEFAULT(str) { msg_Err( vars.p_demuxer, "unknown codec id=`%s'", str ); - vars.p_tk->fmt.i_codec = VLC_FOURCC( 'u', 'n', 'd', 'f' ); + vars.p_tk->fmt.i_codec = VLC_CODEC_UNKNOWN; } }; diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c index 8c4c9df0b3..38b06006b4 100644 --- a/modules/demux/ogg.c +++ b/modules/demux/ogg.c @@ -1851,8 +1851,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux ) wf_tag_to_fourcc( i_format_tag, &p_stream->fmt.i_codec, 0 ); - if( p_stream->fmt.i_codec == - VLC_FOURCC('u','n','d','f') ) + if( p_stream->fmt.i_codec == VLC_CODEC_UNKNOWN ) { p_stream->fmt.i_codec = VLC_FOURCC( 'm', 's', ( i_format_tag >> 8 ) & 0xff, @@ -1986,8 +1985,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux ) wf_tag_to_fourcc( i_format_tag, &p_stream->fmt.i_codec, 0 ); - if( p_stream->fmt.i_codec == - VLC_FOURCC('u','n','d','f') ) + if( p_stream->fmt.i_codec == VLC_CODEC_UNKNOWN ) { p_stream->fmt.i_codec = VLC_FOURCC( 'm', 's', ( i_format_tag >> 8 ) & 0xff, diff --git a/src/input/decoder.c b/src/input/decoder.c index 9678a1ed5f..c28c953a59 100644 --- a/src/input/decoder.c +++ b/src/input/decoder.c @@ -1872,7 +1872,7 @@ static void DeleteDecoder( decoder_t * p_dec ) /* */ static void DecoderUnsupportedCodec( decoder_t *p_dec, const es_format_t *fmt, bool b_decoding ) { - if (fmt->i_codec != VLC_FOURCC('u','n','d','f') && fmt->i_codec) { + if (fmt->i_codec != VLC_CODEC_UNKNOWN && fmt->i_codec) { const char *desc = vlc_fourcc_GetDescription(fmt->i_cat, fmt->i_codec); if (!desc || !*desc) desc = N_("No description for this codec");