1.1 --- a/gmyth-stream/gmemcoder/src/gmencoder.c Fri Jun 22 16:14:21 2007 +0100
1.2 +++ b/gmyth-stream/gmemcoder/src/gmencoder.c Tue Jun 26 14:32:33 2007 +0100
1.3 @@ -82,7 +82,7 @@
1.4 gpointer user_data);
1.5
1.6 static void _close_output(GMencoder * self);
1.7 -static void _open_output(GMencoder * self, const gchar * uri);
1.8 +static gboolean _open_output(GMencoder * self, const gchar * uri);
1.9
1.10 static GstElement *_create_source(const gchar * uri);
1.11 static GstElement *_create_pipeline(GMencoder * self,
1.12 @@ -437,7 +437,7 @@
1.13
1.14
1.15
1.16 -void
1.17 +gboolean
1.18 g_mencoder_setup_stream(GMencoder * self,
1.19 const gchar * mux_name,
1.20 const gchar * video_encode,
1.21 @@ -454,11 +454,12 @@
1.22 if (priv->ready == TRUE) {
1.23 g_warning
1.24 ("Stream already configured. You need close stream first.");
1.25 - return;
1.26 + return FALSE;
1.27 }
1.28
1.29 _close_output(self);
1.30 - _open_output(self, out_uri);
1.31 + if (_open_output(self, out_uri) == FALSE)
1.32 + return FALSE;
1.33
1.34 priv->sources = 0;
1.35 priv->pipe = _create_pipeline(self,
1.36 @@ -472,6 +473,7 @@
1.37 audio_encode, audio_encode_prop,
1.38 audio_rate);
1.39
1.40 + return (priv->pipe != NULL);
1.41 }
1.42
1.43
1.44 @@ -856,9 +858,10 @@
1.45 return NULL;
1.46 }
1.47
1.48 -static void
1.49 +static gboolean
1.50 _open_output(GMencoder * self, const gchar * uri)
1.51 {
1.52 + gboolean ret = TRUE;
1.53 gchar **i;
1.54 GMencoderPrivate *priv = G_MENCODER_GET_PRIVATE(self);
1.55
1.56 @@ -867,15 +870,27 @@
1.57 priv->fd = atoi(i[1]);
1.58 } else if (strcmp(i[0], "file") == 0) {
1.59 if (g_file_test (i[1], G_FILE_TEST_EXISTS)) {
1.60 - g_assert (unlink (i[1]) == 0);
1.61 + if (unlink (i[1]) != 0) {
1.62 + g_warning ("Fail to write in : %s", uri);
1.63 + ret = FALSE;
1.64 + goto done;
1.65 + }
1.66 }
1.67 priv->fd = open(i[1], O_WRONLY | O_CREAT | O_TRUNC,
1.68 S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
1.69 +
1.70 + if (priv->fd == -1) {
1.71 + g_warning ("Fail to open : %s", uri);
1.72 + ret = FALSE;
1.73 + }
1.74 } else {
1.75 g_warning("Output uri not supported");
1.76 + ret = FALSE;
1.77 }
1.78
1.79 +done:
1.80 g_strfreev(i);
1.81 + return ret;
1.82 }
1.83
1.84 static gboolean