2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 namespace Tizen.Multimedia
22 /// Provides functionality to read and write a media buffer.
24 public interface IMediaBuffer
27 /// Gets or sets a value at the specified index.
29 /// <param name="index">The index of the value to get or set.</param>
30 /// <exception cref="ArgumentOutOfRangeException">
31 /// index is less than zero.\n
33 /// index is equal to or greater than <see cref="Length"/>.
35 /// <exception cref="ObjectDisposedException">The object that owns the current buffer already has been disposed of.</exception>
36 /// <exception cref="InvalidOperationException">The buffer is not available. i.e. not writable state.</exception>
44 /// Gets the size of the buffer, in bytes.
49 /// Gets the value indicating whether the <see cref="IMediaBuffer"/> is read-only.
51 /// <value> true if the <see cref="IMediaBuffer"/> is read-only; otherwise, false.
52 bool IsReadOnly { get; }
55 /// Copies data from a byte array to the buffer.
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="ArgumentOutOfRangeException">startIndex or length is not valid.</exception>
61 /// <exception cref="ObjectDisposedException">The object that owns the current buffer already has been disposed of.</exception>
62 void CopyTo(byte[] dest, int startIndex, int length);
65 /// Copies data from a byte array to the buffer.
67 /// <param name="dest">The array to copy to.</param>
68 /// <param name="startIndex">The zero-based index in the source array where copying should start.</param>
69 /// <param name="length">The number of array elements to copy.</param>
70 /// <param name="offset">The zero-based index in the buffer where copying should start.</param>
71 /// <exception cref="ArgumentOutOfRangeException">startIndex, offset or length is not valid.</exception>
72 /// <exception cref="ObjectDisposedException">The object that owns the current buffer already has been disposed of.</exception>
73 void CopyTo(byte[] dest, int startIndex, int length, int offset);
76 /// Copies data from the buffer to a byte array.
78 /// <param name="source">The array to copy from.</param>
79 /// <param name="startIndex">The zero-based index in the dest array where copying should start.</param>
80 /// <param name="length">The number of elements to copy.</param>
81 /// <exception cref="ArgumentOutOfRangeException">startIndex or length is not valid.</exception>
82 /// <exception cref="ObjectDisposedException">The object that owns the current buffer already has been disposed of.</exception>
83 /// <exception cref="InvalidOperationException">The buffer is not available. i.e. not writable state.</exception>
85 void CopyFrom(byte[] source, int startIndex, int length);
88 /// Copies data from the buffer to a byte array.
90 /// <param name="source">The array to copy from.</param>
91 /// <param name="startIndex">The zero-based index in the dest array where copying should start.</param>
92 /// <param name="length">The number of elements to copy.</param>
93 /// <param name="offset">The zero-based index in the buffer where copying should start.</param>
94 /// <exception cref="ArgumentOutOfRangeException">startIndex, offset or length is not valid.</exception>
95 /// <exception cref="ObjectDisposedException">The object that owns the current buffer already has been disposed of.</exception>
96 /// <exception cref="InvalidOperationException">The buffer is not available. i.e. not writable state.</exception>
97 void CopyFrom(byte[] source, int startIndex, int length, int offset);