Consider the endianness when export video frame 99/323999/1 accepted/tizen_unified accepted/tizen_unified_x tizen accepted/tizen/unified/20250514.114139 accepted/tizen/unified/x/20250515.044727
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 06:26:21 +0000 (15:26 +0900)
[Version] 0.1.9

- 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 d333aaf45f5ad7eff2de0696437d7911e3794c12..484ac4441678068f4774f1bfb3ae499ceb98a847 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libtrackrenderer
 Summary:    new multimedia streaming player trackrenderer
-Version:    0.1.8
+Version:    0.1.9
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 8fd6a874a9ff9710dd280206199a9b3f28a78e6a..afb7cb9270a11d48ae3a0ed2322b3edb6406d157 100644 (file)
@@ -139,12 +139,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));
@@ -224,8 +231,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;
@@ -264,6 +271,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);