Remove unnecessary lock

This commit is contained in:
Flamefire committed 2014-12-02 20:59:45 +01:00
1 parent 4b0f563a6c
commit c96fac02c2
1 file changed
-41
@@ -190,8 +190,6 @@ namespace Vocaluxe.Lib.Video.Acinerella
#endif #endif
#endif #endif
private static readonly Object _Lock = new Object();
// Defines the type of an Acinerella media stream. Currently only video and // Defines the type of an Acinerella media stream. Currently only video and
// audio streams are supported, subtitle and data streams will be marked as // audio streams are supported, subtitle and data streams will be marked as
// "unknown". // "unknown".
@@ -202,12 +200,9 @@ namespace Vocaluxe.Lib.Video.Acinerella
private static extern IntPtr _ac_init(); private static extern IntPtr _ac_init();
public static IntPtr AcInit() public static IntPtr AcInit()
{
lock (_Lock)
{ {
return _ac_init(); return _ac_init();
} }
}
// Frees an Acinerella instance. // Frees an Acinerella instance.
//procedure ac_free(inst: PAc_instance); cdecl; external ac_dll; //procedure ac_free(inst: PAc_instance); cdecl; external ac_dll;
@@ -215,12 +210,9 @@ namespace Vocaluxe.Lib.Video.Acinerella
private static extern void _ac_free(IntPtr pAcInstance); private static extern void _ac_free(IntPtr pAcInstance);
public static void AcFree(IntPtr pAcInstance) public static void AcFree(IntPtr pAcInstance)
{
lock (_Lock)
{ {
_ac_free(pAcInstance); _ac_free(pAcInstance);
} }
}
// Opens a media file. // Opens a media file.
// @param(inst specifies the Acinerella Instance the stream should be opened for) // @param(inst specifies the Acinerella Instance the stream should be opened for)
@@ -273,12 +265,9 @@ namespace Vocaluxe.Lib.Video.Acinerella
// ReSharper disable UnusedMethodReturnValue.Global // ReSharper disable UnusedMethodReturnValue.Global
public static Int32 AcOpen2(IntPtr pAcInstance, string filename) public static Int32 AcOpen2(IntPtr pAcInstance, string filename)
// ReSharper restore UnusedMethodReturnValue.Global // ReSharper restore UnusedMethodReturnValue.Global
{
lock (_Lock)
{ {
return _ac_open2(pAcInstance, filename); return _ac_open2(pAcInstance, filename);
} }
}
// Closes an opened media file. // Closes an opened media file.
//procedure ac_close(inst: PAc_instance);cdecl; external ac_dll; //procedure ac_close(inst: PAc_instance);cdecl; external ac_dll;
@@ -286,12 +275,9 @@ namespace Vocaluxe.Lib.Video.Acinerella
private static extern void _ac_close(IntPtr pAcInstance); private static extern void _ac_close(IntPtr pAcInstance);
public static void AcClose(IntPtr pAcInstance) public static void AcClose(IntPtr pAcInstance)
{
lock (_Lock)
{ {
_ac_close(pAcInstance); _ac_close(pAcInstance);
} }
}
// Stores information in "pInfo" about stream number "nb". // Stores information in "pInfo" about stream number "nb".
//procedure ac_get_stream_info(inst: PAc_instance; nb: integer; pinfo: PAc_stream_info); cdecl; external ac_dll; //procedure ac_get_stream_info(inst: PAc_instance; nb: integer; pinfo: PAc_stream_info); cdecl; external ac_dll;
@@ -299,12 +285,9 @@ namespace Vocaluxe.Lib.Video.Acinerella
private static extern void _ac_get_stream_info(IntPtr pAcInstance, Int32 nb, out SACStreamInfo info); private static extern void _ac_get_stream_info(IntPtr pAcInstance, Int32 nb, out SACStreamInfo info);
public static void AcGetStreamInfo(IntPtr pAcInstance, Int32 nb, out SACStreamInfo info) public static void AcGetStreamInfo(IntPtr pAcInstance, Int32 nb, out SACStreamInfo info)
{
lock (_Lock)
{ {
_ac_get_stream_info(pAcInstance, nb, out info); _ac_get_stream_info(pAcInstance, nb, out info);
} }
}
// Reads a package from an opened media file. // Reads a package from an opened media file.
//function ac_read_package(inst: PAc_instance): PAc_package; cdecl; external ac_dll; //function ac_read_package(inst: PAc_instance): PAc_package; cdecl; external ac_dll;
@@ -320,23 +303,17 @@ namespace Vocaluxe.Lib.Video.Acinerella
private static extern IntPtr _ac_create_video_decoder(IntPtr pAcInstance); private static extern IntPtr _ac_create_video_decoder(IntPtr pAcInstance);
public static IntPtr AcCreateVideoDecoder(IntPtr pAcInstance) public static IntPtr AcCreateVideoDecoder(IntPtr pAcInstance)
{
lock (_Lock)
{ {
return _ac_create_video_decoder(pAcInstance); return _ac_create_video_decoder(pAcInstance);
} }
}
[DllImport(_AcDll, EntryPoint = "ac_create_audio_decoder", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] [DllImport(_AcDll, EntryPoint = "ac_create_audio_decoder", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
private static extern IntPtr _ac_create_audio_decoder(IntPtr pAcInstance); private static extern IntPtr _ac_create_audio_decoder(IntPtr pAcInstance);
public static IntPtr AcCreateAudioDecoder(IntPtr pAcInstance) public static IntPtr AcCreateAudioDecoder(IntPtr pAcInstance)
{
lock (_Lock)
{ {
return _ac_create_audio_decoder(pAcInstance); return _ac_create_audio_decoder(pAcInstance);
} }
}
// Frees an created decoder. // Frees an created decoder.
//procedure ac_free_decoder(pDecoder: PAc_decoder); cdecl; external ac_dll; //procedure ac_free_decoder(pDecoder: PAc_decoder); cdecl; external ac_dll;
@@ -344,12 +321,9 @@ namespace Vocaluxe.Lib.Video.Acinerella
private static extern void _ac_free_decoder(IntPtr pAcDecoder); private static extern void _ac_free_decoder(IntPtr pAcDecoder);
public static void AcFreeDecoder(IntPtr pAcDecoder) public static void AcFreeDecoder(IntPtr pAcDecoder)
{
lock (_Lock)
{ {
_ac_free_decoder(pAcDecoder); _ac_free_decoder(pAcDecoder);
} }
}
// Decodes a package using the specified decoder. The decodec data is stored in the // Decodes a package using the specified decoder. The decodec data is stored in the
// "buffer" property of the decoder. // "buffer" property of the decoder.
@@ -358,45 +332,33 @@ namespace Vocaluxe.Lib.Video.Acinerella
private static extern Int32 _ac_decode_package(IntPtr pAcPackage, IntPtr pAcDecoder); private static extern Int32 _ac_decode_package(IntPtr pAcPackage, IntPtr pAcDecoder);
public static bool AcDecodePackage(IntPtr pAcPackage, IntPtr pAcDecoder) public static bool AcDecodePackage(IntPtr pAcPackage, IntPtr pAcDecoder)
{
lock (_Lock)
{ {
return _ac_decode_package(pAcPackage, pAcDecoder) != 0; return _ac_decode_package(pAcPackage, pAcDecoder) != 0;
} }
}
[DllImport(_AcDll, EntryPoint = "ac_get_audio_frame", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] [DllImport(_AcDll, EntryPoint = "ac_get_audio_frame", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
private static extern Int32 _ac_get_audio_frame(IntPtr pAcInstance, IntPtr pAcDecoder); private static extern Int32 _ac_get_audio_frame(IntPtr pAcInstance, IntPtr pAcDecoder);
public static bool AcGetAudioFrame(IntPtr pAcInstance, IntPtr pAcDecoder) public static bool AcGetAudioFrame(IntPtr pAcInstance, IntPtr pAcDecoder)
{
lock (_Lock)
{ {
return _ac_get_audio_frame(pAcInstance, pAcDecoder) != 0; return _ac_get_audio_frame(pAcInstance, pAcDecoder) != 0;
} }
}
[DllImport(_AcDll, EntryPoint = "ac_get_frame", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] [DllImport(_AcDll, EntryPoint = "ac_get_frame", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
private static extern Int32 _ac_get_frame(IntPtr pAcInstance, IntPtr pAcDecoder); private static extern Int32 _ac_get_frame(IntPtr pAcInstance, IntPtr pAcDecoder);
public static bool AcGetFrame(IntPtr pAcInstance, IntPtr pAcDecoder) public static bool AcGetFrame(IntPtr pAcInstance, IntPtr pAcDecoder)
{
lock (_Lock)
{ {
return _ac_get_frame(pAcInstance, pAcDecoder) != 0; return _ac_get_frame(pAcInstance, pAcDecoder) != 0;
} }
}
[DllImport(_AcDll, EntryPoint = "ac_skip_frames", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] [DllImport(_AcDll, EntryPoint = "ac_skip_frames", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
private static extern Int32 _ac_skip_frames(IntPtr pAcInstance, IntPtr pAcDecoder, Int32 num); private static extern Int32 _ac_skip_frames(IntPtr pAcInstance, IntPtr pAcDecoder, Int32 num);
public static bool AcSkipFrames(IntPtr pAcInstance, IntPtr pAcDecoder, Int32 num) public static bool AcSkipFrames(IntPtr pAcInstance, IntPtr pAcDecoder, Int32 num)
{
lock (_Lock)
{ {
return _ac_skip_frames(pAcInstance, pAcDecoder, num) != 0; return _ac_skip_frames(pAcInstance, pAcDecoder, num) != 0;
} }
}
// Seeks to the given target position in the file. The seek funtion is not able to seek a single audio/video stream // Seeks to the given target position in the file. The seek funtion is not able to seek a single audio/video stream
// but seeks the whole file forward. The deocder parameter is only used as an timecode reference. // but seeks the whole file forward. The deocder parameter is only used as an timecode reference.
@@ -407,12 +369,9 @@ namespace Vocaluxe.Lib.Video.Acinerella
private static extern Int32 _ac_seek(IntPtr pAcDecoder, Int32 dir, Int64 targetPos); private static extern Int32 _ac_seek(IntPtr pAcDecoder, Int32 dir, Int64 targetPos);
public static bool AcSeek(IntPtr pAcDecoder, Int32 dir, Int64 targetPos) public static bool AcSeek(IntPtr pAcDecoder, Int32 dir, Int64 targetPos)
{
lock (_Lock)
{ {
return _ac_seek(pAcDecoder, dir, targetPos) != 0; return _ac_seek(pAcDecoder, dir, targetPos) != 0;
} }
}
//function ac_probe_input_buffer(buf: PChar; bufsize: Integer; filename: PChar; //function ac_probe_input_buffer(buf: PChar; bufsize: Integer; filename: PChar;
//var score_max: Integer): PAc_proberesult; cdecl; external ac_dll; //var score_max: Integer): PAc_proberesult; cdecl; external ac_dll;