Domanda

I have written this gist to convert gif data downloaded from the this incredible site and turn that into a mp4 that is playable with MPMoviePlayerController.

The problem is, I must download the entire gif and then start converting. I would like to convert as I get data and I believe, but can't confirm that, it might be possible with CGImageSourceCreateIncremental by passing in the data returned by - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data.

Has anyone attempted this or know of an example?

È stato utile?

Soluzione

I know that incremental works for jpegs and pngs. The coding of it is slightly complex but you should be able to find sample code here or on Apple's site. No way to know what it will do with animated gifs. If it does not do what you need you can most certainly find an open source libgif library, which you'd obviously need to port to iOS. I have used libjpeg turbo in a project to get incremental decoding for JPEGs.

The one problem with the Quartz method you reference is it always incrementally decodes from the image beginning. So, if you have a really big image as I did, as the size of the download increases the longer that each request for an incremental image takes. I actually burned a DTS incident on this - Apple engineer agreed it would be nice if they'd cache the intermediate image so each request would build on the last image, but they don't now.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top