mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
ext/alsa/gstalsa.c: Alsa should trigger an error if it failed opening the audio device.
Original commit message from CVS: 2004-02-16 Julien MOUTTE <julien@moutte.net> * ext/alsa/gstalsa.c: (gst_alsa_open_audio), (gst_alsa_timestamp_to_bytes): Alsa should trigger an error if it failed opening the audio device. * sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new), (gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize), (gst_ximagesink_xwindow_clear), (gst_ximagesink_renegotiate_size), (gst_ximagesink_handle_xevents), (gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear), (gst_ximagesink_change_state), (gst_ximagesink_chain), (gst_ximagesink_set_xwindow_id): Clearing window in READY TO PAUSED. Removing some useless g_return_if_fail like wingo suggested. * sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy), (gst_xvimagesink_xvimage_put), (gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy), (gst_xvimagesink_xwindow_resize), (gst_xvimagesink_xwindow_clear), (gst_xvimagesink_update_colorbalance), (gst_xvimagesink_handle_xevents), (gst_xvimagesink_xcontext_get), (gst_xvimagesink_xcontext_clear), (gst_xvimagesink_get_fourcc_from_caps), (gst_xvimagesink_change_state), (gst_xvimagesink_chain), (gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_colorbalance_list_channels), (gst_xvimagesink_colorbalance_set_value), (gst_xvimagesink_colorbalance_get_value): Clearing window in READY TO PAUSED. Removing some useless g_return_if_fail like wingo suggested.
This commit is contained in:
parent
0f003d87b3
commit
614d7e3d7d
5 changed files with 81 additions and 34 deletions
29
ChangeLog
29
ChangeLog
|
@ -1,3 +1,32 @@
|
|||
2004-02-16 Julien MOUTTE <julien@moutte.net>
|
||||
|
||||
* ext/alsa/gstalsa.c: (gst_alsa_open_audio),
|
||||
(gst_alsa_timestamp_to_bytes): Alsa should trigger an error if it
|
||||
failed opening the audio device.
|
||||
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
|
||||
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
|
||||
(gst_ximagesink_xwindow_new), (gst_ximagesink_xwindow_destroy),
|
||||
(gst_ximagesink_xwindow_resize), (gst_ximagesink_xwindow_clear),
|
||||
(gst_ximagesink_renegotiate_size), (gst_ximagesink_handle_xevents),
|
||||
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
|
||||
(gst_ximagesink_change_state), (gst_ximagesink_chain),
|
||||
(gst_ximagesink_set_xwindow_id): Clearing window in READY TO PAUSED.
|
||||
Removing some useless g_return_if_fail like wingo suggested.
|
||||
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_new),
|
||||
(gst_xvimagesink_xvimage_destroy), (gst_xvimagesink_xvimage_put),
|
||||
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
|
||||
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_xwindow_clear),
|
||||
(gst_xvimagesink_update_colorbalance),
|
||||
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_xcontext_get),
|
||||
(gst_xvimagesink_xcontext_clear),
|
||||
(gst_xvimagesink_get_fourcc_from_caps),
|
||||
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
|
||||
(gst_xvimagesink_set_xwindow_id),
|
||||
(gst_xvimagesink_colorbalance_list_channels),
|
||||
(gst_xvimagesink_colorbalance_set_value),
|
||||
(gst_xvimagesink_colorbalance_get_value): Clearing window in READY TO
|
||||
PAUSED. Removing some useless g_return_if_fail like wingo suggested.
|
||||
|
||||
2004-02-16 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain):
|
||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
|||
Subproject commit 19cb5127af898da4a72109547e9c31c4e14cc964
|
||||
Subproject commit d821172609916bc61bbbca7f8d2e6cf0ca1ab47a
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "gst/gst-i18n-plugin.h"
|
||||
#include "gstalsa.h"
|
||||
#include "gstalsaclock.h"
|
||||
#include "gstalsamixer.h"
|
||||
|
@ -909,10 +910,14 @@ gst_alsa_open_audio (GstAlsa *this)
|
|||
ERROR_CHECK (snd_output_stdio_attach (&this->out, stderr, 0),
|
||||
"error opening log output: %s");
|
||||
#endif
|
||||
/* we use non-blocking i/o */
|
||||
ERROR_CHECK (snd_pcm_open (&this->handle, this->device,
|
||||
GST_ALSA_GET_CLASS (this)->stream, SND_PCM_NONBLOCK),
|
||||
"error opening pcm device %s: %s\n", this->device);
|
||||
|
||||
if (snd_pcm_open (&this->handle, this->device,
|
||||
GST_ALSA_GET_CLASS (this)->stream, SND_PCM_NONBLOCK) < 0) {
|
||||
GST_ELEMENT_ERROR (GST_ELEMENT (this), RESOURCE, BUSY,
|
||||
(_("Alsa device \"%s\" is already in use by another program."), this->device),
|
||||
(NULL));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GST_FLAG_SET (this, GST_ALSA_OPEN);
|
||||
return TRUE;
|
||||
|
@ -1305,4 +1310,3 @@ gst_alsa_timestamp_to_bytes (GstAlsa *this, GstClockTime time)
|
|||
{
|
||||
return gst_alsa_samples_to_bytes (this, gst_alsa_timestamp_to_samples (this, time));
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,6 @@ gst_ximagesink_ximage_new (GstXImageSink *ximagesink, gint width, gint height)
|
|||
{
|
||||
GstXImage *ximage = NULL;
|
||||
|
||||
g_return_val_if_fail (ximagesink != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL);
|
||||
|
||||
ximage = g_new0 (GstXImage, 1);
|
||||
|
@ -218,7 +217,6 @@ static void
|
|||
gst_ximagesink_ximage_destroy (GstXImageSink *ximagesink, GstXImage *ximage)
|
||||
{
|
||||
g_return_if_fail (ximage != NULL);
|
||||
g_return_if_fail (ximagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
||||
|
||||
/* If the destroyed image is the current one we destroy our reference too */
|
||||
|
@ -263,7 +261,6 @@ gst_ximagesink_ximage_put (GstXImageSink *ximagesink, GstXImage *ximage)
|
|||
gint x, y;
|
||||
|
||||
g_return_if_fail (ximage != NULL);
|
||||
g_return_if_fail (ximagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
||||
|
||||
/* Store a reference to the last image we put */
|
||||
|
@ -302,7 +299,6 @@ gst_ximagesink_xwindow_new (GstXImageSink *ximagesink, gint width, gint height)
|
|||
{
|
||||
GstXWindow *xwindow = NULL;
|
||||
|
||||
g_return_val_if_fail (ximagesink != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL);
|
||||
|
||||
xwindow = g_new0 (GstXWindow, 1);
|
||||
|
@ -341,7 +337,6 @@ static void
|
|||
gst_ximagesink_xwindow_destroy (GstXImageSink *ximagesink, GstXWindow *xwindow)
|
||||
{
|
||||
g_return_if_fail (xwindow != NULL);
|
||||
g_return_if_fail (ximagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
||||
|
||||
g_mutex_lock (ximagesink->x_lock);
|
||||
|
@ -367,7 +362,6 @@ gst_ximagesink_xwindow_resize (GstXImageSink *ximagesink, GstXWindow *xwindow,
|
|||
guint width, guint height)
|
||||
{
|
||||
g_return_if_fail (xwindow != NULL);
|
||||
g_return_if_fail (ximagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
||||
|
||||
g_mutex_lock (ximagesink->x_lock);
|
||||
|
@ -377,7 +371,28 @@ gst_ximagesink_xwindow_resize (GstXImageSink *ximagesink, GstXWindow *xwindow,
|
|||
|
||||
XResizeWindow (ximagesink->xcontext->disp, xwindow->win,
|
||||
xwindow->width, xwindow->height);
|
||||
|
||||
XSync (ximagesink->xcontext->disp, FALSE);
|
||||
|
||||
g_mutex_unlock (ximagesink->x_lock);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_ximagesink_xwindow_clear (GstXImageSink *ximagesink, GstXWindow *xwindow)
|
||||
{
|
||||
g_return_if_fail (xwindow != NULL);
|
||||
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
||||
|
||||
g_mutex_lock (ximagesink->x_lock);
|
||||
|
||||
XSetForeground (ximagesink->xcontext->disp, xwindow->gc,
|
||||
ximagesink->xcontext->black);
|
||||
|
||||
XFillRectangle (ximagesink->xcontext->disp, xwindow->win, xwindow->gc,
|
||||
0, 0, xwindow->width, xwindow->height);
|
||||
|
||||
XSync (ximagesink->xcontext->disp, FALSE);
|
||||
|
||||
g_mutex_unlock (ximagesink->x_lock);
|
||||
}
|
||||
|
||||
|
@ -385,7 +400,6 @@ static void
|
|||
gst_ximagesink_renegotiate_size (GstXImageSink *ximagesink,
|
||||
guint width, guint height)
|
||||
{
|
||||
g_return_if_fail (ximagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
||||
|
||||
/* Window got resized or moved. We do caps negotiation again to get video
|
||||
|
@ -442,7 +456,6 @@ gst_ximagesink_handle_xevents (GstXImageSink *ximagesink, GstPad *pad)
|
|||
guint new_width = 0, new_height = 0, pointer_x = 0, pointer_y = 0;
|
||||
gboolean pointer_moved = FALSE;
|
||||
|
||||
g_return_if_fail (ximagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
||||
|
||||
/* First we get all structure modification events. Only the last one is
|
||||
|
@ -580,7 +593,6 @@ gst_ximagesink_xcontext_get (GstXImageSink *ximagesink)
|
|||
XPixmapFormatValues *px_formats = NULL;
|
||||
gint nb_formats = 0, i;
|
||||
|
||||
g_return_val_if_fail (ximagesink != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL);
|
||||
|
||||
xcontext = g_new0 (GstXContext, 1);
|
||||
|
@ -679,7 +691,6 @@ gst_ximagesink_xcontext_get (GstXImageSink *ximagesink)
|
|||
static void
|
||||
gst_ximagesink_xcontext_clear (GstXImageSink *ximagesink)
|
||||
{
|
||||
g_return_if_fail (ximagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
||||
|
||||
gst_caps_free (ximagesink->xcontext->caps);
|
||||
|
@ -842,6 +853,7 @@ gst_ximagesink_change_state (GstElement *element)
|
|||
return GST_STATE_FAILURE;
|
||||
break;
|
||||
case GST_STATE_READY_TO_PAUSED:
|
||||
gst_ximagesink_xwindow_clear (ximagesink, ximagesink->xwindow);
|
||||
ximagesink->time = 0;
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_PLAYING:
|
||||
|
@ -889,7 +901,6 @@ gst_ximagesink_chain (GstPad *pad, GstData *data)
|
|||
GstBuffer *buf = GST_BUFFER (data);
|
||||
GstXImageSink *ximagesink;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
g_return_if_fail (buf != NULL);
|
||||
|
||||
|
@ -1095,7 +1106,6 @@ gst_ximagesink_set_xwindow_id (GstXOverlay *overlay, XID xwindow_id)
|
|||
GstXWindow *xwindow = NULL;
|
||||
XWindowAttributes attr;
|
||||
|
||||
g_return_if_fail (ximagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
||||
|
||||
/* If we already use that window return */
|
||||
|
|
|
@ -160,7 +160,6 @@ gst_xvimagesink_xvimage_new (GstXvImageSink *xvimagesink,
|
|||
{
|
||||
GstXvImage *xvimage = NULL;
|
||||
|
||||
g_return_val_if_fail (xvimagesink != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), NULL);
|
||||
|
||||
xvimage = g_new0 (GstXvImage, 1);
|
||||
|
@ -230,7 +229,6 @@ gst_xvimagesink_xvimage_destroy (GstXvImageSink *xvimagesink,
|
|||
GstXvImage *xvimage)
|
||||
{
|
||||
g_return_if_fail (xvimage != NULL);
|
||||
g_return_if_fail (xvimagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
|
||||
|
||||
/* If the destroyed image is the current one we destroy our reference too */
|
||||
|
@ -273,7 +271,6 @@ static void
|
|||
gst_xvimagesink_xvimage_put (GstXvImageSink *xvimagesink, GstXvImage *xvimage)
|
||||
{
|
||||
g_return_if_fail (xvimage != NULL);
|
||||
g_return_if_fail (xvimagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
|
||||
|
||||
/* Store a reference to the last image we put */
|
||||
|
@ -319,7 +316,6 @@ gst_xvimagesink_xwindow_new (GstXvImageSink *xvimagesink,
|
|||
GstXWindow *xwindow = NULL;
|
||||
XGCValues values;
|
||||
|
||||
g_return_val_if_fail (xvimagesink != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), NULL);
|
||||
|
||||
xwindow = g_new0 (GstXWindow, 1);
|
||||
|
@ -358,7 +354,6 @@ static void
|
|||
gst_xvimagesink_xwindow_destroy (GstXvImageSink *xvimagesink, GstXWindow *xwindow)
|
||||
{
|
||||
g_return_if_fail (xwindow != NULL);
|
||||
g_return_if_fail (xvimagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
|
||||
|
||||
g_mutex_lock (xvimagesink->x_lock);
|
||||
|
@ -384,7 +379,6 @@ gst_xvimagesink_xwindow_resize (GstXvImageSink *xvimagesink,
|
|||
GstXWindow *xwindow, guint width, guint height)
|
||||
{
|
||||
g_return_if_fail (xwindow != NULL);
|
||||
g_return_if_fail (xvimagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
|
||||
|
||||
g_mutex_lock (xvimagesink->x_lock);
|
||||
|
@ -400,6 +394,25 @@ gst_xvimagesink_xwindow_resize (GstXvImageSink *xvimagesink,
|
|||
g_mutex_unlock (xvimagesink->x_lock);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_xvimagesink_xwindow_clear (GstXvImageSink *xvimagesink, GstXWindow *xwindow)
|
||||
{
|
||||
g_return_if_fail (xwindow != NULL);
|
||||
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
|
||||
|
||||
g_mutex_lock (xvimagesink->x_lock);
|
||||
|
||||
XSetForeground (xvimagesink->xcontext->disp, xwindow->gc,
|
||||
xvimagesink->xcontext->black);
|
||||
|
||||
XFillRectangle (xvimagesink->xcontext->disp, xwindow->win, xwindow->gc,
|
||||
0, 0, xwindow->width, xwindow->height);
|
||||
|
||||
XSync (xvimagesink->xcontext->disp, FALSE);
|
||||
|
||||
g_mutex_unlock (xvimagesink->x_lock);
|
||||
}
|
||||
|
||||
/* This function commits our internal colorbalance settings to our grabbed Xv
|
||||
port. If the xcontext is not initialized yet it simply returns */
|
||||
static void
|
||||
|
@ -407,7 +420,6 @@ gst_xvimagesink_update_colorbalance (GstXvImageSink *xvimagesink)
|
|||
{
|
||||
GList *channels = NULL;
|
||||
|
||||
g_return_if_fail (xvimagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
|
||||
|
||||
/* If we haven't initialized the X context we can't update anything */
|
||||
|
@ -485,7 +497,6 @@ gst_xvimagesink_handle_xevents (GstXvImageSink *xvimagesink, GstPad *pad)
|
|||
guint pointer_x = 0, pointer_y = 0;
|
||||
gboolean pointer_moved = FALSE;
|
||||
|
||||
g_return_if_fail (xvimagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
|
||||
|
||||
/* We get all pointer motion events, only the last position is
|
||||
|
@ -743,7 +754,6 @@ gst_xvimagesink_xcontext_get (GstXvImageSink *xvimagesink)
|
|||
char *channels[4] = { "XV_HUE", "XV_SATURATION",
|
||||
"XV_BRIGHTNESS", "XV_CONTRAST" };
|
||||
|
||||
g_return_val_if_fail (xvimagesink != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), NULL);
|
||||
|
||||
xcontext = g_new0 (GstXContext, 1);
|
||||
|
@ -895,7 +905,6 @@ gst_xvimagesink_xcontext_clear (GstXvImageSink *xvimagesink)
|
|||
{
|
||||
GList *formats_list, *channels_list;
|
||||
|
||||
g_return_if_fail (xvimagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
|
||||
|
||||
formats_list = xvimagesink->xcontext->formats_list;
|
||||
|
@ -989,7 +998,6 @@ gst_xvimagesink_get_fourcc_from_caps (GstXvImageSink *xvimagesink,
|
|||
{
|
||||
GList *list = NULL;
|
||||
|
||||
g_return_val_if_fail (xvimagesink != NULL, 0);
|
||||
g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), 0);
|
||||
|
||||
list = xvimagesink->xcontext->formats_list;
|
||||
|
@ -1129,6 +1137,7 @@ gst_xvimagesink_change_state (GstElement *element)
|
|||
gst_xvimagesink_update_colorbalance (xvimagesink);
|
||||
break;
|
||||
case GST_STATE_READY_TO_PAUSED:
|
||||
gst_xvimagesink_xwindow_clear (xvimagesink, xvimagesink->xwindow);
|
||||
xvimagesink->time = 0;
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_PLAYING:
|
||||
|
@ -1176,7 +1185,6 @@ gst_xvimagesink_chain (GstPad *pad, GstData *data)
|
|||
GstBuffer *buf = NULL;
|
||||
GstXvImageSink *xvimagesink;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
|
@ -1379,7 +1387,6 @@ gst_xvimagesink_set_xwindow_id (GstXOverlay *overlay, XID xwindow_id)
|
|||
GstXWindow *xwindow = NULL;
|
||||
XWindowAttributes attr;
|
||||
|
||||
g_return_if_fail (xvimagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
|
||||
|
||||
/* If we already use that window return */
|
||||
|
@ -1498,7 +1505,6 @@ gst_xvimagesink_colorbalance_list_channels (GstColorBalance *balance)
|
|||
{
|
||||
GstXvImageSink *xvimagesink = GST_XVIMAGESINK (balance);
|
||||
|
||||
g_return_val_if_fail (xvimagesink != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), NULL);
|
||||
|
||||
if (xvimagesink->xcontext)
|
||||
|
@ -1514,7 +1520,6 @@ gst_xvimagesink_colorbalance_set_value (GstColorBalance *balance,
|
|||
{
|
||||
GstXvImageSink *xvimagesink = GST_XVIMAGESINK (balance);
|
||||
|
||||
g_return_if_fail (xvimagesink != NULL);
|
||||
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
|
||||
g_return_if_fail (channel->label != NULL);
|
||||
|
||||
|
@ -1556,7 +1561,6 @@ gst_xvimagesink_colorbalance_get_value (GstColorBalance *balance,
|
|||
GstXvImageSink *xvimagesink = GST_XVIMAGESINK (balance);
|
||||
gint value = 0;
|
||||
|
||||
g_return_val_if_fail (xvimagesink != NULL, 0);
|
||||
g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), 0);
|
||||
g_return_val_if_fail (channel->label != NULL, 0);
|
||||
|
||||
|
|
Loading…
Reference in a new issue