#define SAFE_UNREF_CAPS(caps) { if (caps) { gst_caps_unref(caps); caps = NULL; } }
-static GstFlowReturn
-_mm_sink_sample(GstElement * appsink, gpointer user_data)
+static GstFlowReturn _mm_sink_sample(GstElement * appsink, gpointer user_data)
{
GstBuffer *_buf = NULL;
GstSample *_sample = NULL;
- gstreamer_s * pGstreamer_s = (gstreamer_s*) user_data;
+ gstcs_data_s * gstcs_data = (gstcs_data_s*) user_data;
_sample = gst_app_sink_pull_sample((GstAppSink*)appsink);
if (_sample) {
_buf = gst_sample_get_buffer(_sample);
- pGstreamer_s->output_buffer = _buf;
+ gstcs_data->gst_buffer = _buf;
- if (pGstreamer_s->output_buffer != NULL) {
+ if (gstcs_data->gst_buffer != NULL) {
GstMapInfo mapinfo = GST_MAP_INFO_INIT;
- gst_buffer_map(pGstreamer_s->output_buffer, &mapinfo, GST_MAP_READ);
+ gst_buffer_map(gstcs_data->gst_buffer, &mapinfo, GST_MAP_READ);
gstcs_debug("Create Output Buffer: GST_BUFFER_DATA: %p\t GST_BUFFER_SIZE: %zu", mapinfo.data, mapinfo.size);
- gst_buffer_unmap(pGstreamer_s->output_buffer, &mapinfo);
+ gst_buffer_unmap(gstcs_data->gst_buffer, &mapinfo);
} else {
gstcs_error("ERROR -Input Prepare Buffer! Check createoutput buffer function");
}
}
- gst_buffer_ref(pGstreamer_s->output_buffer); /* when you want to avoid flushing */
+ gst_buffer_ref(gstcs_data->gst_buffer); /* when you want to avoid flushing */
gst_sample_unref(_sample);
return GST_FLOW_OK;
}
-static gboolean
-_mm_on_src_message(GstBus * bus, GstMessage * message, gpointer user_data)
+static gboolean _mm_on_src_message(GstBus * bus, GstMessage * message, gpointer user_data)
{
- gstreamer_s * pGstreamer_s = (gstreamer_s*) user_data;
+ gstcs_data_s * gstcs_data = (gstcs_data_s*) user_data;
switch (GST_MESSAGE_TYPE(message)) {
case GST_MESSAGE_EOS: {
gstcs_debug("The source got dry");
- gst_app_src_end_of_stream(GST_APP_SRC(pGstreamer_s->appsrc));
- g_main_context_pop_thread_default(pGstreamer_s->context);
- g_main_loop_quit(pGstreamer_s->loop);
+ gst_app_src_end_of_stream(GST_APP_SRC(gstcs_data->appsrc));
+ g_main_context_pop_thread_default(gstcs_data->context);
+ g_main_loop_quit(gstcs_data->loop);
break;
}
case GST_MESSAGE_ERROR: {
gstcs_error("Debugging info: %s\n", (dbg_info) ? dbg_info : "none");
g_error_free(err);
g_free(dbg_info);
- g_main_context_pop_thread_default(pGstreamer_s->context);
- g_main_loop_quit(pGstreamer_s->loop);
+ g_main_context_pop_thread_default(gstcs_data->context);
+ g_main_loop_quit(gstcs_data->loop);
gstcs_debug("Quit GST_CS\n");
break;
}
byte_per_pixcel = 4;
break;
default:
- gstcs_error("Not supported format");
+ gstcs_error("Not supported format [%d]", color_format);
break;
}
return byte_per_pixcel;
}
-static int _mm_create_pipeline(gstreamer_s* pGstreamer_s)
+static int _mm_create_pipeline(gstcs_data_s* gstcs_data)
{
- int ret = GSTCS_ERROR_NONE;
- pGstreamer_s->pipeline = gst_pipeline_new("pipeline");
- if (!pGstreamer_s->pipeline) {
+ gstcs_data->pipeline = gst_pipeline_new("pipeline");
+ if (!gstcs_data->pipeline) {
gstcs_error("pipeline could not be created. Exiting.\n");
return GSTCS_ERROR_INVALID_PARAMETER;
}
- pGstreamer_s->appsrc = gst_element_factory_make("appsrc" , "appsrc");
- if (!pGstreamer_s->appsrc) {
+ gstcs_data->appsrc = gst_element_factory_make("appsrc" , "appsrc");
+ if (!gstcs_data->appsrc) {
gstcs_error("appsrc could not be created. Exiting.\n");
- gst_object_unref(pGstreamer_s->pipeline);
+ gst_object_unref(gstcs_data->pipeline);
return GSTCS_ERROR_INVALID_PARAMETER;
}
- pGstreamer_s->colorspace = gst_element_factory_make("videoconvert" , "convert");
- if (!pGstreamer_s->colorspace) {
+ gstcs_data->videoconvert = gst_element_factory_make("videoconvert" , "convert");
+ if (!gstcs_data->videoconvert) {
gstcs_error("colorspace could not be created. Exiting.\n");
- gst_object_unref(pGstreamer_s->pipeline);
+ gst_object_unref(gstcs_data->pipeline);
return GSTCS_ERROR_INVALID_PARAMETER;
}
- pGstreamer_s->videoscale = gst_element_factory_make("videoscale", "scale");
- if (!pGstreamer_s->videoscale) {
+ gstcs_data->videoscale = gst_element_factory_make("videoscale", "scale");
+ if (!gstcs_data->videoscale) {
gstcs_error("videoscale could not be created. Exiting.\n");
- gst_object_unref(pGstreamer_s->pipeline);
+ gst_object_unref(gstcs_data->pipeline);
return GSTCS_ERROR_INVALID_PARAMETER;
}
- pGstreamer_s->videoflip = gst_element_factory_make("videoflip", "flip");
- if (!pGstreamer_s->videoflip) {
+ gstcs_data->videoflip = gst_element_factory_make("videoflip", "flip");
+ if (!gstcs_data->videoflip) {
gstcs_error("videoflip could not be created. Exiting.\n");
- gst_object_unref(pGstreamer_s->pipeline);
+ gst_object_unref(gstcs_data->pipeline);
return GSTCS_ERROR_INVALID_PARAMETER;
}
- pGstreamer_s->appsink = gst_element_factory_make("appsink" , "appsink");
- if (!pGstreamer_s->appsink) {
+ gstcs_data->appsink = gst_element_factory_make("appsink" , "appsink");
+ if (!gstcs_data->appsink) {
gstcs_error("appsink could not be created. Exiting.\n");
- gst_object_unref(pGstreamer_s->pipeline);
+ gst_object_unref(gstcs_data->pipeline);
return GSTCS_ERROR_INVALID_PARAMETER;
}
- return ret;
+ return GSTCS_ERROR_NONE;
}
static void _mm_destroy_notify(gpointer data)
}
}
-static void
-_mm_dump_caps_format(GstCaps* caps)
+static void _mm_dump_caps_format(GstCaps* caps)
{
GstStructure *caps_structure = gst_caps_get_structure(caps, 0);
const gchar* formatInfo = gst_structure_get_string(caps_structure, "format");
gstcs_debug("[%d] caps: %s", GST_IS_CAPS(caps), formatInfo);
}
-static void
-_mm_link_pipeline(gstreamer_s* pGstreamer_s, int value)
+static void _mm_link_pipeline(gstcs_data_s* gstcs_data, int value)
{
gstcs_fenter();
/* set property */
- gst_bin_add_many(GST_BIN(pGstreamer_s->pipeline), pGstreamer_s->appsrc, pGstreamer_s->colorspace, pGstreamer_s->videoscale, pGstreamer_s->videoflip, pGstreamer_s->appsink, NULL);
- if (!gst_element_link_many(pGstreamer_s->appsrc, pGstreamer_s->colorspace, pGstreamer_s->videoscale, pGstreamer_s->videoflip, pGstreamer_s->appsink, NULL))
+ gst_bin_add_many(GST_BIN(gstcs_data->pipeline), gstcs_data->appsrc, gstcs_data->videoconvert, gstcs_data->videoscale, gstcs_data->videoflip, gstcs_data->appsink, NULL);
+ if (!gst_element_link_many(gstcs_data->appsrc, gstcs_data->videoconvert, gstcs_data->videoscale, gstcs_data->videoflip, gstcs_data->appsink, NULL))
gstcs_error("Fail to link pipeline");
else
gstcs_debug("Success to link pipeline");
- g_object_set(G_OBJECT(pGstreamer_s->appsrc), "stream-type", 0, "format", GST_FORMAT_TIME, NULL);
- g_object_set(pGstreamer_s->appsrc, "num-buffers", 1, NULL);
- g_object_set(pGstreamer_s->appsrc, "is-live", TRUE, NULL); /* add because of gstreamer_s time issue */
+ g_object_set(G_OBJECT(gstcs_data->appsrc), "stream-type", 0, "format", GST_FORMAT_TIME, NULL);
+ g_object_set(gstcs_data->appsrc, "num-buffers", 1, NULL);
+ g_object_set(gstcs_data->appsrc, "is-live", TRUE, NULL); /* add because of gstcs_data_s time issue */
/* Values are 'GstVideoOrientationMethod' in gst-plugins-base/gst-libs/gst/video/video.h */
- g_object_set(pGstreamer_s->videoflip, "video-direction", value, NULL);
+ g_object_set(gstcs_data->videoflip, "video-direction", value, NULL);
- g_object_set(pGstreamer_s->appsink, "emit-signals", TRUE, "sync", FALSE, NULL);
+ g_object_set(gstcs_data->appsink, "emit-signals", TRUE, "sync", FALSE, NULL);
gstcs_fleave();
}
static GstVideoFormat _mm_get_video_format(mm_util_color_format_e color_format)
{
GstVideoFormat videoFormat = GST_VIDEO_FORMAT_UNKNOWN;
- int _bpp = 0;
- int _depth = 0;
- int _red_mask = 0;
- int _green_mask = 0;
- int _blue_mask = 0;
- int _alpha_mask = 0;
- int _endianness = 0;
switch (color_format) {
case MM_UTIL_COLOR_YUV420:
videoFormat = GST_VIDEO_FORMAT_I420;
break;
case MM_UTIL_COLOR_NV12:
- videoFormat = GST_VIDEO_FORMAT_NV12;
+ videoFormat = GST_VIDEO_FORMAT_NV21;
break;
case MM_UTIL_COLOR_UYVY:
videoFormat = GST_VIDEO_FORMAT_UYVY;
videoFormat = GST_VIDEO_FORMAT_YVYU;
break;
case MM_UTIL_COLOR_RGB16:
- _bpp = 16; _depth = 16; _red_mask = 63488; _green_mask = 2016; _blue_mask = 31; _endianness = 1234; _alpha_mask = 0;
- videoFormat = gst_video_format_from_masks(_depth, _bpp, _endianness, _red_mask, _green_mask, _blue_mask, _alpha_mask);
+ videoFormat = GST_VIDEO_FORMAT_BGR16;
break;
case MM_UTIL_COLOR_RGB24:
- _bpp = 24; _depth = 24; _red_mask = 16711680; _green_mask = 65280; _blue_mask = 255; _endianness = 4321; _alpha_mask = 0;
- videoFormat = gst_video_format_from_masks(_depth, _bpp, _endianness, _red_mask, _green_mask, _blue_mask, _alpha_mask);
+ videoFormat = GST_VIDEO_FORMAT_BGR;
break;
case MM_UTIL_COLOR_ARGB:
- _bpp = 32; _depth = 32; _red_mask = 16711680; _green_mask = 65280; _blue_mask = 255; _alpha_mask = -16777216; _endianness = 4321;
- videoFormat = gst_video_format_from_masks(_depth, _bpp, _endianness, _red_mask, _green_mask, _blue_mask, _alpha_mask);
+ videoFormat = GST_VIDEO_FORMAT_ABGR;
break;
case MM_UTIL_COLOR_BGRA:
- _bpp = 32; _depth = 32; _red_mask = 65280; _green_mask = 16711680; _blue_mask = -16777216; _alpha_mask = 255; _endianness = 4321;
- videoFormat = gst_video_format_from_masks(_depth, _bpp, _endianness, _red_mask, _green_mask, _blue_mask, _alpha_mask);
+ videoFormat = GST_VIDEO_FORMAT_RGBA;
break;
case MM_UTIL_COLOR_RGBA:
- _bpp = 32; _depth = 32; _red_mask = -16777216; _green_mask = 16711680; _blue_mask = 65280; _alpha_mask = 255; _endianness = 4321;
- videoFormat = gst_video_format_from_masks(_depth, _bpp, _endianness, _red_mask, _green_mask, _blue_mask, _alpha_mask);
+ videoFormat = GST_VIDEO_FORMAT_BGRA;
break;
case MM_UTIL_COLOR_BGRX:
- _bpp = 32; _depth = 24; _red_mask = 65280; _green_mask = 16711680; _blue_mask = -16777216; _endianness = 4321; _alpha_mask = 0;
- videoFormat = gst_video_format_from_masks(_depth, _bpp, _endianness, _red_mask, _green_mask, _blue_mask, _alpha_mask);
+ videoFormat = GST_VIDEO_FORMAT_RGBx;
break;
default:
- gstcs_error("Not supported format");
+ gstcs_error("Not supported format [%d]", color_format);
break;
}
- gstcs_debug("color_format [%d], Chosen video format [%s]", color_format, gst_video_format_to_string(videoFormat));
+ gstcs_info("color_format [%d], Chosen video format [%s]", color_format, gst_video_format_to_string(videoFormat));
return videoFormat;
*elevation = MM_UTIL_ROUND_UP_2(height);
break;
default:
- gstcs_error("Not supported format");
+ gstcs_error("Not supported format [%d]", color_format);
break;
}
return size;
}
-static int _mm_push_buffer_into_pipeline(imgp_info_s* pImgp_info, unsigned char *src, gstreamer_s * pGstreamer_s)
+static int _mm_push_buffer_into_pipeline(imgp_info_s* pImgp_info, unsigned char *src, gstcs_data_s * gstcs_data)
{
size_t data_size = 0;
GstBuffer* gst_buf = NULL;
gstcs_fenter();
- gstcs_retvm_if(pGstreamer_s->pipeline == NULL, GSTCS_ERROR_INVALID_PARAMETER, "Invalid pipeline");
+ gstcs_retvm_if(gstcs_data->pipeline == NULL, GSTCS_ERROR_INVALID_PARAMETER, "Invalid pipeline");
data_size = _mm_setup_image_size(pImgp_info->src_format, pImgp_info->src_width, pImgp_info->src_height);
gst_buf = gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_READONLY, src, data_size, 0, data_size, NULL, NULL);
- gst_app_src_push_buffer(GST_APP_SRC(pGstreamer_s->appsrc), gst_buf); /* push buffer to pipeline */
+ gst_app_src_push_buffer(GST_APP_SRC(gstcs_data->appsrc), gst_buf); /* push buffer to pipeline */
gstcs_fleave();
return GSTCS_ERROR_NONE;
}
-static int _mm_push_buffer_into_pipeline_new(unsigned char *src, gstreamer_s * pGstreamer_s, mm_util_color_format_e color_format, unsigned int width, unsigned int height, unsigned int stride, unsigned int elevation)
+static int _mm_push_buffer_into_pipeline_new(unsigned char *src, gstcs_data_s * gstcs_data, mm_util_color_format_e color_format, unsigned int width, unsigned int height, unsigned int stride, unsigned int elevation)
{
GstBuffer *gst_buf = NULL;
size_t src_size = 0;
gstcs_fenter();
- gstcs_retvm_if(pGstreamer_s->pipeline == NULL, GSTCS_ERROR_INVALID_PARAMETER, "Invalid pipeline");
+ gstcs_retvm_if(gstcs_data->pipeline == NULL, GSTCS_ERROR_INVALID_PARAMETER, "Invalid pipeline");
gstcs_retvm_if((width == 0 || height == 0), GSTCS_ERROR_INVALID_PARAMETER, "Invalid width(%u) and height(%u)", width, height);
src_size = _mm_setup_image_size(color_format, stride, elevation);
for (y = 0; y < height; y++) {
guint8 *pLine = (guint8 *) &(src[src_row * y]);
+ guint8 stride_row_color = pLine[src_row - 1];
+
for (i = 0; i < src_row; i++)
data[y * stride_row + i] = pLine[i];
- guint8 stride_row_color = pLine[i - 1];
for (i = src_row; i < stride_row; i++)
data[y * stride_row + i] = stride_row_color;
}
gst_buf = gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_READONLY, data, src_size, 0, src_size, data, _mm_destroy_notify);
- gst_app_src_push_buffer(GST_APP_SRC(pGstreamer_s->appsrc), gst_buf); /* push buffer to pipeline */
+ gst_app_src_push_buffer(GST_APP_SRC(gstcs_data->appsrc), gst_buf); /* push buffer to pipeline */
gstcs_fleave();
return GSTCS_ERROR_NONE;
}
-static int _mm_imgp_gstcs_processing(gstreamer_s* pGstreamer_s, unsigned char *src, unsigned char **dst, imgp_info_s* pImgp_info)
+static int _mm_imgp_gstcs_processing(gstcs_data_s* gstcs_data, unsigned char *src, unsigned char **dst, imgp_info_s* pImgp_info)
{
GstBus *bus = NULL;
GstStateChangeReturn ret_state;
gstcs_fenter();
/*create pipeline*/
- ret = _mm_create_pipeline(pGstreamer_s);
+ ret = _mm_create_pipeline(gstcs_data);
if (ret != GSTCS_ERROR_NONE) {
gstcs_error("ERROR - mm_create_pipeline ");
return ret;
}
/* Make appsink emit the "new-preroll" and "new-sample" signals. This option is by default disabled because signal emission is expensive and unneeded when the application prefers to operate in pull mode. */
- gst_app_sink_set_emit_signals((GstAppSink*)pGstreamer_s->appsink, TRUE);
+ gst_app_sink_set_emit_signals((GstAppSink*)gstcs_data->appsink, TRUE);
- bus = gst_pipeline_get_bus(GST_PIPELINE(pGstreamer_s->pipeline));
- gst_bus_add_watch(bus, (GstBusFunc) _mm_on_src_message, pGstreamer_s);
+ bus = gst_pipeline_get_bus(GST_PIPELINE(gstcs_data->pipeline));
+ gst_bus_add_watch(bus, (GstBusFunc) _mm_on_src_message, gstcs_data);
gst_object_unref(bus);
_mm_get_round_up_width_height(pImgp_info->src_format, pImgp_info->src_width, pImgp_info->src_height,
gstcs_error("ERROR - _mm_get_capabilities ");
SAFE_UNREF_CAPS(src_caps);
SAFE_UNREF_CAPS(dst_caps);
- gst_object_unref(pGstreamer_s->pipeline);
- return ret;
+ gst_object_unref(gstcs_data->pipeline);
+ return GSTCS_ERROR_NOT_SUPPORTED_FORMAT;
}
- gst_app_src_set_caps(GST_APP_SRC(pGstreamer_s->appsrc), src_caps);
+ gst_app_src_set_caps(GST_APP_SRC(gstcs_data->appsrc), src_caps);
if (pImgp_info->angle == MM_UTIL_ROTATE_0)
- gst_app_sink_set_caps(GST_APP_SINK(pGstreamer_s->appsink), dst_caps);
+ gst_app_sink_set_caps(GST_APP_SINK(gstcs_data->appsink), dst_caps);
else
gstcs_debug("Don't set the caps of app_sink when angle is %d", pImgp_info->angle);
if ((pImgp_info->src_width != src_stride) || (pImgp_info->src_height != src_elevation)) {
- ret = _mm_push_buffer_into_pipeline_new(src, pGstreamer_s, pImgp_info->src_format, pImgp_info->src_width, pImgp_info->src_height, src_stride, src_elevation);
+ ret = _mm_push_buffer_into_pipeline_new(src, gstcs_data, pImgp_info->src_format, pImgp_info->src_width, pImgp_info->src_height, src_stride, src_elevation);
} else {
- ret = _mm_push_buffer_into_pipeline(pImgp_info, src, pGstreamer_s);
+ ret = _mm_push_buffer_into_pipeline(pImgp_info, src, gstcs_data);
}
if (ret != GSTCS_ERROR_NONE) {
gstcs_error("ERROR - mm_push_buffer_into_pipeline ");
SAFE_UNREF_CAPS(src_caps);
SAFE_UNREF_CAPS(dst_caps);
- gst_object_unref(pGstreamer_s->pipeline);
+ gst_object_unref(gstcs_data->pipeline);
return ret;
}
/*link pipeline*/
- _mm_link_pipeline(pGstreamer_s, pImgp_info->angle);
+ _mm_link_pipeline(gstcs_data, pImgp_info->angle);
/* Conecting to the new-sample signal emited by the appsink*/
gstcs_debug("Start G_CALLBACK(_mm_sink_sample)");
- g_signal_connect(pGstreamer_s->appsink, "new-sample", G_CALLBACK(_mm_sink_sample), pGstreamer_s);
+ g_signal_connect(gstcs_data->appsink, "new-sample", G_CALLBACK(_mm_sink_sample), gstcs_data);
gstcs_debug("End G_CALLBACK(_mm_sink_sample)");
/* GST_STATE_PLAYING*/
gstcs_debug("Start GST_STATE_PLAYING");
- ret_state = gst_element_set_state(pGstreamer_s->pipeline, GST_STATE_PLAYING);
+ ret_state = gst_element_set_state(gstcs_data->pipeline, GST_STATE_PLAYING);
gstcs_debug("End GST_STATE_PLAYING ret_state: %d", ret_state);
/*g_main_loop_run*/
gstcs_debug("g_main_loop_run");
- g_main_loop_run(pGstreamer_s->loop);
+ g_main_loop_run(gstcs_data->loop);
gstcs_debug("Sucess GST_STATE_CHANGE");
/*GST_STATE_NULL*/
- gst_element_set_state(pGstreamer_s->pipeline, GST_STATE_NULL);
+ gst_element_set_state(gstcs_data->pipeline, GST_STATE_NULL);
gstcs_debug("End GST_STATE_NULL");
- gstcs_debug("###pGstreamer_s->output_buffer### : %p", pGstreamer_s->output_buffer);
+ gstcs_debug("###gstcs_data->gst_buffer### : %p", gstcs_data->gst_buffer);
- ret_state = gst_element_get_state(pGstreamer_s->pipeline, NULL, NULL, 1*GST_SECOND);
+ ret_state = gst_element_get_state(gstcs_data->pipeline, NULL, NULL, 1*GST_SECOND);
if (ret_state == GST_STATE_CHANGE_SUCCESS)
gstcs_debug("GST_STATE_NULL ret_state = %d (GST_STATE_CHANGE_SUCCESS)\n", ret_state);
if (ret_state == GST_STATE_CHANGE_FAILURE) {
gstcs_error("GST_STATE_CHANGE_FAILURE");
} else {
- if (pGstreamer_s->output_buffer != NULL) {
+ if (gstcs_data->gst_buffer != NULL) {
GstMapInfo mapinfo = GST_MAP_INFO_INIT;
- gst_buffer_map(pGstreamer_s->output_buffer, &mapinfo, GST_MAP_READ);
+ gst_buffer_map(gstcs_data->gst_buffer, &mapinfo, GST_MAP_READ);
size_t buffer_size = mapinfo.size;
size_t calc_buffer_size = 0;
if (buffer_size != calc_buffer_size) {
gstcs_debug("Buffer size is different \n");
gstcs_debug("unref output buffer");
- gst_buffer_unref(pGstreamer_s->output_buffer);
- gst_object_unref(pGstreamer_s->pipeline);
- pGstreamer_s->output_buffer = NULL;
+ gst_buffer_unref(gstcs_data->gst_buffer);
+ gst_object_unref(gstcs_data->pipeline);
+ gstcs_data->gst_buffer = NULL;
return GSTCS_ERROR_INVALID_OPERATION;
}
- gstcs_debug("pGstreamer_s->output_buffer: %p\n", pGstreamer_s->output_buffer);
+ gstcs_debug("gstcs_data->gst_buffer: %p\n", gstcs_data->gst_buffer);
*dst = g_memdup2(mapinfo.data, buffer_size);
pImgp_info->buffer_size = buffer_size;
- gst_buffer_unmap(pGstreamer_s->output_buffer, &mapinfo);
+ gst_buffer_unmap(gstcs_data->gst_buffer, &mapinfo);
} else {
- gstcs_debug("pGstreamer_s->output_buffer is NULL");
+ gstcs_debug("gstcs_data->gst_buffer is NULL");
}
}
gstcs_debug("unref output buffer");
- gst_buffer_unref(pGstreamer_s->output_buffer);
- gst_object_unref(pGstreamer_s->pipeline);
- pGstreamer_s->output_buffer = NULL;
+ gst_buffer_unref(gstcs_data->gst_buffer);
+ gst_object_unref(gstcs_data->pipeline);
+ gstcs_data->gst_buffer = NULL;
gstcs_debug("dst: %p", *dst);
gstcs_fleave();
return ret;
}
-static int _gstcs_create_default_thread(gstreamer_s *gstreamer)
+static int _gstcs_create_default_thread(gstcs_data_s *gstreamer)
{
gstcs_retvm_if(gstreamer == NULL, GSTCS_ERROR_INVALID_PARAMETER, "Invalid gstreamer");
return GSTCS_ERROR_NONE;
}
-static int _gstcs_destroy_default_thread(gstreamer_s *gstreamer)
+static int _gstcs_destroy_default_thread(gstcs_data_s *gstreamer)
{
gstcs_retvm_if(gstreamer == NULL, GSTCS_ERROR_INVALID_PARAMETER, "Invalid gstreamer");
static int _mm_imgp_gstcs(imgp_info_s* pImgp_info, unsigned char *src, unsigned char **dst)
{
- gstreamer_s* pGstreamer_s = NULL;
+ gstcs_data_s* gstcs_data = NULL;
int ret = GSTCS_ERROR_NONE;
/* Print debug message for inout structure */
/* Initialize gstreamer */
_gstcs_init();
- pGstreamer_s = g_new0(gstreamer_s, 1);
+ gstcs_data = g_new0(gstcs_data_s, 1);
/* Create default thread for async behavior */
- ret = _gstcs_create_default_thread(pGstreamer_s);
+ ret = _gstcs_create_default_thread(gstcs_data);
if (ret != GSTCS_ERROR_NONE) {
gstcs_error("Error: _gstcs_create_default_thread is failed");
- g_free(pGstreamer_s);
+ g_free(gstcs_data);
return ret;
}
/* Do gstreamer processing */
- ret = _mm_imgp_gstcs_processing(pGstreamer_s, src, dst, pImgp_info); /* input: buffer pointer for input image , input image format, input image width, input image height, output: buffer porinter for output image */
+ ret = _mm_imgp_gstcs_processing(gstcs_data, src, dst, pImgp_info); /* input: buffer pointer for input image , input image format, input image width, input image height, output: buffer porinter for output image */
if (ret == GSTCS_ERROR_NONE)
gstcs_debug("End _mm_imgp_gstcs_processing [dst: %p]", *dst);
gstcs_error("ERROR - _mm_imgp_gstcs_processing");
/* Free resouces */
- ret = _gstcs_destroy_default_thread(pGstreamer_s);
+ ret = _gstcs_destroy_default_thread(gstcs_data);
if (ret != GSTCS_ERROR_NONE)
gstcs_error("Error: _gstcs_create_default_thread is failed");
- g_free(pGstreamer_s);
+ g_free(gstcs_data);
return ret;
}