diff options
Diffstat (limited to 'command')
-rw-r--r-- | command/Makefile | 8 | ||||
-rw-r--r-- | command/decoder.cpp | 10 | ||||
-rw-r--r-- | command/decoder.h | 8 | ||||
-rw-r--r-- | command/demux.cpp | 86 | ||||
-rw-r--r-- | command/markad-standalone.cpp | 1 | ||||
-rw-r--r-- | command/marks.h | 2 | ||||
-rw-r--r-- | command/queue.cpp | 1 | ||||
-rw-r--r-- | command/queue.h | 2 |
8 files changed, 79 insertions, 39 deletions
diff --git a/command/Makefile b/command/Makefile index 2229eb3..6bbd123 100644 --- a/command/Makefile +++ b/command/Makefile @@ -2,6 +2,9 @@ # Makefile for a Video Disk Recorder addon # +# use this, if you use libavcodec51 +#WITH_OLD_FFMPEG_HEADERS=1 + ### The version number of this plugin (taken from the main source file): VERSION = $(shell grep 'static const char \*VERSION *=' ../version.h | awk '{ print $$6 }' | sed -e 's/[";]//g') @@ -22,6 +25,11 @@ DEFINES += -D_GNU_SOURCE DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE DEFINES += -D__STDC_CONSTANT_MACROS +ifdef WITH_OLD_FFMPEG_HEADERS + DEFINES += -DUSE_OLD_FFMPEG_HEADERS +endif + + INCLUDES += $(shell $(PKG-CONFIG) --cflags $(PKG-INCLUDES)) LIBS += $(shell $(PKG-CONFIG) --libs $(PKG-LIBS)) -pthread diff --git a/command/decoder.cpp b/command/decoder.cpp index 87619de..92ea1a0 100644 --- a/command/decoder.cpp +++ b/command/decoder.cpp @@ -7,6 +7,7 @@ #include <stdint.h> #include <sched.h> +#include <errno.h> #include <sys/types.h> #include <string.h> #include <cstdlib> @@ -39,7 +40,9 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) dest->palctrl = NULL; dest->slice_offset = NULL; dest->internal_buffer = NULL; +#if LIBAVCODEC_VERSION_INT >= ((52<<16)+(18<<8)+0) dest->hwaccel = NULL; +#endif dest->execute = NULL; #if LIBAVCODEC_VERSION_INT >= ((52<<16)+(37<<8)+0) dest->execute2 = NULL; @@ -240,10 +243,11 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH264, bool useMP2, bool hasAC3) video_context->skip_idct=AVDISCARD_ALL; + av_log_set_level(AV_LOG_FATAL); // silence decoder output + if (video_codecid==CODEC_ID_H264) { video_context->flags2|=CODEC_FLAG2_CHUNKS; // needed for H264! - av_log_set_level(AV_LOG_FATAL); // H264 decoder is very chatty } else { @@ -292,7 +296,11 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH264, bool useMP2, bool hasAC3) } else { +#if LIBAVCODEC_VERSION_INT < ((51<<16)+(55<<8)+0) + isyslog("using codec %s",video_codec->name); +#else isyslog("using codec %s",video_codec->long_name); +#endif #if LIBAVCODEC_VERSION_INT >= ((52<<16)+(22<<8)+2) if (video_context->hwaccel) diff --git a/command/decoder.h b/command/decoder.h index e3fb7a7..4a59883 100644 --- a/command/decoder.h +++ b/command/decoder.h @@ -14,15 +14,23 @@ typedef unsigned char uchar; extern "C" { +#ifdef USE_OLD_FFMPEG_HEADERS +#include <avcodec.h> +#else #include <libavcodec/avcodec.h> +#endif #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) #warning H264 parsing may be broken, better use libavcodec52 #endif #if LIBAVCODEC_VERSION_INT < ((52<<16)+(23<<8)+0) +#ifdef USE_OLD_FFMPEG_HEADERS +#include <avformat.h> +#else #include <libavformat/avformat.h> #endif +#endif #include "debug.h" } diff --git a/command/demux.cpp b/command/demux.cpp index 20922cd..c3580c5 100644 --- a/command/demux.cpp +++ b/command/demux.cpp @@ -41,37 +41,6 @@ void cMarkAdDemux::Clear() skip=0; } -void cMarkAdDemux::ProcessVDR(MarkAdPid Pid, uchar *Data, int Count, MarkAdPacket *Pkt) -{ - if (!Pkt) return; - - if ((Pid.Type==MARKAD_PIDTYPE_AUDIO_AC3) || (Pid.Type==MARKAD_PIDTYPE_AUDIO_MP2)) - { - if (!pes2audioes) pes2audioes=new cMarkAdPES2ES("PES2ES audio"); - if (!pes2audioes) return; - pes2audioes->Process(Pid,Data,Count,Pkt); - } - - if ((Pid.Type==MARKAD_PIDTYPE_VIDEO_H262) || (Pid.Type==MARKAD_PIDTYPE_VIDEO_H264)) - { - if (!pes2videoes) - { - if (Pid.Type==MARKAD_PIDTYPE_VIDEO_H264) - { - pes2videoes=new cMarkAdPES2ES("PES2H264ES video",425984); - } - else - { - pes2videoes=new cMarkAdPES2ES("PES2ES video",65536); - } - } - if (!pes2videoes) return; - pes2videoes->Process(Pid,Data,Count,Pkt); - } - - return; -} - void cMarkAdDemux::GetVideoPTS(uchar *Data, int Count, unsigned int *Timestamp) { if (!Data) return; @@ -102,6 +71,38 @@ void cMarkAdDemux::GetVideoPTS(uchar *Data, int Count, unsigned int *Timestamp) return; } +void cMarkAdDemux::ProcessVDR(MarkAdPid Pid, uchar *Data, int Count, MarkAdPacket *Pkt) +{ + if (!Pkt) return; + + if ((Pid.Type==MARKAD_PIDTYPE_AUDIO_AC3) || (Pid.Type==MARKAD_PIDTYPE_AUDIO_MP2)) + { + if (!pes2audioes) pes2audioes=new cMarkAdPES2ES((Pid.Type==MARKAD_PIDTYPE_AUDIO_AC3) ? + "PES2ES AC3" : "PES2ES MP2"); + if (!pes2audioes) return; + pes2audioes->Process(Pid,Data,Count,Pkt); + } + + if ((Pid.Type==MARKAD_PIDTYPE_VIDEO_H262) || (Pid.Type==MARKAD_PIDTYPE_VIDEO_H264)) + { + if (!pes2videoes) + { + if (Pid.Type==MARKAD_PIDTYPE_VIDEO_H264) + { + pes2videoes=new cMarkAdPES2ES("PES2H264ES",425984); + } + else + { + pes2videoes=new cMarkAdPES2ES("PES2H262ES",65536); + } + } + if (!pes2videoes) return; + pes2videoes->Process(Pid,Data,Count,Pkt); + } + + return; +} + void cMarkAdDemux::ProcessTS(MarkAdPid Pid, uchar *Data, int Count, MarkAdPacket *Pkt) { if (!Pkt) return; @@ -111,13 +112,23 @@ void cMarkAdDemux::ProcessTS(MarkAdPid Pid, uchar *Data, int Count, MarkAdPacket if (!ts2pkt) { - if (Pid.Type==MARKAD_PIDTYPE_VIDEO_H264) + switch (Pid.Type) { + case MARKAD_PIDTYPE_VIDEO_H264: ts2pkt=new cMarkAdTS2Pkt("TS2H264",819200); - } - else - { - ts2pkt=new cMarkAdTS2Pkt("TS2PKT",262144); + break; + + case MARKAD_PIDTYPE_VIDEO_H262: + ts2pkt=new cMarkAdTS2Pkt("TS2H262",262144); + break; + + case MARKAD_PIDTYPE_AUDIO_AC3: + ts2pkt=new cMarkAdTS2Pkt("TS2PES AC3",32768); + break; + + case MARKAD_PIDTYPE_AUDIO_MP2: + ts2pkt=new cMarkAdTS2Pkt("TS2PES MP2",16384); + break; } } if (!ts2pkt) return; @@ -130,7 +141,8 @@ void cMarkAdDemux::ProcessTS(MarkAdPid Pid, uchar *Data, int Count, MarkAdPacket if ((Pid.Type==MARKAD_PIDTYPE_AUDIO_AC3) || (Pid.Type==MARKAD_PIDTYPE_AUDIO_MP2)) { - if (!pes2audioes) pes2audioes=new cMarkAdPES2ES("PES2ES audio"); + if (!pes2audioes) pes2audioes=new cMarkAdPES2ES((Pid.Type==MARKAD_PIDTYPE_AUDIO_AC3) ? + "PES2ES AC3" : "PES2ES MP2"); if (!pes2audioes) return; pes2audioes->Process(Pid,pkt.Data,pkt.Length,Pkt); } diff --git a/command/markad-standalone.cpp b/command/markad-standalone.cpp index bca7a37..e9701ff 100644 --- a/command/markad-standalone.cpp +++ b/command/markad-standalone.cpp @@ -7,6 +7,7 @@ #include <syslog.h> #include <stdio.h> +#include <stdlib.h> #include <stdarg.h> #include <unistd.h> #include <fcntl.h> diff --git a/command/marks.h b/command/marks.h index 8deae5b..8d75df7 100644 --- a/command/marks.h +++ b/command/marks.h @@ -8,6 +8,8 @@ #ifndef __marks_h_ #define __marks_h_ +#include <string.h> + class clMark { private: diff --git a/command/queue.cpp b/command/queue.cpp index 4f4eaa0..9a312e2 100644 --- a/command/queue.cpp +++ b/command/queue.cpp @@ -97,6 +97,7 @@ bool cMarkAdPaketQueue::Put(uchar *Data, int Size) { esyslog("buffer full"); } + mpercent=100; Clear(); return false; } diff --git a/command/queue.h b/command/queue.h index 8f40ac3..855355b 100644 --- a/command/queue.h +++ b/command/queue.h @@ -119,7 +119,7 @@ private: } pktinfo; int percent; - int mpercent; + int mpercent; // max percentage use uchar *buffer; int maxqueue; |