mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
Merge commit '71e92414bfd79e56ea6fff174a665ff7b9b86e68'
* commit '71e92414bfd79e56ea6fff174a665ff7b9b86e68': lavf: move RIFF INFO tag writing from avienc to riff avconv: fix disabling auto mappings with -map_metadata Conflicts: ffmpeg_opt.c libavformat/riff.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
fadfbb354b
@ -428,6 +428,10 @@ static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFor
|
|||||||
if (type_in == 'c' || type_out == 'c')
|
if (type_in == 'c' || type_out == 'c')
|
||||||
o->metadata_chapters_manual = 1;
|
o->metadata_chapters_manual = 1;
|
||||||
|
|
||||||
|
/* ic is NULL when just disabling automatic mappings */
|
||||||
|
if (!ic)
|
||||||
|
return 0;
|
||||||
|
|
||||||
#define METADATA_CHECK_INDEX(index, nb_elems, desc)\
|
#define METADATA_CHECK_INDEX(index, nb_elems, desc)\
|
||||||
if ((index) < 0 || (index) >= (nb_elems)) {\
|
if ((index) < 0 || (index) >= (nb_elems)) {\
|
||||||
av_log(NULL, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps.\n",\
|
av_log(NULL, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps.\n",\
|
||||||
@ -1706,7 +1710,9 @@ loop_end:
|
|||||||
av_log(NULL, AV_LOG_FATAL, "Invalid input file index %d while processing metadata maps\n", in_file_index);
|
av_log(NULL, AV_LOG_FATAL, "Invalid input file index %d while processing metadata maps\n", in_file_index);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
copy_metadata(o->metadata_map[i].specifier, *p ? p + 1 : p, oc, in_file_index >= 0 ? input_files[in_file_index]->ctx : NULL, o);
|
copy_metadata(o->metadata_map[i].specifier, *p ? p + 1 : p, oc,
|
||||||
|
in_file_index >= 0 ?
|
||||||
|
input_files[in_file_index]->ctx : NULL, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy chapters */
|
/* copy chapters */
|
||||||
|
@ -106,19 +106,6 @@ static char* avi_stream2fourcc(char* tag, int index, enum AVMediaType type)
|
|||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void avi_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
|
|
||||||
{
|
|
||||||
int len = strlen(str);
|
|
||||||
if (len > 0) {
|
|
||||||
len++;
|
|
||||||
ffio_wfourcc(pb, tag);
|
|
||||||
avio_wl32(pb, len);
|
|
||||||
avio_put_str(pb, str);
|
|
||||||
if (len & 1)
|
|
||||||
avio_w8(pb, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int avi_write_counters(AVFormatContext* s, int riff_id)
|
static int avi_write_counters(AVFormatContext* s, int riff_id)
|
||||||
{
|
{
|
||||||
AVIOContext *pb = s->pb;
|
AVIOContext *pb = s->pb;
|
||||||
@ -304,7 +291,7 @@ static int avi_write_header(AVFormatContext *s)
|
|||||||
}
|
}
|
||||||
ff_end_tag(pb, strf);
|
ff_end_tag(pb, strf);
|
||||||
if ((t = av_dict_get(s->streams[i]->metadata, "title", NULL, 0))) {
|
if ((t = av_dict_get(s->streams[i]->metadata, "title", NULL, 0))) {
|
||||||
avi_write_info_tag(s->pb, "strn", t->value);
|
ff_riff_write_info_tag(s->pb, "strn", t->value);
|
||||||
t = NULL;
|
t = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -381,14 +368,7 @@ static int avi_write_header(AVFormatContext *s)
|
|||||||
|
|
||||||
ff_end_tag(pb, list1);
|
ff_end_tag(pb, list1);
|
||||||
|
|
||||||
list2 = ff_start_tag(pb, "LIST");
|
ff_riff_write_info(s);
|
||||||
ffio_wfourcc(pb, "INFO");
|
|
||||||
ff_metadata_conv(&s->metadata, ff_riff_info_conv, NULL);
|
|
||||||
for (i = 0; *ff_riff_tags[i]; i++) {
|
|
||||||
if ((t = av_dict_get(s->metadata, ff_riff_tags[i], NULL, AV_DICT_MATCH_CASE)))
|
|
||||||
avi_write_info_tag(s->pb, t->key, t->value);
|
|
||||||
}
|
|
||||||
ff_end_tag(pb, list2);
|
|
||||||
|
|
||||||
/* some padding for easier tag editing */
|
/* some padding for easier tag editing */
|
||||||
list2 = ff_start_tag(pb, "JUNK");
|
list2 = ff_start_tag(pb, "JUNK");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* RIFF codec tags
|
* RIFF common functions and data
|
||||||
* Copyright (c) 2000 Fabrice Bellard
|
* Copyright (c) 2000 Fabrice Bellard
|
||||||
*
|
*
|
||||||
* This file is part of FFmpeg.
|
* This file is part of FFmpeg.
|
||||||
@ -798,3 +798,33 @@ int ff_read_riff_info(AVFormatContext *s, int64_t size)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
|
||||||
|
{
|
||||||
|
int len = strlen(str);
|
||||||
|
if (len > 0) {
|
||||||
|
len++;
|
||||||
|
ffio_wfourcc(pb, tag);
|
||||||
|
avio_wl32(pb, len);
|
||||||
|
avio_put_str(pb, str);
|
||||||
|
if (len & 1)
|
||||||
|
avio_w8(pb, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ff_riff_write_info(AVFormatContext *s)
|
||||||
|
{
|
||||||
|
AVIOContext *pb = s->pb;
|
||||||
|
int i;
|
||||||
|
int64_t list_pos;
|
||||||
|
AVDictionaryEntry *t = NULL;
|
||||||
|
|
||||||
|
list_pos = ff_start_tag(pb, "LIST");
|
||||||
|
ffio_wfourcc(pb, "INFO");
|
||||||
|
ff_metadata_conv(&s->metadata, ff_riff_info_conv, NULL);
|
||||||
|
for (i = 0; *ff_riff_tags[i]; i++) {
|
||||||
|
if ((t = av_dict_get(s->metadata, ff_riff_tags[i], NULL, AV_DICT_MATCH_CASE)))
|
||||||
|
ff_riff_write_info_tag(s->pb, t->key, t->value);
|
||||||
|
}
|
||||||
|
ff_end_tag(pb, list_pos);
|
||||||
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* RIFF codec tags
|
* RIFF common functions and data
|
||||||
* copyright (c) 2000 Fabrice Bellard
|
* copyright (c) 2000 Fabrice Bellard
|
||||||
*
|
*
|
||||||
* This file is part of FFmpeg.
|
* This file is part of FFmpeg.
|
||||||
@ -86,4 +86,14 @@ extern const AVCodecGuid ff_codec_wav_guids[];
|
|||||||
#define FF_MEDIASUBTYPE_BASE_GUID \
|
#define FF_MEDIASUBTYPE_BASE_GUID \
|
||||||
0x00,0x00,0x10,0x00,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71
|
0x00,0x00,0x10,0x00,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write all recognized RIFF tags from s->metadata
|
||||||
|
*/
|
||||||
|
void ff_riff_write_info(AVFormatContext *s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a single RIFF info tag
|
||||||
|
*/
|
||||||
|
void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str);
|
||||||
|
|
||||||
#endif /* AVFORMAT_RIFF_H */
|
#endif /* AVFORMAT_RIFF_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user