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);
MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "max-bytes", 0); /* unlimited */
/* set capsfilter */
- if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
- _mmcam_dbg_log("get pad from videosrc_filter");
- pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "src");
+ if (profile == MM_CAMCORDER_ENCBIN_PROFILE_VIDEO) {
+ if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+ _mmcam_dbg_log("get pad from videosrc_filter");
+ pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "src");
+ } else {
+ _mmcam_dbg_log("get pad from videosrc_que");
+ pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "src");
+ }
+ if (!pad) {
+ _mmcam_dbg_err("get videosrc_que src pad failed");
+ err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
+ goto pipeline_creation_error;
+ }
+
+ caps_from_pad = gst_pad_get_allowed_caps(pad);
+ video_caps = gst_caps_copy(caps_from_pad);
+ gst_caps_unref(caps_from_pad);
+ caps_from_pad = NULL;
+ gst_object_unref(pad);
+ pad = NULL;
} else {
- _mmcam_dbg_log("get pad from videosrc_que");
- pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "src");
- }
- if (!pad) {
- _mmcam_dbg_err("get videosrc_que src pad failed");
- err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
- goto pipeline_creation_error;
+ /* Image */
+ MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", &video_caps);
}
- caps_from_pad = gst_pad_get_allowed_caps(pad);
- video_caps = gst_caps_copy(caps_from_pad);
- gst_caps_unref(caps_from_pad);
- caps_from_pad = NULL;
- gst_object_unref(pad);
- pad = NULL;
-
if (video_caps) {
char *caps_str = NULL;
}
if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
- gst_element_venc_name = strdup("capsfilter");
+ gst_element_venc_name = "capsfilter";
} else {
_mmcamcorder_conf_get_value_element_name(VideoencElement, &gst_element_venc_name);
}
if (use_venc_queue) {
_MMCAMCORDER_ENCODEBIN_ELMGET(sc, _MMCAMCORDER_ENCSINK_VENC_QUE, "use-venc-queue", err);
}
-
- if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
- free(gst_element_venc_name);
- gst_element_venc_name = NULL;
- }
}
if (sc->audio_disable == FALSE &&
stream.data.yuv420sp.length_y = stream.width * stream.height;
stream.data.yuv420sp.uv = stream.data.yuv420sp.y + stream.data.yuv420sp.length_y;
stream.data.yuv420sp.length_uv = stream.data.yuv420sp.length_y >> 1;
+ stream.stride[0] = stream.width;
+ stream.elevation[0] = stream.height;
+ stream.stride[1] = stream.width;
+ stream.elevation[1] = stream.height >> 1;
/*
_mmcam_dbg_log("format[%d][num_planes:%d] [Y]p:0x%x,size:%d [UV]p:0x%x,size:%d",
stream.format, stream.num_planes,
stream.data.yuv420p.length_u = stream.data.yuv420p.length_y >> 2;
stream.data.yuv420p.v = stream.data.yuv420p.u + stream.data.yuv420p.length_u;
stream.data.yuv420p.length_v = stream.data.yuv420p.length_u;
+ stream.stride[0] = stream.width;
+ stream.elevation[0] = stream.height;
+ stream.stride[1] = stream.width >> 1;
+ stream.elevation[1] = stream.height >> 1;
+ stream.stride[2] = stream.width >> 1;
+ stream.elevation[2] = stream.height >> 1;
/*
_mmcam_dbg_log("I420[num_planes:%d] [Y]p:0x%x,size:%d [U]p:0x%x,size:%d [V]p:0x%x,size:%d",
stream.num_planes,
stream.data_type = MM_CAM_STREAM_DATA_YUV422;
stream.data.yuv422.yuv = mapinfo.data;
stream.data.yuv422.length_yuv = stream.length_total;
+ stream.stride[0] = stream.width << 1;
+ stream.elevation[0] = stream.height;
} else if (stream.format == MM_PIXEL_FORMAT_ENCODED_H264) {
stream.data_type = MM_CAM_STREAM_DATA_ENCODED;
stream.data.encoded.data = mapinfo.data;
stream.data_type = MM_CAM_STREAM_DATA_YUV420;
stream.data.yuv420.yuv = mapinfo.data;
stream.data.yuv420.length_yuv = stream.length_total;
+ stream.stride[0] = (stream.width * 3) >> 1;
+ stream.elevation[0] = stream.height;
}
stream.num_planes = 1;
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;
+}
+