mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-01 22:21:13 +00:00
Handle binary files under Windows
Original commit message from CVS: Handle binary files under Windows
This commit is contained in:
parent
0c7ff9acae
commit
fb7d3a201c
12 changed files with 31 additions and 12 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2004-07-12 Steve Lhomme <steve.lhomme@free.fr>
|
||||||
|
* gst/elements/gstfilesink.c:
|
||||||
|
* gst/elements/gstfilesrc.c:
|
||||||
|
* gst/indexers/gstfileindex.c:
|
||||||
|
* gst/gsttypes.h:
|
||||||
|
* testsuite/bytestream/filepadsink.c:
|
||||||
|
* testsuite/bytestream/test1.c:
|
||||||
|
Handle binary files under Windows
|
||||||
|
|
||||||
2004-07-12 Steve Lhomme <steve.lhomme@free.fr>
|
2004-07-12 Steve Lhomme <steve.lhomme@free.fr>
|
||||||
* docs/manual/win32.xml:
|
* docs/manual/win32.xml:
|
||||||
* win32/config.h:
|
* win32/config.h:
|
||||||
|
|
|
@ -260,7 +260,7 @@ gst_filesink_open_file (GstFileSink * sink)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
sink->file = fopen (sink->filename, "w");
|
sink->file = fopen (sink->filename, "wb");
|
||||||
if (sink->file == NULL) {
|
if (sink->file == NULL) {
|
||||||
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
|
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
|
||||||
(_("Could not open file \"%s\" for writing."), sink->filename),
|
(_("Could not open file \"%s\" for writing."), sink->filename),
|
||||||
|
|
|
@ -756,7 +756,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, O_RDONLY);
|
src->fd = open (src->filename, GST_O_READONLY);
|
||||||
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,6 +66,16 @@ 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
|
||||||
|
|
||||||
#endif /* __GST_TYPES_H__ */
|
#endif /* __GST_TYPES_H__ */
|
||||||
|
|
|
@ -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, "w", &err);
|
chan = g_io_channel_new_file (path, GST_FILE_MODE_WRITE, &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, "w", &err);
|
tocfile = g_io_channel_new_file (path, GST_FILE_MODE_WRITE, &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);
|
||||||
|
|
|
@ -260,7 +260,7 @@ gst_filesink_open_file (GstFileSink * sink)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
sink->file = fopen (sink->filename, "w");
|
sink->file = fopen (sink->filename, "wb");
|
||||||
if (sink->file == NULL) {
|
if (sink->file == NULL) {
|
||||||
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
|
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
|
||||||
(_("Could not open file \"%s\" for writing."), sink->filename),
|
(_("Could not open file \"%s\" for writing."), sink->filename),
|
||||||
|
|
|
@ -756,7 +756,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, O_RDONLY);
|
src->fd = open (src->filename, GST_O_READONLY);
|
||||||
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, "w", &err);
|
chan = g_io_channel_new_file (path, GST_FILE_MODE_WRITE, &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, "w", &err);
|
tocfile = g_io_channel_new_file (path, GST_FILE_MODE_WRITE, &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, "r");
|
GST_FP_SINK (sink)->stream = fopen (THE_FILE, GST_FILE_MODE_READ);
|
||||||
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, "r");
|
fp = fopen (filename, GST_FILE_MODE_READ);
|
||||||
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, "r");
|
GST_FP_SINK (sink)->stream = fopen (THE_FILE, GST_FILE_MODE_READ);
|
||||||
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, "r");
|
fp = fopen (filename, GST_FILE_MODE_READ);
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue