AVPKit
MetaData.h
1 /*******************************************************************************
2  * Copyright (c) 2024, 2026, Olivier Ayache. All rights reserved.
3  *
4  * This file is part of AVPKit.
5  *
6  * AVPKit is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * AVPKit is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with AVPKit. If not, see <http://www.gnu.org/licenses/>.
18  *******************************************************************************/
19 /*
20  * MetaData.h
21  *
22  * Created on: Jun 29, 2009
23  * Author: aclarke
24  */
25 
26 #ifndef METADATA_H_
27 #define METADATA_H_
28 
29 #include <com/avpkit/core/IMetaData.h>
30 #include <com/avpkit/core/FfmpegIncludes.h>
31 namespace com { namespace avpkit { namespace core
32 {
33 
34 class MetaData : public IMetaData
35 {
36  VS_JNIUTILS_REFCOUNTED_OBJECT(MetaData);
37 public:
38  virtual int32_t getNumKeys();
39  virtual const char* getKey(int32_t position);
40 
41  virtual const char *getValue(const char* key, Flags flag);
42  virtual int32_t setValue(const char* key, const char* value);
43  virtual int32_t setValue(const char* key, const char* value, Flags flag);
44 
52  static MetaData* make(AVDictionary ** metaDataToReference);
53 
58  static MetaData* make(AVDictionary* metaDataToCopy);
59 
64  int32_t copy(IMetaData* copy);
65 
69  int32_t copy(AVDictionary* copy);
70 
76  AVDictionary* getDictionary() { return (mMetaData ? *mMetaData : 0); }
77 
78 protected:
79  MetaData();
80  virtual
81  ~MetaData();
82 private:
83  AVDictionary** mMetaData;
84  AVDictionary* mLocalMeta;
85 };
86 
87 }
88 
89 }
90 
91 }
92 
93 #endif /* METADATA_H_ */
Get MetaData about a IContainer or IStream.
Definition: IMetaData.h:51
Flags
Different types of flags that can be passed to IMetaData#getValue.
Definition: IMetaData.h:56
static IMetaData * make()
Create a new IMetaData bag of properties with no values set.
Definition: IMetaData.cpp:36
int32_t copy(IMetaData *copy)
Destroys the current data, and copies all data from copy.
Definition: MetaData.cpp:164
virtual const char * getKey(int32_t position)
Get the key at the given position, or null if no such key at that position.
Definition: MetaData.cpp:67
AVDictionary * getDictionary()
Returns the AVDictionary for passing to FFmpeg calls.
Definition: MetaData.h:76
virtual const char * getValue(const char *key, Flags flag)
Get the value for the given key.
Definition: MetaData.cpp:86
virtual int32_t getNumKeys()
Get the total number of keys currently in this IMetaData object.
Definition: MetaData.cpp:50
virtual int32_t setValue(const char *key, const char *value)
Sets the value for the given key to value.
Definition: MetaData.cpp:98
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...