Exemple #1
0
 public void Add(string key, string value, DictFlags flags = DefaultFlags)
 {
     unsafe
     {
         ffmpeg.av_dict_set(ppDictionary, key, value, (int)flags).ThrowExceptionIfError();
     }
 }
Exemple #2
0
 public int Add(string key, string value, DictFlags flags)
 {
     fixed(AVDictionary **pp = &pDictionary)
     {
         return(ffmpeg.av_dict_set(pp, key, value, (int)flags).ThrowIfError());
     }
 }
        public string[] GetValue(string key, DictFlags flags)
        {
            List <string>      output = new List <string>();
            AVDictionaryEntry *t      = null;

            while ((t = ffmpeg.av_dict_get(*ppDictionary, key, t, (int)flags)) != null)
            {
                output.Add((*t).ToKeyValuePair().Value);
            }
            return(output.ToArray());
        }
        public bool Remove(string key, DictFlags flags = DictFlags.AV_DICT_MATCH_CASE)
        {
            int count            = 0;
            AVDictionaryEntry *t = null;

            while ((t = ffmpeg.av_dict_get(*ppDictionary, key, t, (int)flags)) != null)
            {
                Add(key, null, 0);
                count++;
            }
            return(count != 0);
        }
Exemple #5
0
        public bool TryGetValues(string key, DictFlags flags, out string[] values)
        {
            var list = new List <string>();
            AVDictionaryEntry *prev = null;

            while ((prev = (AVDictionaryEntry *)DictGet(this, key, (IntPtr)prev, flags)) != null)
            {
                list.Add(((IntPtr)prev->value).PtrToStringUTF8());
            }
            values = list.ToArray();
            return(values.Length > 0);
        }
        public void Set(string key, string value, DictFlags flags = DictFlags.DontOverwrite)
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));                // in AVDictionary, value is also not-null.
            }
            AVDictionary *ptr = this;

            av_dict_set(&ptr, key, value, (int)flags).ThrowIfError();
            _handle = ptr;
        }
Exemple #7
0
        public IEnumerable <KeyValuePair <string, string> > GetEnumerable(string key, DictFlags flags)
        {
            IntPtr prev = IntPtr.Zero;

            while ((prev = DictGet(this, key, prev, flags)) != IntPtr.Zero)
            {
                yield return(GetEntry(prev));
            }
        }
Exemple #8
0
 private static IntPtr DictGet(MediaDictionary dict, string key, IntPtr prev, DictFlags flags)
 {
     return((IntPtr)ffmpeg.av_dict_get(dict.pDictionary, key, (AVDictionaryEntry *)prev, (int)flags));
 }
Exemple #9
0
 public bool ContainsKey(string key, DictFlags flags)
 {
     return(DictGet(this, key, IntPtr.Zero, flags) != IntPtr.Zero);
 }
Exemple #10
0
 public void Add(string key, long value, DictFlags flags = DefaultFlags)
 {
     ffmpeg.av_dict_set_int(ppDictionary, key, value, (int)flags).ThrowIfError();
 }