Remove deprecated ffmpeg api

This commit is contained in:
Damiano Galassi committed 2016-07-23 12:42:55 +02:00
1 parent c21e3c2966
commit 54437f9030
2 files changed
+9 -17

No files matched your search

-1
View File
@@ -26,7 +26,6 @@ NS_ASSUME_NONNULL_BEGIN
CIContext *_imgContext; CIContext *_imgContext;
AVCodec *avCodec; AVCodec *avCodec;
AVCodecContext *avContext; AVCodecContext *avContext;
AVSubtitle subtitle;
MP42Fifo<MP42SampleBuffer *> *_inputSamplesBuffer; MP42Fifo<MP42SampleBuffer *> *_inputSamplesBuffer;
MP42Fifo<MP42SampleBuffer *> *_outputSamplesBuffer; MP42Fifo<MP42SampleBuffer *> *_outputSamplesBuffer;
+9 -16
View File
@@ -166,6 +166,7 @@ void FFInitFFmpeg() {
} }
AVPacket pkt; AVPacket pkt;
AVSubtitle subtitle;
av_init_packet(&pkt); av_init_packet(&pkt);
pkt.data = codecData; pkt.data = codecData;
pkt.size = bufferSize; pkt.size = bufferSize;
@@ -208,10 +209,10 @@ void FFInitFFmpeg() {
uint8_t *imageData = calloc(rect->w * rect->h * 4, sizeof(uint8_t)); uint8_t *imageData = calloc(rect->w * rect->h * 4, sizeof(uint8_t));
uint8_t *line = (uint8_t *)imageData; uint8_t *line = (uint8_t *)imageData;
uint8_t *sub = rect->pict.data[0]; uint8_t *sub = rect->data[0];
unsigned int w = rect->w; unsigned int w = rect->w;
unsigned int h = rect->h; unsigned int h = rect->h;
uint32_t *palette = (uint32_t *)rect->pict.data[1]; uint32_t *palette = (uint32_t *)rect->data[1];
if (usePalette) { if (usePalette) {
for (unsigned int j = 0; j < 4; j++) for (unsigned int j = 0; j < 4; j++)
@@ -226,7 +227,7 @@ void FFInitFFmpeg() {
} }
line += rect->w*4; line += rect->w*4;
sub += rect->pict.linesize[0]; sub += rect->linesize[0];
} }
// Kill the alpha // Kill the alpha
@@ -275,7 +276,7 @@ void FFInitFFmpeg() {
} }
avsubtitle_free(&subtitle); avsubtitle_free(&subtitle);
av_free_packet(&pkt); av_packet_unref(&pkt);
[sampleBuffer release]; [sampleBuffer release];
} }
@@ -300,6 +301,7 @@ void FFInitFFmpeg() {
} }
AVPacket pkt; AVPacket pkt;
AVSubtitle subtitle;
av_init_packet(&pkt); av_init_packet(&pkt);
pkt.data = sampleBuffer->data; pkt.data = sampleBuffer->data;
pkt.size = sampleBuffer->size; pkt.size = sampleBuffer->size;
@@ -339,8 +341,8 @@ void FFInitFFmpeg() {
uint8_t color; uint8_t color;
pixel = yy * rect->w + xx; pixel = yy * rect->w + xx;
color = rect->pict.data[0][pixel]; color = rect->data[0][pixel];
argb = ((uint32_t *)rect->pict.data[1])[color]; argb = ((uint32_t *)rect->data[1])[color];
imageData[yy * rect->w + xx] = EndianU32_BtoN(argb); imageData[yy * rect->w + xx] = EndianU32_BtoN(argb);
} }
@@ -392,7 +394,7 @@ void FFInitFFmpeg() {
} }
avsubtitle_free(&subtitle); avsubtitle_free(&subtitle);
av_free_packet(&pkt); av_packet_unref(&pkt);
[sampleBuffer release]; [sampleBuffer release];
} }
@@ -497,15 +499,6 @@ void FFInitFFmpeg() {
av_freep(&codecData); av_freep(&codecData);
} }
if (subtitle.rects) {
for (unsigned i = 0; i < subtitle.num_rects; i++) {
av_freep(&subtitle.rects[i]->pict.data[0]);
av_freep(&subtitle.rects[i]->pict.data[1]);
av_freep(&subtitle.rects[i]);
}
av_freep(&subtitle.rects);
}
[srcMagicCookie release]; [srcMagicCookie release];
[_outputSamplesBuffer release]; [_outputSamplesBuffer release];
[_inputSamplesBuffer release]; [_inputSamplesBuffer release];