summaryrefslogtreecommitdiff
path: root/markad-standalone.h
blob: cd4a0232618f349bac8cb1a2cc72188c3f2fd8c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * markad-standalone.h: A plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 * $Id$
 */

#ifndef __markad_standalone_h_
#define __markad_standalone_h_

#include <syslog.h>
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
#include <fcntl.h>
#include <getopt.h>
#include <signal.h>
#include <ctype.h>

#include "demux.h"
#include "global.h"
#include "decoder.h"
#include "video.h"
#include "audio.h"
#include "common.h"
#include "version.h"

int SysLogLevel=2;

class cMarkAdIndex
{
private:
    int index_fd; // index file descriptor
    int maxfiles;
    bool ts;

    int index;
    int iframe;
    off_t offset;

    bool Open(const char *Directory);
    void Close();
public:
    bool isTS()
    {
        return ts;
    }
    int MaxFiles()
    {
        return maxfiles;
    }
    int GetNext(off_t Offset);
    cMarkAdIndex(const char *Directory);
    ~cMarkAdIndex();
};

class cMarkAdStandalone
{
private:
    cMarkAdDemux *video_demux;
    cMarkAdDemux *ac3_demux;
    cMarkAdDemux *mp2_demux;
    cMarkAdDecoder *decoder;
    cMarkAdVideo *video;
    cMarkAdAudio *audio;
    cMarkAdCommon *common;

    MarkAdContext macontext;
    char *dir;

    cMarkAdIndex *index;

    void AddMark(MarkAdMark *Mark);
    int LastIFrame(int Number, off_t Offset);
    bool ProcessFile(int Number);

public:
    void Process();
    cMarkAdStandalone(const char *Directory);
    ~cMarkAdStandalone();
};

#endif