summaryrefslogtreecommitdiff
path: root/gst/auparse
diff options
context:
space:
mode:
authorSangchul Lee <sc11.lee@samsung.com>2012-08-21 22:53:54 +0900
committerSangchul Lee <sc11.lee@samsung.com>2012-08-21 22:53:54 +0900
commitbaa3403ebe3f0028ca826fb8d7f56e9cbed05356 (patch)
tree7765d941dd576fcd3bf0cb297894e55fbbfe3207 /gst/auparse
parentb1065bf2a5159183bde18dcd95c988ea42b86f83 (diff)
downloadgst-plugins-good0.10-master.tar.gz
gst-plugins-good0.10-master.tar.bz2
gst-plugins-good0.10-master.zip
Diffstat (limited to 'gst/auparse')
-rw-r--r--gst/auparse/Makefile.in89
-rw-r--r--gst/auparse/gstauparse.c130
2 files changed, 162 insertions, 57 deletions
diff --git a/gst/auparse/Makefile.in b/gst/auparse/Makefile.in
index 2e0739e..392cb0a 100644
--- a/gst/auparse/Makefile.in
+++ b/gst/auparse/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -67,8 +67,7 @@ am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
$(top_srcdir)/common/m4/orc.m4 $(top_srcdir)/common/m4/pkg.m4 \
$(top_srcdir)/m4/aalib.m4 $(top_srcdir)/m4/esd.m4 \
$(top_srcdir)/m4/gconf-2.m4 $(top_srcdir)/m4/gettext.m4 \
- $(top_srcdir)/m4/gst-fionread.m4 \
- $(top_srcdir)/m4/gst-shout2.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/gst-fionread.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
@@ -103,6 +102,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
am__installdirs = "$(DESTDIR)$(plugindir)"
LTLIBRARIES = $(plugin_LTLIBRARIES)
am__DEPENDENCIES_1 =
@@ -110,8 +115,8 @@ libgstauparse_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
am_libgstauparse_la_OBJECTS = libgstauparse_la-gstauparse.lo
libgstauparse_la_OBJECTS = $(am_libgstauparse_la_OBJECTS)
-AM_V_lt = $(am__v_lt_$(V))
-am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
libgstauparse_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(libgstauparse_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
@@ -127,21 +132,21 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_$(V))
-am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_$(V))
-am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(libgstauparse_la_SOURCES)
DIST_SOURCES = $(libgstauparse_la_SOURCES)
@@ -224,7 +229,10 @@ GDK_PIXBUF_CFLAGS = @GDK_PIXBUF_CFLAGS@
GDK_PIXBUF_LIBS = @GDK_PIXBUF_LIBS@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GIO_CFLAGS = @GIO_CFLAGS@
+GIO_LIBS = @GIO_LIBS@
GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_EXTRA_CFLAGS = @GLIB_EXTRA_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GLIB_PREFIX = @GLIB_PREFIX@
GLIB_REQ = @GLIB_REQ@
@@ -299,7 +307,6 @@ JPEG_LIBS = @JPEG_LIBS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBCACA_CFLAGS = @LIBCACA_CFLAGS@
-LIBCACA_CONFIG = @LIBCACA_CONFIG@
LIBCACA_LIBS = @LIBCACA_LIBS@
LIBDV_CFLAGS = @LIBDV_CFLAGS@
LIBDV_LIBS = @LIBDV_LIBS@
@@ -323,6 +330,7 @@ LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MSGFMT = @MSGFMT@
MSGFMT_015 = @MSGFMT_015@
@@ -357,18 +365,10 @@ PKG_CONFIG = @PKG_CONFIG@
PLUGINDIR = @PLUGINDIR@
POSUB = @POSUB@
PROFILE_CFLAGS = @PROFILE_CFLAGS@
-PULSE_0_9_11_CFLAGS = @PULSE_0_9_11_CFLAGS@
-PULSE_0_9_11_LIBS = @PULSE_0_9_11_LIBS@
-PULSE_0_9_12_CFLAGS = @PULSE_0_9_12_CFLAGS@
-PULSE_0_9_12_LIBS = @PULSE_0_9_12_LIBS@
-PULSE_0_9_13_CFLAGS = @PULSE_0_9_13_CFLAGS@
-PULSE_0_9_13_LIBS = @PULSE_0_9_13_LIBS@
-PULSE_0_9_15_CFLAGS = @PULSE_0_9_15_CFLAGS@
-PULSE_0_9_15_LIBS = @PULSE_0_9_15_LIBS@
-PULSE_0_9_16_CFLAGS = @PULSE_0_9_16_CFLAGS@
-PULSE_0_9_16_LIBS = @PULSE_0_9_16_LIBS@
PULSE_0_9_20_CFLAGS = @PULSE_0_9_20_CFLAGS@
PULSE_0_9_20_LIBS = @PULSE_0_9_20_LIBS@
+PULSE_1_0_CFLAGS = @PULSE_1_0_CFLAGS@
+PULSE_1_0_LIBS = @PULSE_1_0_LIBS@
PULSE_CFLAGS = @PULSE_CFLAGS@
PULSE_LIBS = @PULSE_LIBS@
PYTHON = @PYTHON@
@@ -421,6 +421,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -455,7 +456,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -548,7 +548,7 @@ clean-pluginLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libgstauparse.la: $(libgstauparse_la_OBJECTS) $(libgstauparse_la_DEPENDENCIES)
+libgstauparse.la: $(libgstauparse_la_OBJECTS) $(libgstauparse_la_DEPENDENCIES) $(EXTRA_libgstauparse_la_DEPENDENCIES)
$(AM_V_CCLD)$(libgstauparse_la_LINK) -rpath $(plugindir) $(libgstauparse_la_OBJECTS) $(libgstauparse_la_LIBADD) $(LIBS)
mostlyclean-compile:
@@ -562,34 +562,30 @@ distclean-compile:
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
libgstauparse_la-gstauparse.lo: gstauparse.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstauparse_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstauparse_la_CFLAGS) $(CFLAGS) -MT libgstauparse_la-gstauparse.lo -MD -MP -MF $(DEPDIR)/libgstauparse_la-gstauparse.Tpo -c -o libgstauparse_la-gstauparse.lo `test -f 'gstauparse.c' || echo '$(srcdir)/'`gstauparse.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstauparse_la-gstauparse.Tpo $(DEPDIR)/libgstauparse_la-gstauparse.Plo
-@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gstauparse.c' object='libgstauparse_la-gstauparse.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstauparse.c' object='libgstauparse_la-gstauparse.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstauparse_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstauparse_la_CFLAGS) $(CFLAGS) -c -o libgstauparse_la-gstauparse.lo `test -f 'gstauparse.c' || echo '$(srcdir)/'`gstauparse.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstauparse_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstauparse_la_CFLAGS) $(CFLAGS) -c -o libgstauparse_la-gstauparse.lo `test -f 'gstauparse.c' || echo '$(srcdir)/'`gstauparse.c
mostlyclean-libtool:
-rm -f *.lo
@@ -696,10 +692,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/gst/auparse/gstauparse.c b/gst/auparse/gstauparse.c
index 715acb2..e0cdc82 100644
--- a/gst/auparse/gstauparse.c
+++ b/gst/auparse/gstauparse.c
@@ -78,6 +78,9 @@ static gboolean gst_au_parse_add_srcpad (GstAuParse * auparse, GstCaps * caps);
static gboolean gst_au_parse_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_au_parse_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_au_parse_sink_event (GstPad * pad, GstEvent * event);
+static gboolean gst_au_parse_src_convert (GstAuParse * auparse,
+ GstFormat src_format, gint64 srcval, GstFormat dest_format,
+ gint64 * destval);
GST_BOILERPLATE (GstAuParse, gst_au_parse, GstElement, GST_TYPE_ELEMENT);
@@ -86,10 +89,9 @@ gst_au_parse_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_template));
+ gst_element_class_add_static_pad_template (element_class,
+ &sink_template);
+ gst_element_class_add_static_pad_template (element_class, &src_template);
gst_element_class_set_details_simple (element_class, "AU audio demuxer",
"Codec/Demuxer/Audio",
"Parse an .au file into raw audio",
@@ -251,7 +253,9 @@ gst_au_parse_parse_header (GstAuParse * auparse)
}
auparse->offset = GST_READ_UINT32_BE (head + 4);
- /* Do not trust size, could be set to -1 : unknown */
+ /* Do not trust size, could be set to -1 : unknown
+ * otherwise: filesize = size + auparse->offset
+ */
size = GST_READ_UINT32_BE (head + 8);
auparse->encoding = GST_READ_UINT32_BE (head + 12);
auparse->samplerate = GST_READ_UINT32_BE (head + 16);
@@ -425,6 +429,9 @@ gst_au_parse_chain (GstPad * pad, GstBuffer * buf)
GstFlowReturn ret = GST_FLOW_OK;
GstAuParse *auparse;
gint avail, sendnow = 0;
+ gint64 timestamp;
+ gint64 duration;
+ gint64 offset;
auparse = GST_AU_PARSE (gst_pad_get_parent (pad));
@@ -446,7 +453,7 @@ gst_au_parse_chain (GstPad * pad, GstBuffer * buf)
goto out;
gst_pad_push_event (auparse->srcpad,
- gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_DEFAULT,
+ gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME,
0, GST_CLOCK_TIME_NONE, 0));
}
@@ -464,6 +471,7 @@ gst_au_parse_chain (GstPad * pad, GstBuffer * buf)
if (sendnow > 0) {
GstBuffer *outbuf;
const guint8 *data;
+ gint64 pos;
ret = gst_pad_alloc_buffer_and_set_caps (auparse->srcpad,
auparse->buffer_offset, sendnow, GST_PAD_CAPS (auparse->srcpad),
@@ -478,6 +486,22 @@ gst_au_parse_chain (GstPad * pad, GstBuffer * buf)
memcpy (GST_BUFFER_DATA (outbuf), data, sendnow);
gst_adapter_flush (auparse->adapter, sendnow);
+ pos = auparse->buffer_offset - auparse->offset;
+ pos = MAX (pos, 0);
+
+ if (auparse->sample_size > 0 && auparse->samplerate > 0) {
+ gst_au_parse_src_convert (auparse, GST_FORMAT_BYTES, pos,
+ GST_FORMAT_DEFAULT, &offset);
+ gst_au_parse_src_convert (auparse, GST_FORMAT_BYTES, pos,
+ GST_FORMAT_TIME, &timestamp);
+ gst_au_parse_src_convert (auparse, GST_FORMAT_BYTES,
+ sendnow, GST_FORMAT_TIME, &duration);
+
+ GST_BUFFER_OFFSET (outbuf) = offset;
+ GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
+ GST_BUFFER_DURATION (outbuf) = duration;
+ }
+
auparse->buffer_offset += sendnow;
ret = gst_pad_push (auparse->srcpad, outbuf);
@@ -517,6 +541,9 @@ gst_au_parse_src_convert (GstAuParse * auparse, GstFormat src_format,
/* fallthrough */
case GST_FORMAT_DEFAULT:{
switch (dest_format) {
+ case GST_FORMAT_DEFAULT:
+ *destval = srcval;
+ break;
case GST_FORMAT_BYTES:
*destval = srcval * samplesize;
break;
@@ -532,8 +559,8 @@ gst_au_parse_src_convert (GstAuParse * auparse, GstFormat src_format,
case GST_FORMAT_TIME:{
switch (dest_format) {
case GST_FORMAT_BYTES:
- *destval =
- gst_util_uint64_scale_int (srcval, rate * samplesize, GST_SECOND);
+ *destval = samplesize *
+ gst_util_uint64_scale_int (srcval, rate, GST_SECOND);
break;
case GST_FORMAT_DEFAULT:
*destval = gst_util_uint64_scale_int (srcval, rate, GST_SECOND);
@@ -581,8 +608,7 @@ gst_au_parse_src_query (GstPad * pad, GstQuery * query)
len -= auparse->offset;
GST_OBJECT_UNLOCK (auparse);
- ret = gst_au_parse_src_convert (auparse, GST_FORMAT_BYTES, len,
- format, &val);
+ ret = gst_au_parse_src_convert (auparse, bformat, len, format, &val);
if (ret) {
gst_query_set_duration (query, format, val);
@@ -611,6 +637,17 @@ gst_au_parse_src_query (GstPad * pad, GstQuery * query)
}
break;
}
+ case GST_QUERY_SEEKING:{
+ GstFormat format;
+
+ gst_query_parse_seeking (query, &format, NULL, NULL, NULL);
+ /* FIXME: query duration in 'format'
+ gst_query_set_seeking (query, format, TRUE, 0, duration);
+ */
+ gst_query_set_seeking (query, format, TRUE, 0, GST_CLOCK_TIME_NONE);
+ ret = TRUE;
+ break;
+ }
default:
ret = gst_pad_query_default (pad, query);
break;
@@ -628,6 +665,7 @@ gst_au_parse_handle_seek (GstAuParse * auparse, GstEvent * event)
GstFormat format;
gdouble rate;
gint64 start, stop;
+ gboolean res;
gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start,
&stop_type, &stop);
@@ -637,19 +675,85 @@ gst_au_parse_handle_seek (GstAuParse * auparse, GstEvent * event)
return FALSE;
}
- /* FIXME: implement seeking */
- return FALSE;
+ res = gst_au_parse_src_convert (auparse, GST_FORMAT_TIME, start,
+ GST_FORMAT_BYTES, &start);
+
+ if (stop > 0) {
+ res = gst_au_parse_src_convert (auparse, GST_FORMAT_TIME, stop,
+ GST_FORMAT_BYTES, &stop);
+ }
+
+ GST_INFO_OBJECT (auparse,
+ "seeking: %" G_GINT64_FORMAT " ... %" G_GINT64_FORMAT, start, stop);
+
+ event = gst_event_new_seek (rate, GST_FORMAT_BYTES, flags, start_type, start,
+ stop_type, stop);
+ res = gst_pad_push_event (auparse->sinkpad, event);
+ return res;
}
static gboolean
gst_au_parse_sink_event (GstPad * pad, GstEvent * event)
{
GstAuParse *auparse;
- gboolean ret;
+ gboolean ret = TRUE;
auparse = GST_AU_PARSE (gst_pad_get_parent (pad));
switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_NEWSEGMENT:
+ {
+ GstFormat format;
+ gdouble rate, arate;
+ gint64 start, stop, time, offset = 0;
+ gboolean update;
+ GstSegment segment;
+ GstEvent *new_event = NULL;
+
+ gst_segment_init (&segment, GST_FORMAT_UNDEFINED);
+ gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
+ &start, &stop, &time);
+ gst_segment_set_newsegment_full (&segment, update, rate, arate, format,
+ start, stop, time);
+
+ if (auparse->sample_size > 0) {
+ if (start > 0) {
+ offset = start;
+ start -= auparse->offset;
+ start = MAX (start, 0);
+ }
+ if (stop > 0) {
+ stop -= auparse->offset;
+ stop = MAX (stop, 0);
+ }
+ gst_au_parse_src_convert (auparse, GST_FORMAT_BYTES, start,
+ GST_FORMAT_TIME, &start);
+ gst_au_parse_src_convert (auparse, GST_FORMAT_BYTES, stop,
+ GST_FORMAT_TIME, &stop);
+ }
+
+ if (auparse->srcpad) {
+ GST_INFO_OBJECT (auparse,
+ "new segment: %" GST_TIME_FORMAT " ... %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (start), GST_TIME_ARGS (stop));
+
+ new_event = gst_event_new_new_segment_full (update, rate, arate,
+ GST_FORMAT_TIME, start, stop, start);
+
+ ret = gst_pad_push_event (auparse->srcpad, new_event);
+ }
+
+ auparse->buffer_offset = offset;
+
+ gst_event_unref (event);
+ break;
+ }
+ case GST_EVENT_EOS:
+ if (!auparse->srcpad) {
+ GST_ELEMENT_ERROR (auparse, STREAM, WRONG_TYPE,
+ ("No valid input found before end of stream"), (NULL));
+ }
+ /* fall-through */
default:
ret = gst_pad_event_default (pad, event);
break;