{
int i = 0;
int err = MM_ERROR_NONE;
- int audio_enable = FALSE;
+ int rec_mode = 0;
+ int width = 0;
+ int height = 0;
+ int video_src_format = 0;
+ int frame_rate = 0;
+ int filename_size = 0;
+ gboolean audio_enable = FALSE;
GstBus *bus = NULL;
GstPad *srcpad = NULL;
GstPad *sinkpad = NULL;
-
+ GstCaps *caps = NULL;
+ GList *element_list = NULL;
+ GstStructure* pulse_property = NULL;
unsigned int video_codec = MM_VIDEO_CODEC_INVALID;
unsigned int file_format = MM_FILE_FORMAT_INVALID;
char *err_name = NULL;
-
+ char *filename = NULL;
mmf_streamrecorder_t *hstreamrecorder = MMF_STREAMRECORDER(handle);
_MMStreamRecorderSubContext *sc = NULL;
_mmstreamrec_dbg_warn("start");
- err = mm_streamrecorder_get_attributes(handle, &err_name, MMSTR_VIDEO_ENCODER, &video_codec, MMSTR_FILE_FORMAT, &file_format, NULL);
+ err = mm_streamrecorder_get_attributes(handle, &err_name, MMSTR_VIDEO_ENCODER, &video_codec, MMSTR_FILE_FORMAT, &file_format, MMSTR_RECORDER_MODE, &rec_mode, NULL);
if (err != MM_ERROR_NONE) {
_mmstreamrec_dbg_warn("Get attrs fail. (%s:%x)", err_name, err);
SAFE_FREE(err_name);
return err;
}
- err = _mmstreamrecorder_check_videocodec_fileformat_compatibility(video_codec, file_format);
- if (err != MM_ERROR_NONE)
- return err;
+ if (rec_mode == MM_STREAMRECORDER_MODE_STREAM_BUFFER) {
+ _mmstreamrec_dbg_log("Recording Mode [%d]", MM_STREAMRECORDER_MODE_STREAM_BUFFER);
+ err = _mmstreamrecorder_check_videocodec_fileformat_compatibility(video_codec, file_format);
+ if (err != MM_ERROR_NONE)
+ return err;
- /* Main pipeline */
- _MMSTREAMRECORDER_PIPELINE_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_ENCODE_MAIN_PIPE, "recorder_pipeline", err);
+ /* Main pipeline */
+ _MMSTREAMRECORDER_PIPELINE_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_ENCODE_MAIN_PIPE, "recorder_pipeline", err);
- /* get audio disable */
- mm_streamrecorder_get_attributes(handle, NULL, MMSTR_AUDIO_ENABLE, &audio_enable, NULL);
- sc->audio_enable = audio_enable;
+ /* get audio disable */
+ mm_streamrecorder_get_attributes(handle, NULL, MMSTR_AUDIO_ENABLE, &audio_enable, NULL);
+ sc->audio_enable = audio_enable;
- _mmstreamrec_dbg_log("AUDIO DISABLE : %d", sc->audio_enable);
+ _mmstreamrec_dbg_log("AUDIO DISABLE : %d", sc->audio_enable);
- if (sc->audio_enable == TRUE) {
- /* create audiosrc bin */
- err = _mmstreamrecorder_create_audiosrc_bin((MMHandleType) hstreamrecorder);
+ if (sc->audio_enable == TRUE) {
+ /* create audiosrc bin */
+ err = _mmstreamrecorder_create_audiosrc_bin((MMHandleType) hstreamrecorder);
+ if (err != MM_ERROR_NONE)
+ return err;
+ }
+
+ err = _mmstreamrecorder_create_encodesink_bin((MMHandleType) hstreamrecorder, MM_STREAMRECORDER_ENCBIN_PROFILE_VIDEO);
if (err != MM_ERROR_NONE)
return err;
- }
-
- err = _mmstreamrecorder_create_encodesink_bin((MMHandleType) hstreamrecorder, MM_STREAMRECORDER_ENCBIN_PROFILE_VIDEO);
- if (err != MM_ERROR_NONE)
- return err;
-
- if (sc->audio_enable == TRUE)
- gst_bin_add(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst), sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_BIN].gst);
- /* add element and encodesink bin to encode main pipeline */
- gst_bin_add_many(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst), sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_FILT].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_BIN].gst, NULL);
+ if (sc->audio_enable == TRUE)
+ gst_bin_add(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst), sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_BIN].gst);
- /* Link each element : appsrc - capsfilter - encodesink bin */
- srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst, "src");
- sinkpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_FILT].gst, "sink");
- _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
+ /* add element and encodesink bin to encode main pipeline */
+ gst_bin_add_many(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst), sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_FILT].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_BIN].gst, NULL);
- srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_FILT].gst, "src");
- sinkpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_BIN].gst, "video_sink0");
- _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
+ /* Link each element : appsrc - capsfilter - encodesink bin */
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst, "src");
+ sinkpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_FILT].gst, "sink");
+ _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
- if (sc->audio_enable == TRUE) {
- srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_BIN].gst, "src");
- sinkpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_BIN].gst, "audio_sink0");
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_FILT].gst, "src");
+ sinkpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_BIN].gst, "video_sink0");
_MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
- }
- if (sc->audio_enable == TRUE) {
- sinkpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC].gst, "sink");
- MMSTREAMRECORDER_ADD_BUFFER_PROBE(sinkpad, _MMSTREAMRECORDER_HANDLER_VIDEOREC, __mmstreamrecorder_audioque_dataprobe, hstreamrecorder);
- gst_object_unref(sinkpad);
- sinkpad = NULL;
+ if (sc->audio_enable == TRUE) {
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_BIN].gst, "src");
+ sinkpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_BIN].gst, "audio_sink0");
+ _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
+ }
- if (sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC_QUE].gst) {
- srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC_QUE].gst, "src");
+ if (sc->audio_enable == TRUE) {
+ sinkpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC].gst, "sink");
+ MMSTREAMRECORDER_ADD_BUFFER_PROBE(sinkpad, _MMSTREAMRECORDER_HANDLER_VIDEOREC, __mmstreamrecorder_audioque_dataprobe, hstreamrecorder);
+ gst_object_unref(sinkpad);
+ sinkpad = NULL;
+
+ if (sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC_QUE].gst) {
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC_QUE].gst, "src");
+ MMSTREAMRECORDER_ADD_EVENT_PROBE(srcpad, _MMSTREAMRECORDER_HANDLER_VIDEOREC, __mmstreamrecorder_eventprobe_monitor, hstreamrecorder);
+ gst_object_unref(srcpad);
+ srcpad = NULL;
+ }
+ }
+
+ if (sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VENC_QUE].gst) {
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VENC_QUE].gst, "src");
MMSTREAMRECORDER_ADD_EVENT_PROBE(srcpad, _MMSTREAMRECORDER_HANDLER_VIDEOREC, __mmstreamrecorder_eventprobe_monitor, hstreamrecorder);
gst_object_unref(srcpad);
srcpad = NULL;
}
- }
- if (sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VENC_QUE].gst) {
- srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VENC_QUE].gst, "src");
- MMSTREAMRECORDER_ADD_EVENT_PROBE(srcpad, _MMSTREAMRECORDER_HANDLER_VIDEOREC, __mmstreamrecorder_eventprobe_monitor, hstreamrecorder);
+ if (sc->audio_enable == FALSE) {
+ sinkpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VENC].gst, "sink");
+ MMSTREAMRECORDER_ADD_BUFFER_PROBE(sinkpad, _MMSTREAMRECORDER_HANDLER_VIDEOREC, __mmstreamrecorder_video_dataprobe_audio_disable, hstreamrecorder);
+ gst_object_unref(sinkpad);
+ sinkpad = NULL;
+ }
+
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VENC].gst, "src");
+ MMSTREAMRECORDER_ADD_BUFFER_PROBE(srcpad, _MMSTREAMRECORDER_HANDLER_VIDEOREC, __mmstreamrecorder_video_dataprobe_record, hstreamrecorder);
gst_object_unref(srcpad);
srcpad = NULL;
- }
- if (sc->audio_enable == FALSE) {
- sinkpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VENC].gst, "sink");
- MMSTREAMRECORDER_ADD_BUFFER_PROBE(sinkpad, _MMSTREAMRECORDER_HANDLER_VIDEOREC, __mmstreamrecorder_video_dataprobe_audio_disable, hstreamrecorder);
- gst_object_unref(sinkpad);
- sinkpad = NULL;
- }
+ if (sc->audio_enable == TRUE) {
+ srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC].gst, "src");
+ MMSTREAMRECORDER_ADD_BUFFER_PROBE(srcpad, _MMSTREAMRECORDER_HANDLER_VIDEOREC, __mmstreamrecorder_audio_dataprobe_check, hstreamrecorder);
+ gst_object_unref(srcpad);
+ srcpad = NULL;
+ }
+ } else if (rec_mode == MM_STREAMRECORDER_MODE_DEVICE_LOOPBACK) {
+ _mmstreamrec_dbg_log("Recording Mode [%d]", MM_STREAMRECORDER_MODE_DEVICE_LOOPBACK);
+ err = mm_streamrecorder_get_attributes(handle, NULL, MMSTR_VIDEO_RESOLUTION_WIDTH, &width, MMSTR_VIDEO_RESOLUTION_HEIGHT, &height, MMSTR_AUDIO_ENABLE, &audio_enable, MMSTR_VIDEO_SOURCE_FORMAT, &video_src_format, MMSTR_VIDEO_FRAMERATE, &frame_rate, MMSTR_FILENAME, &filename, &filename_size, NULL);
+ _mmstreamrec_dbg_log("width [%d], height [%d], audio enable[%d], format [%d], framerate [%d] filename [%s]", width, height, audio_enable, video_src_format, frame_rate, filename);
- srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VENC].gst, "src");
- MMSTREAMRECORDER_ADD_BUFFER_PROBE(srcpad, _MMSTREAMRECORDER_HANDLER_VIDEOREC, __mmstreamrecorder_video_dataprobe_record, hstreamrecorder);
- gst_object_unref(srcpad);
- srcpad = NULL;
+ _MMSTREAMRECORDER_PIPELINE_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_ENCODE_MAIN_PIPE, "recorder_pipeline", err);
- if (sc->audio_enable == TRUE) {
- srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC].gst, "src");
- MMSTREAMRECORDER_ADD_BUFFER_PROBE(srcpad, _MMSTREAMRECORDER_HANDLER_VIDEOREC, __mmstreamrecorder_audio_dataprobe_check, hstreamrecorder);
- gst_object_unref(srcpad);
- srcpad = NULL;
+ if (!hstreamrecorder->ini.hw_encoder_supported) {
+ _mmstreamrec_dbg_log("Screen is recorded with SW encoder.");
+ if (audio_enable) {
+ _mmstreamrec_dbg_log("Audio is enabled!");
+
+ /* Audio pipeline */
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_AUDIO_SRC, "pulsesrc", "audio_source", element_list, err);
+
+ pulse_property = gst_structure_new_from_string("props,media.role=loopback-mirroring");
+ MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_AUDIO_SRC].gst, "stream-properties", pulse_property);
+ MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_AUDIO_SRC].gst, "do-timestamp", true);
+ MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_AUDIO_SRC].gst, "provide-clock", false);
+
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_AUDIO_CONV, "audioconvert", "audio_converter", element_list, err);
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_AUDIO_ENC, "avenc_aac", "audio_encoder", element_list, err);
+ MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_AUDIO_ENC].gst, "compliance", -2);
+
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_AUDIO_QUE, "queue", "audio_queue", element_list, err);
+
+ gst_bin_add_many(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst),
+ sc->encode_element[_MMSTREAMRECORDER_AUDIO_SRC].gst,
+ sc->encode_element[_MMSTREAMRECORDER_AUDIO_CONV].gst,
+ sc->encode_element[_MMSTREAMRECORDER_AUDIO_ENC].gst,
+ sc->encode_element[_MMSTREAMRECORDER_AUDIO_QUE].gst, NULL);
+ }
+
+ /* Video pipeline */
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_VIDEO_SRC, "waylandsrc", "video_source", element_list, err);
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_VIDEO_CAPS, "capsfilter", "video_capsfilter", element_list, err);
+
+ caps = gst_set_videosrcpad_caps_sw(MM_STREAMRECORDER_INPUT_FORMAT_BGRA, width, height, frame_rate, 1);
+ MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_VIDEO_CAPS].gst, "caps", caps);
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_VIDEO_CONV, "videoconvert", "video_conveter", element_list, err);
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_VIDEO_ENC, "avenc_mpeg4", "video_encoder", element_list, err);
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_VIDEO_QUE, "queue", "video_queue", element_list, err);
+
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_MUX, "avmux_mp4", "av_muxer", element_list, err);
+
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_SINK, "filesink", "av_sink", element_list, err);
+ MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_SINK].gst, "location", filename);
+
+
+ gst_bin_add_many(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst),
+ sc->encode_element[_MMSTREAMRECORDER_VIDEO_SRC].gst,
+ sc->encode_element[_MMSTREAMRECORDER_VIDEO_CAPS].gst,
+ sc->encode_element[_MMSTREAMRECORDER_VIDEO_CONV].gst,
+ sc->encode_element[_MMSTREAMRECORDER_VIDEO_ENC].gst,
+ sc->encode_element[_MMSTREAMRECORDER_VIDEO_QUE].gst, NULL);
+
+ gst_bin_add_many(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst),
+ sc->encode_element[_MMSTREAMRECORDER_MUX].gst,
+ sc->encode_element[_MMSTREAMRECORDER_SINK].gst, NULL);
+ if (audio_enable) {
+ if (!_MM_GST_ELEMENT_LINK_MANY(GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_AUDIO_SRC].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_AUDIO_CONV].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_AUDIO_ENC].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_AUDIO_QUE].gst), NULL)) {
+ _mmstreamrec_dbg_log("AUDIO PIPELINE LINK MANY FAILED");
+ }
+
+ if (!_MM_GST_ELEMENT_LINK(GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_AUDIO_QUE].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_MUX].gst))) {
+ _mmstreamrec_dbg_log("LINK BETWEEN AUDIO QUE AND MUX FAILED");
+ }
+ }
+
+ if (!_MM_GST_ELEMENT_LINK_MANY(GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_VIDEO_SRC].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_VIDEO_CAPS].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_VIDEO_CONV].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_VIDEO_ENC].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_VIDEO_QUE].gst), NULL)) {
+ _mmstreamrec_dbg_log("VIDEO PIPELINE LINK MANY FAILED");
+ }
+
+ if (!_MM_GST_ELEMENT_LINK(GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_VIDEO_QUE].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_MUX].gst))) {
+ _mmstreamrec_dbg_log("LINK BETWEEN VIDEO QUE AND MUX FAILED");
+ }
+
+ if (!_MM_GST_ELEMENT_LINK(GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_MUX].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_SINK].gst))) {
+ _mmstreamrec_dbg_log("LINK BETWEEN MUX AND SINK FAILED");
+ }
+ } else {
+ _mmstreamrec_dbg_log("Screen is recorded with HW encoder.");
+ if (audio_enable) {
+ _mmstreamrec_dbg_log("Audio is enabled!");
+
+ /* Audio pipeline */
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_AUDIO_SRC, "pulsesrc", "audio_source", element_list, err);
+
+ pulse_property = gst_structure_new_from_string("props,media.role=loopback-mirroring");
+ MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_AUDIO_SRC].gst, "stream-properties", pulse_property);
+ MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_AUDIO_SRC].gst, "do-timestamp", true);
+ MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_AUDIO_SRC].gst, "provide-clock", false);
+
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_AUDIO_CONV, "audioconvert", "audio_converter", element_list, err);
+
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_AUDIO_ENC, "avenc_aac", "audio_encoder", element_list, err);
+ MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_AUDIO_ENC].gst, "compliance", -2);
+
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_AUDIO_QUE, "queue", "audio_queue", element_list, err);
+
+ gst_bin_add_many(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst),
+ sc->encode_element[_MMSTREAMRECORDER_AUDIO_SRC].gst,
+ sc->encode_element[_MMSTREAMRECORDER_AUDIO_CONV].gst,
+ sc->encode_element[_MMSTREAMRECORDER_AUDIO_ENC].gst,
+ sc->encode_element[_MMSTREAMRECORDER_AUDIO_QUE].gst,
+ sc->encode_element[_MMSTREAMRECORDER_VIDEO_SRC].gst, NULL);
+ }
+ /* Video pipeline */
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_VIDEO_SRC, "waylandsrc", "video_source", element_list, err);
+
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_VIDEO_CAPS, "capsfilter", "video_capsfilter", element_list, err);
+
+ caps = gst_set_videosrcpad_caps_hw(hstreamrecorder->ini.video_codec_element_hw, width, height, frame_rate, 1);
+ MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_VIDEO_CAPS].gst, "caps", caps);
+
+ if (!g_strcmp0(hstreamrecorder->ini.video_codec_element_hw, "sprd")){
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_VIDEO_ENC, "sprdenc_h264", "video_encoder", element_list, err);
+ } else {
+ _mmstreamrec_dbg_warn("no matched hw codec element found.");
+ goto pipeline_creation_error;
+ }
+
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_VIDEO_QUE, "queue", "video_queue", element_list, err);
+
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_MUX, "avmux_mp4", "av_muxer", element_list, err);
+
+ _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_SINK, "filesink", "av_sink", element_list, err);
+ MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_SINK].gst, "location", filename);
+
+ gst_bin_add_many(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst),
+ sc->encode_element[_MMSTREAMRECORDER_VIDEO_SRC].gst,
+ sc->encode_element[_MMSTREAMRECORDER_VIDEO_CAPS].gst,
+ sc->encode_element[_MMSTREAMRECORDER_VIDEO_ENC].gst,
+ sc->encode_element[_MMSTREAMRECORDER_VIDEO_QUE].gst, NULL);
+
+ gst_bin_add_many(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst),
+ sc->encode_element[_MMSTREAMRECORDER_MUX].gst,
+ sc->encode_element[_MMSTREAMRECORDER_SINK].gst, NULL);
+ if (audio_enable) {
+ if (!_MM_GST_ELEMENT_LINK_MANY(GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_AUDIO_SRC].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_AUDIO_CONV].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_AUDIO_ENC].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_AUDIO_QUE].gst), NULL)) {
+ _mmstreamrec_dbg_log("AUDIO PIPELINE LINK MANY FAILED");
+ }
+
+ if (!_MM_GST_ELEMENT_LINK(GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_AUDIO_QUE].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_MUX].gst))) {
+ _mmstreamrec_dbg_log("LINK BETWEEN AUDIO QUE AND MUX FAILED");
+ }
+ }
+
+ if (!_MM_GST_ELEMENT_LINK_MANY(GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_VIDEO_SRC].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_VIDEO_CAPS].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_VIDEO_ENC].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_VIDEO_QUE].gst), NULL)) {
+ _mmstreamrec_dbg_log("VIDEO PIPELINE LINK MANY FAILED");
+ }
+
+ if (!_MM_GST_ELEMENT_LINK(GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_VIDEO_QUE].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_MUX].gst))) {
+ _mmstreamrec_dbg_log("LINK BETWEEN VIDEO QUE AND MUX FAILED");
+ }
+
+ if (!_MM_GST_ELEMENT_LINK(GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_MUX].gst),
+ GST_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_SINK].gst))) {
+ _mmstreamrec_dbg_log("LINK BETWEEN MUX AND SINK FAILED");
+ }
+ }
}
bus = gst_pipeline_get_bus(GST_PIPELINE(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst));
gst_object_unref(bus);
bus = NULL;
-
return MM_ERROR_NONE;
pipeline_creation_error:
_MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_ENCSINK_SRC, hstreamrecorder->ini.name_of_encsink_src, "encodesink_src", element_list, err);
_MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_ENCSINK_FILT, "capsfilter", "encodesink_filter", element_list, err);
- caps = gst_set_videosrcpad_caps(video_src_format, video_width, video_height, video_fps, 1);
+ caps = gst_set_videosrcpad_caps_sw(video_src_format, video_width, video_height, video_fps, 1);
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst, "caps", caps);
if (caps) {
gst_caps_unref(caps);
caps = NULL;
}
- caps = gst_set_videosrcpad_caps(video_src_format, video_width, video_height, video_fps, 1);
+ caps = gst_set_videosrcpad_caps_sw(video_src_format, video_width, video_height, video_fps, 1);
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_FILT].gst, "caps", caps);
if (caps) {
gst_caps_unref(caps);
g_list_free(element_list);
element_list = NULL;
}
- if (rec_mode == MM_STREAMRECORDER_MODE_MEDIABUFFER) {
+ if (rec_mode == MM_STREAMRECORDER_MODE_STREAM_BUFFER) {
/* set appsrc as live source */
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst, "is-live", hstreamrecorder->ini.encsink_src_islive);
}
/* TODO : check the last value ( set ) */
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, "profile", hstreamrecorder->ini.encsink_bin_profile);
- if (rec_mode == MM_STREAMRECORDER_MODE_MEDIABUFFER)
+ if (rec_mode == MM_STREAMRECORDER_MODE_STREAM_BUFFER)
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, "auto-audio-convert", hstreamrecorder->ini.encsink_bin_auto_audio_convert);
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, "auto-audio-resample", hstreamrecorder->ini.encsink_bin_auto_audio_resample);
if (video_src_format == MM_STREAMRECORDER_INPUT_FORMAT_NV12)
video_src_format = MM_STREAMRECORDER_INPUT_FORMAT_I420;
- caps = gst_set_videosrcpad_caps(video_src_format, video_width, video_height, video_fps, 1);
+ caps = gst_set_videosrcpad_caps_sw(video_src_format, video_width, video_height, video_fps, 1);
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, "vcaps", caps);
if (video_src_format != MM_STREAMRECORDER_INPUT_FORMAT_NV12)
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VCONV].gst, "dst-buffer-num", hstreamrecorder->ini.convert_output_buffer_num);
return MM_ERROR_NONE;
- pipeline_creation_error:
+pipeline_creation_error:
_MMSTREAMRECORDER_ELEMENT_REMOVE(sc->encode_element, _MMSTREAMRECORDER_ENCSINK_ENCBIN);
_MMSTREAMRECORDER_ELEMENT_REMOVE(sc->encode_element, _MMSTREAMRECORDER_ENCSINK_SRC);
_MMSTREAMRECORDER_ELEMENT_REMOVE(sc->encode_element, _MMSTREAMRECORDER_ENCSINK_FILT);
}
if (caps) {
- if (rec_mode == MM_STREAMRECORDER_MODE_MEDIABUFFER)
+ if (rec_mode == MM_STREAMRECORDER_MODE_STREAM_BUFFER)
MMSTREAMRECORDER_G_OBJECT_SET((sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_SRC].gst), "caps", caps);
MMSTREAMRECORDER_G_OBJECT_SET((sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_FILT].gst), "caps", caps);
goto pipeline_creation_error;
}
- if (rec_mode == MM_STREAMRECORDER_MODE_SCREENRECORD) {
+ if (rec_mode == MM_STREAMRECORDER_MODE_DEVICE_LOOPBACK) {
#if 1 /* mic mode */
MMSTREAMRECORDER_G_OBJECT_SET((sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_SRC].gst), "do-timestamp", TRUE);
#else /* speaker mode with alsasrc */
GstElement *pipeline = NULL;
GstPad *pad = NULL;
guint count = 0;
+ gboolean audio_enable = FALSE;
+ int rec_mode = 0;
+ char *err_name = NULL;
mmf_return_val_if_fail(hstreamrecorder, MM_ERROR_STREAMRECORDER_NOT_INITIALIZED);
mmf_return_val_if_fail(sc->info_file, MM_ERROR_STREAMRECORDER_NOT_INITIALIZED);
+ ret = mm_streamrecorder_get_attributes(handle, &err_name, MMSTR_RECORDER_MODE, &rec_mode, MMSTR_AUDIO_ENABLE, &audio_enable, NULL);
+
+ if (ret != MM_ERROR_NONE) {
+ _mmstreamrec_dbg_err("Get attrs fail. (%s:%x)", err_name, ret);
+ SAFE_FREE(err_name);
+ return ret;
+ }
+
info = sc->info_video;
if (sc->audio_enable == TRUE)
info_audio = sc->info_audio;
sc->ferror_count = 0;
sc->error_occurs = FALSE;
sc->bget_eos = FALSE;
-
+ ret = _mmstreamrecorder_gst_set_state(handle, sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_PAUSED);
ret = _mmstreamrecorder_gst_set_state(handle, sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_PLAYING);
if (ret != MM_ERROR_NONE) {
/* Remove recorder pipeline and recording file which size maybe zero */
case _MM_STREAMRECORDER_CMD_COMMIT:
/* video recording command */
{
-
- if (info->b_commiting) {
- _mmstreamrec_dbg_err("now on commiting previous file!!(command : %d)", command);
- return MM_ERROR_STREAMRECORDER_CMD_IS_RUNNING;
- } else {
- _mmstreamrec_dbg_log("_MM_STREAMRECORDER_CMD_COMMIT : start");
- info->b_commiting = TRUE;
- }
-
- for (count = 0; count <= hstreamrecorder->ini.retrial_count; count++) {
- if (sc->audio_enable == FALSE) {
- /* check only video frame */
- if (info->video_frame_count >= hstreamrecorder->ini.minimum_frame) {
- break;
- } else if (count == hstreamrecorder->ini.retrial_count) {
- _mmstreamrec_dbg_err("Commit fail, frame count is %" G_GUINT64_FORMAT "", info->video_frame_count);
- info->b_commiting = FALSE;
- return MM_ERROR_STREAMRECORDER_INVALID_CONDITION;
- } else {
- _mmstreamrec_dbg_warn("Waiting for enough video frame, retrial [%d], frame %" G_GUINT64_FORMAT "", count, info->video_frame_count);
+ if(rec_mode == MM_STREAMRECORDER_MODE_DEVICE_LOOPBACK) {
+ if (sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst != NULL) {\
+ if (audio_enable) {
+ ret = gst_element_send_event(gst_bin_get_by_name(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst), "audio_source"), gst_event_new_eos());
}
+ ret = gst_element_send_event(gst_bin_get_by_name(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst), "video_source"), gst_event_new_eos());
+ }
+ } else {
- usleep(hstreamrecorder->ini.video_frame_wait_time);
+ if (info->b_commiting) {
+ _mmstreamrec_dbg_err("now on commiting previous file!!(command : %d)", command);
+ return MM_ERROR_STREAMRECORDER_CMD_IS_RUNNING;
} else {
- /* check both of video and audio frame */
- if (info->video_frame_count >= hstreamrecorder->ini.minimum_frame && info_audio->audio_frame_count) {
- break;
- } else if (count == hstreamrecorder->ini.retrial_count) {
- _mmstreamrec_dbg_err("Commit fail, VIDEO[%" G_GUINT64_FORMAT "], AUDIO [%" G_GUINT64_FORMAT "]", info->video_frame_count, info_audio->audio_frame_count);
+ _mmstreamrec_dbg_log("_MM_STREAMRECORDER_CMD_COMMIT : start");
+ info->b_commiting = TRUE;
+ }
- info->b_commiting = FALSE;
- return MM_ERROR_STREAMRECORDER_INVALID_CONDITION;
+ for (count = 0; count <= hstreamrecorder->ini.retrial_count; count++) {
+ if (sc->audio_enable == FALSE) {
+ /* check only video frame */
+ if (info->video_frame_count >= hstreamrecorder->ini.minimum_frame) {
+ break;
+ } else if (count == hstreamrecorder->ini.retrial_count) {
+ _mmstreamrec_dbg_err("Commit fail, frame count is %" G_GUINT64_FORMAT "", info->video_frame_count);
+ info->b_commiting = FALSE;
+ return MM_ERROR_STREAMRECORDER_INVALID_CONDITION;
+ } else {
+ _mmstreamrec_dbg_warn("Waiting for enough video frame, retrial [%d], frame %" G_GUINT64_FORMAT "", count, info->video_frame_count);
+ }
+
+ usleep(hstreamrecorder->ini.video_frame_wait_time);
} else {
- _mmstreamrec_dbg_warn("Waiting for enough frames, retrial [%d], VIDEO[%" G_GUINT64_FORMAT "], AUDIO [%" G_GUINT64_FORMAT "]", count, info->video_frame_count, info_audio->audio_frame_count);
+ /* check both of video and audio frame */
+ if (info->video_frame_count >= hstreamrecorder->ini.minimum_frame && info_audio->audio_frame_count) {
+ break;
+ } else if (count == hstreamrecorder->ini.retrial_count) {
+ _mmstreamrec_dbg_err("Commit fail, VIDEO[%" G_GUINT64_FORMAT "], AUDIO [%" G_GUINT64_FORMAT "]", info->video_frame_count, info_audio->audio_frame_count);
+
+ info->b_commiting = FALSE;
+ return MM_ERROR_STREAMRECORDER_INVALID_CONDITION;
+ } else {
+ _mmstreamrec_dbg_warn("Waiting for enough frames, retrial [%d], VIDEO[%" G_GUINT64_FORMAT "], AUDIO [%" G_GUINT64_FORMAT "]", count, info->video_frame_count, info_audio->audio_frame_count);
+ }
+
+ usleep(hstreamrecorder->ini.video_frame_wait_time);
}
-
- usleep(hstreamrecorder->ini.video_frame_wait_time);
}
- }
- if (sc->error_occurs) {
- GstPad *video = NULL;
- GstPad *audio = NULL;
+ if (sc->error_occurs) {
+ GstPad *video = NULL;
+ GstPad *audio = NULL;
- _mmstreamrec_dbg_err("Committing Error case");
+ _mmstreamrec_dbg_err("Committing Error case");
#if 0
- video = gst_element_get_static_pad(sc->element[_MMSTREAMRECORDER_VIDEOSINK_SINK].gst, "sink");
- ret = gst_pad_send_event(video, gst_event_new_eos());
- _mmstreamrec_dbg_err("Sending EOS video sink : %d", ret);
- gst_object_unref(video);
+ video = gst_element_get_static_pad(sc->element[_MMSTREAMRECORDER_VIDEOSINK_SINK].gst, "sink");
+ ret = gst_pad_send_event(video, gst_event_new_eos());
+ _mmstreamrec_dbg_err("Sending EOS video sink : %d", ret);
+ gst_object_unref(video);
#endif
- video = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VENC].gst, "src");
- gst_pad_push_event(video, gst_event_new_flush_start());
- gst_pad_push_event(video, gst_event_new_flush_stop(TRUE));
- ret = gst_pad_push_event(video, gst_event_new_eos());
- _mmstreamrec_dbg_err("Sending EOS video encoder src pad : %d", ret);
- gst_object_unref(video);
-
- if (sc->audio_enable == TRUE) {
- audio = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC].gst, "src");
- gst_pad_push_event(audio, gst_event_new_flush_start());
- gst_pad_push_event(audio, gst_event_new_flush_stop(TRUE));
- ret = gst_element_send_event(sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_SRC].gst, gst_event_new_eos());
- _mmstreamrec_dbg_err("Sending EOS audio encoder src pad : %d", ret);
- gst_object_unref(audio);
- }
- } else {
- if (sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst != NULL) {
+ video = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VENC].gst, "src");
+ gst_pad_push_event(video, gst_event_new_flush_start());
+ gst_pad_push_event(video, gst_event_new_flush_stop(TRUE));
+ ret = gst_pad_push_event(video, gst_event_new_eos());
+ _mmstreamrec_dbg_err("Sending EOS video encoder src pad : %d", ret);
+ gst_object_unref(video);
+
+ if (sc->audio_enable == TRUE) {
+ audio = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC].gst, "src");
+ gst_pad_push_event(audio, gst_event_new_flush_start());
+ gst_pad_push_event(audio, gst_event_new_flush_stop(TRUE));
+ ret = gst_element_send_event(sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_SRC].gst, gst_event_new_eos());
+ _mmstreamrec_dbg_err("Sending EOS audio encoder src pad : %d", ret);
+ gst_object_unref(audio);
+ }
+ } else {
+ if (sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst != NULL) {
ret = gst_element_send_event(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst, gst_event_new_eos());
_mmstreamrec_dbg_warn("send eos to appsrc result : %d", ret);
- }
+ }
- if (sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_SRC].gst != NULL) {
- pad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_SRC].gst, "src");
- ret = gst_element_send_event(sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_SRC].gst, gst_event_new_eos());
- gst_object_unref(pad);
- pad = NULL;
+ if (sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_SRC].gst != NULL) {
+ pad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_SRC].gst, "src");
+ ret = gst_element_send_event(sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_SRC].gst, gst_event_new_eos());
+ gst_object_unref(pad);
+ pad = NULL;
- _mmstreamrec_dbg_warn("send eos to audiosrc result : %d", ret);
+ _mmstreamrec_dbg_warn("send eos to audiosrc result : %d", ret);
+ }
}
}
-
/* Wait EOS */
_mmstreamrec_dbg_log("Start to wait EOS");
ret = _mmstreamrecorder_get_eos_message(handle);
return TRUE;
}
-int _mmstreamrecorder_push_videostream_buffer(MMHandleType handle, unsigned long timestamp, GstBuffer *buffer, int size)
+int _mmstreamrecorder_push_videostream_buffer(MMHandleType handle, unsigned long long timestamp, GstBuffer *buffer, int size)
{
mmf_streamrecorder_t *hstreamrecorder = MMF_STREAMRECORDER(handle);
_MMStreamRecorderSubContext *sc = NULL;
mmf_return_val_if_fail(sc, MM_ERROR_STREAMRECORDER_NOT_INITIALIZED);
if (buffer == NULL || size == 0) {
- _mmstreamrec_dbg_err("video : Buffer is %p , size %d, time stamp is %ld", buffer, size, timestamp);
+ _mmstreamrec_dbg_err("video : Buffer is %p , size %d, time stamp is %lld", buffer, size, timestamp);
return MM_ERROR_STREAMRECORDER_RESOURCE_CREATION;
}
- _mmstreamrec_dbg_log("video : Buffer is %p , size %d, time stamp is %ld", buffer, size, timestamp);
+ _mmstreamrec_dbg_log("video : Buffer is %p , size %d, time stamp is %lld", buffer, size, timestamp);
/* check element availability */
ret = mm_streamrecorder_get_attributes(handle, &err_name, MMSTR_VIDEO_FRAMERATE, &video_fps, MMSTR_VIDEO_SOURCE_FORMAT, &video_src, MMSTR_VIDEO_RESOLUTION_WIDTH, &video_width, MMSTR_VIDEO_RESOLUTION_HEIGHT, &video_height, MMSTR_VIDEO_SOURCE_FORMAT, &video_source_format, NULL);
/*_mmstreamrec_dbg_log("Buffer Push start , time stamp %ld",timestamp);*/
/* srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst, "src"); */
/* srccaps = gst_pad_get_current_caps(srcpad); */
- srccaps = gst_set_videosrcpad_caps(video_src, video_width, video_height, video_fps, 1);
+ srccaps = gst_set_videosrcpad_caps_sw(video_src, video_width, video_height, video_fps, 1);
if (srccaps) {
gst_app_src_set_caps((GstAppSrc *) sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst, srccaps);
gst_caps_unref(srccaps);
/*_mmstreamrec_dbg_err("newbuf streamrecorder(%p) ",newbuf);*/
ret = gst_app_src_push_buffer((GstAppSrc *) sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst, buffer);
+
if (ret) {
_mmstreamrec_dbg_err("video gst_app_src_push_buffer %d", ret);
ret = MM_ERROR_STREAMRECORDER_VIDEOBUFFER_PUSH;
return ret;
}
-int _mmstreamrecorder_push_audiostream_buffer(MMHandleType handle, unsigned long timestamp, GstBuffer *buffer, int size)
+int _mmstreamrecorder_push_audiostream_buffer(MMHandleType handle, unsigned long long timestamp, GstBuffer *buffer, int size)
{
mmf_streamrecorder_t *hstreamrecorder = MMF_STREAMRECORDER(handle);
_MMStreamRecorderSubContext *sc = NULL;