Release 4.0.0-preview1-00201
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia / Common / IMediaBuffer.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18
19 namespace Tizen.Multimedia
20 {
21     /// <summary>
22     /// Provides functionality to read and write the media buffer.
23     /// </summary>
24     public interface IMediaBuffer
25     {
26         /// <summary>
27         /// Gets or sets a value at the specified index.
28         /// </summary>
29         /// <param name="index">The index of the value to get or set.</param>
30         /// <exception cref="ArgumentOutOfRangeException">
31         ///     <paramref name="index"/> is less than zero.\n
32         ///     -or-\n
33         ///     <paramref name="index"/> is equal to or greater than <see cref="Length"/>.
34         /// </exception>
35         /// <exception cref="ObjectDisposedException">The object that owns the current buffer has already been disposed of.</exception>
36         /// <exception cref="InvalidOperationException">The buffer is not available, i.e. not writable state.</exception>
37         byte this[int index]
38         {
39             get;
40             set;
41         }
42
43         /// <summary>
44         /// Gets the size of the buffer, in bytes.
45         /// </summary>
46         int Length { get; }
47
48         /// <summary>
49         /// Gets the value indicating whether the <see cref="IMediaBuffer"/> is read-only.
50         /// </summary>
51         /// <value> true if the <see cref="IMediaBuffer"/> is read-only; otherwise, false.
52         bool IsReadOnly { get; }
53
54         /// <summary>
55         /// Copies data from a byte array to the buffer.
56         /// </summary>
57         /// <param name="dest">The array to copy to.</param>
58         /// <param name="startIndex">The zero-based index in the source array where copying should start.</param>
59         /// <param name="length">The number of array elements to copy.</param>
60         /// <exception cref="ArgumentNullException"><paramref name="dest"/> is null.</exception>
61         /// <exception cref="ArgumentOutOfRangeException"><paramref name="startIndex"/> or <paramref name="length"/> is not valid.</exception>
62         /// <exception cref="ObjectDisposedException">The object that owns the current buffer has already been disposed of.</exception>
63         void CopyTo(byte[] dest, int startIndex, int length);
64
65         /// <summary>
66         /// Copies data from a byte array to the buffer.
67         /// </summary>
68         /// <param name="dest">The array to copy to.</param>
69         /// <param name="startIndex">The zero-based index in the source array where copying should start.</param>
70         /// <param name="length">The number of array elements to copy.</param>
71         /// <param name="offset">The zero-based index in the buffer where copying should start.</param>
72         /// <exception cref="ArgumentNullException"><paramref name="dest"/> is null.</exception>
73         /// <exception cref="ArgumentOutOfRangeException"><paramref name="startIndex"/>, <paramref name="length"/>,
74         ///     or <paramref name="offset"/> is not valid.</exception>
75         /// <exception cref="ObjectDisposedException">The object that owns the current buffer has already been disposed of.</exception>
76         void CopyTo(byte[] dest, int startIndex, int length, int offset);
77
78         /// <summary>
79         /// Copies data from the buffer to a byte array.
80         /// </summary>
81         /// <param name="source">The array to copy from.</param>
82         /// <param name="startIndex">The zero-based index in the destination array where copying should start.</param>
83         /// <param name="length">The number of elements to copy.</param>
84         /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
85         /// <exception cref="ArgumentOutOfRangeException"><paramref name="startIndex"/> or <paramref name="length"/> is not valid.</exception>
86         /// <exception cref="ObjectDisposedException">The object that owns the current buffer has already been disposed of.</exception>
87         /// <exception cref="InvalidOperationException">The buffer is not available. i.e. not writable state.</exception>
88         void CopyFrom(byte[] source, int startIndex, int length);
89
90         /// <summary>
91         /// Copies data from the buffer to a byte array.
92         /// </summary>
93         /// <param name="source">The array to copy from.</param>
94         /// <param name="startIndex">The zero-based index in the destination array where copying should start.</param>
95         /// <param name="length">The number of elements to copy.</param>
96         /// <param name="offset">The zero-based index in the buffer where copying should start.</param>
97         /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
98         /// <exception cref="ArgumentOutOfRangeException"><paramref name="startIndex"/>, <paramref name="length"/>,
99         ///     or <paramref name="offset"/> is not valid.</exception>
100         /// <exception cref="ObjectDisposedException">The object that owns the current buffer has already been disposed of.</exception>
101         /// <exception cref="InvalidOperationException">The buffer is not available. i.e. not writable state.</exception>
102         void CopyFrom(byte[] source, int startIndex, int length, int offset);
103     }
104 }