summaryrefslogtreecommitdiff
path: root/command/pes2es.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'command/pes2es.cpp')
-rw-r--r--command/pes2es.cpp102
1 files changed, 0 insertions, 102 deletions
diff --git a/command/pes2es.cpp b/command/pes2es.cpp
deleted file mode 100644
index c78afd6..0000000
--- a/command/pes2es.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * pes2es.cpp: A program for the Video Disk Recorder
- *
- * See the README file for copyright information and how to reach the author.
- *
- */
-
-#include <inttypes.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pes2es.h"
-#include <stdio.h>
-cMarkAdPES2ES::cMarkAdPES2ES(const char *QueueName, int QueueSize)
-{
- queue = new cMarkAdPaketQueue(QueueName,QueueSize);
- type=0;
-}
-
-cMarkAdPES2ES::~cMarkAdPES2ES()
-{
- if (queue) delete queue;
-}
-
-void cMarkAdPES2ES::Clear()
-{
- if (queue) queue->Clear();
-}
-
-void cMarkAdPES2ES::Process(MarkAdPid Pid, uchar *PESData, int PESSize, MarkAdPacket *ESPkt)
-{
- if (!ESPkt) return;
-
- if (PESData)
- {
- struct PESHDR *peshdr=(struct PESHDR *) PESData;
-
- // first check some simple things
- if ((peshdr->Sync1!=0) && (peshdr->Sync2!=0) && (peshdr->Sync3!=1))
- {
- Clear();
- return;
- }
-
- if (peshdr->StreamID<=0xBC) return;
-
- int Length=(peshdr->LenH<<8)+peshdr->LenL;
- if (Length) Length+=sizeof(PESHDR);
- if (Length!=PESSize)
- {
- if ((peshdr->StreamID & 0xF0)==0xE0) return;
- Clear();
- return;
- }
-
- switch (Pid.Type)
- {
- case MARKAD_PIDTYPE_VIDEO_H262:
- if ((peshdr->StreamID & 0xF0)!=0xE0) return;
- type=MA_PACKET_PKT;
- break;
- case MARKAD_PIDTYPE_VIDEO_H264:
- if ((peshdr->StreamID & 0xF0)!=0xE0) return;
- type=MA_PACKET_H264;
- break;
- case MARKAD_PIDTYPE_AUDIO_AC3:
- if (peshdr->StreamID!=0xBD) return;
- type=MA_PACKET_AC3;
- break;
- case MARKAD_PIDTYPE_AUDIO_MP2:
- if ((peshdr->StreamID<0xC0) || (peshdr->StreamID>0xDF)) return;
- type=MA_PACKET_MP2;
- break;
- default:
- Clear();
- return;
- }
-
- struct PESHDROPT *peshdropt=(struct PESHDROPT *) &PESData[sizeof(struct PESHDR)];
-
- uchar *buf;
- int buflen;
-
- if (peshdropt->MarkerBits==0x2)
- {
- // we have an optional PES header
- int bpos=sizeof(struct PESHDR)+sizeof(struct PESHDROPT)+
- peshdropt->Length;
- buf=&PESData[bpos];
- buflen=PESSize-bpos;
- }
- else
- {
- int bpos=sizeof(struct PESHDR);
- buf=&PESData[bpos];
- buflen=PESSize-bpos;
- }
- queue->Put(buf,buflen);
- }
- if (type) ESPkt->Data=queue->GetPacket(&ESPkt->Length,type);
- return;
-}