2008-05-21 Wim Taymans <wim.taymans@collabora.co.uk>
+ * plugins/elements/gstfilesink.c: (gst_file_sink_set_location),
+ (gst_file_sink_render):
+ * plugins/elements/gstfilesrc.c: (gst_file_src_set_location),
+ (gst_file_src_start):
+ Small cleanups. Add note adbout g_fopen() on windows and why we don't
+ use it yet.
+
+2008-05-21 Wim Taymans <wim.taymans@collabora.co.uk>
+
* gst/gstpad.c: (gst_pad_load_and_link):
* gst/gstutils.c: (gst_element_link_pads),
(gst_element_unlink_pads):
g_free (sink->filename);
g_free (sink->uri);
if (location != NULL) {
+ /* we store the filename as we received it from the application. On Windows
+ * this should be in UTF8 */
sink->filename = g_strdup (location);
- sink->uri = gst_uri_construct ("file", location);
+ sink->uri = gst_uri_construct ("file", sink->filename);
} else {
sink->filename = NULL;
sink->uri = NULL;
if (sink->filename == NULL || sink->filename[0] == '\0')
goto no_filename;
+ /* FIXME, can we use g_fopen here? some people say that the FILE object is
+ * local to the .so that performed the fopen call, which would not be us when
+ * we use g_fopen. */
sink->file = fopen (sink->filename, "wb");
if (sink->file == NULL)
goto open_failed;
{
GstFileSink *filesink;
guint size;
-
- size = GST_BUFFER_SIZE (buffer);
+ guint8 *data;
filesink = GST_FILE_SINK (sink);
+ size = GST_BUFFER_SIZE (buffer);
+ data = GST_BUFFER_DATA (buffer);
+
GST_DEBUG_OBJECT (filesink, "writing %u bytes at %" G_GUINT64_FORMAT,
size, filesink->current_pos);
- if (size > 0 && GST_BUFFER_DATA (buffer) != NULL) {
- if (fwrite (GST_BUFFER_DATA (buffer), size, 1, filesink->file) != 1)
+ if (size > 0 && data != NULL) {
+ if (fwrite (data, size, 1, filesink->file) != 1)
goto handle_error;
filesink->current_pos += size;
src->filename = NULL;
src->uri = NULL;
} else {
+ /* we store the filename as received by the application. On Windoes this
+ * should be UTF8 */
src->filename = g_strdup (location);
src->uri = gst_uri_construct ("file", src->filename);
}
/* open the file */
src->fd = open (src->filename, O_RDONLY | O_BINARY);
+
if (src->fd < 0)
goto open_failed;