[Multimedia] Add MediaPacket TBM surface APIs (#6278)
authorHaesu Gwon <haesu.gwon@samsung.com>
Wed, 28 Aug 2024 00:03:36 +0000 (09:03 +0900)
committerGitHub <noreply@github.com>
Wed, 28 Aug 2024 00:03:36 +0000 (09:03 +0900)
* [Multimedia] Add MediaPacket TBM surface API

src/Tizen.Multimedia/Interop/Interop.MediaTool.cs
src/Tizen.Multimedia/MediaTool/MediaPacket.cs

index d088bbff8bcf11e31015bf3ab7e18d939e5c604d..029ed1cc2548b738fbbdee87c281885cc83a391e 100644 (file)
@@ -115,6 +115,13 @@ namespace Tizen.Multimedia
 
             [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_duration")]
             internal static extern int GetDuration(IntPtr handle, out ulong value);
+
+            [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_tbm_surface")]
+            internal static extern int GetTbmSurface(IntPtr handle, out IntPtr surface);
+
+            [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_has_tbm_surface_buffer")]
+            internal static extern int HasTbmSurface(IntPtr handle, out bool hasTbmSurface);
+
         }
 
         internal static class MediaFormat
index affdc4d77f204af9fd419d59c4ee8cb91ae64e48..7d49b8ff7c49b6e603b542085fb38609528fe9e1 100644 (file)
@@ -502,6 +502,47 @@ namespace Tizen.Multimedia
             }
         }
 
+        /// <summary>
+        /// Gets the pointer to the TBM surface object associated with the packet.
+        /// </summary>
+        /// <value>
+        /// The pointer to the TBM surface object.<br/>
+        /// If packet doesn't have TBM surface, this will return IntPtr.Zero.
+        /// </value>
+        /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
+        /// <since_tizen> 12 </since_tizen>
+        public IntPtr TbmSurface
+        {
+            get
+            {
+                ValidateNotDisposed();
+
+                int ret = Native.GetTbmSurface(_handle, out var value);
+                MultimediaDebug.AssertNoError(ret);
+
+                return value;
+            }
+        }
+
+        /// <summary>
+        /// Gets a value indicating whether the packet has TBM surface or not.
+        /// </summary>
+        /// <value>true if the packet has TBM surface; otherwise, false.</value>
+        /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
+        /// <since_tizen> 12 </since_tizen>
+        public bool HasTbmSurface
+        {
+            get
+            {
+                ValidateNotDisposed();
+
+                int ret = Native.HasTbmSurface(_handle, out var value);
+                MultimediaDebug.AssertNoError(ret);
+
+                return value;
+            }
+        }
+
         #region Dispose support
         /// <summary>
         /// Gets a value indicating whether the packet has been disposed.