# include <unistd.h>
#endif
#ifdef _MSC_VER
-/* ssize_t is not available, so match return value of read()/write() on MSVC */
-#define ssize_t int
-/* read, write */
-#include <io.h>
+/* ssize_t is not available, so match return value of recv()/send() on MSVC */
+# define ssize_t int
+# include <winsock2.h>
#endif
#include <errno.h>
#include <string.h>
GST_TRACE_OBJECT (comm->element, "Writing %u bytes to fdout",
(unsigned) size);
while (size) {
+#ifdef _MSC_VER
+ ssize_t written =
+ send (comm->fdout, (const unsigned char *) data + offset, size, 0);
+ if (written < 0) {
+ int last_error = WSAGetLastError ();
+ if (last_error == WSAEWOULDBLOCK)
+ continue;
+ gchar *error_text = g_win32_error_message (last_error);
+ GST_ERROR_OBJECT (comm->element, "Failed to write to fd: %s", error_text);
+ g_free (error_text);
+ ret = FALSE;
+ goto done;
+ }
+#else
ssize_t written =
write (comm->fdout, (const unsigned char *) data + offset, size);
if (written < 0) {
ret = FALSE;
goto done;
}
+#endif
size -= written;
offset += written;
}
mem = gst_allocator_alloc (NULL, comm->read_chunk_size, NULL);
gst_memory_map (mem, &map, GST_MAP_WRITE);
+#ifdef _MSC_VER
+ sz = recv (comm->pollFDin.fd, map.data, map.size, 0);
+ if (sz < 0) {
+ int last_error = WSAGetLastError ();
+ if (last_error == WSAEWOULDBLOCK) {
+ errno = EAGAIN;
+ } else {
+ errno = last_error;
+ }
+ }
+#else
sz = read (comm->pollFDin.fd, map.data, map.size);
+#endif
gst_memory_unmap (mem, &map);
if (sz <= 0) {
ipcpipeline_sources,
c_args : gst_plugins_bad_args,
include_directories : [configinc],
- dependencies : [gstbase_dep],
+ dependencies : [gstbase_dep] + winsock2,
install : true,
install_dir : plugins_install_dir,
)