Mercurial > libavformat.hg
comparison matroskadec.c @ 2201:c514ebfeec49 libavformat
drop blocks which are part of unsupported tracks
author | aurel |
---|---|
date | Sun, 24 Jun 2007 21:49:13 +0000 |
parents | 4c2924cebe00 |
children | 32d675fb5e2e |
comparison
equal
deleted
inserted
replaced
2200:5894ebb2faa7 | 2201:c514ebfeec49 |
---|---|
39 | 39 |
40 /* Unique track number and track ID. stream_index is the index that | 40 /* Unique track number and track ID. stream_index is the index that |
41 * the calling app uses for this track. */ | 41 * the calling app uses for this track. */ |
42 uint32_t num; | 42 uint32_t num; |
43 uint32_t uid; | 43 uint32_t uid; |
44 uint32_t stream_index; | 44 int stream_index; |
45 | 45 |
46 char *name; | 46 char *name; |
47 char *language; | 47 char *language; |
48 | 48 |
49 char *codec_id; | 49 char *codec_id; |
2019 enum CodecID codec_id = CODEC_ID_NONE; | 2019 enum CodecID codec_id = CODEC_ID_NONE; |
2020 uint8_t *extradata = NULL; | 2020 uint8_t *extradata = NULL; |
2021 int extradata_size = 0; | 2021 int extradata_size = 0; |
2022 int extradata_offset = 0; | 2022 int extradata_offset = 0; |
2023 track = matroska->tracks[i]; | 2023 track = matroska->tracks[i]; |
2024 track->stream_index = -1; | |
2024 | 2025 |
2025 /* libavformat does not really support subtitles. | 2026 /* libavformat does not really support subtitles. |
2026 * Also apply some sanity checks. */ | 2027 * Also apply some sanity checks. */ |
2027 if ((track->type == MATROSKA_TRACK_TYPE_SUBTITLE) || | 2028 if ((track->type == MATROSKA_TRACK_TYPE_SUBTITLE) || |
2028 (track->codec_id == NULL)) | 2029 (track->codec_id == NULL)) |
2211 int i, track, stream; | 2212 int i, track, stream; |
2212 for (i=0; i<matroska->num_indexes; i++) { | 2213 for (i=0; i<matroska->num_indexes; i++) { |
2213 MatroskaDemuxIndex *idx = &matroska->index[i]; | 2214 MatroskaDemuxIndex *idx = &matroska->index[i]; |
2214 track = matroska_find_track_by_num(matroska, idx->track); | 2215 track = matroska_find_track_by_num(matroska, idx->track); |
2215 stream = matroska->tracks[track]->stream_index; | 2216 stream = matroska->tracks[track]->stream_index; |
2217 if (stream >= 0) | |
2216 av_add_index_entry(matroska->ctx->streams[stream], | 2218 av_add_index_entry(matroska->ctx->streams[stream], |
2217 idx->pos, idx->time/matroska->time_scale, | 2219 idx->pos, idx->time/matroska->time_scale, |
2218 0, 0, AVINDEX_KEYFRAME); | 2220 0, 0, AVINDEX_KEYFRAME); |
2219 } | 2221 } |
2220 } | 2222 } |
2258 av_log(matroska->ctx, AV_LOG_INFO, | 2260 av_log(matroska->ctx, AV_LOG_INFO, |
2259 "Invalid stream %d or size %u\n", track, size); | 2261 "Invalid stream %d or size %u\n", track, size); |
2260 av_free(origdata); | 2262 av_free(origdata); |
2261 return res; | 2263 return res; |
2262 } | 2264 } |
2265 if (matroska->tracks[track]->stream_index < 0) | |
2266 return res; | |
2263 st = matroska->ctx->streams[matroska->tracks[track]->stream_index]; | 2267 st = matroska->ctx->streams[matroska->tracks[track]->stream_index]; |
2264 if (st->discard >= AVDISCARD_ALL) { | 2268 if (st->discard >= AVDISCARD_ALL) { |
2265 av_free(origdata); | 2269 av_free(origdata); |
2266 return res; | 2270 return res; |
2267 } | 2271 } |