Skip to content

Commit daeb051

Browse files
Merge pull request #52 from cchampet/dev_addMetadata
OutputFile: add addMetadata
2 parents 43e9723 + 6169265 commit daeb051

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/AvTranscoder/File/OutputFile.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,24 @@ bool OutputFile::endWrap( )
204204
return true;
205205
}
206206

207+
void OutputFile::addMetadata( const MetadatasMap& dataMap )
208+
{
209+
for( MetadatasMap::const_iterator it = dataMap.begin(); it != dataMap.end(); ++it )
210+
{
211+
addMetadata( it->first, it->second );
212+
}
213+
}
214+
215+
void OutputFile::addMetadata( const std::string& key, const std::string& value )
216+
{
217+
int ret = av_dict_set( &_formatContext->metadata, key.c_str(), value.c_str(), 0 );
218+
if( ret < 0 )
219+
{
220+
char err[250];
221+
av_strerror( ret, err, 250 );
222+
std::cout << err << std::endl;
223+
}
224+
}
207225

208226
void OutputFile::setProfile( const Profile::ProfileDesc& desc )
209227
{

src/AvTranscoder/File/OutputFile.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include <AvTranscoder/common.hpp>
55

6+
#include <AvTranscoder/Metadatas/MediaMetadatasStructures.hpp>
7+
68
#include <AvTranscoder/CodedStructures/DataStream.hpp>
79
#include <AvTranscoder/CodedStructures/VideoDesc.hpp>
810
#include <AvTranscoder/CodedStructures/AudioDesc.hpp>
@@ -98,6 +100,13 @@ class AvExport OutputFile
98100
* @param desc: the profile of the output format
99101
*/
100102
virtual void setProfile( const Profile::ProfileDesc& desc );
103+
104+
/**
105+
* @brief Add metadata to the output file.
106+
* @note Depending on the format, you are not sure to find your metadata after the transcode.
107+
*/
108+
virtual void addMetadata( const MetadatasMap& dataMap );
109+
virtual void addMetadata( const std::string& key, const std::string& value );
101110

102111
virtual void setVerbose( bool verbose = false ){ _verbose = verbose; }
103112

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy