CA1401: P/Invoke should not be public.

This commit is contained in:
Huo Yaoyuan
2019-11-17 23:29:09 +08:00
parent 34ec36c2f0
commit 8ceac307f2
3 changed files with 42 additions and 43 deletions

View File

@@ -58,7 +58,6 @@
<Rule Id="CA1305" Action="None" />
<Rule Id="CA1307" Action="None" />
<Rule Id="CA1308" Action="None" />
<Rule Id="CA1401" Action="None" />
<Rule Id="CA1816" Action="None" />
<Rule Id="CA1820" Action="None" />
<Rule Id="CA1826" Action="None" />

View File

@@ -18,67 +18,67 @@ namespace osu.Framework.Android.Graphics.Video
private const string lib_swscale = "libswscale.so";
[DllImport(lib_avutil)]
public static extern AVFrame* av_frame_alloc();
private static extern AVFrame* av_frame_alloc();
[DllImport(lib_avutil)]
public static extern void av_frame_free(AVFrame** frame);
private static extern void av_frame_free(AVFrame** frame);
[DllImport(lib_avutil)]
public static extern int av_image_fill_arrays(ref byte_ptrArray4 dst_data, ref int_array4 dst_linesize, byte* src, AVPixelFormat pix_fmt, int width, int height, int align);
private static extern int av_image_fill_arrays(ref byte_ptrArray4 dst_data, ref int_array4 dst_linesize, byte* src, AVPixelFormat pix_fmt, int width, int height, int align);
[DllImport(lib_avutil)]
public static extern int av_image_get_buffer_size(AVPixelFormat pix_fmt, int width, int height, int align);
private static extern int av_image_get_buffer_size(AVPixelFormat pix_fmt, int width, int height, int align);
[DllImport(lib_avutil)]
public static extern void* av_malloc(ulong size);
private static extern void* av_malloc(ulong size);
[DllImport(lib_avcodec)]
public static extern AVPacket* av_packet_alloc();
private static extern AVPacket* av_packet_alloc();
[DllImport(lib_avcodec)]
public static extern void av_packet_free(AVPacket** pkt);
private static extern void av_packet_free(AVPacket** pkt);
[DllImport(lib_avformat)]
public static extern int av_read_frame(AVFormatContext* s, AVPacket* pkt);
private static extern int av_read_frame(AVFormatContext* s, AVPacket* pkt);
[DllImport(lib_avformat)]
public static extern int av_seek_frame(AVFormatContext* s, int stream_index, long timestamp, int flags);
private static extern int av_seek_frame(AVFormatContext* s, int stream_index, long timestamp, int flags);
[DllImport(lib_avcodec)]
public static extern AVCodec* avcodec_find_decoder(AVCodecID id);
private static extern AVCodec* avcodec_find_decoder(AVCodecID id);
[DllImport(lib_avcodec)]
public static extern int avcodec_open2(AVCodecContext* avctx, AVCodec* codec, AVDictionary** options);
private static extern int avcodec_open2(AVCodecContext* avctx, AVCodec* codec, AVDictionary** options);
[DllImport(lib_avcodec)]
public static extern int avcodec_receive_frame(AVCodecContext* avctx, AVFrame* frame);
private static extern int avcodec_receive_frame(AVCodecContext* avctx, AVFrame* frame);
[DllImport(lib_avcodec)]
public static extern int avcodec_send_packet(AVCodecContext* avctx, AVPacket* avpkt);
private static extern int avcodec_send_packet(AVCodecContext* avctx, AVPacket* avpkt);
[DllImport(lib_avformat)]
public static extern AVFormatContext* avformat_alloc_context();
private static extern AVFormatContext* avformat_alloc_context();
[DllImport(lib_avformat)]
public static extern void avformat_close_input(AVFormatContext** s);
private static extern void avformat_close_input(AVFormatContext** s);
[DllImport(lib_avformat)]
public static extern int avformat_find_stream_info(AVFormatContext* ic, AVDictionary** options);
private static extern int avformat_find_stream_info(AVFormatContext* ic, AVDictionary** options);
[DllImport(lib_avformat)]
public static extern int avformat_open_input(AVFormatContext** ps, [MarshalAs((UnmanagedType)48)] string url, AVInputFormat* fmt, AVDictionary** options);
private static extern int avformat_open_input(AVFormatContext** ps, [MarshalAs((UnmanagedType)48)] string url, AVInputFormat* fmt, AVDictionary** options);
[DllImport(lib_avformat)]
public static extern AVIOContext* avio_alloc_context(byte* buffer, int buffer_size, int write_flag, void* opaque, avio_alloc_context_read_packet_func read_packet, avio_alloc_context_write_packet_func write_packet, avio_alloc_context_seek_func seek);
private static extern AVIOContext* avio_alloc_context(byte* buffer, int buffer_size, int write_flag, void* opaque, avio_alloc_context_read_packet_func read_packet, avio_alloc_context_write_packet_func write_packet, avio_alloc_context_seek_func seek);
[DllImport(lib_swscale)]
public static extern void sws_freeContext(SwsContext* swsContext);
private static extern void sws_freeContext(SwsContext* swsContext);
[DllImport(lib_swscale)]
public static extern SwsContext* sws_getContext(int srcW, int srcH, AVPixelFormat srcFormat, int dstW, int dstH, AVPixelFormat dstFormat, int flags, SwsFilter* srcFilter, SwsFilter* dstFilter, double* param);
private static extern SwsContext* sws_getContext(int srcW, int srcH, AVPixelFormat srcFormat, int dstW, int dstH, AVPixelFormat dstFormat, int flags, SwsFilter* srcFilter, SwsFilter* dstFilter, double* param);
[DllImport(lib_swscale)]
public static extern int sws_scale(SwsContext* c, byte*[] srcSlice, int[] srcStride, int srcSliceY, int srcSliceH, byte*[] dst, int[] dstStride);
private static extern int sws_scale(SwsContext* c, byte*[] srcSlice, int[] srcStride, int srcSliceY, int srcSliceH, byte*[] dst, int[] dstStride);
public AndroidVideoDecoder(string filename, Scheduler scheduler)
: base(filename, scheduler)

