+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-using System.Runtime.InteropServices;
-
-internal static partial class Interop
-{
- internal static partial class Libc
- {
- [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)]
- internal static extern int Free(IntPtr ptr);
- }
-}
internal static partial class Libraries
{
public const string MediaContent = "libcapi-content-media-content.so.0";
- public const string Libc = "libc.so.6";
}
}
}
finally
{
- Interop.Libc.Free(val);
+ Marshal.FreeHGlobal(val);
}
}
var current = path;
for (int i = 0; i < length; i++)
{
- Interop.Libc.Free(Marshal.ReadIntPtr(current));
+ Marshal.FreeHGlobal(current);
current = (IntPtr)((long)current + Marshal.SizeOf(typeof(IntPtr)));
}
}
}
finally
{
- LibcSupport.Free(val);
+ Marshal.FreeHGlobal(val);
}
}
}
finally
{
- LibcSupport.Free(val);
+ Marshal.FreeHGlobal(val);
}
}
}
finally
{
- LibcSupport.Free(code);
+ // LibcSupport.Free(code);
+ // Marshal.FreeHGlobal(Marshal.ReadIntPtr(code));
+ Marshal.FreeHGlobal(code);
}
}
}
finally
{
- LibcSupport.Free(audioPtr);
- LibcSupport.Free(videoPtr);
+ Marshal.FreeHGlobal(audioPtr);
+ Marshal.FreeHGlobal(videoPtr);
}
}
}
finally
{
- LibcSupport.Free(ptr);
+ Marshal.FreeHGlobal(ptr);
}
}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-using System.Runtime.InteropServices;
-
-internal static partial class Interop
-{
- internal static partial class Libc
- {
- [DllImport(Libraries.Libc, EntryPoint = "free")]
- public static extern void Free(IntPtr userData);
- }
-}
{
public const string MetadataEditor = "libcapi-media-metadata-editor.so";
public const string MetadataExtractor = "libcapi-media-metadata-extractor.so";
- public const string Libc = "libc.so.6";
}
}
using System.IO;
using System.Runtime.InteropServices;
+using Native = Interop.MetadataEditor;
+
namespace Tizen.Multimedia
{
/// <summary>
throw new ArgumentException($"{nameof(path)} is a zero-length string.", nameof(path));
}
- Interop.MetadataEditor.Create(out _handle).ThrowIfError("Failed to create metadata");
+ Native.Create(out _handle).ThrowIfError("Failed to create metadata");
try
{
- Interop.MetadataEditor.SetPath(Handle, path).ThrowIfError("Failed to set path");
+ Native.SetPath(Handle, path).ThrowIfError("Failed to set path");
_isFileReadOnly = File.GetAttributes(path).HasFlag(FileAttributes.ReadOnly);
}
try
{
- Interop.MetadataEditor.GetMetadata(Handle, attr, out val)
+ Native.GetMetadata(Handle, attr, out val)
.ThrowIfError("Failed to get metadata");
return Marshal.PtrToStringAnsi(val);
}
finally
{
- Interop.Libc.Free(val);
+ Marshal.FreeHGlobal(val);
}
}
throw new InvalidOperationException("The media file is read-only.");
}
- Interop.MetadataEditor.SetMetadata(Handle, attr, value).ThrowIfError("Failed to set value");
+ Native.SetMetadata(Handle, attr, value).ThrowIfError("Failed to set value");
}
/// <summary>
throw new InvalidOperationException("The media file is read-only.");
}
- Interop.MetadataEditor.UpdateMetadata(Handle).ThrowIfError("Failed to update file");
+ Native.UpdateMetadata(Handle).ThrowIfError("Failed to update file");
}
/// <summary>
try
{
- Interop.MetadataEditor.GetPicture(Handle, index, out data, out var size, out mimeType).
+ Native.GetPicture(Handle, index, out data, out var size, out mimeType).
ThrowIfError("Failed to get the value");
if (size > 0)
{
if (data != IntPtr.Zero)
{
- Interop.Libc.Free(data);
+ Marshal.FreeHGlobal(data);
}
if (mimeType != IntPtr.Zero)
{
- Interop.Libc.Free(mimeType);
+ Marshal.FreeHGlobal(mimeType);
}
}
}
throw new InvalidOperationException("The media file is read-only.");
}
- Interop.MetadataEditor.AddPicture(Handle, path).
+ Native.AddPicture(Handle, path).
ThrowIfError("Failed to append picture");
}
throw new InvalidOperationException("The media file is read-only.");
}
- Interop.MetadataEditor.RemovePicture(Handle, index).ThrowIfError("Failed to remove picture");
+ Native.RemovePicture(Handle, index).ThrowIfError("Failed to remove picture");
}
/// <summary>
{
if (_handle != IntPtr.Zero)
{
- Interop.MetadataEditor.Destroy(_handle);
+ Native.Destroy(_handle);
_handle = IntPtr.Zero;
}
using System;
using System.Diagnostics;
-using static Interop.MetadataExtractor;
namespace Tizen.Multimedia
{
using System.IO;
using System.Runtime.InteropServices;
+using Native = Interop.MetadataExtractor;
+
namespace Tizen.Multimedia
{
/// <summary>
private void Create(Func<MetadataExtractorError> initFunc)
{
MetadataExtractorRetValidator.ThrowIfError(
- Interop.MetadataExtractor.Create(out _handle), "Failed to create metadata");
+ Native.Create(out _handle), "Failed to create metadata");
try
{
throw new ArgumentNullException(nameof(path));
}
- Create(() => Interop.MetadataExtractor.SetPath(_handle, path));
+ Create(() => Native.SetPath(_handle, path));
}
/// <summary>
try
{
- Create(() => Interop.MetadataExtractor.SetBuffer(_handle, _buffer, buffer.Length));
+ Create(() => Native.SetBuffer(_handle, _buffer, buffer.Length));
}
catch (Exception)
{
{
int size = 0;
- var ret = Interop.MetadataExtractor.GetArtwork(Handle, out data, out size, out mimeType);
+ var ret = Native.GetArtwork(Handle, out data, out size, out mimeType);
MetadataExtractorRetValidator.ThrowIfError(ret, "Failed to get value");
if (size > 0)
}
finally
{
- Interop.Libc.Free(data);
- Interop.Libc.Free(mimeType);
+ Marshal.FreeHGlobal(data);
+ Marshal.FreeHGlobal(mimeType);
}
}
{
uint timestamp = 0;
- var ret = Interop.MetadataExtractor.GetSynclyrics(Handle, index, out timestamp, out lyrics);
+ var ret = Native.GetSynclyrics(Handle, index, out timestamp, out lyrics);
MetadataExtractorRetValidator.ThrowIfError(ret, "Failed to get sync lyrics");
if (lyrics == IntPtr.Zero)
}
finally
{
- Interop.Libc.Free(lyrics);
+ Marshal.FreeHGlobal(lyrics);
}
}
{
int size = 0;
- var ret = Interop.MetadataExtractor.GetFrame(Handle, out data, out size);
+ var ret = Native.GetFrame(Handle, out data, out size);
MetadataExtractorRetValidator.ThrowIfError(ret, "Failed to get value");
if (size == 0)
}
finally
{
- Interop.Libc.Free(data);
+ Marshal.FreeHGlobal(data);
}
}
{
int size = 0;
- var ret = Interop.MetadataExtractor.GetFrameAtTime(Handle, timeStamp, accurate, out data, out size);
+ var ret = Native.GetFrameAtTime(Handle, timeStamp, accurate, out data, out size);
MetadataExtractorRetValidator.ThrowIfError(ret, "Failed to get value");
if (size == 0)
}
finally
{
- Interop.Libc.Free(data);
+ Marshal.FreeHGlobal(data);
}
}
if (_handle != IntPtr.Zero)
{
- var ret = Interop.MetadataExtractor.Destroy(_handle);
+ var ret = Native.Destroy(_handle);
if (ret != MetadataExtractorError.None)
{
Log.Error(typeof(MetadataExtractor).FullName, $"DestroyHandle failed : {ret}.");
using System.Diagnostics;
using System.Runtime.InteropServices;
using Native = Interop.MetadataExtractor;
-using static Interop;
namespace Tizen.Multimedia
{
}
finally
{
- Libc.Free(valuePtr);
+ Marshal.FreeHGlobal(valuePtr);
}
}
}
finally
{
- Tizen.Multimedia.LibcSupport.Free(valuePtr);
+ Marshal.FreeHGlobal(valuePtr);
}
}
}
finally
{
- Tizen.Multimedia.LibcSupport.Free(valuePtr);
+ Marshal.FreeHGlobal(valuePtr);
}
}
}
finally
{
- Tizen.Multimedia.LibcSupport.Free(playlistName);
- Tizen.Multimedia.LibcSupport.Free(index);
+ Marshal.FreeHGlobal(playlistName);
+ Marshal.FreeHGlobal(index);
}
}
}
finally
{
- Tizen.Multimedia.LibcSupport.Free(valuePtr);
+ Marshal.FreeHGlobal(valuePtr);
}
}
{
if (outBuffer != IntPtr.Zero)
{
- LibcSupport.Free(outBuffer);
+ Marshal.FreeHGlobal(outBuffer);
}
if (imageHandle != IntPtr.Zero)
}
finally
{
- Interop.Libc.Free(outBuffer);
+ Marshal.FreeHGlobal(outBuffer);
}
}
using System.IO;
using System.Threading;
using System.Threading.Tasks;
+using System.Runtime.InteropServices;
using Native = Interop.ThumbnailExtractor;
namespace Tizen.Multimedia.Util
{
if (thumbData != IntPtr.Zero)
{
- LibcSupport.Free(thumbData);
+ Marshal.FreeHGlobal(thumbData);
}
}
}
}
finally
{
- LibcSupport.Free(ptr);
+ Marshal.FreeHGlobal(ptr);
}
}
var current = values;
for (int i = 0; i < size; i++)
{
- LibcSupport.Free(Marshal.ReadIntPtr(current));
+ Marshal.FreeHGlobal(current);
current = (IntPtr)((long)current + Marshal.SizeOf(typeof(IntPtr)));
}
}
{
if (unmangedArray != IntPtr.Zero)
{
- LibcSupport.Free(unmangedArray);
+ Marshal.FreeHGlobal(unmangedArray);
}
}
}
}
finally
{
- LibcSupport.Free(roiPtr);
+ Marshal.FreeHGlobal(roiPtr);
}
}
set
[assembly: InternalsVisibleTo("Tizen.Multimedia.Radio, " + PublicKey.Value)]
+[assembly: InternalsVisibleTo("Tizen.Multimedia.Metadata, " + PublicKey.Value)]
+
internal static class PublicKey
{
internal const string Value =
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-
-namespace Tizen.Multimedia
-{
- internal static class LibcSupport
- {
- internal static void Free(IntPtr ptr)
- {
- Interop.Libc.Free(ptr);
- }
- }
-}
internal const int R_OK = 0x04;
}
- [DllImport(Libraries.Libc, EntryPoint = "free")]
+ [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)]
public static extern void Free(IntPtr ptr);
- [DllImport(Libraries.Libc, EntryPoint = "access")]
+ [DllImport(Libraries.Libc, EntryPoint = "access", CallingConvention = CallingConvention.Cdecl)]
public static extern int Access(string path, int mode);
}
}
public const string SoundManager = "libcapi-media-sound-manager.so.0";
public const string MediaTool = "libcapi-media-tool.so.0";
public const string Libc = "libc.so.6";
+ public const string GLib = "libglib-2.0.so.0";
}
}
}