diff --git a/libavformat/cdxl.c b/libavformat/cdxl.c
index 185b745..c73ec72 100644
|
a
|
b
|
typedef struct CDXLDemuxContext { |
| 37 | 37 | uint8_t header[CDXL_HEADER_SIZE]; |
| 38 | 38 | int video_stream_index; |
| 39 | 39 | int audio_stream_index; |
| | 40 | int64_t filesize; |
| 40 | 41 | } CDXLDemuxContext; |
| 41 | 42 | |
| 42 | 43 | static int cdxl_read_probe(AVProbeData *p) |
| … |
… |
static int cdxl_read_probe(AVProbeData *p) |
| 84 | 85 | static int cdxl_read_header(AVFormatContext *s) |
| 85 | 86 | { |
| 86 | 87 | CDXLDemuxContext *cdxl = s->priv_data; |
| 87 | | int ret; |
| | 88 | int frames, ret; |
| 88 | 89 | |
| 89 | 90 | if (cdxl->framerate && (ret = av_parse_video_rate(&cdxl->fps, cdxl->framerate)) < 0) { |
| 90 | 91 | av_log(s, AV_LOG_ERROR, |
| … |
… |
static int cdxl_read_header(AVFormatContext *s) |
| 92 | 93 | return ret; |
| 93 | 94 | } |
| 94 | 95 | |
| | 96 | cdxl->filesize = avio_size(s->pb); |
| | 97 | |
| 95 | 98 | cdxl->read_chunk = 0; |
| 96 | 99 | cdxl->video_stream_index = -1; |
| 97 | 100 | cdxl->audio_stream_index = -1; |
| … |
… |
static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 129 | 132 | audio_size = AV_RB16(&cdxl->header[22]); |
| 130 | 133 | image_size = FFALIGN(width, 16) * height * cdxl->header[19] / 8; |
| 131 | 134 | video_size = palette_size + image_size; |
| | 135 | |
| | 136 | frames = cdxl->filesize / (audio_size + video_size); |
| 132 | 137 | |
| 133 | 138 | if (palette_size > 512) |
| 134 | 139 | return AVERROR_INVALIDDATA; |
| … |
… |
static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 175 | 180 | st->codec->codec_id = AV_CODEC_ID_CDXL; |
| 176 | 181 | st->codec->width = width; |
| 177 | 182 | st->codec->height = height; |
| | 183 | if(!cdxl->framerate) |
| | 184 | st->duration = frames * audio_size; |
| 178 | 185 | st->start_time = 0; |
| 179 | 186 | cdxl->video_stream_index = st->index; |
| 180 | 187 | if (cdxl->framerate) |