Hi,
@@ -129,6 +132,8 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt) audio_size = AV_RB16(&cdxl->header[22]); image_size = FFALIGN(width, 16) * height * cdxl->header[19] / 8; video_size = palette_size + image_size; + + frames = cdxl->filesize / (audio_size + video_size);
This seems kind of error prone to me. It doesn't account for things like header, palette size, and such, I think.
Maybe, but it seems to work ok on the files I've tested, so if there are some errors then not big enough to be noticable in the final duration, but if it's possible to make a better calculation for number of frames then please suggest a code I could use and I will do so.
@@ -175,6 +180,10 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt) st->codec->codec_id = AV_CODEC_ID_CDXL; st->codec->width = width; st->codec->height = height; + if(cdxl->framerate) + st->duration = frames; + else + st->duration = frames * audio_size;
Needs to be properly indented.
Thanks, fixed. Regards