summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2010-06-30 14:55:51 +0200
committerChristian Gmeiner <christian.gmeiner@gmail.com>2010-06-30 14:55:51 +0200
commitf07c415201044981ad5e516828682f39179c11de (patch)
treed6b5c8e26697e0ae080d80ae19727a8f632075d4
parent01c93f4b36e791c42130352f3ce865a26f7002be (diff)
downloadvdr-plugin-dxr3-f07c415201044981ad5e516828682f39179c11de.tar.gz
vdr-plugin-dxr3-f07c415201044981ad5e516828682f39179c11de.tar.bz2
fix runtime problem
-rw-r--r--decoder.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/decoder.c b/decoder.c
index 89d7ab5..6eca41b 100644
--- a/decoder.c
+++ b/decoder.c
@@ -80,20 +80,6 @@ cDecoder::cDecoder() : rbuf(50000), ac3dtsDecoder(&rbuf)
exit(-1);
}
- // reserve place for raw data for our rgbFrame
- uint8_t *buffer;
- int numBytes;
- // determine required buffer size and allocate buffer
- numBytes = avpicture_get_size(PIX_FMT_RGB24, contextVideo->width, contextVideo->height);
- buffer = (uint8_t *)av_malloc(numBytes * sizeof(uint8_t));
- if (!buffer) {
- esyslog("[dxr3-decoder] failed to alloc rgbFrame data");
- exit(-1);
- }
-
- // ssociate the frame with our newly allocated buffer
- avpicture_fill((AVPicture *)rgbFrame, buffer, PIX_FMT_RGB24, contextVideo->width, contextVideo->height);
-
lastBitrate = 0xff; // init with an invalid value - see checkMpegAudioHdr;
}
@@ -106,7 +92,6 @@ cDecoder::~cDecoder()
avcodec_close(contextVideo);
if (rgbFrame) {
- av_free(rgbFrame->data);
av_free(rgbFrame);
}
}
@@ -136,6 +121,23 @@ AVFrame *cDecoder::decode(AVPacket *source, uint32_t width, uint32_t height)
if (gotPicture) {
+ // reserve place for raw data for our rgbFrame
+ uint8_t *buffer;
+ int numBytes;
+ // determine required buffer size and allocate buffer
+ numBytes = avpicture_get_size(PIX_FMT_RGB24, contextVideo->width, contextVideo->height);
+ dsyslog("numBytes %d w%d h%d", numBytes, contextVideo->width, contextVideo->height);
+ buffer = (uint8_t *)av_malloc(numBytes * sizeof(uint8_t));
+ if (!buffer) {
+ esyslog("[dxr3-decoder] failed to alloc rgbFrame data");
+ exit(-1);
+ }
+
+ // TODO: caller must free buffer!!
+
+ // associate the frame with our newly allocated buffer
+ avpicture_fill((AVPicture *)rgbFrame, buffer, PIX_FMT_RGB24, contextVideo->width, contextVideo->height);
+
SwsContext *swsContext = sws_getContext(contextVideo->width, contextVideo->height,
contextVideo->pix_fmt, width, height, PIX_FMT_RGB24, SWS_BILINEAR, 0, 0, 0);