ext/alsa/gstalsa.c: handle case better where a soundcard can't pause

Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_change_state),
(gst_alsa_close_audio):
handle case better where a soundcard can't pause
* ext/ogg/gstoggdemux.c:
don't crash when we get events but don't have pads yet
This commit is contained in:
Benjamin Otte 2004-04-01 16:34:14 +00:00
parent e888bd8780
commit f49d8faa28
3 changed files with 22 additions and 10 deletions

View file

@ -1,3 +1,11 @@
2004-04-01 Benjamin Otte <otte@gnome.org>
* ext/alsa/gstalsa.c: (gst_alsa_change_state),
(gst_alsa_close_audio):
handle case better where a soundcard can't pause
* ext/ogg/gstoggdemux.c:
don't crash when we get events but don't have pads yet
2004-04-01 Thomas Vander Stichele <thomas at apestaart dot org> 2004-04-01 Thomas Vander Stichele <thomas at apestaart dot org>
* sys/oss/gstosselement.c: (gst_osselement_probe_caps): * sys/oss/gstosselement.c: (gst_osselement_probe_caps):
@ -130,7 +138,6 @@
* ext/kio/kiosrc.cpp: (process_events): * ext/kio/kiosrc.cpp: (process_events):
update handling event processing if inside KDE - untested update handling event processing if inside KDE - untested
>>>>>>> 1.489
2004-03-29 David Schleef <ds@schleef.org> 2004-03-29 David Schleef <ds@schleef.org>
* ext/hermes/gsthermescolorspace.c: (plugin_init): decrease rank * ext/hermes/gsthermescolorspace.c: (plugin_init): decrease rank

View file

@ -894,7 +894,7 @@ out:
static GstElementStateReturn static GstElementStateReturn
gst_alsa_change_state (GstElement * element) gst_alsa_change_state (GstElement * element)
{ {
int err; int err = 0;
GstAlsa *this; GstAlsa *this;
g_return_val_if_fail (element != NULL, FALSE); g_return_val_if_fail (element != NULL, FALSE);
@ -931,10 +931,12 @@ gst_alsa_change_state (GstElement * element)
if ((err = snd_pcm_pause (this->handle, 1)) < 0) { if ((err = snd_pcm_pause (this->handle, 1)) < 0) {
GST_ERROR_OBJECT (this, "Error pausing sound: %s", GST_ERROR_OBJECT (this, "Error pausing sound: %s",
snd_strerror (err)); snd_strerror (err));
return GST_STATE_FAILURE; GST_ALSA_CAPS_SET (this, GST_ALSA_CAPS_PAUSE, 0);
goto cant_pause;
} }
} }
} else { } else {
cant_pause:
/* if device doesn't know how to pause, we just stop */ /* if device doesn't know how to pause, we just stop */
if (GST_FLAG_IS_SET (element, GST_ALSA_RUNNING)) if (GST_FLAG_IS_SET (element, GST_ALSA_RUNNING))
gst_alsa_stop_audio (this); gst_alsa_stop_audio (this);
@ -1402,6 +1404,9 @@ gst_alsa_close_audio (GstAlsa * this)
g_free (this->cardname); g_free (this->cardname);
this->cardname = NULL; this->cardname = NULL;
} }
GST_ALSA_CAPS_SET (this, GST_ALSA_CAPS_PAUSE, 0);
GST_ALSA_CAPS_SET (this, GST_ALSA_CAPS_RESUME, 0);
GST_ALSA_CAPS_SET (this, GST_ALSA_CAPS_SYNC_START, 0);
GST_FLAG_UNSET (this, GST_ALSA_OPEN); GST_FLAG_UNSET (this, GST_ALSA_OPEN);
return TRUE; return TRUE;

View file

@ -90,9 +90,11 @@ GstOggChain;
#define CURRENT_CHAIN(ogg) (&g_array_index ((ogg)->chains, GstOggChain, (ogg)->current_chain)) #define CURRENT_CHAIN(ogg) (&g_array_index ((ogg)->chains, GstOggChain, (ogg)->current_chain))
#define FOR_PAD_IN_CURRENT_CHAIN(ogg, _pad, ...) G_STMT_START{ \ #define FOR_PAD_IN_CURRENT_CHAIN(ogg, _pad, ...) G_STMT_START{ \
GSList *_walk; \ GSList *_walk; \
for (_walk = CURRENT_CHAIN (ogg)->pads; _walk; _walk = g_slist_next (_walk)) { \ if ((ogg)->current_chain != -1) { \
GstOggPad *_pad = (GstOggPad *) _walk->data; \ for (_walk = CURRENT_CHAIN (ogg)->pads; _walk; _walk = g_slist_next (_walk)) { \
__VA_ARGS__ \ GstOggPad *_pad = (GstOggPad *) _walk->data; \
__VA_ARGS__ \
} \
} \ } \
}G_STMT_END }G_STMT_END
@ -374,8 +376,7 @@ gst_ogg_demux_src_event (GstPad * pad, GstEvent * event)
GST_OGG_SET_STATE (ogg, GST_OGG_STATE_SEEK); GST_OGG_SET_STATE (ogg, GST_OGG_STATE_SEEK);
FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, FOR_PAD_IN_CURRENT_CHAIN (ogg, pad,
pad->flags |= GST_OGG_PAD_NEEDS_DISCONT; pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;);
);
GST_DEBUG_OBJECT (ogg, "initiating seeking to offset %" G_GUINT64_FORMAT, GST_DEBUG_OBJECT (ogg, "initiating seeking to offset %" G_GUINT64_FORMAT,
offset); offset);
ogg->seek_pad = cur; ogg->seek_pad = cur;
@ -422,8 +423,7 @@ gst_ogg_demux_handle_event (GstPad * pad, GstEvent * event)
gst_event_unref (event); gst_event_unref (event);
GST_FLAG_UNSET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT); GST_FLAG_UNSET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT);
FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, FOR_PAD_IN_CURRENT_CHAIN (ogg, pad,
pad->flags |= GST_OGG_PAD_NEEDS_DISCONT; pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;);
);
break; break;
case GST_EVENT_EOS: case GST_EVENT_EOS:
if (ogg->state == GST_OGG_STATE_SETUP) { if (ogg->state == GST_OGG_STATE_SETUP) {