| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Matroska file demuxer | 2 * Matroska file demuxer |
| 3 * Copyright (c) 2003-2008 The FFmpeg Project | 3 * Copyright (c) 2003-2008 The FFmpeg Project |
| 4 * | 4 * |
| 5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
| 6 * | 6 * |
| 7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
| (...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 MatroskaAttachement *attachements; | 1162 MatroskaAttachement *attachements; |
| 1163 EbmlList *chapters_list = &matroska->chapters; | 1163 EbmlList *chapters_list = &matroska->chapters; |
| 1164 MatroskaChapter *chapters; | 1164 MatroskaChapter *chapters; |
| 1165 MatroskaTrack *tracks; | 1165 MatroskaTrack *tracks; |
| 1166 EbmlList *index_list; | 1166 EbmlList *index_list; |
| 1167 MatroskaIndex *index; | 1167 MatroskaIndex *index; |
| 1168 int index_scale = 1; | 1168 int index_scale = 1; |
| 1169 uint64_t max_start = 0; | 1169 uint64_t max_start = 0; |
| 1170 Ebml ebml = { 0 }; | 1170 Ebml ebml = { 0 }; |
| 1171 AVStream *st; | 1171 AVStream *st; |
| 1172 int i, j; | 1172 int i, j, res; |
| 1173 | 1173 |
| 1174 matroska->ctx = s; | 1174 matroska->ctx = s; |
| 1175 | 1175 |
| 1176 /* First read the EBML header. */ | 1176 /* First read the EBML header. */ |
| 1177 if (ebml_parse(matroska, ebml_syntax, &ebml) | 1177 if (ebml_parse(matroska, ebml_syntax, &ebml) |
| 1178 || ebml.version > EBML_VERSION || ebml.max_size > sizeof(uint64_t) | 1178 || ebml.version > EBML_VERSION || ebml.max_size > sizeof(uint64_t) |
| 1179 || ebml.id_length > sizeof(uint32_t) || ebml.doctype_version > 2) { | 1179 || ebml.id_length > sizeof(uint32_t) || ebml.doctype_version > 2) { |
| 1180 av_log(matroska->ctx, AV_LOG_ERROR, | 1180 av_log(matroska->ctx, AV_LOG_ERROR, |
| 1181 "EBML header using unsupported features\n" | 1181 "EBML header using unsupported features\n" |
| 1182 "(EBML version %"PRIu64", doctype %s, doc version %"PRIu64")\n", | 1182 "(EBML version %"PRIu64", doctype %s, doc version %"PRIu64")\n", |
| 1183 ebml.version, ebml.doctype, ebml.doctype_version); | 1183 ebml.version, ebml.doctype, ebml.doctype_version); |
| 1184 ebml_free(ebml_syntax, &ebml); | 1184 ebml_free(ebml_syntax, &ebml); |
| 1185 return AVERROR_PATCHWELCOME; | 1185 return AVERROR_PATCHWELCOME; |
| 1186 } | 1186 } |
| 1187 av_metadata_set2(&s->metadata, "doctype", ebml.doctype, 0); | 1187 av_metadata_set2(&s->metadata, "doctype", ebml.doctype, 0); |
| 1188 for (i = 0; i < FF_ARRAY_ELEMS(matroska_doctypes); i++) | 1188 for (i = 0; i < FF_ARRAY_ELEMS(matroska_doctypes); i++) |
| 1189 if (!strcmp(ebml.doctype, matroska_doctypes[i])) | 1189 if (!strcmp(ebml.doctype, matroska_doctypes[i])) |
| 1190 break; | 1190 break; |
| 1191 if (i >= FF_ARRAY_ELEMS(matroska_doctypes)) { | 1191 if (i >= FF_ARRAY_ELEMS(matroska_doctypes)) { |
| 1192 av_log(s, AV_LOG_WARNING, "Unknown EBML doctype '%s'\n", ebml.doctype); | 1192 av_log(s, AV_LOG_WARNING, "Unknown EBML doctype '%s'\n", ebml.doctype); |
| 1193 } | 1193 } |
| 1194 ebml_free(ebml_syntax, &ebml); | 1194 ebml_free(ebml_syntax, &ebml); |
| 1195 | 1195 |
| 1196 /* The next thing is a segment. */ | 1196 /* The next thing is a segment. */ |
| 1197 if (ebml_parse(matroska, matroska_segments, matroska) < 0) | 1197 if ((res = ebml_parse(matroska, matroska_segments, matroska)) < 0) |
| 1198 return -1; | 1198 return res; |
| 1199 matroska_execute_seekhead(matroska); | 1199 matroska_execute_seekhead(matroska); |
| 1200 | 1200 |
| 1201 if (!matroska->time_scale) | 1201 if (!matroska->time_scale) |
| 1202 matroska->time_scale = 1000000; | 1202 matroska->time_scale = 1000000; |
| 1203 if (matroska->duration) | 1203 if (matroska->duration) |
| 1204 matroska->ctx->duration = matroska->duration * matroska->time_scale | 1204 matroska->ctx->duration = matroska->duration * matroska->time_scale |
| 1205 * 1000 / AV_TIME_BASE; | 1205 * 1000 / AV_TIME_BASE; |
| 1206 av_metadata_set2(&s->metadata, "title", matroska->title, 0); | 1206 av_metadata_set2(&s->metadata, "title", matroska->title, 0); |
| 1207 | 1207 |
| 1208 tracks = matroska->tracks.elem; | 1208 tracks = matroska->tracks.elem; |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 "matroska", | 1919 "matroska", |
| 1920 NULL_IF_CONFIG_SMALL("Matroska file format"), | 1920 NULL_IF_CONFIG_SMALL("Matroska file format"), |
| 1921 sizeof(MatroskaDemuxContext), | 1921 sizeof(MatroskaDemuxContext), |
| 1922 matroska_probe, | 1922 matroska_probe, |
| 1923 matroska_read_header, | 1923 matroska_read_header, |
| 1924 matroska_read_packet, | 1924 matroska_read_packet, |
| 1925 matroska_read_close, | 1925 matroska_read_close, |
| 1926 matroska_read_seek, | 1926 matroska_read_seek, |
| 1927 .metadata_conv = ff_mkv_metadata_conv, | 1927 .metadata_conv = ff_mkv_metadata_conv, |
| 1928 }; | 1928 }; |
| OLD | NEW |