diff options
-rw-r--r-- | gstreamer_ti/ti_build/ticodecplugin/src/gsttiaudenc1.c | 62 |
1 files changed, 45 insertions, 17 deletions
diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttiaudenc1.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttiaudenc1.c index 53ce4ca..f3249e3 100644 --- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttiaudenc1.c +++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttiaudenc1.c @@ -68,6 +68,22 @@ GST_DEBUG_CATEGORY_STATIC (gst_tiaudenc1_debug); #define GST_CAT_DEFAULT gst_tiaudenc1_debug +/* define property defaults */ +#define DEFAULT_NUM_CHANNELES 2 +#define DEFAULT_CODEC_NAME "unspecified" +#define DEFAULT_BITRATE 64000 +#define DEFAULT_SAMPLEFREQ 44100 +#define DEFAULT_NUMOUTPUT_BUFS 3 +#define DEFAULT_DISPLAY_BUFFER FALSE +#define DEFAULT_GENTIMESTAMPS TRUE + +/* define platform specific defaults */ +#if defined(Platform_dm6446) + #define DEFAULT_ENGINE_NAME "encode" +#else + #define DEFAULT_ENGINE_NAME "codecServer" +#endif + /* Element property identifiers */ enum { @@ -238,42 +254,42 @@ static void gst_tiaudenc1_class_init(GstTIAudenc1Class *klass) g_object_class_install_property(gobject_class, PROP_ENGINE_NAME, g_param_spec_string("engineName", "Engine Name", - "Engine name used by Codec Engine", "unspecified", - G_PARAM_READWRITE)); + "Engine name used by Codec Engine", DEFAULT_ENGINE_NAME, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property(gobject_class, PROP_CODEC_NAME, g_param_spec_string("codecName", "Codec Name", "Name of audio codec", - "unspecified", G_PARAM_READWRITE)); + DEFAULT_CODEC_NAME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property(gobject_class, PROP_NUM_CHANNELS, g_param_spec_int("numChannels", "Number of Channels", "Number of audio channels", - 1, G_MAXINT32, 2, G_PARAM_WRITABLE)); + 1, G_MAXINT32, DEFAULT_NUM_CHANNELES, G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_BITRATE, g_param_spec_int("bitrate", "Bitrate (bps)", "Bitrate in bits/sec", - 8000, 128000, 64000, G_PARAM_WRITABLE)); + 8000, 128000, DEFAULT_BITRATE, G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_SAMPLEFREQ, g_param_spec_int("samplefreq", "samplefreq (KHz)", - "Sampe Frequency in KHz", 16000, 48000, 44100, G_PARAM_WRITABLE)); + "Sampe Frequency in KHz", 16000, 48000, DEFAULT_SAMPLEFREQ, G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_NUM_OUTPUT_BUFS, g_param_spec_int("numOutputBufs", "Number of Ouput Buffers", "Number of output buffers to allocate for codec", - 2, G_MAXINT32, 2, G_PARAM_WRITABLE)); + 2, G_MAXINT32, DEFAULT_NUMOUTPUT_BUFS, G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_DISPLAY_BUFFER, g_param_spec_boolean("displayBuffer", "Display Buffer", "Display circular buffer status while processing", - FALSE, G_PARAM_WRITABLE)); + DEFAULT_DISPLAY_BUFFER, G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_GEN_TIMESTAMPS, g_param_spec_boolean("genTimeStamps", "Generate Time Stamps", "Set timestamps on output buffers", - TRUE, G_PARAM_WRITABLE)); + DEFAULT_GENTIMESTAMPS, G_PARAM_READWRITE)); } /****************************************************************************** @@ -372,23 +388,23 @@ static void gst_tiaudenc1_init(GstTIAudenc1 *audenc1, GstTIAudenc1Class *gclass) gst_element_add_pad(GST_ELEMENT(audenc1), audenc1->srcpad); /* Initialize TIAudenc1 state */ - audenc1->engineName = NULL; - audenc1->codecName = NULL; - audenc1->displayBuffer = FALSE; - audenc1->genTimeStamps = TRUE; + g_object_set(audenc1, "engineName", DEFAULT_ENGINE_NAME, (gchar*)NULL); + g_object_set(audenc1, "codecName", DEFAULT_CODEC_NAME, (gchar*)NULL); + audenc1->displayBuffer = DEFAULT_DISPLAY_BUFFER; + audenc1->genTimeStamps = DEFAULT_GENTIMESTAMPS; audenc1->hEngine = NULL; audenc1->hAe = NULL; - audenc1->channels = 0; - audenc1->bitrate = 0; - audenc1->samplefreq = 0; + audenc1->channels = DEFAULT_NUM_CHANNELES; + audenc1->bitrate = DEFAULT_BITRATE; + audenc1->samplefreq = DEFAULT_SAMPLEFREQ; audenc1->drainingEOS = FALSE; audenc1->threadStatus = 0UL; audenc1->waitOnEncodeThread = NULL; audenc1->waitOnEncodeDrain = NULL; - audenc1->numOutputBufs = 0UL; + audenc1->numOutputBufs = DEFAULT_NUMOUTPUT_BUFS; audenc1->hOutBufTab = NULL; audenc1->circBuf = NULL; @@ -487,6 +503,18 @@ static void gst_tiaudenc1_get_property(GObject *object, guint prop_id, case PROP_SAMPLEFREQ: g_value_set_int(value, audenc1->samplefreq); break; + case PROP_NUM_OUTPUT_BUFS: + g_value_set_int(value, audenc1->numOutputBufs); + break; + case PROP_DISPLAY_BUFFER: + g_value_set_boolean(value, audenc1->displayBuffer); + break; + case PROP_GEN_TIMESTAMPS: + g_value_set_boolean(value, audenc1->genTimeStamps); + break; + case PROP_NUM_CHANNELS: + g_value_set_int(value, audenc1->channels); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; |