MM_CAM_DISPLAY_SOCKET_PATH,
MM_CAM_PID_FOR_SOUND_FOCUS,
MM_CAM_ROOT_DIRECTORY, /* 120 */
+ MM_CAM_SOUND_STREAM_TYPE,
+ MM_CAM_SOUND_STREAM_INDEX,
MM_CAM_ATTRIBUTE_NUM
}MMCamcorderAttrsID;
bool _mmcamcorder_commit_encoded_preview_bitrate(MMHandleType handle, int attr_idx, const mmf_value_t *value);
bool _mmcamcorder_commit_encoded_preview_gop_interval(MMHandleType handle, int attr_idx, const mmf_value_t *value);
bool _mmcamcorder_commit_pid_for_sound_focus(MMHandleType handle, int attr_idx, const mmf_value_t *value);
+bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, const mmf_value_t *value);
+
/**
* This function initialize effect setting.
{0},
{0},
NULL,
+ },
+ {
+ MM_CAM_SOUND_STREAM_TYPE,
+ "sound-stream-type",
+ MMF_VALUE_TYPE_STRING,
+ MM_ATTRS_FLAG_RW,
+ {(void*)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
+ },
+ {
+ MM_CAM_SOUND_STREAM_INDEX,
+ "sound-stream-index",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)-1},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = -1},
+ {.int_max = _MMCAMCORDER_MAX_INT},
+ _mmcamcorder_commit_sound_stream_info,
}
};
}
+bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+{
+ char *stream_type = NULL;
+ int stream_type_len = 0;
+ _MMCamcorderSubContext *sc = NULL;
+
+ if ((void *)handle == NULL) {
+ _mmcam_dbg_warn("handle is NULL");
+ return FALSE;
+ }
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ if (!sc || !sc->encode_element ||
+ !sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) {
+ _mmcam_dbg_log("audiosrc element is not initialized, it will be set later");
+ return TRUE;
+ }
+
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_SOUND_STREAM_TYPE, &stream_type, &stream_type_len,
+ NULL);
+
+ if (stream_type == NULL) {
+ _mmcam_dbg_err("stream type is not set");
+ return FALSE;
+ }
+
+ _mmcam_dbg_log("Commit : sound stream info - type %s", stream_type);
+
+ return _mmcamcorder_set_sound_stream_info(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, stream_type, value->value.i_val);
+}
+
+
static bool
__mmcamcorder_attrs_is_supported(MMHandleType handle, int idx)
{
char *err_name = NULL;
const char *audiosrc_name = NULL;
char *cat_name = NULL;
+ char *stream_type = NULL;
+ char stream_type_len = 0;
+ int stream_index = 0;
GstCaps *caps = NULL;
GstPad *pad = NULL;
}
err = mm_camcorder_get_attributes(handle, &err_name,
- MMCAM_AUDIO_DEVICE, &a_dev,
- MMCAM_AUDIO_ENCODER, &a_enc,
- MMCAM_AUDIO_ENCODER_BITRATE, &val,
- MMCAM_AUDIO_SAMPLERATE, &rate,
- MMCAM_AUDIO_FORMAT, &format,
- MMCAM_AUDIO_CHANNEL, &channel,
- MMCAM_AUDIO_VOLUME, &volume,
- NULL);
+ MMCAM_AUDIO_DEVICE, &a_dev,
+ MMCAM_AUDIO_ENCODER, &a_enc,
+ MMCAM_AUDIO_ENCODER_BITRATE, &val,
+ MMCAM_AUDIO_SAMPLERATE, &rate,
+ MMCAM_AUDIO_FORMAT, &format,
+ MMCAM_AUDIO_CHANNEL, &channel,
+ MMCAM_AUDIO_VOLUME, &volume,
+ MMCAM_SOUND_STREAM_TYPE, &stream_type, &stream_type_len,
+ MMCAM_SOUND_STREAM_INDEX, &stream_index,
+ NULL);
if (err != MM_ERROR_NONE) {
_mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, err);
SAFE_FREE(err_name);
_MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_AUDIOSRC_SRC, audiosrc_name, "audiosrc_src", element_list, err);
+ /* set sound stream info */
+ _mmcamcorder_set_sound_stream_info(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, stream_type, stream_index);
+
+ /* set audiosrc properties in ini configuration */
_mmcamcorder_conf_set_value_element_property(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, AudiosrcElement);
_MMCAMCORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMCAMCORDER_AUDIOSRC_FILT, "capsfilter", "audiosrc_capsfilter", element_list, err);
return TRUE;
}
+
+
+bool _mmcamcorder_set_sound_stream_info(GstElement *element, char *stream_type, int stream_index)
+{
+ GstStructure *props = NULL;
+ char stream_props[64] = {'\0',};
+
+ if (element == NULL || stream_type == NULL || stream_index < 0) {
+ _mmcam_dbg_err("invalid argument %p %p %d", element, stream_type, stream_index);
+ return FALSE;
+ }
+
+ snprintf(stream_props, sizeof(stream_props) - 1,
+ "props,media.role=%s, media.parent_id=%d",
+ stream_type, stream_index);
+
+ _mmcam_dbg_log("stream type %s, index %d -> [%s]", stream_type, stream_index, stream_props);
+
+ props = gst_structure_from_string(stream_props, NULL);
+ if (!props) {
+ _mmcam_dbg_err("failed to create GstStructure");
+ return FALSE;
+ }
+
+ MMCAMCORDER_G_OBJECT_SET_POINTER(element, "stream-properties", props);
+
+ gst_structure_free(props);
+ props = NULL;
+
+ return TRUE;
+}
+