3 *****************************************************************************
4 * Copyright © 2014-2015 VideoLAN and VLC Authors
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
23 #include <vlc_common.h>
28 class ExtraFMTInfoInterface
31 virtual void fillExtraFMTInfo( es_format_t
* ) const = 0;
32 virtual ~ExtraFMTInfoInterface() = default;
36 class CommandsFactory
;
37 class AbstractFakeESOutID
;
40 class AbstractFakeEsOut
42 friend class EsOutCallbacks
;
45 virtual ~AbstractFakeEsOut();
47 /* Used by FakeES ID */
48 virtual void recycle( AbstractFakeESOutID
* ) = 0;
49 virtual void createOrRecycleRealEsID( AbstractFakeESOutID
* ) = 0;
50 virtual void setPriority(int) = 0;
51 virtual void sendData( AbstractFakeESOutID
*, block_t
* ) = 0;
52 virtual void sendMeta( int, const vlc_meta_t
* ) = 0;
56 virtual es_out_id_t
*esOutAdd( const es_format_t
* ) = 0;
57 virtual int esOutSend( es_out_id_t
*, block_t
* ) = 0;
58 virtual void esOutDel( es_out_id_t
* ) = 0;
59 virtual int esOutControl( int, va_list ) = 0;
60 virtual void esOutDestroy() = 0;
63 class FakeESOut
: public AbstractFakeEsOut
68 friend class FakeESOut
;
72 FakeESOut
& operator*();
73 FakeESOut
* operator->();
76 LockedFakeEsOut(FakeESOut
&q
);
78 FakeESOut( es_out_t
*, CommandsQueue
*, CommandsFactory
* );
80 LockedFakeEsOut
WithLock();
81 CommandsQueue
* commandsQueue();
82 CommandsFactory
*commandsFactory() const;
83 void setAssociatedTimestamp( vlc_tick_t
);
84 void setExpectedTimestamp( vlc_tick_t
);
85 void resetTimestamps();
86 bool getStartTimestamps( vlc_tick_t
*, vlc_tick_t
* );
87 size_t esCount() const;
88 bool hasSelectedEs() const;
89 bool decodersDrained();
90 bool restarting() const;
91 void setExtraInfoProvider( ExtraFMTInfoInterface
* );
92 vlc_tick_t
fixTimestamp(vlc_tick_t
);
93 void declareEs( const es_format_t
* );
95 /* Used by FakeES ID */
96 virtual void recycle( AbstractFakeESOutID
*id
) override
;
97 virtual void createOrRecycleRealEsID( AbstractFakeESOutID
* ) override
;
98 virtual void setPriority(int) override
;
99 virtual void sendData( AbstractFakeESOutID
*, block_t
* ) override
;
100 virtual void sendMeta( int, const vlc_meta_t
* ) override
;
103 void schedulePCRReset();
104 void scheduleAllForDeletion(); /* Queue Del commands for non Del issued ones */
105 void recycleAll(); /* Cancels all commands and send fakees for recycling */
109 friend class LockedFakeESOut
;
111 virtual es_out_id_t
*esOutAdd( const es_format_t
* ) override
;
112 virtual int esOutSend( es_out_id_t
*, block_t
* ) override
;
113 virtual void esOutDel( es_out_id_t
* ) override
;
114 virtual int esOutControl( int, va_list ) override
;
115 virtual void esOutDestroy() override
;
116 es_out_t
*real_es_out
;
117 FakeESOutID
* createNewID( const es_format_t
* );
118 ExtraFMTInfoInterface
*extrainfo
;
119 CommandsQueue
*commandsqueue
;
120 CommandsFactory
*commandsfactory
;
123 vlc_tick_t timestamp
;
124 bool b_timestamp_set
;
125 bool b_offset_calculated
;
126 } associated
, expected
;
127 vlc_tick_t timestamp_first
;
128 vlc_tick_t timestamps_offset
;
130 std::list
<FakeESOutID
*> fakeesidlist
;
131 std::list
<FakeESOutID
*> recycle_candidates
;
132 std::list
<FakeESOutID
*> declared
;
136 #endif // FAKEESOUT_HPP