static void evas_video_sink_samsung_main_render(void *data);
static void
-_evas_video_bgrx_step(unsigned char *evas_data, const unsigned char *gst_data,
- unsigned int w, unsigned int h __UNUSED__, unsigned int output_height, unsigned int step)
-{
- unsigned int x;
- unsigned int y;
-
- for (y = 0; y < output_height; ++y)
- {
- for (x = 0; x < w; x++)
- {
- evas_data[0] = gst_data[0];
- evas_data[1] = gst_data[1];
- evas_data[2] = gst_data[2];
- evas_data[3] = 255;
- gst_data += step;
- evas_data += 4;
- }
- }
-}
-
-static void
-_evas_video_bgr(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h, unsigned int output_height)
-{
- _evas_video_bgrx_step(evas_data, gst_data, w, h, output_height, 3);
-}
-
-static void
-_evas_video_bgrx(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h, unsigned int output_height)
-{
- _evas_video_bgrx_step(evas_data, gst_data, w, h, output_height, 4);
-}
-
-static void
-_evas_video_bgra(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h __UNUSED__, unsigned int output_height)
-{
- unsigned int x;
- unsigned int y;
-
- for (y = 0; y < output_height; ++y)
- {
- unsigned char alpha;
-
- for (x = 0; x < w; ++x)
- {
- alpha = gst_data[3];
- evas_data[0] = (gst_data[0] * alpha) / 255;
- evas_data[1] = (gst_data[1] * alpha) / 255;
- evas_data[2] = (gst_data[2] * alpha) / 255;
- evas_data[3] = alpha;
- gst_data += 4;
- evas_data += 4;
- }
- }
-}
-
-static void
-_evas_video_i420(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h __UNUSED__, unsigned int output_height)
-{
- const unsigned char **rows;
- unsigned int i, j;
- unsigned int rh;
-
- rh = output_height;
-
- rows = (const unsigned char **)evas_data;
-
- for (i = 0; i < rh; i++)
- rows[i] = &gst_data[i * w];
-
- for (j = 0; j < (rh / 2); j++, i++)
- rows[i] = &gst_data[h * w + j * (w / 2)];
-
- for (j = 0; j < (rh / 2); j++, i++)
- rows[i] = &gst_data[h * w + rh * (w / 4) + j * (w / 2)];
-}
-
-static void
-_evas_video_yv12(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h __UNUSED__, unsigned int output_height)
-{
- const unsigned char **rows;
- unsigned int i, j;
- unsigned int rh;
-
- rh = output_height;
-
- rows = (const unsigned char **)evas_data;
-
- for (i = 0; i < rh; i++)
- rows[i] = &gst_data[i * w];
-
- for (j = 0; j < (rh / 2); j++, i++)
- rows[i] = &gst_data[h * w + rh * (w / 4) + j * (w / 2)];
-
- for (j = 0; j < (rh / 2); j++, i++)
- rows[i] = &gst_data[h * w + j * (w / 2)];
-}
-
-static void
-_evas_video_yuy2(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h __UNUSED__, unsigned int output_height)
-{
- const unsigned char **rows;
- unsigned int i;
-
- rows = (const unsigned char **)evas_data;
-
- for (i = 0; i < output_height; i++)
- rows[i] = &gst_data[i * w * 2];
-}
-
-static void
-_evas_video_nv12(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h __UNUSED__, unsigned int output_height)
-{
- const unsigned char **rows;
- unsigned int i, j;
- unsigned int rh;
-
- rh = output_height;
-
- rows = (const unsigned char **)evas_data;
-
- for (i = 0; i < rh; i++)
- rows[i] = &gst_data[i * w];
-
- for (j = 0; j < (rh / 2); j++, i++)
- rows[i] = &gst_data[rh * w + j * w];
-}
-
-static void
-_evas_video_mt12(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h, unsigned int output_height __UNUSED__)
-{
- const unsigned char **rows;
- unsigned int i;
- unsigned int j;
-
- rows = (const unsigned char **)evas_data;
-
- for (i = 0; i < (h / 32) / 2; i++)
- rows[i] = &gst_data[i * w * 2 * 32];
-
- if ((h / 32) % 2)
- {
- rows[i] = &gst_data[i * w * 2 * 32];
- i++;
- }
-
- for (j = 0; j < ((h / 2) / 32) / 2; ++j, ++i)
- rows[i] = &gst_data[h * w + j * (w / 2) * 2 * 16];
-}
-
-static void
-_evas_video_st12_multiplane(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h, unsigned int output_height __UNUSED__)
-{
- const GstMultiPlaneImageBuffer *mp_buf = (const GstMultiPlaneImageBuffer *) gst_data;
- const unsigned char **rows;
- unsigned int i;
- unsigned int j;
-
- rows = (const unsigned char **)evas_data;
-
- for (i = 0; i < (h / 32) / 2; i++)
- rows[i] = mp_buf->uaddr[0] + i * w * 2 * 32;
- if ((h / 32) % 2)
- {
- rows[i] = mp_buf->uaddr[0] + i * w * 2 * 32;
- i++;
- }
-
- for (j = 0; j < ((h / 2) / 16) / 2; j++, i++)
- {
- rows[i] = mp_buf->uaddr[1] + j * w * 2 * 16 * 2;
- }
- if (((h / 2) / 16) % 2)
- rows[i] = mp_buf->uaddr[1] + j * w * 2 * 16 * 2;
-}
-
-static void
-_evas_video_st12(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w __UNUSED__, unsigned int h, unsigned int output_height __UNUSED__)
-{
- const SCMN_IMGB *imgb = (const SCMN_IMGB *) gst_data;
- const unsigned char **rows;
- unsigned int i, j;
-
- rows = (const unsigned char **)evas_data;
-
- for (i = 0; i < (h / 32) / 2; i++)
- rows[i] = imgb->uaddr[0] + i * imgb->stride[0] * 2 * 32;
- if ((h / 32) % 2)
- {
- rows[i] = imgb->uaddr[0] + i * imgb->stride[0] * 2 * 32;
- i++;
- }
-
- for (j = 0; j < (unsigned int) imgb->elevation[1] / 32 / 2; j++, i++)
- rows[i] = imgb->uaddr[1] + j * imgb->stride[1] * 32 * 2;
- if ((imgb->elevation[1] / 32) % 2)
- rows[i++] = imgb->uaddr[1] + j * imgb->stride[1] * 32 * 2;
-}
-
-static const struct {
- const char *name;
- guint32 fourcc;
- Evas_Colorspace eformat;
- Evas_Video_Convert_Cb func;
- Eina_Bool force_height;
-} colorspace_fourcc_convertion[] = {
- { "I420", GST_MAKE_FOURCC('I', '4', '2', '0'), EVAS_COLORSPACE_YCBCR422P601_PL, _evas_video_i420, EINA_TRUE },
- { "YV12", GST_MAKE_FOURCC('Y', 'V', '1', '2'), EVAS_COLORSPACE_YCBCR422P601_PL, _evas_video_yv12, EINA_TRUE },
- { "YUY2", GST_MAKE_FOURCC('Y', 'U', 'Y', '2'), EVAS_COLORSPACE_YCBCR422601_PL, _evas_video_yuy2, EINA_FALSE },
- { "NV12", GST_MAKE_FOURCC('N', 'V', '1', '2'), EVAS_COLORSPACE_YCBCR420NV12601_PL, _evas_video_nv12, EINA_TRUE },
- { "TM12", GST_MAKE_FOURCC('T', 'M', '1', '2'), EVAS_COLORSPACE_YCBCR420TM12601_PL, _evas_video_mt12, EINA_TRUE }
-};
-
-static const struct {
- const char *name;
- GstVideoFormat format;
- Evas_Colorspace eformat;
- Evas_Video_Convert_Cb func;
-} colorspace_format_convertion[] = {
- { "BGR", GST_VIDEO_FORMAT_BGR, EVAS_COLORSPACE_ARGB8888, _evas_video_bgr },
- { "BGRx", GST_VIDEO_FORMAT_BGRx, EVAS_COLORSPACE_ARGB8888, _evas_video_bgrx },
- { "BGRA", GST_VIDEO_FORMAT_BGRA, EVAS_COLORSPACE_ARGB8888, _evas_video_bgra }
-};
-
-static void
evas_video_sink_base_init(gpointer g_class)
{
GstElementClass* element_class;
{
priv->source_height = priv->height;
- for (i = 0; i < sizeof (colorspace_fourcc_convertion) / sizeof (colorspace_fourcc_convertion[0]); ++i)
+ for (i = 0; colorspace_fourcc_convertion[i].name != NULL; ++i)
if (fourcc == colorspace_fourcc_convertion[i].fourcc)
{
fprintf(stderr, "Found '%s'\n", colorspace_fourcc_convertion[i].name);
priv->source_height = priv->height;
- for (i = 0; i < sizeof (colorspace_format_convertion) / sizeof (colorspace_format_convertion[0]); ++i)
+ for (i = 0; colorspace_format_convertion[i].name != NULL; ++i)
if (format == colorspace_format_convertion[i].format)
{
fprintf(stderr, "Found '%s'\n", colorspace_format_convertion[i].name);
if (!priv || !priv->o || priv->unlocked)
goto exit_point;
+ if (send->ev->send)
+ {
+ emotion_gstreamer_buffer_free(send->ev->send);
+ send->ev->send = NULL;
+ }
+
if (!send->ev->stream && !send->force)
{
- if (send->ev->send)
- emotion_gstreamer_buffer_free(send->ev->send);
send->ev->send = send;
+ _emotion_frame_new(send->ev->obj);
goto exit_stream;
}
send->ev->play_started = 0;
}
- _emotion_frame_new(send->ev->obj);
+ if (!send->force)
+ {
+ _emotion_frame_new(send->ev->obj);
+ }
vstream = eina_list_nth(send->ev->video_streams, send->ev->video_stream_nbr - 1);
if (!priv || !priv->o || priv->unlocked)
goto exit_point;
+ if (ev->send && send != ev->send)
+ {
+ emotion_gstreamer_buffer_free(ev->send);
+ ev->send = NULL;
+ }
+
if (!ev->stream && !send->force)
{
- if (ev->send)
- emotion_gstreamer_buffer_free(ev->send);
ev->send = send;
+ _emotion_frame_new(ev->obj);
evas_object_image_data_update_add(priv->o, 0, 0, priv->width, priv->height);
goto exit_stream;
}
ev->play_started = 0;
}
- _emotion_frame_new(ev->obj);
+ if (!send->force)
+ {
+ _emotion_frame_new(ev->obj);
+ }
gst_element_query_position(ev->pipeline, &fmt, &pos);
ev->position = (double)pos / (double)GST_SECOND;
_video_update_pixels(void *data, Evas_Object *obj __UNUSED__, const Evas_Video_Surface *surface __UNUSED__)
{
Emotion_Gstreamer_Video *ev = data;
+ Emotion_Gstreamer_Buffer *send;
if (!ev->send) return ;
- ev->send->force = EINA_TRUE;
- evas_video_sink_main_render(ev->send);
+ send = ev->send;
+ send->force = EINA_TRUE;
ev->send = NULL;
+ evas_video_sink_main_render(send);
}
GstElement *