static void _mc_send_eos_signal(mc_gst_core_t *core);
static void _mc_wait_for_eos(mc_gst_core_t *core);
static int _mc_get_mime(mc_gst_core_t *core);
-static int _mc_set_codec_data(mc_gst_core_t *core, GstMCBuffer *mcbuffer);
+static int _mc_set_codec_data(mc_gst_core_t *core, GstMCBuffer *mcbuffer, bool codec_config);
GstCaps *_mc_gst_vid_caps_new(mc_gst_core_t *core, mediacodec_codec_type_e codec_id, gint index);
GstCaps *_mc_gst_aud_caps_new(mc_gst_core_t *core, mediacodec_codec_type_e codec_id, gint index);
return is_format_change;
}
-static int _mc_set_codec_data(mc_gst_core_t *core, GstMCBuffer *mcbuffer)
+static int _mc_set_codec_data(mc_gst_core_t *core, GstMCBuffer *mcbuffer, bool codec_config)
{
MEDIACODEC_FENTER();
case MEDIACODEC_AAC:
case MEDIACODEC_AAC_HE:
case MEDIACODEC_AAC_HE_PS:
- ret = __mc_set_caps_codecdata(core, mcbuffer, AAC_CODECDATA_SIZE);
- if (ret != MC_ERROR_NONE)
- LOGW("__mc_set_caps_codecdata failed");
+ if (codec_config) {
+ ret = __mc_set_caps_codecdata(core, mcbuffer, AAC_CODECDATA_SIZE);
+ if (ret != MC_ERROR_NONE)
+ LOGW("__mc_set_caps_codecdata failed");
+ }
break;
case MEDIACODEC_WMAV1:
case MEDIACODEC_WMAV2:
case MEDIACODEC_WMAPRO:
case MEDIACODEC_WMALSL:
- ret = __mc_set_caps_codecdata(core, mcbuffer, WMA_CODECDATA_SIZE);
- if (ret != MC_ERROR_NONE)
- LOGW("__mc_set_caps_codecdata failed");
+ if (codec_config) {
+ ret = __mc_set_caps_codecdata(core, mcbuffer, WMA_CODECDATA_SIZE);
+ if (ret != MC_ERROR_NONE)
+ LOGW("__mc_set_caps_codecdata failed");
+ }
break;
case MEDIACODEC_VORBIS:
case MEDIACODEC_FLAC:
- ret = __mc_set_caps_streamheader(core, mcbuffer, VORBIS_CODECDATA_SIZE);
- if (ret != MC_ERROR_NONE)
- LOGW("__mc_set_caps_streamheader failed");
+ if (codec_config) {
+ ret = __mc_set_caps_streamheader(core, mcbuffer, VORBIS_CODECDATA_SIZE);
+ if (ret != MC_ERROR_NONE)
+ LOGW("__mc_set_caps_streamheader failed");
+ }
break;
case MEDIACODEC_H264:
case MEDIACODEC_MPEG4:
input_buffer = NULL;
if (codec_config || initiative) {
- GstPad *pad;
- ret = _mc_set_codec_data(core, mcbuffer);
- if (ret != MC_ERROR_NONE) {
- LOGE("failed to set codec data");
- gst_buffer_unref(mcbuffer->buffer);
- goto ERROR;
+ GstPad *pad = NULL;
+ if (!core->encoder) {
+ ret = _mc_set_codec_data(core, mcbuffer, codec_config);
+ if (ret != MC_ERROR_NONE) {
+ LOGE("failed to set codec data");
+ gst_buffer_unref(mcbuffer->buffer);
+ goto ERROR;
+ }
}
pad = gst_element_get_static_pad(core->appsrc, "src");
gst_pad_push_event(pad, gst_event_new_stream_start("start"));
g_object_set(core->appsrc, "caps", caps, NULL);
gst_caps_unref(caps);
LOGD("caps updated");
+ is_format_change = FALSE;
}
/* set caps in capsfilter as default*/
caps = new_core->mc_caps_new(new_core, id, out_port_index);
+ new_core->caps = caps;
/* FIXME will parse input format from ini. format is needed when linking elements*/
if (new_core->video && new_core->encoder) {
gchar *format = NULL;