Consider the endianness when export video frame 27/324027/1 tizen_8.0
authorEunhye Choi <eunhae1.choi@samsung.com>
Mon, 12 May 2025 06:22:20 +0000 (15:22 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Mon, 12 May 2025 10:27:17 +0000 (19:27 +0900)
[Version] 0.0.59

- In Gstreamer, pixel data is stored in memory in a fixed byte order regardless of the
system's endianness. Therefore, the correct format must be set before
passing frame to the rendering system.

Change-Id: If1f59dfe5b0bec0131a462097b47bd6cd486af1a

packaging/libtrackrenderer.spec
src/trackrenderer.cpp

index bdbd8a75efbaa68a23034a15d62abb40ec75dec7..a0e21ca0a6cf2564ddb8fd4d1f75ea43f1970690 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libtrackrenderer
 Summary:    new multimedia streaming player trackrenderer
-Version:    0.0.58
+Version:    0.0.59
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 5f0f9a6386aeddd73b60c7a11761716a3dd68299..ceceead6aeef0727cf8d469b878a40b1cd8f9c9a 100644 (file)
@@ -196,12 +196,19 @@ uint32_t ConvertToTbmFormat(const gchar *data) {
   case GST_STR_FOURCC("S420"):
   case GST_STR_FOURCC("I420"):
     return TBM_FORMAT_YUV420;
+#if G_BYTE_ORDER == G_BIG_ENDIAN
   case GST_STR_FOURCC("BGRA"):
+  case GST_STR_FOURCC("SR32"):
     return TBM_FORMAT_BGRA8888;
   case GST_STR_FOURCC("BGRx"):
     return TBM_FORMAT_BGRX8888;
+#else
+  case GST_STR_FOURCC("BGRA"):
   case GST_STR_FOURCC("SR32"):
     return TBM_FORMAT_ARGB8888;
+  case GST_STR_FOURCC("BGRx"):
+    return TBM_FORMAT_XRGB8888;
+#endif
   default:
     TRACKRENDERER_ERROR("Not supported format %" GST_FOURCC_FORMAT,
                   GST_FOURCC_ARGS(fourcc));
@@ -281,8 +288,8 @@ tbm_surface_h CreateTbmSurfaceWithBuffer(GstBuffer* buffer, GstCaps* caps) {
   }
   BOOST_SCOPE_EXIT_END
 
-  TRACKRENDERER_INFO("width %d, height %d, size %" G_GSIZE_FORMAT ", bo_size %d",
-            width, height, mapinfo.size, bo_size);
+  TRACKRENDERER_INFO("format %s, bo format 0x%X, width %d, height %d, size %" G_GSIZE_FORMAT ", bo_size %d",
+            string_format, bo_format, width, height, mapinfo.size, bo_size);
 
   unsigned char* src = NULL;
   unsigned char* dest = NULL;
@@ -321,6 +328,7 @@ tbm_surface_h CreateTbmSurfaceWithBuffer(GstBuffer* buffer, GstCaps* caps) {
   case TBM_FORMAT_BGRA8888:
   case TBM_FORMAT_BGRX8888:
   case TBM_FORMAT_ARGB8888:
+  case TBM_FORMAT_XRGB8888:
   {
     GstVideoMeta *vmeta = gst_buffer_get_video_meta(buffer);
     int src_stride = (vmeta) ? (vmeta->stride[0]) : (width * 4);