comparison matroska.c @ 1531:b9caa8a8d77d libavformat

matroska: properly handle real video extradata
author aurel
date Mon, 20 Nov 2006 00:15:52 +0000
parents f65cd8910a5c
children 4eb3d2701215
comparison
equal deleted inserted replaced
1530:f65cd8910a5c 1531:b9caa8a8d77d
2191 2191
2192 for (i = 0; i < matroska->num_tracks; i++) { 2192 for (i = 0; i < matroska->num_tracks; i++) {
2193 enum CodecID codec_id = CODEC_ID_NONE; 2193 enum CodecID codec_id = CODEC_ID_NONE;
2194 uint8_t *extradata = NULL; 2194 uint8_t *extradata = NULL;
2195 int extradata_size = 0; 2195 int extradata_size = 0;
2196 int extradata_offset = 0;
2196 track = matroska->tracks[i]; 2197 track = matroska->tracks[i];
2197 2198
2198 /* libavformat does not really support subtitles. 2199 /* libavformat does not really support subtitles.
2199 * Also apply some sanity checks. */ 2200 * Also apply some sanity checks. */
2200 if ((track->type == MATROSKA_TRACK_TYPE_SUBTITLE) || 2201 if ((track->type == MATROSKA_TRACK_TYPE_SUBTITLE) ||
2260 } else { 2261 } else {
2261 extradata_size = 2; 2262 extradata_size = 2;
2262 } 2263 }
2263 } 2264 }
2264 2265
2266 else if (codec_id == CODEC_ID_RV10 || codec_id == CODEC_ID_RV20 ||
2267 codec_id == CODEC_ID_RV30 || codec_id == CODEC_ID_RV40) {
2268 extradata_offset = 26;
2269 track->codec_priv_size -= extradata_offset;
2270 }
2271
2265 if (codec_id == CODEC_ID_NONE) { 2272 if (codec_id == CODEC_ID_NONE) {
2266 av_log(matroska->ctx, AV_LOG_INFO, 2273 av_log(matroska->ctx, AV_LOG_INFO,
2267 "Unknown/unsupported CodecID %s.\n", 2274 "Unknown/unsupported CodecID %s.\n",
2268 track->codec_id); 2275 track->codec_id);
2269 } 2276 }
2288 } else if(track->codec_priv && track->codec_priv_size > 0){ 2295 } else if(track->codec_priv && track->codec_priv_size > 0){
2289 st->codec->extradata = av_malloc(track->codec_priv_size); 2296 st->codec->extradata = av_malloc(track->codec_priv_size);
2290 if(st->codec->extradata == NULL) 2297 if(st->codec->extradata == NULL)
2291 return AVERROR_NOMEM; 2298 return AVERROR_NOMEM;
2292 st->codec->extradata_size = track->codec_priv_size; 2299 st->codec->extradata_size = track->codec_priv_size;
2293 memcpy(st->codec->extradata, track->codec_priv, 2300 memcpy(st->codec->extradata,track->codec_priv+extradata_offset,
2294 track->codec_priv_size); 2301 track->codec_priv_size);
2295 } 2302 }
2296 2303
2297 if (track->type == MATROSKA_TRACK_TYPE_VIDEO) { 2304 if (track->type == MATROSKA_TRACK_TYPE_VIDEO) {
2298 MatroskaVideoTrack *videotrack = (MatroskaVideoTrack *)track; 2305 MatroskaVideoTrack *videotrack = (MatroskaVideoTrack *)track;