You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-06-30 22:24:04 +02:00
matroskadec: use new metadata API to export some simple information
Originally committed as revision 17328 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
@ -154,6 +154,8 @@ typedef struct {
|
|||||||
uint64_t end;
|
uint64_t end;
|
||||||
uint64_t uid;
|
uint64_t uid;
|
||||||
char *title;
|
char *title;
|
||||||
|
|
||||||
|
AVChapter *chapter;
|
||||||
} MatroskaChapter;
|
} MatroskaChapter;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -1103,9 +1105,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
|||||||
if (matroska->duration)
|
if (matroska->duration)
|
||||||
matroska->ctx->duration = matroska->duration * matroska->time_scale
|
matroska->ctx->duration = matroska->duration * matroska->time_scale
|
||||||
* 1000 / AV_TIME_BASE;
|
* 1000 / AV_TIME_BASE;
|
||||||
if (matroska->title)
|
av_metadata_set(&s->metadata, "title", matroska->title);
|
||||||
strncpy(matroska->ctx->title, matroska->title,
|
|
||||||
sizeof(matroska->ctx->title)-1);
|
|
||||||
matroska_convert_tags(s, &matroska->tags);
|
matroska_convert_tags(s, &matroska->tags);
|
||||||
|
|
||||||
tracks = matroska->tracks.elem;
|
tracks = matroska->tracks.elem;
|
||||||
@ -1294,7 +1294,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
|||||||
st->codec->codec_id = codec_id;
|
st->codec->codec_id = codec_id;
|
||||||
st->start_time = 0;
|
st->start_time = 0;
|
||||||
if (strcmp(track->language, "und"))
|
if (strcmp(track->language, "und"))
|
||||||
av_strlcpy(st->language, track->language, 4);
|
av_metadata_set(&st->metadata, "language", track->language);
|
||||||
|
|
||||||
if (track->flag_default)
|
if (track->flag_default)
|
||||||
st->disposition |= AV_DISPOSITION_DEFAULT;
|
st->disposition |= AV_DISPOSITION_DEFAULT;
|
||||||
@ -1346,7 +1346,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
|||||||
AVStream *st = av_new_stream(s, 0);
|
AVStream *st = av_new_stream(s, 0);
|
||||||
if (st == NULL)
|
if (st == NULL)
|
||||||
break;
|
break;
|
||||||
st->filename = av_strdup(attachements[j].filename);
|
av_metadata_set(&st->metadata, "filename",attachements[j].filename);
|
||||||
st->codec->codec_id = CODEC_ID_NONE;
|
st->codec->codec_id = CODEC_ID_NONE;
|
||||||
st->codec->codec_type = CODEC_TYPE_ATTACHMENT;
|
st->codec->codec_type = CODEC_TYPE_ATTACHMENT;
|
||||||
st->codec->extradata = av_malloc(attachements[j].bin.size);
|
st->codec->extradata = av_malloc(attachements[j].bin.size);
|
||||||
@ -1369,9 +1369,12 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
|||||||
for (i=0; i<chapters_list->nb_elem; i++)
|
for (i=0; i<chapters_list->nb_elem; i++)
|
||||||
if (chapters[i].start != AV_NOPTS_VALUE && chapters[i].uid
|
if (chapters[i].start != AV_NOPTS_VALUE && chapters[i].uid
|
||||||
&& (max_start==0 || chapters[i].start > max_start)) {
|
&& (max_start==0 || chapters[i].start > max_start)) {
|
||||||
|
chapters[i].chapter =
|
||||||
ff_new_chapter(s, chapters[i].uid, (AVRational){1, 1000000000},
|
ff_new_chapter(s, chapters[i].uid, (AVRational){1, 1000000000},
|
||||||
chapters[i].start, chapters[i].end,
|
chapters[i].start, chapters[i].end,
|
||||||
chapters[i].title);
|
chapters[i].title);
|
||||||
|
av_metadata_set(&chapters[i].chapter->metadata,
|
||||||
|
"title", chapters[i].title);
|
||||||
max_start = chapters[i].start;
|
max_start = chapters[i].start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user