summaryrefslogtreecommitdiff
path: root/dxr3demuxdevice.h
blob: 60de113126ef19cc7a05eea8fcfeec3ade09ecc8 (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
/*
 * dxr3demuxdevice.h
 *
 * Copyright (C) 2002-2004 Kai Möller
 *
 * 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 library 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.
 *
 * 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
 *
 */

#ifndef __DXR3_DEMUX_DEVICE_H
#define __DXR3_DEMUX_DEVICE_H

#include "dxr3generaldefines.h"
#include "dxr3syncbuffer.h"
#include "dxr3output.h"

const int AUDIO_MAX_BUFFER_SIZE = 200;
const int VIDEO_MAX_BUFFER_SIZE = 500;

const int AUIDO_MAX_FRAME_SIZE = 5000;
const int VIDEO_MAX_FRAME_SIZE = 3000;
const uint32_t PRE_BUFFER_LENGTH = 0;

// ==================================
// extract video and audio
class cDxr3DemuxDevice : private Uncopyable {
public:
    cDxr3DemuxDevice();
    ~cDxr3DemuxDevice();

    void setAudio(iAudio *audio);

    void Stop();
    void Resync();
    void Clear();
    void SetReplayMode();
    void SetTrickMode(eDxr3TrickState trickState, int Speed = 1);

    int DemuxPes(const uint8_t* buf, int length, bool bAc3Dts = false);
    int DemuxAudioPes(const uint8_t* buf, int length);
    void StillPicture(const uint8_t* buf, int length);

    eDxr3DemuxMode GetDemuxMode()   { return m_demuxMode; }
    eDxr3TrickState GetTrickState() { return m_trickState; };

    bool Poll(int TimeoutMs)  {
        return  m_aBuf.Poll(TimeoutMs) && m_vBuf.Poll(TimeoutMs);
    };

private:
    cDxr3Interface *m_dxr3Device;
    cDxr3SyncBuffer m_aBuf;
    cDxr3SyncBuffer m_vBuf;
    eDxr3DemuxSynchState m_synchState;
    eDxr3DemuxMode m_demuxMode;
    eDxr3TrickState m_trickState;
    cDxr3AudioDecoder m_aDecoder;
    cDxr3AudioOutThread* m_pAudioThread;
    cDxr3VideoOutThread* m_pVideoThread;
    uint32_t m_stopScr;
    int m_ReUseFrame;			// how often a frame should be used
};

#endif // __DXR3_DEMUX_DEVICE_H

// Local variables:
// mode: c++
// c-file-style: "stroustrup"
// c-file-offsets: ((inline-open . 0))
// tab-width: 4;
// indent-tabs-mode: nil
// End: