- srcpad = gst_element_get_static_pad (sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst, "src");
- sinkpad = gst_element_get_static_pad (sc->encode_element[_MMCAMCORDER_ENCSINK_BIN].gst, "audio_sink0");
- _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
- } else {
- /* IF MUX in not chosen then record in raw amr file */
- if (!strcmp(aenc_name, "wavenc")) {
- gst_bin_add_many(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst),
- sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
- sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst,
- sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst,
- sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst,
- NULL);
-
- if (!_MM_GST_ELEMENT_LINK_MANY(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
- sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst,
- sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst,
- sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst,
- NULL)) {
- err = MM_ERROR_CAMCORDER_GST_LINK;
- goto pipeline_creation_error;
- }
- } else {
- gst_bin_add_many(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst),
- sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
- sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst,
- sc->encode_element[_MMCAMCORDER_ENCSINK_CONV].gst,
- sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst,
- sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst,
- NULL);
-
- if (!_MM_GST_ELEMENT_LINK_MANY(sc->encode_element[_MMCAMCORDER_AUDIOSRC_BIN].gst,
- sc->encode_element[_MMCAMCORDER_ENCSINK_AQUE].gst,
- sc->encode_element[_MMCAMCORDER_ENCSINK_CONV].gst,
- sc->encode_element[_MMCAMCORDER_ENCSINK_AENC].gst,
- sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst,
- NULL)) {
- err = MM_ERROR_CAMCORDER_GST_LINK;
- goto pipeline_creation_error;
- }
+ _MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_ENCSINK_SINK, sink_name, NULL, element_list, err);
+
+ /* add elements to encode pipeline */
+ if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->encode_element[_MMCAMCORDER_ENCODE_MAIN_PIPE].gst), element_list)) {
+ _mmcam_dbg_err("add encode elements error.");
+ err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
+ goto pipeline_creation_error;
+ }
+
+ /* link elements */
+ if (!_mmcamcorder_link_elements(element_list)) {
+ _mmcam_dbg_err("encode element link error.");
+ err = MM_ERROR_CAMCORDER_GST_LINK;
+ goto pipeline_creation_error;