mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:36:20 +00:00
plugins/elements/gstfdsrc.c: Add some debugging.
Original commit message from CVS: * plugins/elements/gstfdsrc.c: (gst_fd_src_update_fd), (gst_fd_src_create): Add some debugging. Only update fd when it's different from the old.
This commit is contained in:
parent
9e24b65bfa
commit
706d4bf73f
2 changed files with 31 additions and 13 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2006-11-03 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* plugins/elements/gstfdsrc.c: (gst_fd_src_update_fd),
|
||||||
|
(gst_fd_src_create):
|
||||||
|
Add some debugging.
|
||||||
|
Only update fd when it's different from the old.
|
||||||
|
|
||||||
2006-11-02 Tim-Philipp Müller <tim at centricular dot net>
|
2006-11-02 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* plugins/elements/gstfilesrc.c: (gst_file_src_create_mmap):
|
* plugins/elements/gstfilesrc.c: (gst_file_src_create_mmap):
|
||||||
|
|
|
@ -192,26 +192,34 @@ gst_fd_src_update_fd (GstFdSrc * src)
|
||||||
{
|
{
|
||||||
struct stat stat_results;
|
struct stat stat_results;
|
||||||
|
|
||||||
src->fd = src->new_fd;
|
if (src->fd != src->new_fd) {
|
||||||
GST_INFO_OBJECT (src, "Updating to fd %d", src->fd);
|
GST_INFO_OBJECT (src, "Updating to fd %d", src->new_fd);
|
||||||
g_free (src->uri);
|
|
||||||
src->uri = g_strdup_printf ("fd://%d", src->fd);
|
|
||||||
|
|
||||||
if (fstat (src->fd, &stat_results) < 0)
|
src->fd = src->new_fd;
|
||||||
goto not_seekable;
|
|
||||||
|
|
||||||
if (!S_ISREG (stat_results.st_mode))
|
g_free (src->uri);
|
||||||
goto not_seekable;
|
src->uri = g_strdup_printf ("fd://%d", src->fd);
|
||||||
|
|
||||||
/* Try a seek of 0 bytes offset to check for seekability */
|
if (fstat (src->fd, &stat_results) < 0)
|
||||||
if (lseek (src->fd, 0, SEEK_CUR) < 0)
|
goto not_seekable;
|
||||||
goto not_seekable;
|
|
||||||
|
|
||||||
src->seekable_fd = TRUE;
|
if (!S_ISREG (stat_results.st_mode))
|
||||||
|
goto not_seekable;
|
||||||
|
|
||||||
|
/* Try a seek of 0 bytes offset to check for seekability */
|
||||||
|
if (lseek (src->fd, 0, SEEK_CUR) < 0)
|
||||||
|
goto not_seekable;
|
||||||
|
|
||||||
|
GST_INFO_OBJECT (src, "marking fd %d as seekable", src->fd);
|
||||||
|
src->seekable_fd = TRUE;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
not_seekable:
|
not_seekable:
|
||||||
src->seekable_fd = FALSE;
|
{
|
||||||
|
GST_INFO_OBJECT (src, "marking fd %d as NOT seekable", src->fd);
|
||||||
|
src->seekable_fd = FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -341,6 +349,8 @@ gst_fd_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
|
||||||
gchar command;
|
gchar command;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (src, "reading command");
|
||||||
|
|
||||||
READ_COMMAND (src, command, res);
|
READ_COMMAND (src, command, res);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
GST_LOG_OBJECT (src, "no more commands");
|
GST_LOG_OBJECT (src, "no more commands");
|
||||||
|
@ -359,6 +369,7 @@ gst_fd_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
readbytes = read (src->fd, GST_BUFFER_DATA (buf), blocksize);
|
readbytes = read (src->fd, GST_BUFFER_DATA (buf), blocksize);
|
||||||
|
GST_LOG_OBJECT (src, "read %d", readbytes);
|
||||||
} while (readbytes == -1 && errno == EINTR); /* retry if interrupted */
|
} while (readbytes == -1 && errno == EINTR); /* retry if interrupted */
|
||||||
|
|
||||||
if (readbytes < 0)
|
if (readbytes < 0)
|
||||||
|
|
Loading…
Reference in a new issue