+2004-09-13 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+
+ * ext/alsa/gstalsamixer.c: (gst_alsa_mixer_update),
+ (gst_alsa_mixer_get_volume), (gst_alsa_mixer_set_volume),
+ (gst_alsa_mixer_set_mute), (gst_alsa_mixer_set_record),
+ (gst_alsa_mixer_set_option), (gst_alsa_mixer_get_option):
+ Update mixer (to sync with other sessions) if we try to obtain
+ a new value. This makes alsamixer work accross applications.
+ * ext/alsa/gstalsasink.c: (gst_alsa_sink_get_time):
+ Only call sync functions if we're running, else alsalib asserts.
+ * ext/ogg/gstoggdemux.c: (gst_ogg_demux_src_query):
+ Sometimes fails to compile. Possibly a gcc bug.
+ * gst/playback/gstplaybin.c: (gen_video_element),
+ (gen_audio_element):
+ Add a reference to an application-provided object, because we lose
+ this same reference if we add it to the bin. If we don't do this,
+ we can only use this object once and thus crash if we go from
+ ready to playing, back to ready and back to playing again.
+ Also add an audioscale element because several cheap soundcards -
+ like mine - don't support all samplerates.
+ * sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
+ (gst_ximagesink_xcontext_clear), (gst_ximagesink_change_state):
+ Fix wrong order or PAR calls. Makes automatically obtained PAR
+ from the X server atually being used.
+
2004-09-12 David Schleef <ds@schleef.org>
Fixes: #151879, #151881, #151882, #151883, #151884, #151886,
}
static void
+gst_alsa_mixer_update (GstAlsaMixer * alsa_mixer)
+{
+ snd_mixer_handle_events (alsa_mixer->mixer_handle);
+}
+
+static void
gst_alsa_mixer_get_volume (GstMixer * mixer,
GstMixerTrack * track, gint * volumes)
{
g_return_if_fail (GST_ALSA_MIXER (mixer)->mixer_handle != NULL);
+ gst_alsa_mixer_update (GST_ALSA_MIXER (mixer));
+
if (track->flags & GST_MIXER_TRACK_MUTE &&
!snd_mixer_selem_has_playback_switch (alsa_track->element)) {
for (i = 0; i < track->num_channels; i++)
g_return_if_fail (GST_ALSA_MIXER (mixer)->mixer_handle != NULL);
+ gst_alsa_mixer_update (GST_ALSA_MIXER (mixer));
+
/* only set the volume with ALSA lib if the track isn't muted. */
for (i = 0; i < track->num_channels; i++) {
alsa_track->volumes[i] = volumes[i];
g_return_if_fail (GST_ALSA_MIXER (mixer)->mixer_handle != NULL);
+ gst_alsa_mixer_update (GST_ALSA_MIXER (mixer));
+
if (mute) {
track->flags |= GST_MIXER_TRACK_MUTE;
} else {
g_return_if_fail (GST_ALSA_MIXER (mixer)->mixer_handle != NULL);
+ gst_alsa_mixer_update (GST_ALSA_MIXER (mixer));
+
if (record) {
track->flags |= GST_MIXER_TRACK_RECORD;
} else {
g_return_if_fail (GST_ALSA_MIXER (mixer)->mixer_handle != NULL);
+ gst_alsa_mixer_update (GST_ALSA_MIXER (mixer));
+
for (item = opts->values; item != NULL; item = item->next, n++) {
if (!strcmp (item->data, value)) {
idx = n;
g_return_val_if_fail (GST_ALSA_MIXER (mixer)->mixer_handle != NULL, NULL);
+ gst_alsa_mixer_update (GST_ALSA_MIXER (mixer));
+
snd_mixer_selem_get_enum_item (alsa_opts->element, 0, &idx);
return g_list_nth_data (opts->values, idx);
if (!this->format)
return 0;
- if (snd_pcm_delay (this->handle, &delay) != 0) {
+ if (!GST_FLAG_IS_SET (this, GST_ALSA_RUNNING)) {
+ delay = 0;
+ } else if (snd_pcm_delay (this->handle, &delay) != 0) {
return this->played / this->format->rate;
}
if (this->played <= delay) {
gboolean res = FALSE;
GstOggDemux *ogg;
GstOggPad *cur;
- guint64 granulepos;
+ guint64 granulepos = 0;
ogg = GST_OGG_DEMUX (gst_pad_get_parent (pad));
GST_OGG_SET_STATE (ogg, GST_OGG_STATE_SEEK);
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 format %d, offset %" G_GUINT64_FORMAT, format,
offset);
gst_event_unref (event);
GST_FLAG_UNSET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT);
FOR_PAD_IN_CURRENT_CHAIN (ogg, pad,
- pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;
- );
+ pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;);
break;
default:
gst_pad_event_default (pad, event);
*end = G_MAXINT64;
g_assert (ogg->current_chain >= 0);
- FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, *start = MAX (*start, pad->end_offset);
- );
+ FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, *start = MAX (*start, pad->end_offset););
if (ogg->setup_state == SETUP_FIND_LAST_CHAIN) {
*end = gst_file_pad_get_length (ogg->sinkpad);
} else {
endpos = G_MAXINT64;
FOR_PAD_IN_CHAIN (ogg, pad, ogg->chains->len - 1,
- endpos = MIN (endpos, pad->start_offset);
- );
+ endpos = MIN (endpos, pad->start_offset););
}
if (!ogg->seek_skipped || gst_ogg_demux_position (ogg) >= endpos) {
/* have we found the endposition for all streams yet? */
conv = gst_element_factory_make ("ffmpegcolorspace", "vconv");
scale = gst_element_factory_make ("videoscale", "vscale");
if (play_bin->video_sink) {
+ gst_object_ref (GST_OBJECT (play_bin->video_sink));
sink = play_bin->video_sink;
} else {
sink = gst_element_factory_make ("ximagesink", "sink");
GstElement *conv;
GstElement *sink;
GstElement *volume;
+ GstElement *scale;
element = gst_bin_new ("abin");
conv = gst_element_factory_make ("audioconvert", "aconv");
+ scale = gst_element_factory_make ("audioscale", "ascale");
volume = gst_element_factory_make ("volume", "volume");
g_object_set (G_OBJECT (volume), "volume", play_bin->volume, NULL);
play_bin->volume_element = volume;
if (play_bin->audio_sink) {
+ gst_object_ref (GST_OBJECT (play_bin->audio_sink));
sink = play_bin->audio_sink;
} else {
sink = gst_element_factory_make ("osssink", "sink");
play_bin->seekables = g_list_prepend (play_bin->seekables, sink);
gst_bin_add (GST_BIN (element), conv);
+ gst_bin_add (GST_BIN (element), scale);
gst_bin_add (GST_BIN (element), volume);
gst_bin_add (GST_BIN (element), sink);
- gst_element_link_pads (conv, "src", volume, "sink");
+ gst_element_link_pads (conv, "src", scale, "sink");
+ gst_element_link_pads (scale, "src", volume, "sink");
gst_element_link_pads (volume, "src", sink, "sink");
gst_element_add_ghost_pad (element,
}
}
+ /* update object's par with calculated one if not set yet */
+ if (!ximagesink->par) {
+ ximagesink->par = g_new0 (GValue, 1);
+ gst_value_init_and_copy (ximagesink->par, xcontext->par);
+ GST_DEBUG_OBJECT (ximagesink, "set calculated PAR on object's PAR");
+ }
xcontext->caps = gst_caps_new_simple ("video/x-raw-rgb",
"bpp", G_TYPE_INT, xcontext->bpp,
"depth", G_TYPE_INT, xcontext->depth,
gst_caps_free (ximagesink->xcontext->caps);
g_free (ximagesink->xcontext->par);
+ g_free (ximagesink->par);
+ ximagesink->par = NULL;
g_mutex_lock (ximagesink->x_lock);
ximagesink->xcontext = gst_ximagesink_xcontext_get (ximagesink);
if (!ximagesink->xcontext)
return GST_STATE_FAILURE;
- /* update object's par with calculated one if not set yet */
- if (!ximagesink->par) {
- ximagesink->par = g_new0 (GValue, 1);
- gst_value_init_and_copy (ximagesink->par, ximagesink->xcontext->par);
- GST_DEBUG_OBJECT (ximagesink, "set calculated PAR on object's PAR");
- }
/* call XSynchronize with the current value of synchronous */
GST_DEBUG_OBJECT (ximagesink, "XSynchronize called with %s",
ximagesink->synchronous ? "TRUE" : "FALSE");
gst_ximagesink_xcontext_clear (ximagesink);
ximagesink->xcontext = NULL;
}
- g_free (ximagesink->par);
- ximagesink->par = NULL;
break;
}