summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNAMJEONGYOON <just.nam@samsung.com>2016-08-25 12:47:21 +0900
committerNAMJEONGYOON <just.nam@samsung.com>2016-08-25 12:47:21 +0900
commitb27c79700382bcef94c20f26d8415e6c6180f05c (patch)
tree3cb5e7c1f7902e96e1cdb73d02d3128cb1e757f5
parentd5c0b2f56db71d37ddf54d5db408eb2468dff273 (diff)
downloadlibmm-evas-renderer-b27c79700382bcef94c20f26d8415e6c6180f05c.tar.gz
libmm-evas-renderer-b27c79700382bcef94c20f26d8415e6c6180f05c.tar.bz2
libmm-evas-renderer-b27c79700382bcef94c20f26d8415e6c6180f05c.zip
fix dump logic
Change-Id: I6d19b85a6e89e23ad0dcd9232295acae993501e9
-rw-r--r--src/mm_evas_renderer.c50
1 files changed, 43 insertions, 7 deletions
diff --git a/src/mm_evas_renderer.c b/src/mm_evas_renderer.c
index 266a78f..c08ea96 100644
--- a/src/mm_evas_renderer.c
+++ b/src/mm_evas_renderer.c
@@ -114,7 +114,7 @@ enum {
static int g_cnt_in = 0;
static int g_cnt_out = 0;
//static void __print_idx(mm_evas_info *evas_info);
-static int __dump_pkt(media_packet_h pkt);
+static int __dump_pkt(media_packet_h pkt, int width, int height);
static int __dump_surf(tbm_surface_h tbm_surf);
#endif
/* internal */
@@ -354,23 +354,54 @@ static void __print_idx(mm_evas_info *evas_info)
return;
}
#endif
-static int __dump_pkt(media_packet_h pkt)
+static int __dump_pkt(media_packet_h pkt, int width, int height)
{
void *data;
uint64_t size;
char filename[128] = {0};
FILE *fp = NULL;
+ int i = 0;
+ int stride_width, stride_height;
sprintf(filename, "/tmp/DUMP_IN_IMG_%2.2d.dump", g_cnt_in);
fp = fopen(filename, "wb");
if (fp == NULL)
return 1;
- media_packet_get_buffer_data_ptr(pkt, &data);
+ media_packet_get_video_plane_data_ptr(pkt, 0, &data);
+ media_packet_get_video_stride_width(pkt, 0, &stride_width);
+ media_packet_get_video_stride_height(pkt, 0, &stride_height);
media_packet_get_buffer_size(pkt, &size);
- LOGI("DUMP_IN_IMG_%2.2d : buffer size(%d) data(%p)", g_cnt_in, (int)size, data);
+ LOGI("[0]stride : %d, %d", stride_width, stride_height);
- fwrite(data, (int)size, 1, fp);
+ for (i = 0; i < height; i++) {
+ fwrite(data, width, 1, fp);
+ data += stride_width;
+ }
+#if 0 //hw format(NV12)
+ media_packet_get_video_plane_data_ptr(pkt, 1, &data);
+ media_packet_get_video_stride_width(pkt, 1, &stride_width);
+ for (i = 0; i < height/2; i++) {
+ ret = fwrite(data, width, 1, fp);
+ data += stride_width;
+ }
+#else
+ media_packet_get_video_plane_data_ptr(pkt, 1, &data);
+ media_packet_get_video_stride_width(pkt, 1, &stride_width);
+ for (i = 0; i < height/2; i++) {
+ fwrite(data, width/2, 1, fp);
+ data += stride_width;
+ }
+ LOGI("[1]stride : %d, %d", stride_width, stride_height);
+ media_packet_get_video_plane_data_ptr(pkt, 2, &data);
+ media_packet_get_video_stride_width(pkt, 2, &stride_width);
+ for (i = 0; i < height/2; i++) {
+ fwrite(data, width/2, 1, fp);
+ data += stride_width;
+ }
+ LOGI("[2]stride : %d, %d", stride_width, stride_height);
+#endif
+ LOGI("DUMP_IN_IMG_%2.2d : buffer size(%d) data(%p)", g_cnt_in, (int)size, data);
fclose(fp);
return 0;
@@ -381,14 +412,19 @@ static int __dump_surf(tbm_surface_h tbm_surf)
char filename[128] = {0};
tbm_surface_info_s info = {0};
- sprintf(filename, "DUMP_OUT_IMG_%2.2d.yuv", g_cnt_out);
+ sprintf(filename, "DUMP_OUT_IMG_%2.2d", g_cnt_out);
if (tbm_surface_get_info(tbm_surf, &info)) {
LOGE("get_info is failed");
return 1;
}
+
tbm_surface_internal_dump_start("/tmp", info.width, info.height, 1);
tbm_surface_internal_dump_buffer(tbm_surf, filename);
tbm_surface_internal_dump_end();
+
+ LOGI("[0]stride : %d, offset : %d", (int)info.planes[0].stride, (int)info.planes[0].offset);
+ LOGI("[1]stride : %d, offset : %d", (int)info.planes[1].stride, (int)info.planes[1].offset);
+ LOGI("[2]stride : %d, offset : %d", (int)info.planes[2].stride, (int)info.planes[2].offset);
LOGI("DUMP_OUT_IMG_%2.2d : buffer size(%d) surf(%p) %d*%d", g_cnt_out, (int)info.size, tbm_surf, info.width, info.height);
return 0;
@@ -1132,7 +1168,7 @@ void mm_evas_renderer_write(media_packet_h packet, void *data)
#ifdef _INTERNAL_DEBUG_
int ret2 = 0;
if ((g_cnt_in%10 == 0) && (g_cnt_in < 500))
- ret2 = __dump_pkt(packet);
+ ret2 = __dump_pkt(packet, handle->w, handle->h);
if (ret2)
LOGW("__dump_pkt() is failed");