mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
ext/ogg/gstoggmux.c: Basic pad template which accepts OGM tracks, speex, flac, vorbis and theora. Any is incorrect.
Original commit message from CVS: * ext/ogg/gstoggmux.c: Basic pad template which accepts OGM tracks, speex, flac, vorbis and theora. Any is incorrect. * gst/asfdemux/gstasfmux.c: (gst_asfmux_vidsink_link): Fix caps. * sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_base_init): * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_base_init), (gst_v4lmjpegsrc_init), (gst_v4lmjpegsrc_srcconnect), (gst_v4lmjpegsrc_getcaps), (gst_v4lmjpegsrc_change_state): * sys/v4l/gstv4lmjpegsrc.h: * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_src_link), (gst_v4lsrc_getcaps), (gst_v4lsrc_change_state): * sys/v4l/v4lmjpegsrc_calls.c: (gst_v4lmjpegsrc_capture_start), (gst_v4lmjpegsrc_capture_stop): Fix caps. Keep track of internal state. Work.
This commit is contained in:
parent
6b5bd90a9a
commit
39caf72eaf
7 changed files with 64 additions and 21 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
2004-10-24 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||
|
||||
* ext/ogg/gstoggmux.c:
|
||||
Basic pad template which accepts OGM tracks, speex, flac, vorbis
|
||||
and theora. Any is incorrect.
|
||||
* gst/asfdemux/gstasfmux.c: (gst_asfmux_vidsink_link):
|
||||
Fix caps.
|
||||
* sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_base_init):
|
||||
* sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_base_init),
|
||||
(gst_v4lmjpegsrc_init), (gst_v4lmjpegsrc_srcconnect),
|
||||
(gst_v4lmjpegsrc_getcaps), (gst_v4lmjpegsrc_change_state):
|
||||
* sys/v4l/gstv4lmjpegsrc.h:
|
||||
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_src_link), (gst_v4lsrc_getcaps),
|
||||
(gst_v4lsrc_change_state):
|
||||
* sys/v4l/v4lmjpegsrc_calls.c: (gst_v4lmjpegsrc_capture_start),
|
||||
(gst_v4lmjpegsrc_capture_stop):
|
||||
Fix caps. Keep track of internal state. Work.
|
||||
|
||||
2004-10-23 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||
|
||||
* ext/Makefile.am:
|
||||
|
|
|
@ -147,7 +147,9 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
|||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink_%d",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_REQUEST,
|
||||
GST_STATIC_CAPS_ANY /* we can take anything, really */
|
||||
GST_STATIC_CAPS ("video/x-theora; "
|
||||
"audio/x-vorbis; audio/x-flac; audio/x-speex; "
|
||||
"application/x-ogm-video; application/x-ogm-audio")
|
||||
);
|
||||
|
||||
static void gst_ogg_mux_base_init (gpointer g_class);
|
||||
|
|
|
@ -112,7 +112,7 @@ gst_v4lmjpegsink_base_init (gpointer g_class)
|
|||
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-jpeg, "
|
||||
GST_STATIC_CAPS ("image/jpeg, "
|
||||
"width = (int) [ 1, MAX ], "
|
||||
"height = (int) [ 1, MAX ], " "framerate = (double) [ 0, MAX ]")
|
||||
);
|
||||
|
|
|
@ -142,7 +142,7 @@ gst_v4lmjpegsrc_base_init (gpointer g_class)
|
|||
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-jpeg, "
|
||||
GST_STATIC_CAPS ("image/jpeg, "
|
||||
"width = (int) [ 0, MAX ], "
|
||||
"height = (int) [ 0, MAX ], " "framerate = (double) [ 0, MAX ]")
|
||||
);
|
||||
|
@ -264,6 +264,8 @@ gst_v4lmjpegsrc_init (GstV4lMjpegSrc * v4lmjpegsrc)
|
|||
|
||||
/* fps */
|
||||
v4lmjpegsrc->use_fixed_fps = TRUE;
|
||||
|
||||
v4lmjpegsrc->is_capturing = FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -401,9 +403,14 @@ gst_v4lmjpegsrc_srcconnect (GstPad * pad, const GstCaps * caps)
|
|||
max_h = GST_V4LELEMENT (v4lmjpegsrc)->vcap.maxheight;
|
||||
gulong bufsize;
|
||||
GstStructure *structure;
|
||||
gboolean was_capturing;
|
||||
|
||||
/* in case the buffers are active (which means that we already
|
||||
* did capsnego before and didn't clean up), clean up anyways */
|
||||
if ((was_capturing = v4lmjpegsrc->is_capturing)) {
|
||||
if (!gst_v4lmjpegsrc_capture_stop (v4lmjpegsrc))
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
}
|
||||
if (GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc))) {
|
||||
if (!gst_v4lmjpegsrc_capture_deinit (v4lmjpegsrc))
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
|
@ -413,7 +420,7 @@ gst_v4lmjpegsrc_srcconnect (GstPad * pad, const GstCaps * caps)
|
|||
|
||||
/* Note: basically, we don't give a damn about the opposite caps here.
|
||||
* that might seem odd, but it isn't. we know that the opposite caps is
|
||||
* either NULL or has mime type video/x-jpeg, and in both cases, we'll set
|
||||
* either NULL or has mime type image/jpeg, and in both cases, we'll set
|
||||
* our own mime type back and it'll work. Other properties are to be set
|
||||
* by the src, not by the opposite caps */
|
||||
|
||||
|
@ -474,6 +481,13 @@ gst_v4lmjpegsrc_srcconnect (GstPad * pad, const GstCaps * caps)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (!gst_v4lmjpegsrc_capture_init (v4lmjpegsrc))
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
|
||||
if (was_capturing || GST_STATE (v4lmjpegsrc) == GST_STATE_PLAYING)
|
||||
if (!gst_v4lmjpegsrc_capture_start (v4lmjpegsrc))
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
|
||||
return GST_PAD_LINK_OK;
|
||||
}
|
||||
|
||||
|
@ -596,15 +610,17 @@ gst_v4lmjpegsrc_getcaps (GstPad * pad)
|
|||
{
|
||||
GstV4lMjpegSrc *v4lmjpegsrc = GST_V4LMJPEGSRC (gst_pad_get_parent (pad));
|
||||
struct video_capability *vcap = &GST_V4LELEMENT (v4lmjpegsrc)->vcap;
|
||||
gdouble fps;
|
||||
|
||||
if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lmjpegsrc))) {
|
||||
return NULL;
|
||||
return gst_caps_copy (gst_pad_get_pad_template_caps (pad));
|
||||
}
|
||||
|
||||
return gst_caps_new_simple ("video/x-jpeg",
|
||||
fps = gst_v4lmjpegsrc_get_fps (v4lmjpegsrc);
|
||||
return gst_caps_new_simple ("image/jpeg",
|
||||
"width", GST_TYPE_INT_RANGE, vcap->maxwidth / 4, vcap->maxwidth,
|
||||
"height", GST_TYPE_INT_RANGE, vcap->maxheight / 4, vcap->maxheight,
|
||||
"framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL);
|
||||
"framerate", G_TYPE_DOUBLE, fps, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -717,7 +733,8 @@ gst_v4lmjpegsrc_change_state (GstElement * element)
|
|||
break;
|
||||
case GST_STATE_PAUSED_TO_PLAYING:
|
||||
/* queue all buffer, start streaming capture */
|
||||
if (!gst_v4lmjpegsrc_capture_start (v4lmjpegsrc))
|
||||
if (GST_V4LELEMENT (v4lmjpegsrc)->buffer &&
|
||||
!gst_v4lmjpegsrc_capture_start (v4lmjpegsrc))
|
||||
return GST_STATE_FAILURE;
|
||||
g_get_current_time (&time);
|
||||
v4lmjpegsrc->substract_time = GST_TIMEVAL_TO_TIME (time) -
|
||||
|
@ -729,12 +746,14 @@ gst_v4lmjpegsrc_change_state (GstElement * element)
|
|||
v4lmjpegsrc->substract_time = GST_TIMEVAL_TO_TIME (time) -
|
||||
v4lmjpegsrc->substract_time;
|
||||
/* de-queue all queued buffers */
|
||||
if (!gst_v4lmjpegsrc_capture_stop (v4lmjpegsrc))
|
||||
if (v4lmjpegsrc->is_capturing &&
|
||||
!gst_v4lmjpegsrc_capture_stop (v4lmjpegsrc))
|
||||
return GST_STATE_FAILURE;
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
/* stop capturing, unmap all buffers */
|
||||
if (!gst_v4lmjpegsrc_capture_deinit (v4lmjpegsrc))
|
||||
if (GST_V4LELEMENT (v4lmjpegsrc)->buffer &&
|
||||
!gst_v4lmjpegsrc_capture_deinit (v4lmjpegsrc))
|
||||
return GST_STATE_FAILURE;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ struct _GstV4lMjpegSrc {
|
|||
gint queue_frame;
|
||||
|
||||
/* True if we want to stop */
|
||||
gboolean quit;
|
||||
gboolean quit, is_capturing;
|
||||
|
||||
/* A/V sync... frame counter and internal cache */
|
||||
gulong handled;
|
||||
|
|
|
@ -730,7 +730,7 @@ gst_v4lsrc_src_link (GstPad * pad, const GstCaps * vscapslist)
|
|||
if (!gst_v4lsrc_capture_init (v4lsrc))
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
|
||||
if (was_capturing) {
|
||||
if (was_capturing || GST_STATE (v4lsrc) == GST_STATE_PLAYING) {
|
||||
if (!gst_v4lsrc_capture_start (v4lsrc))
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
}
|
||||
|
@ -794,8 +794,7 @@ gst_v4lsrc_getcaps (GstPad * pad)
|
|||
struct video_capability *vcap = &GST_V4LELEMENT (v4lsrc)->vcap;
|
||||
gfloat fps = 0.0;
|
||||
GList *item;
|
||||
static GValue *fps_list; /* FIXME: this should be done in a hash table
|
||||
* on device name instead */
|
||||
GValue *fps_list;
|
||||
|
||||
if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lsrc))) {
|
||||
return gst_caps_new_any ();
|
||||
|
@ -805,9 +804,9 @@ gst_v4lsrc_getcaps (GstPad * pad)
|
|||
return gst_caps_new_any ();
|
||||
}
|
||||
|
||||
/* if not cached from last run, get it */
|
||||
if (!fps_list)
|
||||
fps_list = gst_v4lsrc_get_fps_list (v4lsrc);
|
||||
/* FIXME: cache this on gst_v4l_open() */
|
||||
fps_list = gst_v4lsrc_get_fps_list (v4lsrc);
|
||||
g_print ("FPS list: %p\n", fps_list);
|
||||
if (!fps_list)
|
||||
fps = gst_v4lsrc_get_fps (v4lsrc);
|
||||
|
||||
|
@ -826,7 +825,7 @@ gst_v4lsrc_getcaps (GstPad * pad)
|
|||
|
||||
if (vcap->minwidth < vcap->maxwidth) {
|
||||
gst_caps_set_simple (one, "width", GST_TYPE_INT_RANGE, vcap->minwidth,
|
||||
NULL);
|
||||
vcap->maxwidth, NULL);
|
||||
} else {
|
||||
gst_caps_set_simple (one, "width", G_TYPE_INT, vcap->minwidth, NULL);
|
||||
}
|
||||
|
@ -1154,7 +1153,8 @@ gst_v4lsrc_change_state (GstElement * element)
|
|||
break;
|
||||
case GST_STATE_PAUSED_TO_PLAYING:
|
||||
/* queue all buffer, start streaming capture */
|
||||
if (!gst_v4lsrc_capture_start (v4lsrc))
|
||||
if (GST_V4LELEMENT (v4lsrc)->buffer != NULL &&
|
||||
!gst_v4lsrc_capture_start (v4lsrc))
|
||||
return GST_STATE_FAILURE;
|
||||
g_get_current_time (&time);
|
||||
v4lsrc->substract_time =
|
||||
|
@ -1162,15 +1162,17 @@ gst_v4lsrc_change_state (GstElement * element)
|
|||
break;
|
||||
case GST_STATE_PLAYING_TO_PAUSED:
|
||||
/* de-queue all queued buffers */
|
||||
if (!gst_v4lsrc_capture_stop (v4lsrc))
|
||||
if (v4lsrc->is_capturing && !gst_v4lsrc_capture_stop (v4lsrc))
|
||||
return GST_STATE_FAILURE;
|
||||
gst_v4lsrc_capture_stop (v4lsrc);
|
||||
g_get_current_time (&time);
|
||||
v4lsrc->substract_time =
|
||||
GST_TIMEVAL_TO_TIME (time) - v4lsrc->substract_time;
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
/* stop capturing, unmap all buffers */
|
||||
if (!gst_v4lsrc_capture_deinit (v4lsrc))
|
||||
if (GST_V4LELEMENT (v4lsrc)->buffer != NULL &&
|
||||
!gst_v4lsrc_capture_deinit (v4lsrc))
|
||||
return GST_STATE_FAILURE;
|
||||
break;
|
||||
case GST_STATE_READY_TO_NULL:
|
||||
|
|
|
@ -400,6 +400,7 @@ gst_v4lmjpegsrc_capture_start (GstV4lMjpegSrc * v4lmjpegsrc)
|
|||
}
|
||||
}
|
||||
|
||||
v4lmjpegsrc->is_capturing = TRUE;
|
||||
g_mutex_unlock (v4lmjpegsrc->mutex_queue_state);
|
||||
|
||||
return TRUE;
|
||||
|
@ -541,6 +542,7 @@ gst_v4lmjpegsrc_capture_stop (GstV4lMjpegSrc * v4lmjpegsrc)
|
|||
gst_v4lmjpegsrc_sync_next_frame (v4lmjpegsrc, &n);
|
||||
}
|
||||
|
||||
v4lmjpegsrc->is_capturing = FALSE;
|
||||
g_mutex_unlock (v4lmjpegsrc->mutex_queue_state);
|
||||
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in a new issue