diff options
-rw-r--r-- | include/xine.h.tmpl.in | 31 | ||||
-rw-r--r-- | src/demuxers/demux_asf.c | 5 | ||||
-rw-r--r-- | src/demuxers/demux_avi.c | 5 | ||||
-rw-r--r-- | src/demuxers/demux_qt.c | 8 | ||||
-rw-r--r-- | src/xine-engine/audio_decoder.c | 5 | ||||
-rw-r--r-- | src/xine-engine/buffer_types.c | 6 | ||||
-rw-r--r-- | src/xine-engine/video_decoder.c | 8 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 34 | ||||
-rw-r--r-- | src/xine-engine/xine_internal.h | 22 |
9 files changed, 111 insertions, 13 deletions
diff --git a/include/xine.h.tmpl.in b/include/xine.h.tmpl.in index 1b5d7f4d0..b0c7bd6d4 100644 --- a/include/xine.h.tmpl.in +++ b/include/xine.h.tmpl.in @@ -28,7 +28,7 @@ \endverbatim */ /* - * $Id: xine.h.tmpl.in,v 1.95 2002/05/02 18:59:29 f1rmb Exp $ + * $Id: xine.h.tmpl.in,v 1.96 2002/06/07 04:15:45 miguelfreitas Exp $ * */ @@ -1612,6 +1612,35 @@ void xine_send_event(xine_t *self, xine_event_t *event); /** @} end of event_group */ + +#define XINE_CODEC_AUDIO 0 +#define XINE_CODEC_VIDEO 1 + +/** + * codec reporting callback. + * \param user_data + * \param codec_type type of codec being reported (XINE_CODEC_AUDIO/XINE_CODEC_VIDEO) + * \param fourcc codec identifier (fourcc) in machine endianness + * \param description description or human readable codec name ("" if unkown) + * \param handled if true, the plugin exist and will be used. otherwise it's an error condition (plugin not found or codec unknown) + * \sa xine_register_report_codec_cb + */ +typedef void (*xine_report_codec_t) (void *user_data, int codec_type, + uint32_t fourcc, char *description, int handled); + +/** + * \fn int xine_register_report_codec_cb(xine_t *self, xine_report_codec_t report_codec, void *user_data); + * \param self Current xine engine configuration ( #see xine_init() ) + * \param report_codec callback function. + * \param user_data - will be used as first parameter to callback + * \brief registers a callback function to receive codec information (may change during playback) + * \return 0 if the callback was registerd, non-zero if it could not. + * \sa xine_report_codec_t + */ +int xine_register_report_codec_cb(xine_t *self, xine_report_codec_t report_codec, + void *user_data); + + /** * \fn int xine_get_current_frame (xine_t *self, int *width, int *height, int *ratio_code, int *format, uint8_t **y, uint8_t **u, uint8_t **v) * diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index eb5bada79..6ba986aa3 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.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_asf.c,v 1.43 2002/06/07 02:40:46 miguelfreitas Exp $ + * $Id: demux_asf.c,v 1.44 2002/06/07 04:15:46 miguelfreitas Exp $ * * demultiplexer for asf streams * @@ -334,6 +334,7 @@ static void asf_send_audio_header (demux_asf_t *this, int stream_id) { if ( !this->streams[this->num_streams].buf_type ) { printf ("demux_asf: unknown audio type 0x%x\n", wavex->wFormatTag); + xine_report_codec( this->xine, XINE_CODEC_AUDIO, wavex->wFormatTag, 0, 0); this->streams[this->num_streams].buf_type = BUF_CONTROL_NOP; } else xine_log (this->xine, XINE_LOG_FORMAT, @@ -389,6 +390,8 @@ static void asf_send_video_header (demux_asf_t *this, int stream_id) { printf ("demux_asf: unknown video format %.4s\n", (char*)&bih->biCompression); + xine_report_codec( this->xine, XINE_CODEC_VIDEO, bih->biCompression, 0, 0); + this->status = DEMUX_FINISHED; return; } diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index b41b88555..7978bd3a4 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.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_avi.c,v 1.93 2002/06/07 02:40:46 miguelfreitas Exp $ + * $Id: demux_avi.c,v 1.94 2002/06/07 04:15:46 miguelfreitas Exp $ * * demultiplexer for avi streams * @@ -1240,6 +1240,7 @@ static int demux_avi_start (demux_plugin_t *this_gen, if( !this->avi->audio[i]->audio_type ) { xine_log (this->xine, XINE_LOG_FORMAT, _("demux_avi: unknown audio type 0x%lx\n"), this->avi->audio[i]->wavex->wFormatTag); + xine_report_codec( this->xine, XINE_CODEC_AUDIO, this->avi->audio[i]->wavex->wFormatTag, 0, 0); this->no_audio = 1; this->avi->audio[i]->audio_type = BUF_CONTROL_NOP; } @@ -1364,6 +1365,8 @@ static int demux_avi_start (demux_plugin_t *this_gen, xine_log (this->xine, XINE_LOG_FORMAT, _("demux_avi: unknown video codec '%.4s'\n"), (char*)&this->avi->bih.biCompression); buf->free_buffer (buf); + + xine_report_codec( this->xine, XINE_CODEC_VIDEO, this->avi->bih.biCompression, 0, 0); this->status = DEMUX_FINISHED; } else { diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 7adb9a24a..7c7578393 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -30,7 +30,7 @@ * build_frame_table * free_qt_info * - * $Id: demux_qt.c,v 1.47 2002/06/07 02:48:31 tmmm Exp $ + * $Id: demux_qt.c,v 1.48 2002/06/07 04:15:46 miguelfreitas Exp $ * */ @@ -1253,8 +1253,14 @@ static int demux_qt_start (demux_plugin_t *this_gen, this->bih.biCompression = this->qt->video_codec; this->qt->video_type = fourcc_to_buf_video(this->bih.biCompression); + + if( !this->qt->video_type ) + xine_report_codec( this->xine, XINE_CODEC_VIDEO, this->bih.biCompression, 0, 0); this->qt->audio_type = formattag_to_buf_audio(this->qt->audio_codec); + + if( !this->qt->audio_type ) + xine_report_codec( this->xine, XINE_CODEC_AUDIO, this->qt->audio_codec, 0, 0); /* print vital stats */ xine_log (this->xine, XINE_LOG_FORMAT, diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index f498bfbe7..6bc566875 100644 --- a/src/xine-engine/audio_decoder.c +++ b/src/xine-engine/audio_decoder.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: audio_decoder.c,v 1.74 2002/06/03 20:36:26 miguelfreitas Exp $ + * $Id: audio_decoder.c,v 1.75 2002/06/07 04:15:46 miguelfreitas Exp $ * * * functions that implement audio decoding @@ -226,6 +226,7 @@ void *audio_decoder_loop (void *this_gen) { xine_log (this, XINE_LOG_FORMAT, "audio_decoder: using audio decoder plugin '%s'\n", decoder->get_identifier()); + xine_report_codec( this, XINE_CODEC_AUDIO, 0, buf->type, 1); this->cur_audio_decoder_plugin = decoder; this->cur_audio_decoder_plugin->init (this->cur_audio_decoder_plugin, this->audio_out); @@ -244,6 +245,7 @@ void *audio_decoder_loop (void *this_gen) { else if( buf->type != buftype_unknown ) { xine_log (this, XINE_LOG_MSG, "audio_decoder: no plugin available to handle '%s'\n", buf_audio_name( buf->type ) ); + xine_report_codec( this, XINE_CODEC_AUDIO, 0, buf->type, 0); buftype_unknown = buf->type; } } @@ -251,6 +253,7 @@ void *audio_decoder_loop (void *this_gen) { } else if( buf->type != buftype_unknown ) { xine_log (this, XINE_LOG_MSG, "audio_decoder: unknown buffer type: %08x\n", buf->type ); + xine_report_codec( this, XINE_CODEC_AUDIO, 0, buf->type, 0); buftype_unknown = buf->type; } diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c index f6f4a9902..e482ddd94 100644 --- a/src/xine-engine/buffer_types.c +++ b/src/xine-engine/buffer_types.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: buffer_types.c,v 1.23 2002/06/07 02:40:47 miguelfreitas Exp $ + * $Id: buffer_types.c,v 1.24 2002/06/07 04:15:46 miguelfreitas Exp $ * * * contents: @@ -599,7 +599,7 @@ int i; } } - return "unknown"; + return ""; } uint32_t formattag_to_buf_audio( uint32_t formattag ) { @@ -633,7 +633,7 @@ int i; } } - return "unknow"; + return ""; } void xine_bmiheader_le2me( xine_bmiheader *bih ) { diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index d061520a8..0c8524bb9 100644 --- a/src/xine-engine/video_decoder.c +++ b/src/xine-engine/video_decoder.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: video_decoder.c,v 1.86 2002/06/03 20:36:26 miguelfreitas Exp $ + * $Id: video_decoder.c,v 1.87 2002/06/07 04:15:46 miguelfreitas Exp $ * */ @@ -257,19 +257,23 @@ void *video_decoder_loop (void *this_gen) { xine_log (this, XINE_LOG_FORMAT, "using video decoder plugin '%s'\n", decoder->get_identifier()); + + xine_report_codec( this, XINE_CODEC_VIDEO, 0, buf->type, 1); } decoder->decode_data (this->cur_video_decoder_plugin, buf); } else if( buf->type != buftype_unknown ) { - xine_log (this, XINE_LOG_MSG, "video_decoder: no plugin available to handle '%s'\n", + xine_log (this, XINE_LOG_MSG, "video_decoder: no plugin available to handle '%s'\n", buf_video_name( buf->type ) ); + xine_report_codec( this, XINE_CODEC_VIDEO, 0, buf->type, 0); buftype_unknown = buf->type; } } else if( buf->type != buftype_unknown ) { xine_log (this, XINE_LOG_MSG, "video_decoder: unknown buffer type: %08x\n", buf->type ); + xine_report_codec( this, XINE_CODEC_VIDEO, 0, buf->type, 0); buftype_unknown = buf->type; } diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 21dd8ce7a..083bf2910 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.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: xine.c,v 1.135 2002/06/07 02:40:47 miguelfreitas Exp $ + * $Id: xine.c,v 1.136 2002/06/07 04:15:46 miguelfreitas Exp $ * * top-level xine functions * @@ -139,6 +139,35 @@ void xine_notify_stream_finished (xine_t *this) { } } +void xine_report_codec( xine_t *this, int codec_type, uint32_t fourcc, uint32_t buf_type, int handled ) { + + if( this->report_codec_cb ) { + if( codec_type == XINE_CODEC_VIDEO ) { + if( !buf_type ) + buf_type = fourcc_to_buf_video( fourcc ); + + this->report_codec_cb( this->report_codec_user_data, + codec_type, fourcc, + buf_video_name( buf_type ), handled ); + } else { + if( !buf_type ) + buf_type = formattag_to_buf_audio( fourcc ); + + this->report_codec_cb( this->report_codec_user_data, + codec_type, fourcc, + buf_audio_name( buf_type ), handled ); + } + } +} + +int xine_register_report_codec_cb(xine_t *this, xine_report_codec_t report_codec, + void *user_data) { + + this->report_codec_cb = report_codec; + this->report_codec_user_data = user_data; + return 0; +} + static void xine_internal_osd (xine_t *this, char *str, uint32_t start_time, uint32_t duration) { @@ -595,7 +624,8 @@ xine_t *xine_init (vo_driver_t *vo, this->num_event_listeners = 0; /* Initially there are none */ this->cur_input_plugin = NULL; /* In case the input plugin event handlers * are called too early. */ - this->cur_spu_decoder_plugin = NULL; + this->cur_spu_decoder_plugin = NULL; + this->report_codec_cb = NULL; /* * create a metronom diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index f5def8794..0342acd2d 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.86 2002/06/07 02:40:47 miguelfreitas Exp $ + * $Id: xine_internal.h,v 1.87 2002/06/07 04:15:46 miguelfreitas Exp $ * */ @@ -151,6 +151,12 @@ struct audio_decoder_s { typedef void (*xine_event_listener_t) (void *user_data, xine_event_t *); +#define XINE_CODEC_AUDIO 0 +#define XINE_CODEC_VIDEO 1 + +typedef void (*xine_report_codec_t) (void *user_data, int codec_type, + uint32_t fourcc, char *description, int handled); + struct xine_s { /* private : */ @@ -250,6 +256,9 @@ struct xine_s { pthread_t finished_thread; int finished_thread_running; + + xine_report_codec_t report_codec_cb; + void *report_codec_user_data; }; /* @@ -428,6 +437,7 @@ char **xine_get_autoplay_mrls (xine_t *this, char *plugin_id, int *num_mrls); */ void xine_notify_stream_finished (xine_t *this); +void xine_report_codec( xine_t *this, int codec_type, uint32_t fourcc, uint32_t buf_type, int handled ); /* * video decoder stuff @@ -588,6 +598,16 @@ int xine_remove_event_listener(xine_t *this, xine_event_listener_t listener); void xine_send_event(xine_t *this, xine_event_t *event); /* + * register an codec reporting callback. + * return 0 if ok + * obs: set to NULL to unregister + */ + +int xine_register_report_codec_cb(xine_t *this, xine_report_codec_t report_codec, + void *user_data); + + +/* * snapshot function * * returns: |