From 1258f00aaa71c16800717caf628f69f2e8e6f4ca Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 4 Feb 2008 18:16:37 +0000 Subject: Report the identifiers of unrecognised video & audio codecs. --- include/xine/xineutils.h | 6 ++++++ src/combined/xine_ogg_demuxer.c | 9 +++++++-- src/demuxers/demux_asf.c | 9 +++------ src/demuxers/demux_avi.c | 11 +++++++++-- src/demuxers/demux_film.c | 4 ++++ src/demuxers/demux_matroska.c | 4 ++++ src/demuxers/demux_nsv.c | 8 ++++++++ src/demuxers/demux_qt.c | 8 ++++++++ src/demuxers/demux_real.c | 6 ++++++ src/demuxers/demux_smjpeg.c | 4 ++++ src/xine-engine/buffer_types.c | 39 +++++++++++++++++++++++++++++++++++++++ 11 files changed, 98 insertions(+), 10 deletions(-) diff --git a/include/xine/xineutils.h b/include/xine/xineutils.h index 5f052ee58..438954557 100644 --- a/include/xine/xineutils.h +++ b/include/xine/xineutils.h @@ -954,6 +954,12 @@ int xine_monotonic_clock(struct timeval *tv, struct timezone *tz) XINE_PROTECTED */ uint32_t _x_compute_crc32 (const uint8_t * data, int32_t length, uint32_t crc32) XINE_PROTECTED; +/** + * Unknown FourCC reporting functions + */ +void _x_report_video_fourcc (xine_t *, const char *module, uint32_t) XINE_PROTECTED; +void _x_report_audio_format_tag (xine_t *, const char *module, uint32_t) XINE_PROTECTED; + /* don't harm following code */ #ifdef extern # undef extern diff --git a/src/combined/xine_ogg_demuxer.c b/src/combined/xine_ogg_demuxer.c index b09bc1a41..88fcea08a 100644 --- a/src/combined/xine_ogg_demuxer.c +++ b/src/combined/xine_ogg_demuxer.c @@ -892,7 +892,10 @@ static void decode_video_header (demux_ogg_t *this, const int stream_num, ogg_pa this->si[stream_num]->buf_types = _x_fourcc_to_buf_video (locsubtype); if( !this->si[stream_num]->buf_types ) + { this->si[stream_num]->buf_types = BUF_VIDEO_UNKNOWN; + _x_report_video_fourcc (this->stream->xine, LOG_MODULE, locsubtype); + } this->si[stream_num]->buf_types |= channel; this->si[stream_num]->headers = 0; /* header is sent below */ @@ -977,9 +980,8 @@ static void decode_audio_header (demux_ogg_t *this, const int stream_num, ogg_pa if( this->si[stream_num]->buf_types ) { this->si[stream_num]->buf_types |= channel; } else { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, - "demux_ogg: unknown audio codec type 0x%x\n", codec); this->si[stream_num]->buf_types = BUF_AUDIO_UNKNOWN; + _x_report_audio_format_tag (this->stream->xine, LOG_MODULE, codec); /*break;*/ } @@ -1044,7 +1046,10 @@ static void decode_dshow_header (demux_ogg_t *this, const int stream_num, ogg_pa this->si[stream_num]->buf_types = _x_fourcc_to_buf_video (fcc); if( !this->si[stream_num]->buf_types ) + { this->si[stream_num]->buf_types = BUF_VIDEO_UNKNOWN; + _x_report_video_fourcc (this->stream->xine, LOG_MODULE, fcc); + } this->si[stream_num]->buf_types |= channel; bih.biSize = sizeof(xine_bmiheader); diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index 827557333..73f70eeb3 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.c @@ -464,10 +464,9 @@ static int asf_read_header (demux_asf_t *this) { demux_stream->buf_type = _x_formattag_to_buf_audio ( ((xine_waveformatex *)asf_stream->private_data)->wFormatTag ); if ( !demux_stream->buf_type ) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, - "demux_asf: unknown audio type 0x%x\n", - ((xine_waveformatex *)asf_stream->private_data)->wFormatTag); demux_stream->buf_type = BUF_AUDIO_UNKNOWN; + _x_report_audio_format_tag (this->stream->xine, LOG_MODULE, + ((xine_waveformatex *)asf_stream->private_data)->wFormatTag); } _x_meta_info_set(this->stream, XINE_META_INFO_AUDIOCODEC, _x_buf_audio_name(demux_stream->buf_type)); @@ -510,10 +509,8 @@ static int asf_read_header (demux_asf_t *this) { demux_stream->buf_type = _x_fourcc_to_buf_video(bmiheader->biCompression); if( !demux_stream->buf_type ) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, - "demux_asf: unknown video format %.4s\n", (char*)&(bmiheader->biCompression)); - demux_stream->buf_type = BUF_VIDEO_UNKNOWN; + _x_report_video_fourcc (this->stream->xine, LOG_MODULE, bmiheader->biCompression); } _x_meta_info_set(this->stream, XINE_META_INFO_VIDEOCODEC, _x_buf_video_name(demux_stream->buf_type)); diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index 239517777..27dfce443 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.c @@ -1871,7 +1871,12 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) { if (!this->avi->bih->biCompression) this->avi->video_type = BUF_VIDEO_RGB; else + { this->avi->video_type = _x_fourcc_to_buf_video(this->avi->bih->biCompression); + if (!this->avi->video_type) + _x_report_video_fourcc (this->stream->xine, LOG_MODULE, + this->avi->bih->biCompression); + } for(i=0; i < this->avi->n_audio; i++) { this->avi->audio[i]->audio_type = _x_formattag_to_buf_audio (this->avi->audio[i]->wavex->wFormatTag); @@ -1884,10 +1889,10 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) { } if( !this->avi->audio[i]->audio_type ) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "unknown audio type 0x%x\n", - this->avi->audio[i]->wavex->wFormatTag); this->no_audio = 1; this->avi->audio[i]->audio_type = BUF_AUDIO_UNKNOWN; + _x_report_audio_format_tag (this->stream->xine, LOG_MODULE, + this->avi->audio[i]->wavex->wFormatTag); } else xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_avi: audio type %s (wFormatTag 0x%x)\n", _x_buf_audio_name(this->avi->audio[i]->audio_type), @@ -1949,6 +1954,8 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) { this->avi->compressor = this->avi->bih->biCompression; } else { this->avi->video_type = _x_fourcc_to_buf_video(this->avi->compressor); + if (!this->avi->video_type) + _x_fourcc_to_buf_video(this->avi->bih->biCompression); } _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_FOURCC, diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c index cc9e90d66..193d8850b 100644 --- a/src/demuxers/demux_film.c +++ b/src/demuxers/demux_film.c @@ -201,7 +201,11 @@ static int open_film_file(demux_film_t *film) { film->video_type = _x_fourcc_to_buf_video(*(uint32_t *)&film_header[i + 8]); if( !film->video_type ) + { film->video_type = BUF_VIDEO_UNKNOWN; + _x_report_video_fourcc (film->stream->xine, LOG_MODULE, + *(uint32_t *)&film_header[i + 8]); + } /* fetch the audio information if the chunk size checks out */ if (chunk_size == 32) { diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 9b32f02c9..ae71923d6 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -1303,6 +1303,8 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { _x_bmiheader_le2me(bih); track->buf_type = _x_fourcc_to_buf_video(bih->biCompression); + if (!track->buf_type) + _x_report_video_fourcc (this->stream->xine, LOG_MODULE, bih->biCompression); init_codec = init_codec_video; } else if (!strcmp(track->codec_id, MATROSKA_CODEC_ID_V_UNCOMPRESSED)) { @@ -1413,6 +1415,8 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { _x_waveformatex_le2me(wfh); track->buf_type = _x_formattag_to_buf_audio(wfh->wFormatTag); + if (!track->buf_type) + _x_report_audio_format_tag (this->stream->xine, LOG_MODULE, wfh->wFormatTag); init_codec = init_codec_audio; } else if (!strncmp(track->codec_id, MATROSKA_CODEC_ID_A_AAC, sizeof(MATROSKA_CODEC_ID_A_AAC) - 1)) { diff --git a/src/demuxers/demux_nsv.c b/src/demuxers/demux_nsv.c index 74f98c7cd..43b1fbc88 100644 --- a/src/demuxers/demux_nsv.c +++ b/src/demuxers/demux_nsv.c @@ -305,13 +305,21 @@ static int open_nsv_file(demux_nsv_t *this) { if (_X_BE_32(&preview[4]) == NONE_TAG) this->video_type = 0; else + { this->video_type = _x_fourcc_to_buf_video(this->video_fourcc); + if (!this->video_type) + _x_report_video_fourcc (this->stream->xine, LOG_MODULE, this->video_fourcc); + } this->audio_fourcc = _X_ME_32(&preview[8]); if (_X_BE_32(&preview[8]) == NONE_TAG) this->audio_type = 0; else + { this->audio_type = _x_formattag_to_buf_audio(this->audio_fourcc); + if (!this->audio_type) + _x_report_audio_format_tag (this->stream->xine, LOG_MODULE, this->audio_fourcc); + } this->bih.biSize = sizeof(this->bih); this->bih.biWidth = _X_LE_16(&preview[12]); diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 6b2aa5eea..ecd2c319a 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -2628,7 +2628,11 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { if( !video_trak->properties->video.codec_buftype && video_trak->properties->video.codec_fourcc ) + { video_trak->properties->video.codec_buftype = BUF_VIDEO_UNKNOWN; + _x_report_video_fourcc (this->stream->xine, LOG_MODULE, + video_trak->properties->video.codec_fourcc); + } _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 1); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, @@ -2670,7 +2674,11 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { if( !audio_trak->properties->audio.codec_buftype && audio_trak->properties->audio.codec_fourcc ) + { audio_trak->properties->audio.codec_buftype = BUF_AUDIO_UNKNOWN; + _x_report_audio_format_tag (this->stream->xine, LOG_MODULE, + audio_trak->properties->audio.codec_fourcc); + } _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS, diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index 8f6ce0611..41c6fb4a2 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -459,6 +459,9 @@ static void real_parse_headers (demux_real_t *this) { this->num_audio_streams++; + if (!this->audio_streams[this->num_audio_streams].buf_type) + _x_report_audio_format_tag (this->stream->xine, LOG_MODULE, fourcc); + } else if(_X_BE_32(mdpr->type_specific_data + 4) == VIDO_TAG) { if(this->num_video_streams == MAX_VIDEO_STREAMS) { @@ -479,6 +482,9 @@ static void real_parse_headers (demux_real_t *this) { this->num_video_streams++; + if (!this->video_streams[this->num_video_streams].buf_type) + _x_report_video_fourcc (this->stream->xine, LOG_MODULE, fourcc); + } else { lprintf("unrecognised type specific data\n"); diff --git a/src/demuxers/demux_smjpeg.c b/src/demuxers/demux_smjpeg.c index 10cdf8120..d9b436032 100644 --- a/src/demuxers/demux_smjpeg.c +++ b/src/demuxers/demux_smjpeg.c @@ -147,6 +147,8 @@ static int open_smjpeg_file(demux_smjpeg_t *this) { this->bih.biHeight = _X_BE_16(&header_chunk[10]); this->bih.biCompression = *(uint32_t *)&header_chunk[12]; this->video_type = _x_fourcc_to_buf_video(this->bih.biCompression); + if (!this->video_type) + _x_report_video_fourcc (this->stream->xine, LOG_MODULE, this->bih.biCompression); break; case _SND_TAG: @@ -166,6 +168,8 @@ static int open_smjpeg_file(demux_smjpeg_t *this) { } else { audio_codec = *(uint32_t *)&header_chunk[8]; this->audio_type = _x_formattag_to_buf_audio(audio_codec); + if (!this->audio_type) + _x_report_audio_format_tag (this->stream->xine, LOG_MODULE, audio_codec); } break; diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c index c7b6ae860..b0e01db31 100644 --- a/src/xine-engine/buffer_types.c +++ b/src/xine-engine/buffer_types.c @@ -33,6 +33,8 @@ #include #include #include +#include +#include #include "bswap.h" typedef struct video_db_s { @@ -1209,6 +1211,43 @@ int i; return ""; } + +static void code_to_text (char ascii[5], uint32_t code) +{ + int i; + for (i = 0; i < 4; ++i) + { + int byte = code & 0xFF; + ascii[i] = (byte < ' ') ? ' ' : (byte >= 0x7F) ? '.' : (char) byte; + code >>= 8; + } +} + +void _x_report_video_fourcc (xine_t *xine, const char *module, uint32_t code) +{ + if (code) + { + char ascii[5]; + code_to_text (ascii, code); + xprintf (xine, XINE_VERBOSITY_LOG, + _("%s: unknown video FourCC code %#x \"%s\"\n"), + module, code, ascii); + } +} + +void _x_report_audio_format_tag (xine_t *xine, const char *module, uint32_t code) +{ + if (code) + { + char ascii[5]; + code_to_text (ascii, code); + xprintf (xine, XINE_VERBOSITY_LOG, + _("%s: unknown audio format tag code %#x \"%s\"\n"), + module, code, ascii); + } +} + + void _x_bmiheader_le2me( xine_bmiheader *bih ) { /* OBS: fourcc must be read using machine endianness * so don't play with biCompression here! -- cgit v1.2.3