diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2006-08-12 01:43:26 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2006-08-12 01:43:26 +0000 |
commit | af78d2543c41a5407e688b077c664cc6d386bc97 (patch) | |
tree | 5fed63fcd8567674d4689c4777f17af6d6a7c991 | |
parent | d5bd5710c23300e1ba95ff596556f25317993de7 (diff) | |
download | xine-lib-af78d2543c41a5407e688b077c664cc6d386bc97.tar.gz xine-lib-af78d2543c41a5407e688b077c664cc6d386bc97.tar.bz2 |
don't report extensions/mimetypes if required decoder is missing
(implemented for mp3 demuxer only)
CVS patchset: 8177
CVS date: 2006/08/12 01:43:26
-rw-r--r-- | src/demuxers/demux_mpgaudio.c | 34 | ||||
-rw-r--r-- | src/xine-engine/load_plugins.c | 23 | ||||
-rw-r--r-- | src/xine-engine/xine_internal.h | 4 |
3 files changed, 47 insertions, 14 deletions
diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 01ab11fbd..f1a534380 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpgaudio.c,v 1.143 2005/10/02 14:15:17 tmattern Exp $ + * $Id: demux_mpgaudio.c,v 1.144 2006/08/12 01:43:26 miguelfreitas Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -1040,20 +1040,30 @@ static char *get_identifier (demux_class_t *this_gen) { } static char *get_extensions (demux_class_t *this_gen) { - return "mp3 mp2 mpa mpega"; + demux_mpgaudio_class_t *this = (demux_mpgaudio_class_t *) this_gen; + + if( _x_decoder_available(this->xine, BUF_AUDIO_MPEG) ) + return "mp3 mp2 mpa mpega"; + else + return ""; } static char *get_mimetypes (demux_class_t *this_gen) { - return "audio/mpeg2: mp2: MPEG audio;" - "audio/x-mpeg2: mp2: MPEG audio;" - "audio/mpeg3: mp3: MPEG audio;" - "audio/x-mpeg3: mp3: MPEG audio;" - "audio/mpeg: mpa,abs,mpega: MPEG audio;" - "audio/x-mpeg: mpa,abs,mpega: MPEG audio;" - "x-mpegurl: mp3: MPEG audio;" - "audio/mpegurl: mp3: MPEG audio;" - "audio/mp3: mp3: MPEG audio;" - "audio/x-mp3: mp3: MPEG audio;"; + demux_mpgaudio_class_t *this = (demux_mpgaudio_class_t *) this_gen; + + if( _x_decoder_available(this->xine, BUF_AUDIO_MPEG) ) + return "audio/mpeg2: mp2: MPEG audio;" + "audio/x-mpeg2: mp2: MPEG audio;" + "audio/mpeg3: mp3: MPEG audio;" + "audio/x-mpeg3: mp3: MPEG audio;" + "audio/mpeg: mpa,abs,mpega: MPEG audio;" + "audio/x-mpeg: mpa,abs,mpega: MPEG audio;" + "x-mpegurl: mp3: MPEG audio;" + "audio/mpegurl: mp3: MPEG audio;" + "audio/mp3: mp3: MPEG audio;" + "audio/x-mp3: mp3: MPEG audio;"; + else + return ""; } static void class_dispose (demux_class_t *this_gen) { diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index dbd6007fd..8de61a103 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: load_plugins.c,v 1.223 2006/07/21 03:31:42 dgp85 Exp $ + * $Id: load_plugins.c,v 1.224 2006/08/12 01:43:26 miguelfreitas Exp $ * * * Load input/demux/audio_out/video_out/codec plugins @@ -1932,6 +1932,27 @@ void _x_free_audio_decoder (xine_stream_t *stream, audio_decoder_t *ad) { } } +int _x_decoder_available (xine_t *xine, uint32_t buftype) +{ + plugin_catalog_t *catalog = xine->plugin_catalog; + int stream_type = (buftype>>16) & 0xFF; + + if ( (buftype & 0xFF000000) == BUF_VIDEO_BASE ) { + if( catalog->video_decoder_map[stream_type][0] ) + return 1; + } else + if ( (buftype & 0xFF000000) == BUF_AUDIO_BASE ) { + if( catalog->audio_decoder_map[stream_type][0] ) + return 1; + } else + if ( (buftype & 0xFF000000) == BUF_SPU_BASE ) { + if( catalog->spu_decoder_map[stream_type][0] ) + return 1; + } + + return 0; +} + #ifdef LOG static void _display_file_plugin_list (xine_list_t *list, plugin_file_t *file) { diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 05a9144d6..ae0e235e8 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_internal.h,v 1.173 2006/08/08 03:25:03 miguelfreitas Exp $ + * $Id: xine_internal.h,v 1.174 2006/08/12 01:43:26 miguelfreitas Exp $ * */ @@ -453,6 +453,8 @@ audio_decoder_t *_x_get_audio_decoder (xine_stream_t *stream, uint8_t stream_ty void _x_free_audio_decoder (xine_stream_t *stream, audio_decoder_t *decoder); spu_decoder_t *_x_get_spu_decoder (xine_stream_t *stream, uint8_t stream_type); void _x_free_spu_decoder (xine_stream_t *stream, spu_decoder_t *decoder); +/* check for decoder availability - but don't try to initialize it */ +int _x_decoder_available (xine_t *xine, uint32_t buftype); /* * load_video_output_plugin |