summaryrefslogtreecommitdiff
path: root/libavformat/id3v2.h
diff options
context:
space:
mode:
authorRichard Shaffer <rshaffer@tunein.com>2018-01-23 09:39:53 -0800
committerwm4 <nfxjfg@googlemail.com>2018-01-24 04:01:01 +0100
commit8a4cc0a2567fa8418709f75af5539cdf76fefb99 (patch)
tree8b4f3db2013b830a884249f4aced89149eab48fc /libavformat/id3v2.h
parentf0320afab977edc7b73317c8ef36ff1d60296401 (diff)
downloadffmpeg-8a4cc0a2567fa8418709f75af5539cdf76fefb99.tar.gz
avformat: add option to parse/store ID3 PRIV tags in metadata.
Enables getting access to ID3 PRIV tags from the command-line or metadata API when demuxing. The PRIV owner is stored as the metadata key prepended with "id3v2_priv.", and the data is stored as the metadata value. As PRIV tags may contain arbitrary data, non-printable characters, including NULL bytes, are escaped as \xXX. Similarly, any metadata tags that begin with "id3v2_priv." are inserted as ID3 PRIV tags into the output (assuming the format supports ID3). \xXX sequences in the value are un-escaped to their byte value. Signed-off-by: wm4 <nfxjfg@googlemail.com>
Diffstat (limited to 'libavformat/id3v2.h')
-rw-r--r--libavformat/id3v2.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavformat/id3v2.h b/libavformat/id3v2.h
index 5e64ead096..9de0bee374 100644
--- a/libavformat/id3v2.h
+++ b/libavformat/id3v2.h
@@ -39,6 +39,8 @@
#define ID3v2_FLAG_ENCRYPTION 0x0004
#define ID3v2_FLAG_COMPRESSION 0x0008
+#define ID3v2_PRIV_METADATA_PREFIX "id3v2_priv."
+
enum ID3v2Encoding {
ID3v2_ENCODING_ISO8859 = 0,
ID3v2_ENCODING_UTF16BOM = 1,
@@ -167,6 +169,19 @@ int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta **extra_meta);
*/
int ff_id3v2_parse_chapters(AVFormatContext *s, ID3v2ExtraMeta **extra_meta);
+/**
+ * Parse PRIV tags into a dictionary. The PRIV owner is the metadata key. The
+ * PRIV data is the value, with non-printable characters escaped.
+ */
+int ff_id3v2_parse_priv_dict(AVDictionary **d, ID3v2ExtraMeta **extra_meta);
+
+/**
+ * Add metadata for all PRIV tags in the ID3v2 header. The PRIV owner is the
+ * metadata key. The PRIV data is the value, with non-printable characters
+ * escaped.
+ */
+int ff_id3v2_parse_priv(AVFormatContext *s, ID3v2ExtraMeta **extra_meta);
+
extern const AVMetadataConv ff_id3v2_34_metadata_conv[];
extern const AVMetadataConv ff_id3v2_4_metadata_conv[];