summaryrefslogtreecommitdiff
path: root/decoder.cpp
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2010-03-19 09:38:50 +0100
committerJochen Dolze <vdr@dolze.de>2010-03-19 09:38:50 +0100
commitb832246723d664e53102fc0bc3a87739b49a3314 (patch)
treebbe3677b72526fedbbc8ba7a5df2f81f9a16d12e /decoder.cpp
parentb8557b40289992318888f793243bff7c98bec106 (diff)
downloadvdr-plugin-markad-b832246723d664e53102fc0bc3a87739b49a3314.tar.gz
vdr-plugin-markad-b832246723d664e53102fc0bc3a87739b49a3314.tar.bz2
libavcodec header and library check
Diffstat (limited to 'decoder.cpp')
-rw-r--r--decoder.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/decoder.cpp b/decoder.cpp
index 66649a6..a8c8c07 100644
--- a/decoder.cpp
+++ b/decoder.cpp
@@ -26,8 +26,20 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH264, bool useMP2, bool hasAC3)
cpucount=CPU_COUNT(&cpumask);
}
- isyslog("using libavcodec.so.%s with %i threads",
- AV_STRINGIFY(LIBAVCODEC_VERSION),cpucount);
+ int ver = avcodec_version();
+ char libver[256];
+ snprintf(libver,sizeof(libver),"%i.%i.%i",ver >> 16 & 0xFF,ver >> 8 & 0xFF,ver & 0xFF);
+ isyslog("using libavcodec.so.%s with %i threads",libver,cpucount);
+
+ if (ver!=LIBAVCODEC_VERSION_INT)
+ {
+ esyslog("libavcodec header version %s",AV_STRINGIFY(LIBAVCODEC_VERSION));
+ esyslog("header and library mismatch, decoding disabled");
+ video_context=NULL;
+ ac3_context=NULL;
+ mp2_context=NULL;
+ audiobuf=NULL;
+ }
if (useMP2)
{
@@ -39,6 +51,8 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH264, bool useMP2, bool hasAC3)
if (mp2_context)
{
mp2_context->thread_count=cpucount;
+ mp2_context->codec_id = mp2_codecid;
+ mp2_context->codec_type = CODEC_TYPE_AUDIO;
if (avcodec_open(mp2_context, mp2_codec) < 0)
{
esyslog("could not open codec for MP2");
@@ -72,6 +86,8 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH264, bool useMP2, bool hasAC3)
if (ac3_context)
{
ac3_context->thread_count=cpucount;
+ ac3_context->codec_id = ac3_codecid;
+ ac3_context->codec_type = CODEC_TYPE_AUDIO;
if (avcodec_open(ac3_context, ac3_codec) < 0)
{
esyslog("could not open codec for AC3");
@@ -140,6 +156,8 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH264, bool useMP2, bool hasAC3)
video_context->skip_frame=AVDISCARD_NONKEY; // just I-frames
}
+ video_context->codec_id = video_codecid;
+ video_context->codec_type = CODEC_TYPE_VIDEO;
int ret=avcodec_open(video_context, video_codec);
if ((ret < 0) && (video_codecid==CODEC_ID_MPEG2VIDEO_XVMC))
{