Only enable lame presets if version of lame has presets in API

Original commit message from CVS:
2004-08-19  Zaheer Abbas Merali  <zaheerabbas at merali dot org>

* configure.ac:
* ext/lame/Makefile.am:
* ext/lame/gstlame.c: (gst_lame_class_init),
(gst_lame_set_property), (gst_lame_get_property), (gst_lame_setup):
Only enable lame presets if version of lame has presets in API
This commit is contained in:
Zaheer Abbas Merali 2004-08-19 22:44:50 +00:00
parent 70e9191c9a
commit 257c9ec4d7
2 changed files with 19 additions and 1 deletions

View file

@ -2,7 +2,7 @@
plugin_LTLIBRARIES = libgstlame.la plugin_LTLIBRARIES = libgstlame.la
libgstlame_la_SOURCES = gstlame.c libgstlame_la_SOURCES = gstlame.c
libgstlame_la_CFLAGS = $(GST_CFLAGS) libgstlame_la_CFLAGS = $(GST_CFLAGS) $(LAME_CFLAGS)
libgstlame_la_LIBADD = $(LAME_LIBS) libgstlame_la_LIBADD = $(LAME_LIBS)
libgstlame_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstlame_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)

View file

@ -23,6 +23,10 @@
#include "string.h" #include "string.h"
#include "gstlame.h" #include "gstlame.h"
#ifdef lame_set_preset
#define GST_LAME_PRESET
#endif
GST_DEBUG_CATEGORY_STATIC (debug); GST_DEBUG_CATEGORY_STATIC (debug);
#define GST_CAT_DEFAULT debug #define GST_CAT_DEFAULT debug
@ -144,6 +148,7 @@ gst_lame_vbrmode_get_type (void)
return lame_vbrmode_type; return lame_vbrmode_type;
} }
#ifdef GSTLAME_PRESET
#define GST_TYPE_LAME_PRESET (gst_lame_preset_get_type()) #define GST_TYPE_LAME_PRESET (gst_lame_preset_get_type())
static GType static GType
gst_lame_preset_get_type (void) gst_lame_preset_get_type (void)
@ -165,6 +170,7 @@ gst_lame_preset_get_type (void)
return gst_lame_preset; return gst_lame_preset;
} }
#endif
/********** Standard stuff for signals and arguments **********/ /********** Standard stuff for signals and arguments **********/
/* GstLame signals and args */ /* GstLame signals and args */
@ -208,8 +214,12 @@ enum
ARG_NO_SHORT_BLOCKS, ARG_NO_SHORT_BLOCKS,
ARG_EMPHASIS, ARG_EMPHASIS,
ARG_VBR_QUALITY, ARG_VBR_QUALITY,
#ifdef GSTLAME_PRESET
ARG_XINGHEADER, ARG_XINGHEADER,
ARG_PRESET ARG_PRESET
#else
ARG_XINGHEADER
#endif
}; };
static void gst_lame_base_init (gpointer g_class); static void gst_lame_base_init (gpointer g_class);
@ -392,9 +402,11 @@ gst_lame_class_init (GstLameClass * klass)
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_XINGHEADER, g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_XINGHEADER,
g_param_spec_boolean ("xingheader", "Output Xing Header", g_param_spec_boolean ("xingheader", "Output Xing Header",
"Output Xing Header", FALSE, G_PARAM_READWRITE)); "Output Xing Header", FALSE, G_PARAM_READWRITE));
#ifdef GSTLAME_PRESET
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PRESET, g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PRESET,
g_param_spec_enum ("preset", "Lame Preset", "Lame Preset", g_param_spec_enum ("preset", "Lame Preset", "Lame Preset",
GST_TYPE_LAME_PRESET, 0, G_PARAM_READWRITE)); GST_TYPE_LAME_PRESET, 0, G_PARAM_READWRITE));
#endif
gobject_class->set_property = gst_lame_set_property; gobject_class->set_property = gst_lame_set_property;
gobject_class->get_property = gst_lame_get_property; gobject_class->get_property = gst_lame_get_property;
@ -771,9 +783,11 @@ gst_lame_set_property (GObject * object, guint prop_id, const GValue * value,
case ARG_XINGHEADER: case ARG_XINGHEADER:
lame->xingheader = g_value_get_boolean (value); lame->xingheader = g_value_get_boolean (value);
break; break;
#ifdef GSTLAME_PRESET
case ARG_PRESET: case ARG_PRESET:
lame->preset = g_value_get_enum (value); lame->preset = g_value_get_enum (value);
break; break;
#endif
default: default:
break; break;
} }
@ -888,9 +902,11 @@ gst_lame_get_property (GObject * object, guint prop_id, GValue * value,
case ARG_XINGHEADER: case ARG_XINGHEADER:
g_value_set_boolean (value, lame->xingheader); g_value_set_boolean (value, lame->xingheader);
break; break;
#ifdef GSTLAME_PRESET
case ARG_PRESET: case ARG_PRESET:
g_value_set_enum (value, lame->preset); g_value_set_enum (value, lame->preset);
break; break;
#endif
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -1077,9 +1093,11 @@ gst_lame_setup (GstLame * lame)
CHECK_ERROR (lame_set_no_short_blocks (lame->lgf, lame->no_short_blocks)); CHECK_ERROR (lame_set_no_short_blocks (lame->lgf, lame->no_short_blocks));
CHECK_ERROR (lame_set_emphasis (lame->lgf, lame->emphasis)); CHECK_ERROR (lame_set_emphasis (lame->lgf, lame->emphasis));
CHECK_ERROR (lame_set_bWriteVbrTag (lame->lgf, lame->xingheader ? 1 : 0)); CHECK_ERROR (lame_set_bWriteVbrTag (lame->lgf, lame->xingheader ? 1 : 0));
#ifdef GSTLAME_PRESET
if (lame->preset > 0) { if (lame->preset > 0) {
CHECK_ERROR (lame_set_preset (lame->lgf, lame->preset)); CHECK_ERROR (lame_set_preset (lame->lgf, lame->preset));
} }
#endif
gst_lame_set_metadata (lame); gst_lame_set_metadata (lame);
/* initialize the lame encoder */ /* initialize the lame encoder */