Add support for AMR-NB (mobile phone audio format; #155163, #163286).
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>
Fri, 28 Jan 2005 10:36:12 +0000 (10:36 +0000)
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>
Fri, 28 Jan 2005 10:36:12 +0000 (10:36 +0000)
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/amrnb/Makefile.am:
* ext/amrnb/amrnb.c: (plugin_init):
* ext/amrnb/amrnbdec.c: (gst_amrnbdec_get_type),
(gst_amrnbdec_base_init), (gst_amrnbdec_class_init),
(gst_amrnbdec_init), (gst_amrnbdec_link), (gst_amrnbdec_chain),
(gst_amrnbdec_state_change):
* ext/amrnb/amrnbdec.h:
* ext/amrnb/amrnbparse.c: (gst_amrnbparse_get_type),
(gst_amrnbparse_base_init), (gst_amrnbparse_class_init),
(gst_amrnbparse_init), (gst_amrnbparse_formats),
(gst_amrnbparse_querytypes), (gst_amrnbparse_query),
(gst_amrnbparse_handle_event), (gst_amrnbparse_reserve),
(gst_amrnbparse_loop), (gst_amrnbparse_state_change):
* ext/amrnb/amrnbparse.h:
Add support for AMR-NB (mobile phone audio format; #155163, #163286).
* gst/typefind/gsttypefindfunctions.c: (plugin_init):
Add AMR-NB/-WB raw formats.
* ext/alsa/gstalsa.c: (gst_alsa_link):
Keep valid time when changing format.
* gst/qtdemux/qtdemux.c: (gst_qtdemux_loop_header),
(qtdemux_parse_trak):
Add some more format-specific options (#140141, #143555, #155163).

ChangeLog
configure.ac
ext/Makefile.am
ext/alsa/gstalsa.c
gst/typefind/gsttypefindfunctions.c

index c88908d..7fbd78a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,32 @@
 2005-01-28  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
+       * configure.ac:
+       * ext/Makefile.am:
+       * ext/amrnb/Makefile.am:
+       * ext/amrnb/amrnb.c: (plugin_init):
+       * ext/amrnb/amrnbdec.c: (gst_amrnbdec_get_type),
+       (gst_amrnbdec_base_init), (gst_amrnbdec_class_init),
+       (gst_amrnbdec_init), (gst_amrnbdec_link), (gst_amrnbdec_chain),
+       (gst_amrnbdec_state_change):
+       * ext/amrnb/amrnbdec.h:
+       * ext/amrnb/amrnbparse.c: (gst_amrnbparse_get_type),
+       (gst_amrnbparse_base_init), (gst_amrnbparse_class_init),
+       (gst_amrnbparse_init), (gst_amrnbparse_formats),
+       (gst_amrnbparse_querytypes), (gst_amrnbparse_query),
+       (gst_amrnbparse_handle_event), (gst_amrnbparse_reserve),
+       (gst_amrnbparse_loop), (gst_amrnbparse_state_change):
+       * ext/amrnb/amrnbparse.h:
+         Add support for AMR-NB (mobile phone audio format; #155163, #163286).
+       * gst/typefind/gsttypefindfunctions.c: (plugin_init):
+         Add AMR-NB/-WB raw formats.
+       * ext/alsa/gstalsa.c: (gst_alsa_link):
+         Keep valid time when changing format.
+       * gst/qtdemux/qtdemux.c: (gst_qtdemux_loop_header),
+       (qtdemux_parse_trak):
+         Add some more format-specific options (#140141, #143555, #155163).
+
+2005-01-28  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
+
        * gst/matroska/matroska-demux.c:
        (gst_matroska_demux_parse_blockgroup):
          Fix logic error in timing of subtitle stream synchronization.
index 4fa04b0..c6e1647 100644 (file)
@@ -778,6 +778,16 @@ GST_CHECK_FEATURE(ALSA, [alsa plug-ins], gstalsa, [
   ])
 ])
 
+dnl *** AMR-NB ***
+translit(dnm, m, l) AM_CONDITIONAL(USE_AMRNB, true)
+GST_CHECK_FEATURE(AMRNB, [AMR-NB], amrnbdec amrnbenc, [
+  GST_CHECK_LIBHEADER(AMRNB, amrnb,
+                     Decoder_Interface_init, -lm,
+                     amrnb/interf_dec.h,
+                     AMRNB_LIBS="-lamrnb -lm"
+                     AC_SUBST(AMRNB_LIBS))
+])
+
 dnl *** arts ***
 dnl if mcopidl can't be found there's no use in compiling it
 AC_CHECK_PROG(MCOPIDL, mcopidl, yes, no)
@@ -2021,6 +2031,7 @@ ext/Makefile
 ext/a52dec/Makefile
 ext/aalib/Makefile
 ext/alsa/Makefile
+ext/amrnb/Makefile
 ext/arts/Makefile
 ext/artsd/Makefile
 ext/audiofile/Makefile
index 08c61fd..a74262f 100644 (file)
@@ -16,6 +16,12 @@ else
 ALSA_DIR=
 endif
 
+if USE_AMRNB
+AMRNB_DIR=amrnb
+else
+AMRNB=
+endif
+
 if USE_ARTS
 ARTS_DIR=arts
 else
@@ -398,6 +404,8 @@ SUBDIRS=\
        $(A52DEC_DIR) \
        $(AALIB_DIR) \
        $(ALSA_DIR) \
+       $(AMRNB_DIR) \
+       $(AMRWB_DIR) \
        $(ARTS_DIR) \
        $(ARTSC_DIR) \
        $(AUDIOFILE_DIR) \
@@ -464,6 +472,7 @@ DIST_SUBDIRS=\
        a52dec \
        aalib \
        alsa \
+       amrnb \
        arts \
        artsd \
        audiofile \
index 5203ad1..8134899 100644 (file)
@@ -1249,6 +1249,7 @@ gst_alsa_link (GstPad * pad, const GstCaps * caps)
   GstAlsa *this;
   GstAlsaFormat *format;
   GstPadLinkReturn ret;
+  gint old_rate = 0;
 
   g_return_val_if_fail (caps != NULL, GST_PAD_LINK_REFUSED);
   g_return_val_if_fail (pad != NULL, GST_PAD_LINK_REFUSED);
@@ -1313,8 +1314,12 @@ gst_alsa_link (GstPad * pad, const GstCaps * caps)
     /* sync the params */
     if (GST_FLAG_IS_SET (this, GST_ALSA_RUNNING))
       gst_alsa_stop_audio (this);
+    if (this->format)
+      old_rate = this->format->rate;
     g_free (this->format);
     this->format = format;
+    if (this->played && old_rate)
+      this->played = this->played * this->format->rate / old_rate;
     if (!gst_alsa_start_audio (this)) {
       GST_ELEMENT_ERROR (this, RESOURCE, SETTINGS, (NULL), (NULL));
       return GST_PAD_LINK_REFUSED;
index d60f2c7..7c6fda3 100644 (file)
@@ -1668,6 +1668,7 @@ plugin_init (GstPlugin * plugin)
   static gchar *tiff_exts[] = { "tif", "tiff", NULL };
   static gchar *matroska_exts[] = { "mkv", "mka", NULL };
   static gchar *dv_exts[] = { "dv", "dif", NULL };
+  static gchar *amr_exts[] = { "amr", NULL };
   static gchar *sid_exts[] = { "sid", NULL };
   static gchar *xcf_exts[] = { "xcf", NULL };
   static gchar *mng_exts[] = { "mng", NULL };
@@ -1778,6 +1779,10 @@ plugin_init (GstPlugin * plugin)
       matroska_type_find, matroska_exts, MATROSKA_CAPS, NULL);
   TYPE_FIND_REGISTER (plugin, "video/x-dv", GST_RANK_SECONDARY, dv_type_find,
       dv_exts, DV_CAPS, NULL);
+  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-amr-nb-sh", GST_RANK_PRIMARY,
+      amr_exts, "#!AMR", 5, GST_TYPE_FIND_LIKELY);
+  TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-amr-wb-sh", GST_RANK_PRIMARY,
+      amr_exts, "#!AMR-WB", 7, GST_TYPE_FIND_MAXIMUM);
   TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-sid", GST_RANK_MARGINAL,
       sid_exts, "PSID", 4, GST_TYPE_FIND_MAXIMUM);
   TYPE_FIND_REGISTER_START_WITH (plugin, "image/x-xcf", GST_RANK_SECONDARY,