diff options
author | Hyuntae Kim <ht1211.kim@samsung.com> | 2020-02-25 10:19:38 +0900 |
---|---|---|
committer | Hyuntae Kim <ht1211.kim@samsung.com> | 2020-04-02 15:11:29 +0900 |
commit | a792fa2658aedcf64f63b17117ce9186e2f14e43 (patch) | |
tree | 59b06ee1925a391e5de174a850efee84a28ce1ad | |
parent | f0e15b6c1cbf6b315d5d0de97a7996f9c74733dd (diff) | |
download | libmm-camcorder-submit/tizen/20200407.044027.tar.gz libmm-camcorder-submit/tizen/20200407.044027.tar.bz2 libmm-camcorder-submit/tizen/20200407.044027.zip |
mjpeg preview support for usb camera in tv platformsubmit/tizen/20200407.044027
Change-Id: I4732c7f1f1746b0621f3e975b9a19bacb4a9b1e4
-rw-r--r-- | packaging/libmm-camcorder.spec | 2 | ||||
-rw-r--r-- | src/mm_camcorder_gstcommon.c | 185 | ||||
-rw-r--r-- | src/mm_camcorder_rm.c | 30 | ||||
-rw-r--r-- | src/mm_camcorder_util.c | 6 |
4 files changed, 162 insertions, 61 deletions
diff --git a/packaging/libmm-camcorder.spec b/packaging/libmm-camcorder.spec index df0fb2d..0b6ddbe 100644 --- a/packaging/libmm-camcorder.spec +++ b/packaging/libmm-camcorder.spec @@ -1,6 +1,6 @@ Name: libmm-camcorder Summary: Camera and recorder library -Version: 0.10.194 +Version: 0.10.195 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/mm_camcorder_gstcommon.c b/src/mm_camcorder_gstcommon.c index cd7b0ac..048c2d7 100644 --- a/src/mm_camcorder_gstcommon.c +++ b/src/mm_camcorder_gstcommon.c @@ -104,7 +104,7 @@ gboolean videocodec_fileformat_compatibility_table[MM_VIDEO_CODEC_NUM][MM_FILE_F /*H262*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /*H263V2*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /*H263V3*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, -/*MJPEG*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, +/*MJPEG*/ { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /*MPEG2*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /*MPEG4_SIMPLE*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /*MPEG4_ADV*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, @@ -154,7 +154,7 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP static GstPadProbeReturn __mmcamcorder_video_dataprobe_push_buffer_to_record(GstPad *pad, GstPadProbeInfo *info, gpointer u_data); static int __mmcamcorder_get_amrnb_bitrate_mode(int bitrate); static guint32 _mmcamcorder_convert_fourcc_string_to_value(const gchar* format_name); - +static inline bool __mmcamcorder_is_encoded_preview_pixel_format(int pixel_format); #ifdef _MMCAMCORDER_PRODUCT_TV static bool __mmcamcorder_find_max_resolution(MMHandleType handle, gint *max_width, gint *max_height); #endif /* _MMCAMCORDER_PRODUCT_TV */ @@ -325,60 +325,93 @@ int _mmcamcorder_create_preview_elements(MMHandleType handle) } } - /* make demux and decoder for H264 stream from videosrc */ - if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264 && display_surface_type != MM_DISPLAY_SURFACE_NULL) { - int preview_bitrate = 0; - int gop_interval = 0; - const char *videodecoder_name = NULL; - + if (__mmcamcorder_is_encoded_preview_pixel_format(sc->info_image->preview_format)) { /* get recreate_decoder flag */ _mmcamcorder_conf_get_value_int(handle, hcamcorder->conf_main, CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT, "RecreateDecoder", &hcamcorder->recreate_decoder); + } - /* get video decoder element and name for H.264 format */ - _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main, - CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT, - "VideodecoderElementH264", - &sc->VideodecoderElementH264); - - _mmcamcorder_conf_get_value_element_name(sc->VideodecoderElementH264, &videodecoder_name); - - if (videodecoder_name) { - _mmcam_dbg_log("video decoder element [%s], recreate decoder %d", - videodecoder_name, hcamcorder->recreate_decoder); -#ifdef _MMCAMCORDER_RM_SUPPORT - if (hcamcorder->request_resources.category_id[0] == RM_CATEGORY_VIDEO_DECODER_SUB) - decoder_index = 1; - - snprintf(decoder_name, sizeof(decoder_name)-1, "%s%d", videodecoder_name, decoder_index); - _mmcam_dbg_log("encoded preview decoder_name %s", decoder_name); - /* create decoder element */ - _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_DECODE, decoder_name, "videosrc_decode", element_list, err); -#else /* _MMCAMCORDER_RM_SUPPORT */ - /* create decoder element */ - _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_DECODE, videodecoder_name, "videosrc_decode", element_list, err); -#endif /* _MMCAMCORDER_RM_SUPPORT */ - _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst, sc->VideodecoderElementH264); - } else { - _mmcam_dbg_err("failed to get video decoder element name from %p", sc->VideodecoderElementH264); - goto pipeline_creation_error; - } - - /* set encoded preview bitrate and iframe interval */ + if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) { + int preview_bitrate = 0; + int gop_interval = 0; mm_camcorder_get_attributes(handle, NULL, MMCAM_ENCODED_PREVIEW_BITRATE, &preview_bitrate, MMCAM_ENCODED_PREVIEW_GOP_INTERVAL, &gop_interval, NULL); + /* set encoded preview bitrate */ if (!_mmcamcorder_set_encoded_preview_bitrate(handle, preview_bitrate)) _mmcam_dbg_warn("_mmcamcorder_set_encoded_preview_bitrate failed"); + /* set encoded preview iframe interval */ if (!_mmcamcorder_set_encoded_preview_gop_interval(handle, gop_interval)) _mmcam_dbg_warn("_mmcamcorder_set_encoded_preview_gop_interval failed"); } + if (display_surface_type != MM_DISPLAY_SURFACE_NULL) { + const char *videodecoder_name = NULL; + /* case of decoder element */ + if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) { + /* get video decoder element and name for H.264 format */ + _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main, + CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT, + "VideodecoderElementH264", + &sc->VideodecoderElementH264); + _mmcamcorder_conf_get_value_element_name(sc->VideodecoderElementH264, + &videodecoder_name); + if (videodecoder_name) { +#ifdef _MMCAMCORDER_RM_SUPPORT + if (hcamcorder->request_resources.category_id[0] == RM_CATEGORY_VIDEO_DECODER_SUB) + decoder_index = 1; + + snprintf(decoder_name, sizeof(decoder_name)-1, "%s%d", videodecoder_name, decoder_index); + _mmcam_dbg_log("encoded preview decoder_name [%s], video decoder element [%s]", + decoder_name, videodecoder_name); + /* create decoder element */ + _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_DECODE, decoder_name, "videosrc_decode", element_list, err); +#else /* _MMCAMCORDER_RM_SUPPORT */ + _mmcam_dbg_log("video decoder element [%s]", videodecoder_name); + /* create decoder element */ + _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_DECODE, videodecoder_name, "videosrc_decode", element_list, err); +#endif /* _MMCAMCORDER_RM_SUPPORT */ + _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst, sc->VideodecoderElementH264); + } else { + _mmcam_dbg_err("failed to get video decoder element name from %p", sc->VideodecoderElementH264); + goto pipeline_creation_error; + } + } else if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_MJPEG) { +#ifdef _MMCAMCORDER_RM_SUPPORT + /* get video decoder element and name for MJPEG format */ + _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main, + CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT, + "VideodecoderElementH264", + &sc->VideodecoderElementH264); + _mmcamcorder_conf_get_value_element_name(sc->VideodecoderElementH264, + &videodecoder_name); + if (videodecoder_name) { + if (hcamcorder->request_resources.category_id[0] == RM_CATEGORY_VIDEO_DECODER) + snprintf(decoder_name, sizeof(decoder_name)-1, "%s", "omx_uhd_mjpegdec"); + else + snprintf(decoder_name, sizeof(decoder_name)-1, "%s", "omx_mjpegdec"); + _mmcam_dbg_log("encoded preview decoder_name [%s], video decoder element [%s]", + decoder_name, videodecoder_name); + /* create decoder element */ + _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_DECODE, decoder_name, "videosrc_decode", element_list, err); + _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst, sc->VideodecoderElementH264); + } else { + _mmcam_dbg_err("failed to get video decoder element name from %p", sc->VideodecoderElementH264); + goto pipeline_creation_error; + } +#else /* _MMCAMCORDER_RM_SUPPORT */ + _mmcam_dbg_log("video decoder element [jpegdec]"); + /* create decoder element */ + _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_VIDEOSRC_DECODE, "jpegdec", "videosrc_decode", element_list, err); +#endif /* _MMCAMCORDER_RM_SUPPORT */ + } + } + _mmcam_dbg_log("Current mode[%d]", hcamcorder->type); /* Get videosink name */ @@ -855,7 +888,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin /* set capsfilter */ if (profile == MM_CAMCORDER_ENCBIN_PROFILE_VIDEO) { - if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) { + if (__mmcamcorder_is_encoded_preview_pixel_format(sc->info_image->preview_format)) { _mmcam_dbg_log("get pad from videosrc_filter"); pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "src"); } else { @@ -990,7 +1023,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin goto pipeline_creation_error; } - if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) { + if (__mmcamcorder_is_encoded_preview_pixel_format(sc->info_image->preview_format)) { /* set dummy element */ gst_element_venc_name = "identity"; } else { @@ -1312,7 +1345,7 @@ int _mmcamcorder_create_preview_pipeline(MMHandleType handle) } /* set dataprobe for video recording */ - if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) + if (__mmcamcorder_is_encoded_preview_pixel_format(sc->info_image->preview_format)) srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "src"); else srcpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "src"); @@ -1724,7 +1757,7 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP GstMemory *memory = NULL; GstMapInfo mapinfo; - if (sc->info_image->preview_format != MM_PIXEL_FORMAT_ENCODED_H264) { + if (!__mmcamcorder_is_encoded_preview_pixel_format(sc->info_image->preview_format)) { state = _mmcamcorder_get_state((MMHandleType)hcamcorder); if (state < MM_CAMCORDER_STATE_PREPARE) { _mmcam_dbg_warn("Not ready for stream callback"); @@ -1748,6 +1781,8 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) { stream.format = MM_PIXEL_FORMAT_ENCODED_H264; + } else if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_MJPEG) { + stream.format = MM_PIXEL_FORMAT_ENCODED_MJPEG; } else { string_format = gst_structure_get_string(structure, "format"); if (string_format == NULL) { @@ -1775,7 +1810,7 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP } /* set size and timestamp */ - if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) + if (__mmcamcorder_is_encoded_preview_pixel_format(sc->info_image->preview_format)) memory = gst_buffer_get_all_memory(buffer); else memory = gst_buffer_peek_memory(buffer, 0); @@ -1918,6 +1953,16 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP stream.data.encoded.data, stream.data.encoded.length_data, stream.data.encoded.is_delta_frame); + + */ + break; + case MM_PIXEL_FORMAT_ENCODED_MJPEG: + stream.data_type = MM_CAM_STREAM_DATA_ENCODED; + stream.data.encoded.data = mapinfo.data; + stream.data.encoded.length_data = stream.length_total; + /* + _mmcam_dbg_log("MJPEG[num_planes:%d] [0]p:%p,size:%d", + stream.num_planes, stream.data.encoded.data, stream.data.encoded.length_data); */ break; case MM_PIXEL_FORMAT_INVZ: @@ -1968,7 +2013,7 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP /* unmap memory */ if (mapinfo.data) gst_memory_unmap(memory, &mapinfo); - if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) + if (__mmcamcorder_is_encoded_preview_pixel_format(sc->info_image->preview_format)) gst_memory_unref(memory); } @@ -2667,8 +2712,9 @@ bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, in gst_structure_get_int(structure, "rotate", &caps_rotate); #ifdef _MMCAMCORDER_PRODUCT_TV - if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) { - if (set_width == caps_width && set_height == caps_height && set_rotate == caps_rotate && fps == caps_fps) { + if (__mmcamcorder_is_encoded_preview_pixel_format(sc->info_image->preview_format)) { + if (set_width == caps_width && set_height == caps_height && + set_rotate == caps_rotate && fps == caps_fps) { _mmcam_dbg_log("No need to replace caps."); } else { _mmcam_dbg_log("current [%c%c%c%c %dx%d, fps %d, rot %d], new [%c%c%c%c %dx%d, fps %d, rot %d]", @@ -2728,7 +2774,8 @@ bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, in MMCAM_DISPLAY_SURFACE, &display_surface_type, NULL); - if (display_surface_type != MM_DISPLAY_SURFACE_NULL && __mmcamcorder_find_max_resolution(handle, &maxwidth, &maxheight) == false) { + if (display_surface_type != MM_DISPLAY_SURFACE_NULL && + __mmcamcorder_find_max_resolution(handle, &maxwidth, &maxheight) == false) { _mmcam_dbg_err("can not find max resolution limitation"); return false; } else if (display_surface_type == MM_DISPLAY_SURFACE_NULL) { @@ -2747,6 +2794,16 @@ bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, in "alignment", G_TYPE_STRING, "au", #endif /* _MMCAMCORDER_PRODUCT_TV */ NULL); + } else if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_MJPEG){ +#ifdef _MMCAMCORDER_PRODUCT_TV + caps = gst_caps_new_simple("video/x-jpeg", +#else + caps = gst_caps_new_simple("image/jpeg", +#endif + "width", G_TYPE_INT, set_width, + "height", G_TYPE_INT, set_height, + "framerate", GST_TYPE_FRACTION, fps, 1, + NULL); } else { char fourcc_string[sizeof(fourcc)+1]; strncpy(fourcc_string, (char*)&fourcc, sizeof(fourcc)); @@ -3065,7 +3122,7 @@ bool _mmcamcorder_recreate_decoder_for_encoded_preview(MMHandleType handle) return FALSE; } - if (sc->info_image->preview_format != MM_PIXEL_FORMAT_ENCODED_H264 || + if (__mmcamcorder_is_encoded_preview_pixel_format(sc->info_image->preview_format) == false || hcamcorder->recreate_decoder == FALSE) { _mmcam_dbg_log("skip this fuction - format %d, recreate decoder %d", sc->info_image->preview_format, hcamcorder->recreate_decoder); @@ -3108,11 +3165,21 @@ bool _mmcamcorder_recreate_decoder_for_encoded_preview(MMHandleType handle) } #ifdef _MMCAMCORDER_RM_SUPPORT - if (hcamcorder->request_resources.category_id[0] == RM_CATEGORY_VIDEO_DECODER_SUB) - decoder_index = 1; + if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) { + if (hcamcorder->request_resources.category_id[0] == RM_CATEGORY_VIDEO_DECODER_SUB) + decoder_index = 1; + + snprintf(decoder_name, sizeof(decoder_name)-1, "%s%d", videodecoder_name, decoder_index); + _mmcam_dbg_log("encoded preview decoder_name %s", decoder_name); + } else { + /* MJPEG */ + if (hcamcorder->request_resources.category_id[0] == RM_CATEGORY_VIDEO_DECODER) + snprintf(decoder_name, sizeof(decoder_name)-1, "%s", "omx_uhd_mjpegdec"); + else + snprintf(decoder_name, sizeof(decoder_name)-1, "%s", "omx_mjpegdec"); + _mmcam_dbg_log("encoded preview decoder_name %s", decoder_name); + } - snprintf(decoder_name, sizeof(decoder_name)-1, "%s%d", videodecoder_name, decoder_index); - _mmcam_dbg_log("encoded preview decoder_name %s", decoder_name); /* create decoder */ sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst = gst_element_factory_make(decoder_name, "videosrc_decode"); if (sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst == NULL) { @@ -3170,6 +3237,13 @@ bool _mmcamcorder_recreate_decoder_for_encoded_preview(MMHandleType handle) return TRUE; } +static inline bool __mmcamcorder_is_encoded_preview_pixel_format(int pixel_format) { + if (pixel_format == MM_PIXEL_FORMAT_ENCODED_H264 || pixel_format == MM_PIXEL_FORMAT_ENCODED_MJPEG) + return true; + + return false; +} + #ifdef _MMCAMCORDER_PRODUCT_TV static bool __mmcamcorder_find_max_resolution(MMHandleType handle, gint *max_width, gint *max_height) { @@ -3219,6 +3293,13 @@ static bool __mmcamcorder_find_max_resolution(MMHandleType handle, gint *max_wid if (gst_structure_has_field(decsink_struct, "maxheight")) *max_height = gst_value_get_int_range_max(gst_structure_get_value(decsink_struct, "maxheight")); break; + } else if (!strcmp(mime, "video/x-jpeg")) { + _mmcam_dbg_log("mjpeg caps structure found"); + if (gst_structure_has_field(decsink_struct, "maxwidth")) + *max_width = gst_value_get_int_range_max(gst_structure_get_value(decsink_struct, "maxwidth")); + if (gst_structure_has_field(decsink_struct, "maxheight")) + *max_height = gst_value_get_int_range_max(gst_structure_get_value(decsink_struct, "maxheight")); + break; } } _mmcam_dbg_log("maxwidth = %d , maxheight = %d", (int)*max_width, (int)*max_height); diff --git a/src/mm_camcorder_rm.c b/src/mm_camcorder_rm.c index 7291d54..fecd42e 100644 --- a/src/mm_camcorder_rm.c +++ b/src/mm_camcorder_rm.c @@ -127,16 +127,23 @@ int _mmcamcorder_rm_allocate(MMHandleType handle) _mmcam_dbg_log("request dec rsc - category 0x%x", RM_CATEGORY_VIDEO_DECODER); resource_count++; - } - - if (display_surface_type == MM_DISPLAY_SURFACE_OVERLAY) { + } else if (preview_format == MM_PIXEL_FORMAT_ENCODED_MJPEG) { hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE; - hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER; + hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_VIDEO_DECODER_SUB; - _mmcam_dbg_log("request scaler rsc - category 0x%x", RM_CATEGORY_SCALER); + _mmcam_dbg_log("request dec rsc - category 0x%x", RM_CATEGORY_VIDEO_DECODER_SUB); resource_count++; } + if (display_surface_type == MM_DISPLAY_SURFACE_OVERLAY) { + hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE; + if (preview_format == MM_PIXEL_FORMAT_ENCODED_H264) + hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER; + else + hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER_SUB; + _mmcam_dbg_log("request scaler rsc - category 0x%x", hcamcorder->request_resources.category_id[resource_count]); + resource_count++; + } hcamcorder->request_resources.request_num = resource_count; @@ -154,12 +161,19 @@ int _mmcamcorder_rm_allocate(MMHandleType handle) hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_VIDEO_DECODER_SUB; _mmcam_dbg_log("request dec rsc - category 0x%x", RM_CATEGORY_VIDEO_DECODER_SUB); resource_count++; + } else if (preview_format == MM_PIXEL_FORMAT_ENCODED_MJPEG) { + hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE; + hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_VIDEO_DECODER; + _mmcam_dbg_log("request dec rsc - category 0x%x", RM_CATEGORY_VIDEO_DECODER); + resource_count++; } - if (display_surface_type == MM_DISPLAY_SURFACE_OVERLAY) { hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE; - hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER_SUB; - _mmcam_dbg_log("request scaler rsc - category 0x%x", RM_CATEGORY_SCALER_SUB); + if (preview_format == MM_PIXEL_FORMAT_ENCODED_H264) + hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER_SUB; + else + hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER; + _mmcam_dbg_log("request scaler rsc - category 0x%x", hcamcorder->request_resources.category_id[resource_count]); resource_count++; } } diff --git a/src/mm_camcorder_util.c b/src/mm_camcorder_util.c index c7c7093..063ac1f 100644 --- a/src/mm_camcorder_util.c +++ b/src/mm_camcorder_util.c @@ -1652,6 +1652,9 @@ unsigned int _mmcamcorder_get_fourcc(int pixtype, int codectype, int use_zero_co case MM_PIXEL_FORMAT_ENCODED_H264: fourcc = GST_MAKE_FOURCC('H', '2', '6', '4'); break; + case MM_PIXEL_FORMAT_ENCODED_MJPEG: + fourcc = GST_MAKE_FOURCC ('M', 'J', 'P', 'G'); + break; case MM_PIXEL_FORMAT_INVZ: fourcc = GST_MAKE_FOURCC('I', 'N', 'V', 'Z'); break; @@ -1733,6 +1736,9 @@ int _mmcamcorder_get_pixtype(unsigned int fourcc) case GST_MAKE_FOURCC('H', '2', '6', '4'): pixtype = MM_PIXEL_FORMAT_ENCODED_H264; break; + case GST_MAKE_FOURCC ('M', 'J', 'P', 'G'): + pixtype = MM_PIXEL_FORMAT_ENCODED_MJPEG; + break; case GST_MAKE_FOURCC('I', 'N', 'V', 'Z'): pixtype = MM_PIXEL_FORMAT_INVZ; break; |