summaryrefslogtreecommitdiffstats
path: root/gst/amrparse
diff options
context:
space:
mode:
authorDave Robillard <dave@drobilla.net>2009-05-31 19:26:30 -0400
committerDave Robillard <dave@drobilla.net>2009-05-31 19:26:30 -0400
commitaf14cf34e69e46bfd6544a420b3fdd7e131aa69a (patch)
tree2bd39ab6ab67995d6e4c69a3e6c6eae2a17f350e /gst/amrparse
parentbd9a3cbd254714bf71cd87c31d4e5b77f6a96cba (diff)
parentb19dd5920605c0036dacf19591a6feca7a736a50 (diff)
downloadgst-plugins-bad-af14cf34e69e46bfd6544a420b3fdd7e131aa69a.tar.gz
gst-plugins-bad-af14cf34e69e46bfd6544a420b3fdd7e131aa69a.tar.bz2
gst-plugins-bad-af14cf34e69e46bfd6544a420b3fdd7e131aa69a.zip
Merge branch 'fdo' into lv2
Diffstat (limited to 'gst/amrparse')
-rw-r--r--gst/amrparse/gstamrparse.c10
-rw-r--r--gst/amrparse/gstamrparse.h1
-rw-r--r--gst/amrparse/gstbaseparse.c2
3 files changed, 8 insertions, 5 deletions
diff --git a/gst/amrparse/gstamrparse.c b/gst/amrparse/gstamrparse.c
index aeb928e1..5ec0c6c2 100644
--- a/gst/amrparse/gstamrparse.c
+++ b/gst/amrparse/gstamrparse.c
@@ -309,12 +309,12 @@ gst_amrparse_parse_header (GstAmrParse * amrparse,
GST_DEBUG_OBJECT (amrparse, "AMR-WB detected");
amrparse->block_size = block_size_wb;
amrparse->wide = TRUE;
- *skipsize = 9;
+ *skipsize = amrparse->header = 9;
} else if (!memcmp (data, "#!AMR\n", 6)) {
GST_DEBUG_OBJECT (amrparse, "AMR-NB detected");
amrparse->block_size = block_size_nb;
amrparse->wide = FALSE;
- *skipsize = 6;
+ *skipsize = amrparse->header = 6;
} else
return FALSE;
@@ -453,6 +453,7 @@ gst_amrparse_start (GstBaseParse * parse)
amrparse = GST_AMRPARSE (parse);
GST_DEBUG ("start");
amrparse->need_header = TRUE;
+ amrparse->header = 0;
amrparse->sync = TRUE;
amrparse->eos = FALSE;
amrparse->framecount = 0;
@@ -478,6 +479,7 @@ gst_amrparse_stop (GstBaseParse * parse)
amrparse = GST_AMRPARSE (parse);
GST_DEBUG ("stop");
amrparse->need_header = TRUE;
+ amrparse->header = 0;
amrparse->ts = -1;
return TRUE;
}
@@ -548,7 +550,7 @@ gst_amrparse_convert (GstBaseParse * parse,
GST_DEBUG ("converting bytes -> time");
if (amrparse->framecount) {
- *dest_value = AMR_FRAME_DURATION * src_value / bpf;
+ *dest_value = AMR_FRAME_DURATION * (src_value - amrparse->header) / bpf;
GST_DEBUG ("conversion result: %lld ms", *dest_value / GST_MSECOND);
ret = TRUE;
}
@@ -557,7 +559,7 @@ gst_amrparse_convert (GstBaseParse * parse,
GST_DEBUG ("converting time -> bytes");
if (dest_format == GST_FORMAT_BYTES) {
if (amrparse->framecount) {
- *dest_value = bpf * src_value / AMR_FRAME_DURATION;
+ *dest_value = bpf * src_value / AMR_FRAME_DURATION + amrparse->header;
GST_DEBUG ("time %lld ms in bytes = %lld",
src_value / GST_MSECOND, *dest_value);
ret = TRUE;
diff --git a/gst/amrparse/gstamrparse.h b/gst/amrparse/gstamrparse.h
index e776f295..4cd432e2 100644
--- a/gst/amrparse/gstamrparse.h
+++ b/gst/amrparse/gstamrparse.h
@@ -61,6 +61,7 @@ struct _GstAmrParse {
GstBaseParse element;
const gint *block_size;
gboolean need_header;
+ gint header;
gboolean wide;
gboolean eos;
gboolean sync;
diff --git a/gst/amrparse/gstbaseparse.c b/gst/amrparse/gstbaseparse.c
index 7483c2b9..e0f1f4d7 100644
--- a/gst/amrparse/gstbaseparse.c
+++ b/gst/amrparse/gstbaseparse.c
@@ -290,7 +290,7 @@ gst_base_parse_base_init (gpointer g_class)
GstBaseParseClass *klass = GST_BASE_PARSE_CLASS (g_class);
GstBaseParseClassPrivate *priv;
- GST_DEBUG_CATEGORY_INIT (gst_base_parse_debug, "flacbaseparse", 0,
+ GST_DEBUG_CATEGORY_INIT (gst_base_parse_debug, "amrbaseparse", 0,
"baseparse element");
/* TODO: Remove this once GObject supports class private data */