[FFmpeg-devel] [PATCH] matroskadec: Export the MuxingApp element value as metadata
James Almer
jamrial at gmail.com
Sun Dec 1 18:44:58 CET 2013
On 01/12/13 2:28 PM, wm4 wrote:
> On Sun, 24 Nov 2013 05:31:48 -0300
> James Almer <jamrial at gmail.com> wrote:
>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>> libavformat/matroskadec.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
>> index eb3b4e6..b3a6477 100644
>> --- a/libavformat/matroskadec.c
>> +++ b/libavformat/matroskadec.c
>> @@ -253,6 +253,7 @@ typedef struct {
>> uint64_t time_scale;
>> double duration;
>> char *title;
>> + char *muxingapp;
>> EbmlBin date_utc;
>> EbmlList tracks;
>> EbmlList attachments;
>> @@ -317,7 +318,7 @@ static EbmlSyntax matroska_info[] = {
>> { MATROSKA_ID_DURATION, EBML_FLOAT, 0, offsetof(MatroskaDemuxContext,duration) },
>> { MATROSKA_ID_TITLE, EBML_UTF8, 0, offsetof(MatroskaDemuxContext,title) },
>> { MATROSKA_ID_WRITINGAPP, EBML_NONE },
>> - { MATROSKA_ID_MUXINGAPP, EBML_NONE },
>> + { MATROSKA_ID_MUXINGAPP, EBML_UTF8, 0, offsetof(MatroskaDemuxContext,muxingapp) },
>> { MATROSKA_ID_DATEUTC, EBML_BIN, 0, offsetof(MatroskaDemuxContext,date_utc) },
>> { MATROSKA_ID_SEGMENTUID, EBML_NONE },
>> { 0 }
>> @@ -1587,6 +1588,7 @@ static int matroska_read_header(AVFormatContext *s)
>> matroska->ctx->duration = matroska->duration * matroska->time_scale
>> * 1000 / AV_TIME_BASE;
>> av_dict_set(&s->metadata, "title", matroska->title, 0);
>> + av_dict_set(&s->metadata, "encoder", matroska->muxingapp, 0);
>>
>> if (matroska->date_utc.size == 8)
>> matroska_metadata_creation_time(&s->metadata, AV_RB64(matroska->date_utc.data));
>
> Another issue: how is the user supposed to distinguish between real
> metadata (i.e. tags), and random-stuff-dumped-into-the-metadata-dict-
> because-there's-no-other-place entries?
The user can't and never could, as far as i know.
Matroska Tags are read last, for that matter. Currently, if there's a "title"
or "creation_time" Tag, the relevant existing dict entries (Which were read
from Matroska Elements as seen in the code above) are overwritten.
This should probably be prevented, to be honest.
And i wouldn't call the values of MATROSKA_ID_TITLE, MATROSKA_ID_MUXINGAPP
and MATROSKA_ID_DATEUTC random stuff. They are the actual metadata values
for the relevant dict entries, which is why they are read as such.
More information about the ffmpeg-devel
mailing list