summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2010-06-29 17:37:38 +0200
committerChristian Gmeiner <christian.gmeiner@gmail.com>2010-06-29 17:37:38 +0200
commitd51aa28273b2a32ecd7e23d0d851ddec5f03578d (patch)
tree0fda0feaa2a08b4be18d8c267baa49effb5d35dc
parentb8c967e8f99bbc52aafe3cf8c98a3fba7f44eaa8 (diff)
downloadvdr-plugin-dxr3-d51aa28273b2a32ecd7e23d0d851ddec5f03578d.tar.gz
vdr-plugin-dxr3-d51aa28273b2a32ecd7e23d0d851ddec5f03578d.tar.bz2
rename dxr3audiodecoder.[ch] to decoder.[ch]
In the near future the decoder will be able to decode MPEG2 video frames to implement basic a GrabImage().
-rw-r--r--Makefile2
-rw-r--r--decoder.c (renamed from dxr3audiodecoder.c)47
-rw-r--r--decoder.h (renamed from dxr3audiodecoder.h)43
-rw-r--r--dxr3device.c8
-rw-r--r--dxr3device.h4
5 files changed, 57 insertions, 47 deletions
diff --git a/Makefile b/Makefile
index e4c713a..c6adde0 100644
--- a/Makefile
+++ b/Makefile
@@ -84,7 +84,7 @@ endif
### The object files (add further files here):
OBJS = $(PLUGIN).o dxr3multichannelaudio.o \
- dxr3audiodecoder.o dxr3blackframe.o dxr3audio.o \
+ decoder.o dxr3blackframe.o dxr3audio.o \
dxr3pesframe.o settings.o \
dxr3device.o dxr3osd.o dxr3spudecoder.o \
dxr3audio-alsa.o dxr3audio-pa.o \
diff --git a/dxr3audiodecoder.c b/decoder.c
index e7b22a7..266ef3c 100644
--- a/dxr3audiodecoder.c
+++ b/decoder.c
@@ -1,27 +1,32 @@
/*
- * dxr3audiodecoder.c
+ * _ _ _ _ _____
+ * __ ____| |_ __ _ __ | |_ _ __ _(_)_ __ __| |_ ___ _|___ /
+ * \ \ / / _` | '__|____| '_ \| | | | |/ _` | | '_ \ _____ / _` \ \/ / '__||_ \
+ * \ V / (_| | | |_____| |_) | | |_| | (_| | | | | |_____| (_| |> <| | ___) |
+ * \_/ \__,_|_| | .__/|_|\__,_|\__, |_|_| |_| \__,_/_/\_\_| |____/
+ * |_| |___/
*
* Copyright (C) 2002-2004 Kai Möller
- * Copyright (C) 2004-2009 Christian Gmeiner
+ * Copyright (C) 2004-2010 Christian Gmeiner
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * This file is part of vdr-plugin-dxr3.
*
- * This library is distributed in the hope that it will be useful,
+ * vdr-plugin-dxr3 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2.
+ *
+ * vdr-plugin-dxr3 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with dxr3-plugin. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <algorithm>
-#include "dxr3audiodecoder.h"
+#include "decoder.h"
#include "dxr3pesframe.h"
#include "dxr3audio.h"
#include "settings.h"
@@ -31,7 +36,7 @@ const int LPCM_HEADER_LENGTH = 7;
// ==================================
//! constructor
-cDxr3AudioDecoder::cDxr3AudioDecoder() : rbuf(50000), ac3dtsDecoder(&rbuf)
+cDecoder::cDecoder() : rbuf(50000), ac3dtsDecoder(&rbuf)
{
// setup ffmpeg
avcodec_init();
@@ -60,7 +65,7 @@ cDxr3AudioDecoder::cDxr3AudioDecoder() : rbuf(50000), ac3dtsDecoder(&rbuf)
// ==================================
//! deconst.
-cDxr3AudioDecoder::~cDxr3AudioDecoder()
+cDecoder::~cDecoder()
{
// close codec, if it is open
avcodec_close(contextAudio);
@@ -68,7 +73,7 @@ cDxr3AudioDecoder::~cDxr3AudioDecoder()
// ==================================
//! (re)init ffmpeg codec
-void cDxr3AudioDecoder::Init()
+void cDecoder::Init()
{
avcodec_close(contextAudio);
@@ -82,7 +87,7 @@ void cDxr3AudioDecoder::Init()
}
}
-void cDxr3AudioDecoder::decode(cDxr3PesFrame *frame, iAudio *audio)
+void cDecoder::decode(cDxr3PesFrame *frame, iAudio *audio)
{
int len, out_size;
@@ -137,7 +142,7 @@ void cDxr3AudioDecoder::decode(cDxr3PesFrame *frame, iAudio *audio)
}
}
-void cDxr3AudioDecoder::ac3dts(cDxr3PesFrame *frame, iAudio *audio)
+void cDecoder::ac3dts(cDxr3PesFrame *frame, iAudio *audio)
{
if (cSettings::instance()->ac3AudioMode() == PCM_ENCAPSULATION) {
@@ -169,7 +174,7 @@ void cDxr3AudioDecoder::ac3dts(cDxr3PesFrame *frame, iAudio *audio)
#if 0
// ==================================
//! decode lpcm
-void cDxr3AudioDecoder::DecodeLpcm(cDxr3PesFrame *frame, uint32_t pts, cDxr3SyncBuffer &aBuf)
+void cDecoder::DecodeLpcm(cDxr3PesFrame *frame, uint32_t pts, cDxr3SyncBuffer &aBuf)
{
const uint8_t *buf = frame->GetPayload();
int length = frame->GetPayloadLength();
@@ -222,7 +227,7 @@ void cDxr3AudioDecoder::DecodeLpcm(cDxr3PesFrame *frame, uint32_t pts, cDxr3Sync
#endif
// ==================================
//! checking routine
-bool cDxr3AudioDecoder::checkMpegAudioHdr(const uint8_t *head)
+bool cDecoder::checkMpegAudioHdr(const uint8_t *head)
{
// all informations about the mpeg audio header
// can be found at http://www.datavoyage.com/mpgscript/mpeghdr.htm
@@ -258,7 +263,7 @@ bool cDxr3AudioDecoder::checkMpegAudioHdr(const uint8_t *head)
return true;
}
-int cDxr3AudioDecoder::calcFrameSize(const uint8_t *header)
+int cDecoder::calcFrameSize(const uint8_t *header)
{
static const int bitrates[2][3][15] =
{
diff --git a/dxr3audiodecoder.h b/decoder.h
index 8f2a28d..b87fa7e 100644
--- a/dxr3audiodecoder.h
+++ b/decoder.h
@@ -1,27 +1,32 @@
/*
- * dxr3audiodecoder.h
+ * _ _ _ _ _____
+ * __ ____| |_ __ _ __ | |_ _ __ _(_)_ __ __| |_ ___ _|___ /
+ * \ \ / / _` | '__|____| '_ \| | | | |/ _` | | '_ \ _____ / _` \ \/ / '__||_ \
+ * \ V / (_| | | |_____| |_) | | |_| | (_| | | | | |_____| (_| |> <| | ___) |
+ * \_/ \__,_|_| | .__/|_|\__,_|\__, |_|_| |_| \__,_/_/\_\_| |____/
+ * |_| |___/
*
* Copyright (C) 2002-2004 Kai Möller
- * Copyright (C) 2004 Christian Gmeiner
+ * Copyright (C) 2004-2010 Christian Gmeiner
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * This file is part of vdr-plugin-dxr3.
*
- * This library is distributed in the hope that it will be useful,
+ * vdr-plugin-dxr3 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2.
+ *
+ * vdr-plugin-dxr3 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with dxr3-plugin. If not, see <http://www.gnu.org/licenses/>.
*
*/
-#ifndef _DXR3_AUDIODECODER_H_
-#define _DXR3_AUDIODECODER_H_
+#ifndef _DECODER_H_
+#define _DECODER_H_
extern "C" {
# include <libavcodec/avcodec.h>
@@ -36,11 +41,11 @@ class cDxr3PesFrame;
class iAudio;
// ==================================
-// decode audio to mp2 or use DD :)
-class cDxr3AudioDecoder : private Uncopyable {
+// allround decoder
+class cDecoder : private Uncopyable {
public:
- cDxr3AudioDecoder();
- ~cDxr3AudioDecoder();
+ cDecoder();
+ ~cDecoder();
void decode(cDxr3PesFrame *frame, iAudio *audio);
void ac3dts(cDxr3PesFrame *frame, iAudio *audio);
@@ -71,7 +76,7 @@ private:
void Init();
};
-#endif /*_DXR3_AUDIODECODER_H_*/
+#endif /*_DECODER_H_*/
// Local variables:
// mode: c++
diff --git a/dxr3device.c b/dxr3device.c
index 1616759..984ad00 100644
--- a/dxr3device.c
+++ b/dxr3device.c
@@ -60,7 +60,7 @@ cDxr3Device::cDxr3Device() : spuDecoder(NULL), pluginOn(true), vPts(0), scrSet(f
}
audioOut->openDevice();
- aDecoder = new cDxr3AudioDecoder();
+ decoder = new cDecoder();
// register observer
cSettings::instance()->registerObserver(this);
@@ -70,7 +70,7 @@ cDxr3Device::~cDxr3Device()
{
audioOut->releaseDevice();
delete audioOut;
- delete aDecoder;
+ delete decoder;
releaseDevices();
@@ -284,9 +284,9 @@ int cDxr3Device::PlayAudio(const uchar *Data, int Length, uchar Id)
bool isAc3 = ((Id & 0xF0) == 0x80) || Id == 0xbd;
if (!isAc3) {
- aDecoder->decode(&frame, audioOut);
+ decoder->decode(&frame, audioOut);
} else {
- aDecoder->ac3dts(&frame, audioOut);
+ decoder->ac3dts(&frame, audioOut);
}
return Length;
diff --git a/dxr3device.h b/dxr3device.h
index 9b1af70..91443ec 100644
--- a/dxr3device.h
+++ b/dxr3device.h
@@ -32,7 +32,7 @@
#include <vdr/device.h>
#include <linux/em8300.h>
-#include "dxr3audiodecoder.h"
+#include "decoder.h"
#include "dxr3spudecoder.h"
#include "dxr3audio.h"
#include "settings.h"
@@ -117,7 +117,7 @@ private:
int offset;
cMutex mutex;
- cDxr3AudioDecoder *aDecoder;
+ cDecoder *decoder;
cDxr3SpuDecoder* spuDecoder;
iAudio *audioOut;
bool pluginOn;