mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 15:18:21 +00:00
sys/oss/gstosssrc.*: OK, so people want offset in DEFAULT. This time, actually fix all cases.
Original commit message from CVS: * sys/oss/gstosssrc.c: (gst_osssrc_get_time), (gst_osssrc_get), (gst_osssrc_src_query): * sys/oss/gstosssrc.h: OK, so people want offset in DEFAULT. This time, actually fix all cases. * sys/v4l2/gstv4l2src.c: (gst_v4l2src_getcaps): Add FPS properly.
This commit is contained in:
parent
7d1805fda4
commit
b41cdefc05
4 changed files with 20 additions and 7 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2004-10-25 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
|
* sys/oss/gstosssrc.c: (gst_osssrc_get_time), (gst_osssrc_get),
|
||||||
|
(gst_osssrc_src_query):
|
||||||
|
* sys/oss/gstosssrc.h:
|
||||||
|
OK, so people want offset in DEFAULT. This time, actually fix all
|
||||||
|
cases.
|
||||||
|
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_getcaps):
|
||||||
|
Add FPS properly.
|
||||||
|
|
||||||
2004-10-24 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
2004-10-24 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
* gst/asfdemux/gstasfmux.c:
|
* gst/asfdemux/gstasfmux.c:
|
||||||
|
|
|
@ -305,7 +305,7 @@ gst_osssrc_get_time (GstClock * clock, gpointer data)
|
||||||
if (ioctl (GST_OSSELEMENT (osssrc)->fd, SNDCTL_DSP_GETISPACE, &info) < 0)
|
if (ioctl (GST_OSSELEMENT (osssrc)->fd, SNDCTL_DSP_GETISPACE, &info) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return (osssrc->curoffset +
|
return (osssrc->curoffset * GST_OSSELEMENT (osssrc)->sample_width +
|
||||||
info.bytes) * GST_SECOND / GST_OSSELEMENT (osssrc)->bps;
|
info.bytes) * GST_SECOND / GST_OSSELEMENT (osssrc)->bps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ gst_osssrc_get (GstPad * pad)
|
||||||
|
|
||||||
GST_BUFFER_SIZE (buf) = readbytes;
|
GST_BUFFER_SIZE (buf) = readbytes;
|
||||||
GST_BUFFER_OFFSET (buf) = src->curoffset;
|
GST_BUFFER_OFFSET (buf) = src->curoffset;
|
||||||
GST_BUFFER_OFFSET_END (buf) = src->curoffset + readbytes;
|
GST_BUFFER_OFFSET_END (buf) = src->curoffset + readsamples;
|
||||||
GST_BUFFER_DURATION (buf) =
|
GST_BUFFER_DURATION (buf) =
|
||||||
readsamples * GST_SECOND / GST_OSSELEMENT (src)->rate;
|
readsamples * GST_SECOND / GST_OSSELEMENT (src)->rate;
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ gst_osssrc_get (GstPad * pad)
|
||||||
if (src->clock == src->provided_clock) {
|
if (src->clock == src->provided_clock) {
|
||||||
/* if it's our own clock, we can be very accurate */
|
/* if it's our own clock, we can be very accurate */
|
||||||
GST_BUFFER_TIMESTAMP (buf) =
|
GST_BUFFER_TIMESTAMP (buf) =
|
||||||
src->curoffset * GST_SECOND / GST_OSSELEMENT (src)->bps;
|
src->curoffset * GST_SECOND / GST_OSSELEMENT (src)->rate;
|
||||||
} else {
|
} else {
|
||||||
/* somebody elses clock, timestamp with that clock, no discontinuity in
|
/* somebody elses clock, timestamp with that clock, no discontinuity in
|
||||||
* the stream since the OFFSET is updated correctly. Elements can stretch
|
* the stream since the OFFSET is updated correctly. Elements can stretch
|
||||||
|
@ -404,7 +404,7 @@ gst_osssrc_get (GstPad * pad)
|
||||||
GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE;
|
GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
src->curoffset += readbytes;
|
src->curoffset += readsamples;
|
||||||
|
|
||||||
GST_DEBUG ("pushed buffer from soundcard of %ld bytes, timestamp %"
|
GST_DEBUG ("pushed buffer from soundcard of %ld bytes, timestamp %"
|
||||||
G_GINT64_FORMAT, readbytes, GST_BUFFER_TIMESTAMP (buf));
|
G_GINT64_FORMAT, readbytes, GST_BUFFER_TIMESTAMP (buf));
|
||||||
|
@ -591,7 +591,7 @@ gst_osssrc_src_query (GstPad * pad, GstQueryType type, GstFormat * format,
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GST_QUERY_POSITION:
|
case GST_QUERY_POSITION:
|
||||||
res = gst_osselement_convert (GST_OSSELEMENT (osssrc),
|
res = gst_osselement_convert (GST_OSSELEMENT (osssrc),
|
||||||
GST_FORMAT_BYTES, osssrc->curoffset, format, value);
|
GST_FORMAT_DEFAULT, osssrc->curoffset, format, value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -58,7 +58,8 @@ struct _GstOssSrc {
|
||||||
|
|
||||||
gboolean need_eos; /* Do we need to emit an EOS? */
|
gboolean need_eos; /* Do we need to emit an EOS? */
|
||||||
|
|
||||||
/* blocking */
|
/* blocking.
|
||||||
|
* curoffset is in *samples*. */
|
||||||
gulong curoffset;
|
gulong curoffset;
|
||||||
gulong buffersize;
|
gulong buffersize;
|
||||||
|
|
||||||
|
|
|
@ -768,6 +768,7 @@ gst_v4l2src_getcaps (GstPad * pad)
|
||||||
int min_w, max_w, min_h, max_h;
|
int min_w, max_w, min_h, max_h;
|
||||||
GSList *walk;
|
GSList *walk;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
|
gdouble fps;
|
||||||
|
|
||||||
if (!GST_V4L2_IS_OPEN (GST_V4L2ELEMENT (v4l2src))) {
|
if (!GST_V4L2_IS_OPEN (GST_V4L2ELEMENT (v4l2src))) {
|
||||||
return gst_caps_copy (gst_pad_get_pad_template_caps (pad));
|
return gst_caps_copy (gst_pad_get_pad_template_caps (pad));
|
||||||
|
@ -776,6 +777,7 @@ gst_v4l2src_getcaps (GstPad * pad)
|
||||||
/* build our own capslist */
|
/* build our own capslist */
|
||||||
caps = gst_caps_new_empty ();
|
caps = gst_caps_new_empty ();
|
||||||
walk = v4l2src->formats;
|
walk = v4l2src->formats;
|
||||||
|
fps = gst_v4l2src_get_fps (v4l2src);
|
||||||
while (walk) {
|
while (walk) {
|
||||||
format = (struct v4l2_fmtdesc *) walk->data;
|
format = (struct v4l2_fmtdesc *) walk->data;
|
||||||
walk = g_slist_next (walk);
|
walk = g_slist_next (walk);
|
||||||
|
@ -793,7 +795,7 @@ gst_v4l2src_getcaps (GstPad * pad)
|
||||||
gst_structure_set (structure,
|
gst_structure_set (structure,
|
||||||
"width", GST_TYPE_INT_RANGE, min_w, max_w,
|
"width", GST_TYPE_INT_RANGE, min_w, max_w,
|
||||||
"height", GST_TYPE_INT_RANGE, min_h, max_h,
|
"height", GST_TYPE_INT_RANGE, min_h, max_h,
|
||||||
"framerate", GST_TYPE_DOUBLE_RANGE, (double) 0, G_MAXDOUBLE, NULL);
|
"framerate", G_TYPE_DOUBLE, fps, NULL);
|
||||||
|
|
||||||
gst_caps_append_structure (caps, structure);
|
gst_caps_append_structure (caps, structure);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue