diff options
author | Bastien Nocera <hadess@hadess.net> | 2003-01-22 23:40:26 +0000 |
---|---|---|
committer | Bastien Nocera <hadess@src.gnome.org> | 2003-01-22 23:40:26 +0000 |
commit | c4ae39bf545d17527119426213dcf7be1671a6c9 (patch) | |
tree | 3cbe6a3232cb212205ccf953ef755c0d62861a47 /src | |
parent | e69d5a98227d428257931d34786eee0e982a62d0 (diff) | |
download | totem-c4ae39bf545d17527119426213dcf7be1671a6c9.tar.gz |
boatloads of little fixes for crashers and don't skip files on error
2003-01-22 Bastien Nocera <hadess@hadess.net>
* src/gtk-xine.c: (get_fourcc_string), (gtk_xine_open),
(gtk_xine_stop), (gtk_xine_close), (gtk_xine_get_position),
(gtk_xine_can_set_volume), (gtk_xine_get_volume),
(gtk_xine_get_stream_length), (gtk_xine_get_metadata_string),
(gtk_xine_get_metadata_int), (gtk_xine_get_metadata_bool),
(gtk_xine_get_metadata):
* src/totem.c: (on_error_event): boatloads of little fixes for
crashers and don't skip files on error
Diffstat (limited to 'src')
-rw-r--r-- | src/gtk-xine.c | 47 | ||||
-rw-r--r-- | src/totem.c | 8 |
2 files changed, 38 insertions, 17 deletions
diff --git a/src/gtk-xine.c b/src/gtk-xine.c index cabd411ef..42916bf4a 100644 --- a/src/gtk-xine.c +++ b/src/gtk-xine.c @@ -1171,7 +1171,7 @@ gtk_xine_size_allocate (GtkWidget *widget, GtkAllocation *allocation) static char * get_fourcc_string (uint32_t f) { - char fcc[5]; + static char fcc[5]; memset(&fcc, 0, sizeof(fcc)); @@ -1191,7 +1191,7 @@ get_fourcc_string (uint32_t f) *(uint32_t *) fcc = 0x33706d2e; /* Force to '.mp3' */ } - return g_strdup (&fcc[0]); + return &fcc[0]; } @@ -1210,6 +1210,7 @@ gtk_xine_open (GtkXine *gtx, const gchar *mrl) error = xine_open (gtx->priv->stream, mrl); if (error == 0) { + gtk_xine_close (gtx); xine_error (gtx); return FALSE; } @@ -1241,7 +1242,7 @@ gtk_xine_open (GtkXine *gtx, const gchar *mrl) D("Reason: Video type '%s' is not handled.", name ? name : fourcc_str ); - g_free (fourcc_str); +// g_free (fourcc_str); return FALSE; } @@ -1298,9 +1299,6 @@ gtk_xine_stop (GtkXine *gtx) g_return_if_fail (GTK_IS_XINE (gtx)); g_return_if_fail (gtx->priv->xine != NULL); - if (gtx->priv->stream == NULL) - return; - if (gtk_xine_is_playing (gtx) == FALSE) return; @@ -1314,9 +1312,6 @@ gtk_xine_close (GtkXine *gtx) g_return_if_fail (GTK_IS_XINE (gtx)); g_return_if_fail (gtx->priv->xine != NULL); - if (gtx->priv->stream == NULL) - return; - xine_close (gtx->priv->stream); g_free (gtx->priv->mrl); } @@ -1423,6 +1418,9 @@ gtk_xine_get_position (GtkXine *gtx) g_return_val_if_fail (GTK_IS_XINE (gtx), 0); g_return_val_if_fail (gtx->priv->xine != NULL, 0); + if (gtx->priv->mrl == NULL) + return 0; + if (gtk_xine_is_playing (gtx) == FALSE) return 0; @@ -1559,9 +1557,6 @@ gtk_xine_can_set_volume (GtkXine *gtx) g_return_val_if_fail (GTK_IS_XINE (gtx), 0); g_return_val_if_fail (gtx->priv->xine != NULL, 0); - if (gtx->priv->stream == NULL) - return FALSE; - if (xine_get_param (gtx->priv->stream, XINE_PARAM_AUDIO_VOLUME) == -1) return FALSE; @@ -1597,6 +1592,9 @@ gtk_xine_get_volume (GtkXine *gtx) g_return_val_if_fail (GTK_IS_XINE (gtx), 0); g_return_val_if_fail (gtx->priv->xine != NULL, 0); + if (gtk_xine_can_set_volume (gtx) == FALSE) + return 0; + volume = xine_get_param (gtx->priv->stream, XINE_PARAM_AUDIO_VOLUME); @@ -1675,6 +1673,9 @@ gtk_xine_get_stream_length (GtkXine *gtx) g_return_val_if_fail (GTK_IS_XINE (gtx), 0); g_return_val_if_fail (gtx->priv->xine != NULL, 0); + if (gtx->priv->mrl == NULL) + return 0; + xine_get_pos_length (gtx->priv->stream, &pos_stream, &pos_time, &length_time); @@ -1839,6 +1840,12 @@ gtk_xine_get_metadata_string (GtkXine *gtx, GtkXineMetadataType type, g_value_init (value, G_TYPE_STRING); + if (gtx->priv->stream == NULL) + { + g_value_set_string (value, ""); + return; + } + switch (type) { case GTX_INFO_TITLE: @@ -1878,6 +1885,12 @@ gtk_xine_get_metadata_int (GtkXine *gtx, GtkXineMetadataType type, g_value_init (value, G_TYPE_INT); + if (gtx->priv->stream == NULL) + { + g_value_set_int (value, 0); + return; + } + switch (type) { case GTX_INFO_DURATION: @@ -1923,6 +1936,12 @@ gtk_xine_get_metadata_bool (GtkXine *gtx, GtkXineMetadataType type, g_value_init (value, G_TYPE_BOOLEAN); + if (gtx->priv->stream == NULL) + { + g_value_set_boolean (value, FALSE); + return; + } + switch (type) { case GTX_INFO_HAS_VIDEO: @@ -1945,6 +1964,10 @@ gtk_xine_get_metadata_bool (GtkXine *gtx, GtkXineMetadataType type, void gtk_xine_get_metadata (GtkXine *gtx, GtkXineMetadataType type, GValue *value) { + g_return_if_fail (gtx != NULL); + g_return_if_fail (GTK_IS_XINE (gtx)); + g_return_if_fail (gtx->priv->xine != NULL); + switch (type) { case GTX_INFO_TITLE: diff --git a/src/totem.c b/src/totem.c index aa12780e4..008ada352 100644 --- a/src/totem.c +++ b/src/totem.c @@ -1877,11 +1877,7 @@ on_error_event (GtkWidget *gtx, GtkXineError error, const char *message, char *msg = NULL; gboolean crap_out = FALSE; - if (gtk_playlist_has_next_mrl (totem->playlist)) - { - totem_action_next (totem); - return; - } + /* We show errors all the time, and don't skip to the next */ switch (error) { @@ -1895,10 +1891,12 @@ on_error_event (GtkWidget *gtx, GtkXineError error, const char *message, msg = g_strdup_printf (_("There is no plugin for Totem to " "handle '%s'.\nTotem will not be able " "to play it."), totem->mrl); + totem_action_stop (totem); break; case GTX_DEMUXER_FAILED: msg = g_strdup_printf (_("'%s' is broken, and Totem can not " "play it further."), totem->mrl); + totem_action_stop (totem); break; case GTX_NO_CODEC: msg = g_strdup_printf(_("Totem could not play '%s':\n%s"), |