2013-10-11 09:34:46 +00:00
|
|
|
// Copyright (C) 2013 Stephan Sundermann <stephansundermann@gmail.com>
|
|
|
|
//
|
2014-05-28 11:29:36 +00:00
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2.1 of the License, or (at your option) any later version.
|
2013-10-11 09:34:46 +00:00
|
|
|
//
|
2014-05-28 11:29:36 +00:00
|
|
|
// This library is distributed in the hope that it will be useful,
|
2013-10-11 09:34:46 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2014-05-28 11:29:36 +00:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
2013-10-11 09:34:46 +00:00
|
|
|
//
|
2014-05-28 11:29:36 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
// 02110-1301 USA
|
2013-10-11 09:34:46 +00:00
|
|
|
|
2021-09-30 11:02:26 +00:00
|
|
|
namespace Gst {
|
2013-10-11 09:34:46 +00:00
|
|
|
using System;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
2021-09-30 11:02:26 +00:00
|
|
|
public partial class TagList {
|
|
|
|
public object this[string tag, uint index] {
|
|
|
|
get { return GetValueIndex(tag, index).Val; }
|
2013-10-11 09:34:46 +00:00
|
|
|
}
|
|
|
|
|
2021-09-30 11:02:26 +00:00
|
|
|
public object this[string tag] {
|
2013-10-11 09:34:46 +00:00
|
|
|
get {
|
2014-08-07 15:15:29 +00:00
|
|
|
var v = GLib.Value.Empty;
|
2013-10-11 09:34:46 +00:00
|
|
|
bool success;
|
|
|
|
|
2021-09-30 11:02:26 +00:00
|
|
|
success = CopyValue(ref v, this, tag);
|
2013-10-11 09:34:46 +00:00
|
|
|
|
|
|
|
if (!success)
|
|
|
|
return null;
|
|
|
|
|
|
|
|
object ret = (object)v.Val;
|
2021-09-30 11:02:26 +00:00
|
|
|
v.Dispose();
|
2013-10-11 09:34:46 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-02 14:14:01 +00:00
|
|
|
public string[] Tags {
|
|
|
|
get {
|
2021-09-30 11:02:26 +00:00
|
|
|
int size = NTags();
|
2013-11-02 14:14:01 +00:00
|
|
|
string[] tags = new string[size];
|
|
|
|
for (uint i = 0; i < size; i++)
|
2021-09-30 11:02:26 +00:00
|
|
|
tags[i] = NthTagName(i);
|
2013-11-02 14:14:01 +00:00
|
|
|
|
|
|
|
return tags;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-30 11:02:26 +00:00
|
|
|
public void Add(Gst.TagMergeMode mode, string tag, object value) {
|
|
|
|
if (!Tag.Exists(tag))
|
|
|
|
throw new ArgumentException(String.Format("Invalid tag name '{0}'", tag));
|
2013-10-11 09:34:46 +00:00
|
|
|
|
2021-09-30 11:02:26 +00:00
|
|
|
GLib.Value v = new GLib.Value(value);
|
2013-10-11 09:34:46 +00:00
|
|
|
|
2021-09-30 11:02:26 +00:00
|
|
|
AddValue(mode, tag, v);
|
|
|
|
v.Dispose();
|
2013-10-11 09:34:46 +00:00
|
|
|
}
|
|
|
|
}
|
2021-09-30 11:02:26 +00:00
|
|
|
}
|