mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 02:00:33 +00:00
Various fixes
Original commit message from CVS: Various fixes
This commit is contained in:
parent
e4f698d77f
commit
ce1c2530ce
17 changed files with 46 additions and 40 deletions
|
@ -5,6 +5,13 @@ TODO list (short term):
|
||||||
* v4lsrc: actually try the format out on capsnego
|
* v4lsrc: actually try the format out on capsnego
|
||||||
* all three: fix interlacing (not handled at all...)
|
* all three: fix interlacing (not handled at all...)
|
||||||
* libgstrec: build (a library for video recording)
|
* libgstrec: build (a library for video recording)
|
||||||
|
For other plugins:
|
||||||
|
* SDL: seems okay for now
|
||||||
|
* jpegmmxenc/dec: seems okay for now
|
||||||
|
* avidemux: seems okay for now, though it doesn't really handle
|
||||||
|
events yet
|
||||||
|
* avimux: interaction with disksink, maxfilesize support, events
|
||||||
|
(GST_EVENT_RESTART!!->s/RESTART/NEW_MEDIA/), etc. - big TODO
|
||||||
|
|
||||||
TODO list (long term):
|
TODO list (long term):
|
||||||
======================
|
======================
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* G-Streamer generic V4L element - generic V4L calls handling
|
/* G-Streamer generic V4L element - generic V4L calls handling
|
||||||
* Copyright (C) 2001 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* G-Streamer generic V4L element - generic V4L calls handling
|
/* G-Streamer generic V4L element - generic V4L calls handling
|
||||||
* Copyright (C) 2001 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* G-Streamer hardware MJPEG video sink plugin
|
/* G-Streamer hardware MJPEG video sink plugin
|
||||||
* Copyright (C) 2001 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@ -185,13 +185,13 @@ gst_v4lmjpegsink_sinkconnect (GstPad *pad,
|
||||||
v4lmjpegsink = GST_V4LMJPEGSINK (gst_pad_get_parent (pad));
|
v4lmjpegsink = GST_V4LMJPEGSINK (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
/* we are not going to act on variable caps */
|
/* we are not going to act on variable caps */
|
||||||
if (!GST_CAPS_IS_FIXED (vscapslist))
|
if (!GST_CAPS_IS_FIXED (vscapslist) || !GST_V4L_IS_OPEN(GST_V4LELEMENT(v4lmjpegsink)))
|
||||||
return GST_PAD_CONNECT_DELAYED;
|
return GST_PAD_CONNECT_DELAYED;
|
||||||
|
|
||||||
for (caps = capslist; caps != NULL; caps = vscapslist = vscapslist->next)
|
for (caps = vscapslist; caps != NULL; caps = vscapslist = vscapslist->next)
|
||||||
{
|
{
|
||||||
v4lmjpegsink->width = gst_caps_get_int (caps, "width");
|
v4lmjpegsink->width = gst_caps_get_int (caps, "width");
|
||||||
v4lmjpegsink->height = gst_caps_get_int (caps, "height");
|
v4lmjpegsink->height = gst_caps_get_int (caps, "height");
|
||||||
|
|
||||||
if (!gst_v4lmjpegsink_set_playback(v4lmjpegsink,
|
if (!gst_v4lmjpegsink_set_playback(v4lmjpegsink,
|
||||||
v4lmjpegsink->width, v4lmjpegsink->height,
|
v4lmjpegsink->width, v4lmjpegsink->height,
|
||||||
|
@ -206,8 +206,6 @@ gst_v4lmjpegsink_sinkconnect (GstPad *pad,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we got here - it's not good */
|
/* if we got here - it's not good */
|
||||||
gst_element_error(GST_ELEMENT(v4lmjpegsink),
|
|
||||||
"Failed to find acceptable caps");
|
|
||||||
return GST_PAD_CONNECT_REFUSED;
|
return GST_PAD_CONNECT_REFUSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* G-Streamer hardware MJPEG video sink plugin
|
/* G-Streamer hardware MJPEG video sink plugin
|
||||||
* Copyright (C) 2001 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@ -71,6 +71,7 @@ struct _GstV4lMjpegSink {
|
||||||
/* width/height/norm of the jpeg stream */
|
/* width/height/norm of the jpeg stream */
|
||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
|
gint norm;
|
||||||
|
|
||||||
/* cache values */
|
/* cache values */
|
||||||
gint x_offset;
|
gint x_offset;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* G-Streamer hardware MJPEG video source plugin
|
/* G-Streamer hardware MJPEG video source plugin
|
||||||
* Copyright (C) 2001 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* G-Streamer hardware MJPEG video source plugin
|
/* G-Streamer hardware MJPEG video source plugin
|
||||||
* Copyright (C) 2001 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* G-Streamer BT8x8/V4L frame grabber plugin
|
/* G-Streamer BT8x8/V4L frame grabber plugin
|
||||||
* Copyright (C) 2001 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@ -329,8 +329,6 @@ gst_v4lsrc_srcconnect (GstPad *pad,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* still nothing - no good caps */
|
/* still nothing - no good caps */
|
||||||
gst_element_error(GST_ELEMENT(v4lsrc),
|
|
||||||
"Failed to find acceptable caps");
|
|
||||||
return GST_PAD_CONNECT_REFUSED;
|
return GST_PAD_CONNECT_REFUSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +443,6 @@ gst_v4lsrc_change_state (GstElement *element)
|
||||||
{
|
{
|
||||||
GstV4lSrc *v4lsrc;
|
GstV4lSrc *v4lsrc;
|
||||||
GstElementStateReturn parent_value;
|
GstElementStateReturn parent_value;
|
||||||
GstCaps *caps;
|
|
||||||
gint transition = GST_STATE_TRANSITION (element);
|
gint transition = GST_STATE_TRANSITION (element);
|
||||||
|
|
||||||
g_return_val_if_fail(GST_IS_V4LSRC(element), GST_STATE_FAILURE);
|
g_return_val_if_fail(GST_IS_V4LSRC(element), GST_STATE_FAILURE);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* G-Streamer BT8x8/V4L frame grabber plugin
|
/* G-Streamer BT8x8/V4L frame grabber plugin
|
||||||
* Copyright (C) 2001 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@ -53,7 +53,7 @@ struct _GstV4lSrc {
|
||||||
struct video_mmap mmap;
|
struct video_mmap mmap;
|
||||||
struct video_mbuf mbuf;
|
struct video_mbuf mbuf;
|
||||||
gint sync_frame;
|
gint sync_frame;
|
||||||
gboolean *frame_queued;
|
gint8 *frame_queued;
|
||||||
guint buffer_size;
|
guint buffer_size;
|
||||||
|
|
||||||
/* a seperate pthread for the sync() thread (improves correctness of timestamps) */
|
/* a seperate pthread for the sync() thread (improves correctness of timestamps) */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* G-Streamer generic V4L element - generic V4L calls handling
|
/* G-Streamer generic V4L element - generic V4L calls handling
|
||||||
* Copyright (C) 2001 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* G-Streamer generic V4L element - generic V4L calls handling
|
/* G-Streamer generic V4L element - generic V4L calls handling
|
||||||
* Copyright (C) 2001 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* G-Streamer hardware MJPEG video sink plugin
|
/* G-Streamer hardware MJPEG video sink plugin
|
||||||
* Copyright (C) 2001 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* G-Streamer hardware MJPEG video sink plugin
|
/* G-Streamer hardware MJPEG video sink plugin
|
||||||
* Copyright (C) 2001 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* G-Streamer hardware MJPEG video source plugin
|
/* G-Streamer hardware MJPEG video source plugin
|
||||||
* Copyright (C) 2001 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* G-Streamer hardware MJPEG video source plugin
|
/* G-Streamer hardware MJPEG video source plugin
|
||||||
* Copyright (C) 2001 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* G-Streamer BT8x8/V4L frame grabber plugin
|
/* G-Streamer BT8x8/V4L frame grabber plugin
|
||||||
* Copyright (C) 2001 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@ -78,6 +78,12 @@ gst_v4lsrc_queue_frame (GstV4lSrc *v4lsrc,
|
||||||
|
|
||||||
v4lsrc->mmap.frame = num;
|
v4lsrc->mmap.frame = num;
|
||||||
|
|
||||||
|
if (v4lsrc->frame_queued[num] < 0)
|
||||||
|
{
|
||||||
|
v4lsrc->frame_queued[num] = 0;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (ioctl(GST_V4LELEMENT(v4lsrc)->video_fd, VIDIOCMCAPTURE, &(v4lsrc->mmap)) < 0)
|
if (ioctl(GST_V4LELEMENT(v4lsrc)->video_fd, VIDIOCMCAPTURE, &(v4lsrc->mmap)) < 0)
|
||||||
{
|
{
|
||||||
gst_element_error(GST_ELEMENT(v4lsrc),
|
gst_element_error(GST_ELEMENT(v4lsrc),
|
||||||
|
@ -86,7 +92,7 @@ gst_v4lsrc_queue_frame (GstV4lSrc *v4lsrc,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
v4lsrc->frame_queued[num] = TRUE;
|
v4lsrc->frame_queued[num] = 1;
|
||||||
|
|
||||||
pthread_mutex_lock(&(v4lsrc->mutex_queued_frames));
|
pthread_mutex_lock(&(v4lsrc->mutex_queued_frames));
|
||||||
v4lsrc->num_queued_frames++;
|
v4lsrc->num_queued_frames++;
|
||||||
|
@ -123,6 +129,8 @@ gst_v4lsrc_soft_sync_thread (void *arg)
|
||||||
pthread_mutex_lock(&(v4lsrc->mutex_queued_frames));
|
pthread_mutex_lock(&(v4lsrc->mutex_queued_frames));
|
||||||
if (v4lsrc->num_queued_frames < MIN_BUFFERS_QUEUED)
|
if (v4lsrc->num_queued_frames < MIN_BUFFERS_QUEUED)
|
||||||
{
|
{
|
||||||
|
if (v4lsrc->frame_queued[frame] < 0)
|
||||||
|
break;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "Waiting for new frames to be queued (%d < %d)\n",
|
fprintf(stderr, "Waiting for new frames to be queued (%d < %d)\n",
|
||||||
v4lsrc->num_queued_frames, MIN_BUFFERS_QUEUED);
|
v4lsrc->num_queued_frames, MIN_BUFFERS_QUEUED);
|
||||||
|
@ -132,11 +140,10 @@ gst_v4lsrc_soft_sync_thread (void *arg)
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&(v4lsrc->mutex_queued_frames));
|
pthread_mutex_unlock(&(v4lsrc->mutex_queued_frames));
|
||||||
|
|
||||||
/* if still wrong, we got interrupted and we should exit */
|
if (!v4lsrc->num_queued_frames)
|
||||||
if (v4lsrc->num_queued_frames < MIN_BUFFERS_QUEUED)
|
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "Still not enough frames, quitting...\n");
|
fprintf(stderr, "Got signal to exit...\n");
|
||||||
#endif
|
#endif
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -169,11 +176,12 @@ retry:
|
||||||
pthread_mutex_unlock(&(v4lsrc->mutex_soft_sync));
|
pthread_mutex_unlock(&(v4lsrc->mutex_soft_sync));
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = (frame+1)%v4lsrc->mbuf.frames;
|
|
||||||
|
|
||||||
pthread_mutex_lock(&(v4lsrc->mutex_queued_frames));
|
pthread_mutex_lock(&(v4lsrc->mutex_queued_frames));
|
||||||
v4lsrc->num_queued_frames--;
|
v4lsrc->num_queued_frames--;
|
||||||
|
v4lsrc->frame_queued[frame] = 0;
|
||||||
pthread_mutex_unlock(&(v4lsrc->mutex_queued_frames));
|
pthread_mutex_unlock(&(v4lsrc->mutex_queued_frames));
|
||||||
|
|
||||||
|
frame = (frame+1)%v4lsrc->mbuf.frames;
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
@ -217,8 +225,6 @@ gst_v4lsrc_sync_next_frame (GstV4lSrc *v4lsrc,
|
||||||
v4lsrc->isready_soft_sync[*num] = 0;
|
v4lsrc->isready_soft_sync[*num] = 0;
|
||||||
pthread_mutex_unlock(&(v4lsrc->mutex_soft_sync));
|
pthread_mutex_unlock(&(v4lsrc->mutex_soft_sync));
|
||||||
|
|
||||||
v4lsrc->frame_queued[*num] = FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +298,7 @@ gst_v4lsrc_capture_init (GstV4lSrc *v4lsrc)
|
||||||
v4lsrc->mbuf.size/(v4lsrc->mbuf.frames*1024));
|
v4lsrc->mbuf.size/(v4lsrc->mbuf.frames*1024));
|
||||||
|
|
||||||
/* keep trakc of queued buffers */
|
/* keep trakc of queued buffers */
|
||||||
v4lsrc->frame_queued = (gint *) malloc(sizeof(int) * v4lsrc->mbuf.frames);
|
v4lsrc->frame_queued = (gint8 *) malloc(sizeof(gint8) * v4lsrc->mbuf.frames);
|
||||||
if (!v4lsrc->frame_queued)
|
if (!v4lsrc->frame_queued)
|
||||||
{
|
{
|
||||||
gst_element_error(GST_ELEMENT(v4lsrc),
|
gst_element_error(GST_ELEMENT(v4lsrc),
|
||||||
|
@ -301,7 +307,7 @@ gst_v4lsrc_capture_init (GstV4lSrc *v4lsrc)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
for (n=0;n<v4lsrc->mbuf.frames;n++)
|
for (n=0;n<v4lsrc->mbuf.frames;n++)
|
||||||
v4lsrc->frame_queued[n] = FALSE;
|
v4lsrc->frame_queued[n] = 0;
|
||||||
|
|
||||||
/* init the pthread stuff */
|
/* init the pthread stuff */
|
||||||
pthread_mutex_init(&(v4lsrc->mutex_soft_sync), NULL);
|
pthread_mutex_init(&(v4lsrc->mutex_soft_sync), NULL);
|
||||||
|
@ -490,11 +496,8 @@ gst_v4lsrc_capture_stop (GstV4lSrc *v4lsrc)
|
||||||
|
|
||||||
/* we actually need to sync on all queued buffers but not on the non-queued ones */
|
/* we actually need to sync on all queued buffers but not on the non-queued ones */
|
||||||
for (n=0;n<v4lsrc->mbuf.frames;n++)
|
for (n=0;n<v4lsrc->mbuf.frames;n++)
|
||||||
while (v4lsrc->frame_queued[n])
|
v4lsrc->frame_queued[n] = -1;
|
||||||
if (!gst_v4lsrc_sync_next_frame(v4lsrc, &num))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
pthread_cancel(v4lsrc->thread_soft_sync);
|
|
||||||
pthread_join(v4lsrc->thread_soft_sync, NULL);
|
pthread_join(v4lsrc->thread_soft_sync, NULL);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* G-Streamer BT8x8/V4L frame grabber plugin
|
/* G-Streamer BT8x8/V4L frame grabber plugin
|
||||||
* Copyright (C) 2001 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
|
Loading…
Reference in a new issue