mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
gst/gsttypes.h: get rid of GST_O_READONLY, GST_FILE_MODE_READ and
Original commit message from CVS: * gst/gsttypes.h: get rid of GST_O_READONLY, GST_FILE_MODE_READ and GST_FILE_MODE_WRITE, I don't want them in the exported headers. It just causes support madness * gst/elements/gstfilesrc.c: (gst_filesrc_open_file): make it work without this * gst/indexers/gstfileindex.c: (_file_index_id_save_entries), (gst_file_index_commit): glib IO channels don't want binary mode * testsuite/bytestream/filepadsink.c: (main): * testsuite/bytestream/test1.c: (read_param_file): use "rb" instead of GST_FILE_MODE_READ, it works on POSIX systems
This commit is contained in:
parent
d77dbaac2f
commit
f1d9a4c380
10 changed files with 33 additions and 19 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
2004-07-12 Benjamin Otte <otte@gnome.org>
|
||||||
|
|
||||||
|
* gst/gsttypes.h:
|
||||||
|
get rid of GST_O_READONLY, GST_FILE_MODE_READ and
|
||||||
|
GST_FILE_MODE_WRITE, I don't want them in the exported headers. It
|
||||||
|
just causes support madness
|
||||||
|
* gst/elements/gstfilesrc.c: (gst_filesrc_open_file):
|
||||||
|
make it work without this
|
||||||
|
* gst/indexers/gstfileindex.c: (_file_index_id_save_entries),
|
||||||
|
(gst_file_index_commit):
|
||||||
|
glib IO channels don't want binary mode
|
||||||
|
* testsuite/bytestream/filepadsink.c: (main):
|
||||||
|
* testsuite/bytestream/test1.c: (read_param_file):
|
||||||
|
use "rb" instead of GST_FILE_MODE_READ, it works on POSIX systems
|
||||||
|
|
||||||
2004-07-12 Benjamin Otte <otte@gnome.org>
|
2004-07-12 Benjamin Otte <otte@gnome.org>
|
||||||
|
|
||||||
* gst/gstelement.c: (gst_element_class_init),
|
* gst/gstelement.c: (gst_element_class_init),
|
||||||
|
|
|
@ -51,6 +51,10 @@
|
||||||
#ifndef S_ISSOCK
|
#ifndef S_ISSOCK
|
||||||
#define S_ISSOCK(x) (0)
|
#define S_ISSOCK(x) (0)
|
||||||
#endif
|
#endif
|
||||||
|
/* FIXME: is that enough or should we do #ifdef __WIN32__ stuff? */
|
||||||
|
#ifndef O_BINARY
|
||||||
|
#define O_BINARY (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* GStreamer Default File Source
|
* GStreamer Default File Source
|
||||||
|
@ -756,7 +760,7 @@ gst_filesrc_open_file (GstFileSrc * src)
|
||||||
GST_INFO_OBJECT (src, "opening file %s", src->filename);
|
GST_INFO_OBJECT (src, "opening file %s", src->filename);
|
||||||
|
|
||||||
/* open the file */
|
/* open the file */
|
||||||
src->fd = open (src->filename, GST_O_READONLY);
|
src->fd = open (src->filename, O_RDONLY | O_BINARY);
|
||||||
if (src->fd < 0) {
|
if (src->fd < 0) {
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),
|
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),
|
||||||
|
|
|
@ -66,15 +66,6 @@ typedef enum {
|
||||||
#define GST_PADDING 4
|
#define GST_PADDING 4
|
||||||
#define GST_PADDING_INIT { 0 }
|
#define GST_PADDING_INIT { 0 }
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#define GST_FILE_MODE_READ "rb"
|
|
||||||
#define GST_FILE_MODE_WRITE "wb"
|
|
||||||
#define GST_O_READONLY O_RDONLY|O_BINARY
|
|
||||||
#else
|
|
||||||
#define GST_FILE_MODE_READ "r"
|
|
||||||
#define GST_FILE_MODE_WRITE "w"
|
|
||||||
#define GST_O_READONLY O_RDONLY
|
|
||||||
#endif
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -543,7 +543,7 @@ _file_index_id_save_entries (gpointer * _key,
|
||||||
|
|
||||||
err = NULL;
|
err = NULL;
|
||||||
path = g_strdup_printf ("%s/%d", prefix, ii->id);
|
path = g_strdup_printf ("%s/%d", prefix, ii->id);
|
||||||
chan = g_io_channel_new_file (path, GST_FILE_MODE_WRITE, &err);
|
chan = g_io_channel_new_file (path, "w", &err);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -605,7 +605,7 @@ gst_file_index_commit (GstIndex * _index, gint _writer_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
path = g_strdup_printf ("%s/gstindex.xml", index->location);
|
path = g_strdup_printf ("%s/gstindex.xml", index->location);
|
||||||
tocfile = g_io_channel_new_file (path, GST_FILE_MODE_WRITE, &err);
|
tocfile = g_io_channel_new_file (path, "w", &err);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
if (err) {
|
if (err) {
|
||||||
GST_ERROR_OBJECT (index, "%s", err->message);
|
GST_ERROR_OBJECT (index, "%s", err->message);
|
||||||
|
|
|
@ -51,6 +51,10 @@
|
||||||
#ifndef S_ISSOCK
|
#ifndef S_ISSOCK
|
||||||
#define S_ISSOCK(x) (0)
|
#define S_ISSOCK(x) (0)
|
||||||
#endif
|
#endif
|
||||||
|
/* FIXME: is that enough or should we do #ifdef __WIN32__ stuff? */
|
||||||
|
#ifndef O_BINARY
|
||||||
|
#define O_BINARY (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* GStreamer Default File Source
|
* GStreamer Default File Source
|
||||||
|
@ -756,7 +760,7 @@ gst_filesrc_open_file (GstFileSrc * src)
|
||||||
GST_INFO_OBJECT (src, "opening file %s", src->filename);
|
GST_INFO_OBJECT (src, "opening file %s", src->filename);
|
||||||
|
|
||||||
/* open the file */
|
/* open the file */
|
||||||
src->fd = open (src->filename, GST_O_READONLY);
|
src->fd = open (src->filename, O_RDONLY | O_BINARY);
|
||||||
if (src->fd < 0) {
|
if (src->fd < 0) {
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),
|
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),
|
||||||
|
|
|
@ -543,7 +543,7 @@ _file_index_id_save_entries (gpointer * _key,
|
||||||
|
|
||||||
err = NULL;
|
err = NULL;
|
||||||
path = g_strdup_printf ("%s/%d", prefix, ii->id);
|
path = g_strdup_printf ("%s/%d", prefix, ii->id);
|
||||||
chan = g_io_channel_new_file (path, GST_FILE_MODE_WRITE, &err);
|
chan = g_io_channel_new_file (path, "w", &err);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -605,7 +605,7 @@ gst_file_index_commit (GstIndex * _index, gint _writer_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
path = g_strdup_printf ("%s/gstindex.xml", index->location);
|
path = g_strdup_printf ("%s/gstindex.xml", index->location);
|
||||||
tocfile = g_io_channel_new_file (path, GST_FILE_MODE_WRITE, &err);
|
tocfile = g_io_channel_new_file (path, "w", &err);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
if (err) {
|
if (err) {
|
||||||
GST_ERROR_OBJECT (index, "%s", err->message);
|
GST_ERROR_OBJECT (index, "%s", err->message);
|
||||||
|
|
|
@ -259,7 +259,7 @@ main (gint argc, gchar ** argv)
|
||||||
if (!gst_element_link (src, sink))
|
if (!gst_element_link (src, sink))
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
g_object_set (src, "location", THE_FILE, NULL);
|
g_object_set (src, "location", THE_FILE, NULL);
|
||||||
GST_FP_SINK (sink)->stream = fopen (THE_FILE, GST_FILE_MODE_READ);
|
GST_FP_SINK (sink)->stream = fopen (THE_FILE, "rb");
|
||||||
g_assert (GST_FP_SINK (sink)->stream);
|
g_assert (GST_FP_SINK (sink)->stream);
|
||||||
/* check correct file sizes */
|
/* check correct file sizes */
|
||||||
if (fseek (GST_FP_SINK (sink)->stream, 0, SEEK_END) != 0)
|
if (fseek (GST_FP_SINK (sink)->stream, 0, SEEK_END) != 0)
|
||||||
|
|
|
@ -68,7 +68,7 @@ read_param_file (gchar * filename)
|
||||||
gchar *scan_str;
|
gchar *scan_str;
|
||||||
gboolean res = TRUE;
|
gboolean res = TRUE;
|
||||||
|
|
||||||
fp = fopen (filename, GST_FILE_MODE_READ);
|
fp = fopen (filename, "rb");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
|
@ -259,7 +259,7 @@ main (gint argc, gchar ** argv)
|
||||||
if (!gst_element_link (src, sink))
|
if (!gst_element_link (src, sink))
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
g_object_set (src, "location", THE_FILE, NULL);
|
g_object_set (src, "location", THE_FILE, NULL);
|
||||||
GST_FP_SINK (sink)->stream = fopen (THE_FILE, GST_FILE_MODE_READ);
|
GST_FP_SINK (sink)->stream = fopen (THE_FILE, "rb");
|
||||||
g_assert (GST_FP_SINK (sink)->stream);
|
g_assert (GST_FP_SINK (sink)->stream);
|
||||||
/* check correct file sizes */
|
/* check correct file sizes */
|
||||||
if (fseek (GST_FP_SINK (sink)->stream, 0, SEEK_END) != 0)
|
if (fseek (GST_FP_SINK (sink)->stream, 0, SEEK_END) != 0)
|
||||||
|
|
|
@ -68,7 +68,7 @@ read_param_file (gchar * filename)
|
||||||
gchar *scan_str;
|
gchar *scan_str;
|
||||||
gboolean res = TRUE;
|
gboolean res = TRUE;
|
||||||
|
|
||||||
fp = fopen (filename, GST_FILE_MODE_READ);
|
fp = fopen (filename, "rb");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue