mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-04 22:48:54 +00:00
configure.ac: Improve mpeg2enc detection. This is for distributions that do ship mjpegtools, but without mpeg2enc. Al...
Original commit message from CVS: 2003-12-21 Ronald Bultje <rbultje@ronald.bitfreak.net> * configure.ac: Improve mpeg2enc detection. This is for distributions that do ship mjpegtools, but without mpeg2enc. Also does object check for might there ever be ABI incompatibility. * ext/mpeg2enc/gstmpeg2enc.cc: Add Andrew as second maintainer (he's helping me), and also add an error if no caps was set. This happens if I pull before capsnego and that's something I should solve sometime else. * gst/matroska/matroska-demux.c: (gst_matroska_demux_parse_blockgroup): Fix time parsing. * gst/matroska/matroska-mux.c: (gst_matroska_mux_audio_pad_link), (gst_matroska_mux_track_header): Add caps to templates. * gst/mpegaudioparse/gstmpegaudioparse.c: (mp3_sink_factory): Add mpegversion=1 to prevent confusion with MPEG/AAC. * gst/mpegstream/gstmpegdemux.c: Remove layer since it causes warnings about unfixed caps. * gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get): Fix obvious typo (we error out if caps were set, we should of course error out if *no* caps were set). * sys/oss/gstosselement.c: (gst_osselement_convert): Fix format conversion, we confused bits/bytes. * sys/oss/gstosselement.h: Improve documentation for 'bps'. * sys/v4l/TODO: Remove stuff about plugins that need removing - this was done ages ago. * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_init), (gst_v4lmjpegsrc_src_convert), (gst_v4lmjpegsrc_src_query): * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_init), (gst_v4lsrc_src_convert), (gst_v4lsrc_src_query): * sys/v4l2/gstv4l2src.c: (gst_v4l2src_init), (gst_v4l2src_src_convert), (gst_v4l2src_src_query): Add get_query_types(), get_formats() and query() functions.
This commit is contained in:
parent
4dbdabd716
commit
ae91d7c717
7 changed files with 263 additions and 64 deletions
38
ChangeLog
38
ChangeLog
|
@ -1,3 +1,41 @@
|
|||
2003-12-21 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||
|
||||
* configure.ac:
|
||||
Improve mpeg2enc detection. This is for distributions that do
|
||||
ship mjpegtools, but without mpeg2enc. Also does object check
|
||||
for might there ever be ABI incompatibility.
|
||||
* ext/mpeg2enc/gstmpeg2enc.cc:
|
||||
Add Andrew as second maintainer (he's helping me), and also add
|
||||
an error if no caps was set. This happens if I pull before capsnego
|
||||
and that's something I should solve sometime else.
|
||||
* gst/matroska/matroska-demux.c:
|
||||
(gst_matroska_demux_parse_blockgroup):
|
||||
Fix time parsing.
|
||||
* gst/matroska/matroska-mux.c: (gst_matroska_mux_audio_pad_link),
|
||||
(gst_matroska_mux_track_header):
|
||||
Add caps to templates.
|
||||
* gst/mpegaudioparse/gstmpegaudioparse.c: (mp3_sink_factory):
|
||||
Add mpegversion=1 to prevent confusion with MPEG/AAC.
|
||||
* gst/mpegstream/gstmpegdemux.c:
|
||||
Remove layer since it causes warnings about unfixed caps.
|
||||
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
|
||||
Fix obvious typo (we error out if caps were set, we should of
|
||||
course error out if *no* caps were set).
|
||||
* sys/oss/gstosselement.c: (gst_osselement_convert):
|
||||
Fix format conversion, we confused bits/bytes.
|
||||
* sys/oss/gstosselement.h:
|
||||
Improve documentation for 'bps'.
|
||||
* sys/v4l/TODO:
|
||||
Remove stuff about plugins that need removing - this was done
|
||||
ages ago.
|
||||
* sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_init),
|
||||
(gst_v4lmjpegsrc_src_convert), (gst_v4lmjpegsrc_src_query):
|
||||
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_init), (gst_v4lsrc_src_convert),
|
||||
(gst_v4lsrc_src_query):
|
||||
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init),
|
||||
(gst_v4l2src_src_convert), (gst_v4l2src_src_query):
|
||||
Add get_query_types(), get_formats() and query() functions.
|
||||
|
||||
2003-12-21 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* ChangeLog: moved to gstreamer/docs/random/old/ChangeLog.gst-plugins
|
||||
|
|
46
configure.ac
46
configure.ac
|
@ -1076,16 +1076,52 @@ GST_CHECK_FEATURE(MPEG2DEC, [mpeg2dec], mpeg2dec, [
|
|||
dnl *** mpeg2enc ***
|
||||
translit(dnm, m, l) AM_CONDITIONAL(USE_MPEG2ENC, true)
|
||||
GST_CHECK_FEATURE(MPEG2ENC, [mpeg2enc], mpeg2enc, [
|
||||
PKG_CHECK_MODULES(MPEG2ENC, mjpegtools >= 1.6.1.92,
|
||||
HAVE_MPEG2ENC="yes", HAVE_MPEG2ENC="no")
|
||||
MPEG2ENC_LIBS="$MPEG2ENC_LIBS -lmpeg2encpp"
|
||||
AC_SUBST(MPEG2ENC_CFLAGS)
|
||||
AC_SUBST(MPEG2ENC_LIBS)
|
||||
HAVE_MPEG2ENC="no"
|
||||
dnl we require a c++ compiler for this one
|
||||
if [ test x$HAVE_CXX = xyes ]; then
|
||||
dnl libmpeg2enc was first included in mjpegtools-1.6.2-rc3 (1.6.1.92)
|
||||
dnl since many distros include mjpegtools specifically without mplex
|
||||
dnl and mpeg2enc, we check for mpeg2enc on its own, too.
|
||||
PKG_CHECK_MODULES(MPEG2ENC, mjpegtools >= 1.6.1.92, [
|
||||
dnl switch over to c++ to test things
|
||||
AC_LANG_CPLUSPLUS
|
||||
OLD_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $MPEG2ENC_CFLAGS"
|
||||
AC_CHECK_HEADER(mpeg2encoder.hh, [
|
||||
MPEG2ENC_LIBS="$MPEG2ENC_LIBS -lmpeg2encpp -lm -lpthread"
|
||||
OLD_LIBS="$LIBS"
|
||||
LIBS="$LIBS $MPEG2ENC_LIBS"
|
||||
AC_MSG_CHECKING([for valid mpeg2enc objects])
|
||||
AC_TRY_RUN([
|
||||
#include <mpeg2encoder.hh>
|
||||
#include <mpeg2encoptions.hh>
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
MPEG2EncOptions *options = new MPEG2EncOptions ();
|
||||
MPEG2Encoder encoder (*options);
|
||||
return 0;
|
||||
}
|
||||
],[
|
||||
HAVE_MPEG2ENC="yes"
|
||||
AC_SUBST(MPEG2ENC_CFLAGS)
|
||||
AC_SUBST(MPEG2ENC_LIBS)
|
||||
AC_MSG_RESULT(yes)
|
||||
], AC_MSG_RESULT(no))
|
||||
LIBS="$OLD_LIBS"
|
||||
])
|
||||
CPPFLAGS="$OLD_CPPFLAGS"
|
||||
AC_LANG_C
|
||||
])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl *** mplex ***
|
||||
translit(dnm, m, l) AM_CONDITIONAL(USE_MPLEX, true)
|
||||
GST_CHECK_FEATURE(MPLEX, [mplex], mplex, [HAVE_MPLEX=$HAVE_CXX])
|
||||
])
|
||||
|
||||
dnl *** pango ***
|
||||
translit(dnm, m, l) AM_CONDITIONAL(USE_PANGO, true)
|
||||
|
|
|
@ -1617,7 +1617,7 @@ gst_matroska_demux_parse_blockgroup (GstMatroskaDemux *demux,
|
|||
case GST_MATROSKA_ID_BLOCK: {
|
||||
GstBuffer *buf;
|
||||
guint8 *data;
|
||||
gint16 time;
|
||||
gint64 time;
|
||||
guint size, *lace_size = NULL;
|
||||
gint n, stream, flags, laces = 0;
|
||||
guint64 num;
|
||||
|
@ -1651,10 +1651,7 @@ gst_matroska_demux_parse_blockgroup (GstMatroskaDemux *demux,
|
|||
}
|
||||
|
||||
/* time (relative to cluster time) */
|
||||
time = (* (gint16 *) data) * demux->time_scale;
|
||||
/* I think this is mis-documented in the matroska sources, we should
|
||||
* probably shift values (EBML-style) on this value... */
|
||||
time = GINT16_FROM_BE (time);
|
||||
time = (GINT16_FROM_BE (* (gint16 *) data)) * demux->time_scale;
|
||||
data += 2; size -= 2;
|
||||
flags = * (guint8 *) data;
|
||||
data += 1; size -= 1;
|
||||
|
|
|
@ -51,20 +51,95 @@ GST_PAD_TEMPLATE_FACTORY (src_templ,
|
|||
)
|
||||
)
|
||||
|
||||
/* FIXME: caps */
|
||||
#define COMMON_VIDEO_PROPERTIES \
|
||||
"width", GST_PROPS_INT_RANGE (16, 4096), \
|
||||
"height", GST_PROPS_INT_RANGE (16, 4096), \
|
||||
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
|
||||
|
||||
GST_PAD_TEMPLATE_FACTORY (videosink_templ,
|
||||
"video_%d",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_REQUEST,
|
||||
NULL
|
||||
GST_CAPS_NEW ("matroska_video_sink_mpeg",
|
||||
"video/mpeg",
|
||||
"mpegversion", GST_PROPS_LIST (
|
||||
GST_PROPS_INT (1),
|
||||
GST_PROPS_INT (2),
|
||||
GST_PROPS_INT (4)
|
||||
),
|
||||
"systemstream", GST_PROPS_BOOLEAN (FALSE),
|
||||
COMMON_VIDEO_PROPERTIES),
|
||||
GST_CAPS_NEW ("matroska_video_sink_divx",
|
||||
"video/x-divx",
|
||||
"divxversion", GST_PROPS_INT_RANGE (3, 5),
|
||||
COMMON_VIDEO_PROPERTIES),
|
||||
GST_CAPS_NEW ("matroska_video_sink_xvid",
|
||||
"video/x-xvid",
|
||||
COMMON_VIDEO_PROPERTIES),
|
||||
GST_CAPS_NEW ("matroska_video_sink_msmpeg4v3",
|
||||
"video/x-msmpeg",
|
||||
"msmpegversion", GST_PROPS_INT (43),
|
||||
COMMON_VIDEO_PROPERTIES),
|
||||
GST_CAPS_NEW ("matroska_video_sink_jpeg",
|
||||
"video/x-jpeg",
|
||||
COMMON_VIDEO_PROPERTIES),
|
||||
GST_CAPS_NEW ("matroska_video_sink_rawyuv",
|
||||
"video/x-raw-yuv",
|
||||
"format", GST_PROPS_LIST (
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2')),
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0'))
|
||||
),
|
||||
COMMON_VIDEO_PROPERTIES)
|
||||
)
|
||||
|
||||
#define COMMON_AUDIO_PROPERTIES \
|
||||
"channels", GST_PROPS_INT_RANGE (1, 8), \
|
||||
"rate", GST_PROPS_INT_RANGE (8000, 96000)
|
||||
|
||||
/* FIXME:
|
||||
* * audio/x-raw-float: endianness needs defining.
|
||||
* * audio/x-vorbis: private data setup needs work.
|
||||
*/
|
||||
GST_PAD_TEMPLATE_FACTORY (audiosink_templ,
|
||||
"audio_%d",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_REQUEST,
|
||||
NULL
|
||||
GST_CAPS_NEW ("matroska_audio_sink_mpeg1",
|
||||
"audio/mpeg",
|
||||
"mpegversion", GST_PROPS_INT (1),
|
||||
"layer", GST_PROPS_INT_RANGE (1, 3),
|
||||
COMMON_AUDIO_PROPERTIES),
|
||||
GST_CAPS_NEW ("matroska_audio_sink_mpeg24",
|
||||
"audio/mpeg",
|
||||
"mpegversion", GST_PROPS_LIST (
|
||||
GST_PROPS_INT (2),
|
||||
GST_PROPS_INT (4)
|
||||
),
|
||||
COMMON_AUDIO_PROPERTIES),
|
||||
GST_CAPS_NEW ("matroska_audio_sink_ac3",
|
||||
"audio/x-ac3",
|
||||
COMMON_AUDIO_PROPERTIES),
|
||||
GST_CAPS_NEW ("matroska_audio_sink_raw_int",
|
||||
"audio/x-raw-int",
|
||||
"width", GST_PROPS_LIST (
|
||||
GST_PROPS_INT (8),
|
||||
GST_PROPS_INT (16),
|
||||
GST_PROPS_INT (24)
|
||||
),
|
||||
"depth", GST_PROPS_LIST (
|
||||
GST_PROPS_INT (8),
|
||||
GST_PROPS_INT (16),
|
||||
GST_PROPS_INT (24)
|
||||
),
|
||||
"endianness", GST_PROPS_LIST (
|
||||
GST_PROPS_INT (G_BIG_ENDIAN),
|
||||
GST_PROPS_INT (G_LITTLE_ENDIAN)
|
||||
),
|
||||
"signed", GST_PROPS_LIST (
|
||||
GST_PROPS_BOOLEAN (TRUE),
|
||||
GST_PROPS_BOOLEAN (FALSE)
|
||||
),
|
||||
COMMON_AUDIO_PROPERTIES)
|
||||
)
|
||||
|
||||
GST_PAD_TEMPLATE_FACTORY (subtitlesink_templ,
|
||||
|
@ -413,7 +488,7 @@ gst_matroska_mux_audio_pad_link (GstPad *pad,
|
|||
NULL);
|
||||
audiocontext->samplerate = samplerate;
|
||||
audiocontext->channels = channels;
|
||||
audiocontext->bitdepth = 16;
|
||||
audiocontext->bitdepth = 0;
|
||||
|
||||
if (!strcmp (mimetype, "audio/mpeg")) {
|
||||
gint mpegversion = 0;
|
||||
|
@ -459,7 +534,7 @@ gst_matroska_mux_audio_pad_link (GstPad *pad,
|
|||
"signed", &signedness,
|
||||
NULL);
|
||||
if (width != depth ||
|
||||
(width == 8 && signedness) || (width == 16 && !signedness))
|
||||
(width == 8 && signedness) || (width != 8 && !signedness))
|
||||
continue;
|
||||
|
||||
audiocontext->bitdepth = depth;
|
||||
|
@ -602,8 +677,10 @@ gst_matroska_mux_track_header (GstMatroskaMux *mux,
|
|||
if (audiocontext->channels != 1)
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOCHANNELS,
|
||||
audiocontext->channels);
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOBITDEPTH,
|
||||
audiocontext->bitdepth);
|
||||
if (audiocontext->bitdepth) {
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOBITDEPTH,
|
||||
audiocontext->bitdepth);
|
||||
}
|
||||
gst_ebml_write_master_finish (ebml, master);
|
||||
|
||||
break;
|
||||
|
|
|
@ -791,7 +791,7 @@ gst_osselement_convert (GstOssElement *oss,
|
|||
*dest_value = src_value * GST_SECOND / oss->bps;
|
||||
break;
|
||||
case GST_FORMAT_DEFAULT:
|
||||
*dest_value = src_value / (oss->channels * oss->width);
|
||||
*dest_value = src_value / (oss->width * oss->channels / 8);
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
|
@ -815,7 +815,7 @@ gst_osselement_convert (GstOssElement *oss,
|
|||
*dest_value = src_value * GST_SECOND / oss->rate;
|
||||
break;
|
||||
case GST_FORMAT_BYTES:
|
||||
*dest_value = src_value * oss->channels * oss->width;
|
||||
*dest_value = src_value * oss->width * oss->channels / 8;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
|
|
|
@ -69,7 +69,7 @@ struct _GstOssElement
|
|||
gint fragment_size;
|
||||
GstOssOpenMode mode;
|
||||
|
||||
/* stats */
|
||||
/* stats bytes per *second* */
|
||||
guint bps;
|
||||
|
||||
/* parameters */
|
||||
|
|
|
@ -51,56 +51,67 @@ enum {
|
|||
ARG_USE_FIXED_FPS
|
||||
};
|
||||
|
||||
GST_FORMATS_FUNCTION (GstPad *, gst_v4l2src_get_formats,
|
||||
GST_FORMAT_TIME, GST_FORMAT_DEFAULT);
|
||||
GST_QUERY_TYPE_FUNCTION (GstPad *, gst_v4l2src_get_query_types,
|
||||
GST_QUERY_POSITION);
|
||||
|
||||
/* init functions */
|
||||
static void gst_v4l2src_class_init (GstV4l2SrcClass *klass);
|
||||
static void gst_v4l2src_base_init (GstV4l2SrcClass *klass);
|
||||
static void gst_v4l2src_init (GstV4l2Src *v4l2src);
|
||||
static void gst_v4l2src_class_init (GstV4l2SrcClass *klass);
|
||||
static void gst_v4l2src_base_init (GstV4l2SrcClass *klass);
|
||||
static void gst_v4l2src_init (GstV4l2Src *v4l2src);
|
||||
|
||||
/* signal functions */
|
||||
static void gst_v4l2src_open (GstElement *element,
|
||||
const gchar *device);
|
||||
static void gst_v4l2src_close (GstElement *element,
|
||||
const gchar *device);
|
||||
static void gst_v4l2src_open (GstElement *element,
|
||||
const gchar *device);
|
||||
static void gst_v4l2src_close (GstElement *element,
|
||||
const gchar *device);
|
||||
|
||||
/* pad/buffer functions */
|
||||
static gboolean gst_v4l2src_srcconvert (GstPad *pad,
|
||||
GstFormat src_format,
|
||||
gint64 src_value,
|
||||
GstFormat *dest_format,
|
||||
gint64 *dest_value);
|
||||
static GstPadLinkReturn gst_v4l2src_srcconnect (GstPad *pad,
|
||||
GstCaps *caps);
|
||||
static GstCaps * gst_v4l2src_getcaps (GstPad *pad,
|
||||
GstCaps *caps);
|
||||
static GstData * gst_v4l2src_get (GstPad *pad);
|
||||
/* pad/info functions */
|
||||
static gboolean gst_v4l2src_src_convert (GstPad *pad,
|
||||
GstFormat src_format,
|
||||
gint64 src_value,
|
||||
GstFormat *dest_format,
|
||||
gint64 *dest_value);
|
||||
static gboolean gst_v4l2src_src_query (GstPad *pad,
|
||||
GstQueryType type,
|
||||
GstFormat *format,
|
||||
gint64 *value);
|
||||
|
||||
/* buffer functions */
|
||||
static GstPadLinkReturn
|
||||
gst_v4l2src_srcconnect (GstPad *pad,
|
||||
GstCaps *caps);
|
||||
static GstCaps *gst_v4l2src_getcaps (GstPad *pad,
|
||||
GstCaps *caps);
|
||||
static GstData *gst_v4l2src_get (GstPad *pad);
|
||||
|
||||
/* get/set params */
|
||||
static void gst_v4l2src_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gst_v4l2src_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gst_v4l2src_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gst_v4l2src_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
/* state handling */
|
||||
static GstElementStateReturn gst_v4l2src_change_state (GstElement *element);
|
||||
static GstElementStateReturn
|
||||
gst_v4l2src_change_state (GstElement *element);
|
||||
|
||||
/* set_clock function for A/V sync */
|
||||
static void gst_v4l2src_set_clock (GstElement *element,
|
||||
GstClock *clock);
|
||||
|
||||
static void gst_v4l2src_set_clock (GstElement *element,
|
||||
GstClock *clock);
|
||||
|
||||
/* bufferpool functions */
|
||||
static GstBuffer * gst_v4l2src_buffer_new (GstBufferPool *pool,
|
||||
guint64 offset,
|
||||
guint size,
|
||||
gpointer user_data);
|
||||
static void gst_v4l2src_buffer_free (GstBufferPool *pool,
|
||||
GstBuffer *buf,
|
||||
gpointer user_data);
|
||||
static GstBuffer *gst_v4l2src_buffer_new (GstBufferPool *pool,
|
||||
guint64 offset,
|
||||
guint size,
|
||||
gpointer user_data);
|
||||
static void gst_v4l2src_buffer_free (GstBufferPool *pool,
|
||||
GstBuffer *buf,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
static GstPadTemplate *src_template;
|
||||
|
@ -220,8 +231,14 @@ gst_v4l2src_init (GstV4l2Src *v4l2src)
|
|||
|
||||
gst_pad_set_get_function(v4l2src->srcpad, gst_v4l2src_get);
|
||||
gst_pad_set_link_function(v4l2src->srcpad, gst_v4l2src_srcconnect);
|
||||
gst_pad_set_convert_function (v4l2src->srcpad, gst_v4l2src_srcconvert);
|
||||
gst_pad_set_getcaps_function (v4l2src->srcpad, gst_v4l2src_getcaps);
|
||||
gst_pad_set_convert_function (v4l2src->srcpad, gst_v4l2src_src_convert);
|
||||
gst_pad_set_formats_function (v4l2src->srcpad,
|
||||
gst_v4l2src_get_formats);
|
||||
gst_pad_set_query_function (v4l2src->srcpad,
|
||||
gst_v4l2src_src_query);
|
||||
gst_pad_set_query_type_function (v4l2src->srcpad,
|
||||
gst_v4l2src_get_query_types);
|
||||
|
||||
v4l2src->bufferpool = gst_buffer_pool_new(NULL, NULL,
|
||||
gst_v4l2src_buffer_new,
|
||||
|
@ -290,13 +307,12 @@ gst_v4l2src_get_fps (GstV4l2Src *v4l2src)
|
|||
return 0.;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
gst_v4l2src_srcconvert (GstPad *pad,
|
||||
GstFormat src_format,
|
||||
gint64 src_value,
|
||||
GstFormat *dest_format,
|
||||
gint64 *dest_value)
|
||||
gst_v4l2src_src_convert (GstPad *pad,
|
||||
GstFormat src_format,
|
||||
gint64 src_value,
|
||||
GstFormat *dest_format,
|
||||
gint64 *dest_value)
|
||||
{
|
||||
GstV4l2Src *v4l2src;
|
||||
gdouble fps;
|
||||
|
@ -334,6 +350,41 @@ gst_v4l2src_srcconvert (GstPad *pad,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_v4l2src_src_query (GstPad *pad,
|
||||
GstQueryType type,
|
||||
GstFormat *format,
|
||||
gint64 *value)
|
||||
{
|
||||
GstV4l2Src *v4l2src = GST_V4L2SRC (gst_pad_get_parent (pad));
|
||||
gboolean res = TRUE;
|
||||
gdouble fps;
|
||||
|
||||
if ((fps = gst_v4l2src_get_fps(v4l2src)) == 0)
|
||||
return FALSE;
|
||||
|
||||
switch (type) {
|
||||
case GST_QUERY_POSITION:
|
||||
switch (*format) {
|
||||
case GST_FORMAT_TIME:
|
||||
*value = v4l2src->handled * GST_SECOND / fps;
|
||||
break;
|
||||
case GST_FORMAT_DEFAULT:
|
||||
*value = v4l2src->handled;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static GstCaps *
|
||||
gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc,
|
||||
|
|
Loading…
Reference in a new issue