diff options
author | Christian Gmeiner <christian.gmeiner@gmail.com> | 2010-06-30 15:16:53 +0200 |
---|---|---|
committer | Christian Gmeiner <christian.gmeiner@gmail.com> | 2010-06-30 15:16:53 +0200 |
commit | 959a6597cc832783dd4364bd6f0f9a499b90402a (patch) | |
tree | e302e6fcba16661ae59a90e82ab2bf4474616073 | |
parent | 447a0d616a6de62e7d4bf438fa79a12ded70ce14 (diff) | |
download | vdr-plugin-dxr3-959a6597cc832783dd4364bd6f0f9a499b90402a.tar.gz vdr-plugin-dxr3-959a6597cc832783dd4364bd6f0f9a499b90402a.tar.bz2 |
remove video decoding stuff - i need to spend more time on alsa
-rw-r--r-- | decoder.c | 66 | ||||
-rw-r--r-- | decoder.h | 4 |
2 files changed, 0 insertions, 70 deletions
@@ -50,14 +50,6 @@ cDecoder::cDecoder() : rbuf(50000), ac3dtsDecoder(&rbuf) exit(-1); } - // look for video codec - video = avcodec_find_decoder(CODEC_ID_MPEG2VIDEO); - if (!video) { - esyslog("[dxr3-decoder] no suitable video codec found."); - esyslog("[dxr3-decoder] check your ffmpeg installation."); - exit(-1); - } - // create a new codec context contextAudio = avcodec_alloc_context(); int ret = avcodec_open(contextAudio, audio); @@ -67,19 +59,6 @@ cDecoder::cDecoder() : rbuf(50000), ac3dtsDecoder(&rbuf) exit(-1); } - contextVideo = avcodec_alloc_context(); - ret = avcodec_open(contextVideo, video); - if (ret < 0) { - esyslog("[dxr3-decoder] failed to open codec %s.", video->name); - exit(-1); - } - - rgbFrame = avcodec_alloc_frame(); - if (!rgbFrame) { - esyslog("[dxr3-decoder] failed to alloc rgbFrame"); - exit(-1); - } - lastBitrate = 0xff; // init with an invalid value - see checkMpegAudioHdr; } @@ -89,11 +68,6 @@ cDecoder::~cDecoder() { // close codec, if it is open avcodec_close(contextAudio); - avcodec_close(contextVideo); - - if (rgbFrame) { - av_free(rgbFrame); - } } // ================================== @@ -112,46 +86,6 @@ void cDecoder::Init() } } -AVFrame *cDecoder::decode(AVPacket *source, uint32_t width, uint32_t height) -{ - AVFrame frame; - int gotPicture; - - avcodec_decode_video2(contextVideo, &frame, &gotPicture, source); - - 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); - - if (swsContext) { - sws_scale(swsContext, frame.data, frame.linesize, 0, contextVideo->height, rgbFrame->data, rgbFrame->linesize); - sws_freeContext(swsContext); - - return rgbFrame; - } - } - - return NULL; -} - void cDecoder::decode(cDxr3PesFrame *frame, iAudio *audio) { int len, out_size; @@ -48,7 +48,6 @@ public: cDecoder(); ~cDecoder(); - AVFrame *decode(AVPacket *source, uint32_t width, uint32_t height); void decode(cDxr3PesFrame *frame, iAudio *audio); void ac3dts(cDxr3PesFrame *frame, iAudio *audio); @@ -63,12 +62,9 @@ private: int calcFrameSize(const uint8_t *header); AVCodec *audio; - AVCodec *video; AVCodecContext *contextAudio; - AVCodecContext *contextVideo; AVPacket avpkt; - AVFrame *rgbFrame; cRingBufferFrame rbuf; cMultichannelAudio ac3dtsDecoder; |