mirror of
https://github.com/mpv-player/mpv
synced 2024-09-12 23:45:53 +02:00
e7e06a47a0
This makes ICY title changes show up at approximately the correct time, even if the demuxer buffer is huge. (It'll still be wrong if the stream byte cache contains a meaningful amount of data.) It should have the same effect for mid-stream metadata changes in e.g. OGG (untested). This is still somewhat fishy, but in parts due to ICY being fishy, and FFmpeg's metadata change API being somewhat fishy. For example, what happens if you seek? With FFmpeg AVFMT_EVENT_FLAG_METADATA_UPDATED and AVSTREAM_EVENT_FLAG_METADATA_UPDATED we hope that FFmpeg will correctly restore the correct metadata when the first packet is returned. If you seke with ICY, we're out of luck, and some audio will be associated with the wrong tag until we get a new title through ICY metadata update at an essentially random point (it's mostly inherent to ICY). Then the tags will switch back and forth, and this behavior will stick with the data stored in the demuxer cache. Fortunately, this can happen only if the HTTP stream is actually seekable, which it usually is not for ICY things. Seeking doesn't even make sense with ICY, since you can't know the exact metadata location. Basically ICY metsdata sucks. Some complexity is due to a microoptimization: I didn't want additional atomic accesses for each packet if no timed metadata is used. (It probably doesn't matter at all.)
30 lines
1019 B
C
30 lines
1019 B
C
#ifndef MP_TAGS_H
|
|
#define MP_TAGS_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "misc/bstr.h"
|
|
|
|
struct mp_tags {
|
|
char **keys;
|
|
char **values;
|
|
int num_keys;
|
|
};
|
|
|
|
void mp_tags_set_str(struct mp_tags *tags, const char *key, const char *value);
|
|
void mp_tags_set_bstr(struct mp_tags *tags, bstr key, bstr value);
|
|
void mp_tags_remove_str(struct mp_tags *tags, const char *key);
|
|
void mp_tags_remove_bstr(struct mp_tags *tags, bstr key);
|
|
char *mp_tags_get_str(struct mp_tags *tags, const char *key);
|
|
char *mp_tags_get_bstr(struct mp_tags *tags, bstr key);
|
|
void mp_tags_clear(struct mp_tags *tags);
|
|
struct mp_tags *mp_tags_dup(void *tparent, struct mp_tags *tags);
|
|
void mp_tags_replace(struct mp_tags *dst, struct mp_tags *src);
|
|
struct mp_tags *mp_tags_filtered(void *tparent, struct mp_tags *tags, char **list);
|
|
void mp_tags_merge(struct mp_tags *tags, struct mp_tags *src);
|
|
struct AVDictionary;
|
|
void mp_tags_copy_from_av_dictionary(struct mp_tags *tags,
|
|
struct AVDictionary *av_dict);
|
|
|
|
#endif
|