View File

@@ -15,67 +15,67 @@ namespace osu.Framework.iOS.Graphics.Video
private const string dll_name = "__Internal";
[DllImport(dll_name)]
public static extern AVFrame* av_frame_alloc();
private static extern AVFrame* av_frame_alloc();
[DllImport(dll_name)]
public static extern void av_frame_free(AVFrame** frame);
private static extern void av_frame_free(AVFrame** frame);
[DllImport(dll_name)]
public static extern int av_image_fill_arrays(ref byte_ptrArray4 dst_data, ref int_array4 dst_linesize, byte* src, AVPixelFormat pix_fmt, int width, int height, int align);
private static extern int av_image_fill_arrays(ref byte_ptrArray4 dst_data, ref int_array4 dst_linesize, byte* src, AVPixelFormat pix_fmt, int width, int height, int align);
[DllImport(dll_name)]
public static extern int av_image_get_buffer_size(AVPixelFormat pix_fmt, int width, int height, int align);
private static extern int av_image_get_buffer_size(AVPixelFormat pix_fmt, int width, int height, int align);
[DllImport(dll_name)]
public static extern void* av_malloc(ulong size);
private static extern void* av_malloc(ulong size);
[DllImport(dll_name)]
public static extern AVPacket* av_packet_alloc();
private static extern AVPacket* av_packet_alloc();
[DllImport(dll_name)]
public static extern void av_packet_free(AVPacket** pkt);
private static extern void av_packet_free(AVPacket** pkt);
[DllImport(dll_name)]
public static extern int av_read_frame(AVFormatContext* s, AVPacket* pkt);
private static extern int av_read_frame(AVFormatContext* s, AVPacket* pkt);
[DllImport(dll_name)]
public static extern int av_seek_frame(AVFormatContext* s, int stream_index, long timestamp, int flags);
private static extern int av_seek_frame(AVFormatContext* s, int stream_index, long timestamp, int flags);
[DllImport(dll_name)]
public static extern AVCodec* avcodec_find_decoder(AVCodecID id);
private static extern AVCodec* avcodec_find_decoder(AVCodecID id);
[DllImport(dll_name)]
public static extern int avcodec_open2(AVCodecContext* avctx, AVCodec* codec, AVDictionary** options);
private static extern int avcodec_open2(AVCodecContext* avctx, AVCodec* codec, AVDictionary** options);
[DllImport(dll_name)]
public static extern int avcodec_receive_frame(AVCodecContext* avctx, AVFrame* frame);
private static extern int avcodec_receive_frame(AVCodecContext* avctx, AVFrame* frame);
[DllImport(dll_name)]
public static extern int avcodec_send_packet(AVCodecContext* avctx, AVPacket* avpkt);
private static extern int avcodec_send_packet(AVCodecContext* avctx, AVPacket* avpkt);
[DllImport(dll_name)]
public static extern AVFormatContext* avformat_alloc_context();
private static extern AVFormatContext* avformat_alloc_context();
[DllImport(dll_name)]
public static extern void avformat_close_input(AVFormatContext** s);
private static extern void avformat_close_input(AVFormatContext** s);
[DllImport(dll_name)]
public static extern int avformat_find_stream_info(AVFormatContext* ic, AVDictionary** options);
private static extern int avformat_find_stream_info(AVFormatContext* ic, AVDictionary** options);
[DllImport(dll_name)]
public static extern int avformat_open_input(AVFormatContext** ps, [MarshalAs((UnmanagedType)48)] string url, AVInputFormat* fmt, AVDictionary** options);
private static extern int avformat_open_input(AVFormatContext** ps, [MarshalAs((UnmanagedType)48)] string url, AVInputFormat* fmt, AVDictionary** options);
[DllImport(dll_name)]
public static extern AVIOContext* avio_alloc_context(byte* buffer, int buffer_size, int write_flag, void* opaque, avio_alloc_context_read_packet_func read_packet, avio_alloc_context_write_packet_func write_packet, avio_alloc_context_seek_func seek);
private static extern AVIOContext* avio_alloc_context(byte* buffer, int buffer_size, int write_flag, void* opaque, avio_alloc_context_read_packet_func read_packet, avio_alloc_context_write_packet_func write_packet, avio_alloc_context_seek_func seek);
[DllImport(dll_name)]
public static extern void sws_freeContext(SwsContext* swsContext);
private static extern void sws_freeContext(SwsContext* swsContext);
[DllImport(dll_name)]
public static extern SwsContext* sws_getContext(int srcW, int srcH, AVPixelFormat srcFormat, int dstW, int dstH, AVPixelFormat dstFormat, int flags, SwsFilter* srcFilter, SwsFilter* dstFilter, double* param);
private static extern SwsContext* sws_getContext(int srcW, int srcH, AVPixelFormat srcFormat, int dstW, int dstH, AVPixelFormat dstFormat, int flags, SwsFilter* srcFilter, SwsFilter* dstFilter, double* param);
[DllImport(dll_name)]
public static extern int sws_scale(SwsContext* c, byte*[] srcSlice, int[] srcStride, int srcSliceY, int srcSliceH, byte*[] dst, int[] dstStride);
private static extern int sws_scale(SwsContext* c, byte*[] srcSlice, int[] srcStride, int srcSliceY, int srcSliceH, byte*[] dst, int[] dstStride);
public IOSVideoDecoder(string filename, Scheduler scheduler)
: base(filename, scheduler)