Valkka  1.6.1
OpenSource Video Management
frame.h
Go to the documentation of this file.
1 #ifndef frame_HEADER_GUARD
2 #define frame_HEADER_GUARD
3 
4 /*
5  * frame.h : Frame classes
6  *
7  * (c) Copyright 2017-2024 Sampsa Riikonen
8  *
9  * Authors: Sampsa Riikonen <sampsa.riikonen@iki.fi>
10  *
11  * This file is part of the Valkka library.
12  *
13  * Valkka is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License as
15  * published by the Free Software Foundation, either version 3 of the
16  * License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public License
24  * along with this program. If not, see <https://www.gnu.org/licenses/>
25  *
26  */
27 
37 #include "common.h"
38 #include "codec.h"
39 #include "metadata.h"
40 #include "threadsignal.h"
41 #include "constant.h"
42 #include "avdep.h"
43 #include "opengl.h"
44 #include "tools.h"
45 #include "macro.h"
46 #include "rawrite.h"
47 
52 enum class FrameClass
53 {
54  none,
55 
56  basic,
57 
58  avpkt,
59 
60  avmedia,
61  avbitmap,
62  // avbitmap_np, ///< child of avmedia: video, non-planar
63 
64  avaudio,
65 
66  avrgb,
67 
68  yuv,
69 
70  rgb,
71 
72  setup,
73  signal,
74 
75  marker,
76 
77  mux,
78 
79  First = none,
80  Last = mux
81 };
82 
86 enum class TimeCorrectionType // <pyapi>
87 { // <pyapi>
88  none, // <pyapi>
89  smart, // <pyapi>
90  dummy // <pyapi>
91 }; // <pyapi>
92 
111 class Frame
112 {
113 
114 public:
115  Frame();
116  virtual ~Frame();
117  frame_essentials(FrameClass::none, Frame);
118  frame_clone(FrameClass::none, Frame);
119  /*Frame(const Frame &f); ///< Default copy ctor
120 
121 
122 public: // frame essentials : must be defined for each frame subclass
123  virtual FrameClass getFrameClass(); ///< Returns the subclass frame type. See Frame::frameclass
124  virtual void copyFrom(Frame *f); ///< Copies data to this frame from a frame of the same type (also metadata)
125  */
126 
127 public: // redefined virtual
128  virtual void print(std::ostream &os) const;
129  virtual std::string dumpPayload();
130  virtual void dumpPayloadToFile(std::ofstream &fout);
131  virtual void updateAux();
132  virtual void update();
133  virtual void reset();
134  virtual bool isSeekable();
135 
136 public:
137  void copyMetaFrom(Frame *f);
138 
139 protected:
141 
142 public: // public metadata
143  SlotNumber n_slot;
145  long int mstimestamp;
146 };
147 
148 inline std::ostream &operator<<(std::ostream &os, const Frame &f)
149 {
150  // https://stackoverflow.com/questions/4571611/making-operator-virtual
151  f.print(os);
152  return os;
153 }
154 
165 class BasicFrame : public Frame
166 {
167 
168 public:
169  BasicFrame();
170  virtual ~BasicFrame();
171  frame_essentials(FrameClass::basic, BasicFrame);
172  frame_clone(FrameClass::basic, BasicFrame);
173  /*BasicFrame(const BasicFrame &f); ///< Default copy ctor
174 
175 public: // frame essentials
176  virtual FrameClass getFrameClass(); ///< Returns the subclass frame type. See Frame::frameclass
177  virtual void copyFrom(Frame *f); ///< Copies data to this frame from a frame of the same type
178  */
179 
180 public: // redefined virtual
181  virtual void print(std::ostream &os) const;
182  virtual std::string dumpPayload();
183  virtual void dumpPayloadToFile(std::ofstream &fout);
184  virtual void reset();
185  virtual bool isSeekable();
186 
187 public: // payload handling
188  void reserve(std::size_t n_bytes);
189  void resize(std::size_t n_bytes);
190 
191 public: // frame variables
192  std::vector<uint8_t> payload;
193  AVMediaType media_type;
194  AVCodecID codec_id;
195 
196 public: // codec-dependent parameters
198 
199 public: // codec-dependent functions
200  void fillPars();
201  void fillH264Pars();
202 
203 public:
204  void fillAVPacket(AVPacket *avpkt);
205  void copyFromAVPacket(AVPacket *avpkt);
206  void filterFromAVPacket(AVPacket *avpkt, AVCodecContext *codec_ctx, AVBitStreamFilterContext *filter);
207 
208 public: // frame serialization
209  std::size_t calcSize();
210  bool dump(IdNumber device_id, RaWriter &raw_writer);
211  IdNumber read(RawReader &raw_reader);
212 };
213 
220 class MuxFrame : public Frame {
221 
222 public:
223  MuxFrame();
224  virtual ~MuxFrame();
225  frame_essentials(FrameClass::mux, MuxFrame);
226  frame_clone(FrameClass::mux, MuxFrame);
227 
228 public: // redefined virtual
229  virtual void print(std::ostream& os) const;
230  virtual std::string dumpPayload();
231  virtual void dumpPayloadToFile(std::ofstream& fout);
232  virtual void reset();
233  //virtual bool isSeekable(); ///< Can we seek to this frame?
234 
235 /*
236 public:
237  virtual bool isInit(); ///< for frag-MP4: ftyp, moov
238  virtual bool isMeta(); ///< for frag-MP4: moof
240 */
241 
242 public: // payload handling
243  void reserve(std::size_t n_bytes);
244  void resize(std::size_t n_bytes);
245 
246 public:
247  std::vector<uint8_t> payload;
248  AVMediaType media_type;
249  AVCodecID codec_id;
250 
251 public:
252  std::vector<uint8_t> meta_blob;
254 };
255 
256 
257 enum class SetupFrameType
258 {
259  none,
260  stream_init,
261  stream_state
262 };
263 
276 class SetupFrame : public Frame
277 {
278 
279 public:
280  SetupFrame();
281  virtual ~SetupFrame();
282  frame_essentials(FrameClass::setup, SetupFrame);
283  frame_clone(FrameClass::setup, SetupFrame);
284  /*
285  SetupFrame(const SetupFrame &f); ///< Default copy ctor
286 
287 public: // frame essentials
288  virtual FrameClass getFrameClass(); ///< Returns the subclass frame type. See Frame::frameclass
289  virtual void copyFrom(Frame *f); ///< Copies data to this frame from a frame of the same type
290  */
291 
292 public: // redefined virtual
293  virtual void print(std::ostream &os) const;
294  virtual void reset();
295 
296 public: // managed objects
297  SetupFrameType sub_type;
298 
299  AVMediaType media_type;
300  AVCodecID codec_id;
301 
303 };
304 
314 class AVMediaFrame : public Frame
315 {
316 
317 public:
318  AVMediaFrame();
319  virtual ~AVMediaFrame();
320  //frame_essentials(FrameClass::avmedia,AVMediaFrame); // now this is a virtual class ..
321  //frame_clone(FrameClass::avmedia,AVMediaFrame);
322  /*AVMediaFrame(const AVMediaFrame &f); ///< Default copy ctor
323 
324  public: // frame essentials
325  virtual FrameClass getFrameClass(); ///< Returns the subclass frame type. See Frame::frameclass
326  virtual void copyFrom(Frame *f); ///< Copies data to this frame from a frame of the same type
327  */
328 
329 /*
330 public:
331  virtual void updateAux() = 0; ///< update any helper objects
332  virtual void update() = 0;
333 */
334 
335 public: // redefined virtual
336  virtual std::string dumpPayload();
337  virtual void print(std::ostream &os) const;
338  virtual void reset();
339 
340 public: // helper objects : values should correspond to member av_frame
341  AVMediaType media_type;
342  AVCodecID codec_id;
343 
344 public: // managed objects
345  AVFrame *av_frame;
346 };
347 
361 {
362 
363 public:
364  AVBitmapFrame();
365  virtual ~AVBitmapFrame();
366  frame_essentials(FrameClass::avbitmap, AVBitmapFrame);
367  frame_clone(FrameClass::avbitmap, AVBitmapFrame); // TODO: think about this!
368  /*
369  AVBitmapFrame(const AVBitmapFrame &f); ///< Default copy ctor
370 
371 public: // frame essentials
372  virtual FrameClass getFrameClass(); ///< Returns the subclass frame type. See Frame::frameclass
373  virtual void copyFrom(Frame *f); ///< Copies data to this frame from a frame of the same type
374  */
375 
376 public: // redefined virtual
377  virtual std::string dumpPayload();
378  virtual void print(std::ostream &os) const;
379  virtual void reset();
380  virtual void copyPayloadFrom(AVBitmapFrame *frame);
381  virtual void updateAux();
382  virtual void update();
383  virtual void reserve(int width, int height);
384 
385 public: // helper objects
386  AVPixelFormat av_pixel_format;
388  uint8_t *y_payload;
389  uint8_t *u_payload;
390  uint8_t *v_payload;
391 };
392 
436 class AVRGBFrame : public AVBitmapFrame
437 {
438 
439 public:
440  AVRGBFrame();
441  virtual ~AVRGBFrame();
442  frame_essentials(FrameClass::avrgb, AVRGBFrame);
443  frame_clone(FrameClass::avrgb, AVRGBFrame); // TODO: think about this!
444 
445 public:
446  virtual void reserve(int width, int height);
447 
448 public: // redefined virtual
449  virtual std::string dumpPayload();
450  virtual void print(std::ostream &os) const;
451 };
452 
453 /*
454 class AVAudioFrame : public AVMediaFrame {
455 
456 public:
457  AVAudioFrame();
458  virtual ~AVAudioFrame();
459 
460 public: // frame essentials
461  virtual FrameClass getFrameClass(); ///< Returns the subclass frame type. See Frame::frameclass
462  virtual void copyFrom(Frame *f); ///< Copies data to this frame from a frame of the same type
463  virtual std::string dumpPayload();
464  virtual void print(std::ostream& os) const; ///< How to print this frame to output stream
465 
466 public:
467  virtual void getParametersDecoder(const AVCodecContext *ctx); ///< Extract sample rate
468 
469 public: // ffmpeg media parameters
470  AVSampleFormat av_sample_fmt;
471 };
472 */
473 
474 // Decoder gives AVBitmapFrame => OpenGLThread internal FrameFilter => OpenGLThread FrameFifo::writeCopy(Frame *f) => .. returns once a copy has been made
475 
491 class YUVFrame : public Frame
492 {
493 
494 public:
495  YUVFrame(BitmapPars bmpars);
496  virtual ~YUVFrame();
497  frame_essentials(FrameClass::yuv, YUVFrame);
498  // TODO: frame_clone
499  /*
500  YUVFrame(const YUVFrame &f); ///< Default copy ctor
501 
502 public: // frame essentials
503  virtual FrameClass getFrameClass(); ///< Returns the subclass frame type. See Frame::frameclass
504  virtual void copyFrom(Frame *f); ///< Copies data to this frame from a frame of the same type
505 
506  */
507 
508 public: // variables filled at constructor time
509  BitmapPars bmpars; // the maximum, pre-reserved size
510  BitmapPars source_bmpars; // the actual size of the image
511 
512 private:
513  void reserve();
514  void release();
515 
516 public: // variables used/filled by reserve
517  GLuint y_index;
518  GLuint u_index;
519  GLuint v_index;
520 
521 private:
522  GLubyte *y_payload;
523  GLubyte *u_payload;
524  GLubyte *v_payload;
525 
526 public: // redefined virtual
527  virtual std::string dumpPayload();
528  virtual void print(std::ostream &os) const;
529  virtual void reset();
530 
531 public:
533 };
534 
541 class RGBFrame : public Frame
542 {
543 
544 public:
545  RGBFrame(int max_width, int max_height);
546  virtual ~RGBFrame();
547  frame_essentials(FrameClass::rgb, RGBFrame);
548 
549 private:
550  std::vector<uint8_t> payload;
551  int max_width, max_height;
552  int width, height;
553 
554 public: // redefined virtual
555  virtual std::string dumpPayload();
556  virtual void print(std::ostream &os) const;
557  virtual void reset();
558 
559 public:
560  void fromAVRGBFrame(AVRGBFrame *f);
561 };
562 
563 typedef std::vector<Frame *> Reservoir;
564 typedef std::deque<Frame *> Stack;
565 typedef std::deque<Frame *> Fifo;
566 typedef std::deque<Frame *> Cache;
567 
568 typedef std::vector<YUVFrame *> YUVReservoir;
569 typedef std::deque<YUVFrame *> YUVStack;
570 typedef std::vector<RGBFrame *> RGBReservoir;
571 typedef std::deque<RGBFrame *> RGBStack;
572 
573 
588 class SignalFrame : public Frame
589 {
590 
591 public:
592  SignalFrame();
593  virtual ~SignalFrame();
594  frame_essentials(FrameClass::signal, SignalFrame);
595  frame_clone(FrameClass::signal, SignalFrame);
596 
597 public:
598  unsigned signaltype;
599 
600 public:
605  // TODO: those ctxes should be written with the new technique:
606  // this generalizes & is copyable
607  std::vector<uint8_t> signal_ctx_buf;
608  /* example of the (revised) signal handling
609  if (signalframe->signaltype==SignalType::offline) {
610  OfflineSignalContext ctx = OfflineSignalContext();
611  get_signal_context(signalframe, ctx);
612  # that's a macro: take a look at macro.h
613  }
614  */
615 
616 public:
617  virtual void reset();
618 
619 };
620 
621 class MarkerFrame : public Frame
622 {
623 
624 public:
625  MarkerFrame();
626  virtual ~MarkerFrame();
627  frame_essentials(FrameClass::marker, MarkerFrame);
628  frame_clone(FrameClass::marker, MarkerFrame);
629 
630 public: // redefined virtual
631  // virtual std::string dumpPayload();
632  virtual void print(std::ostream &os) const;
633  virtual void reset();
634 
635 public:
636  bool fs_start, fs_end;
637  bool tm_start, tm_end;
638 };
639 
640 #endif
List of common ffmpeg/libav header files. Definition of some functions to call FFmpeg API directly fr...
Decoded YUV/RGB frame in FFMpeg format.
Definition: frame.h:361
virtual std::string dumpPayload()
Dumps internal payload data.
Definition: frame.cpp:440
uint8_t * y_payload
shortcut to AVMediaFrame::av_frame->data[0]
Definition: frame.h:388
AVBitmapFrame()
Default ctor.
Definition: frame.cpp:429
virtual void print(std::ostream &os) const
How to print this frame to output stream.
Definition: frame.cpp:477
uint8_t * u_payload
shortcut to AVMediaFrame::av_frame->data[1]
Definition: frame.h:389
virtual void reserve(int width, int height)
Reserves space for underlying av_frame.
Definition: frame.cpp:555
uint8_t * v_payload
shortcut to AVMediaFrame::av_frame->data[2]
Definition: frame.h:390
AVPixelFormat av_pixel_format
From AVCodecContext .. this class implies YUV420P so this is not really required ....
Definition: frame.h:386
virtual void updateAux()
Uses AVBitmapFrame::av_frame width and height and AVBitmapFrame::av_pixel_format to calculate AVBitma...
Definition: frame.cpp:487
BitmapPars bmpars
Calculated bitmap plane dimensions, data sizes, etc.
Definition: frame.h:387
virtual ~AVBitmapFrame()
Default virtual dtor.
Definition: frame.cpp:433
virtual void update()
Update helper points (call always)
Definition: frame.cpp:528
virtual void reset()
Reset the internal data.
Definition: frame.cpp:467
Decoded Frame in FFmpeg format.
Definition: frame.h:315
AVMediaFrame()
Default ctor.
Definition: frame.cpp:393
virtual std::string dumpPayload()
Dumps internal payload data.
Definition: frame.cpp:414
AVCodecID codec_id
helper object: codec id
Definition: frame.h:342
virtual ~AVMediaFrame()
Default virtual dtor.
Definition: frame.cpp:398
AVMediaType media_type
helper object: media type
Definition: frame.h:341
virtual void reset()
Reset the internal data.
Definition: frame.cpp:420
AVFrame * av_frame
The decoded frame.
Definition: frame.h:345
virtual void print(std::ostream &os) const
How to print this frame to output stream.
Definition: frame.cpp:407
Decoded YUV frame in a non-planar format (thus "NP")
Definition: frame.h:437
virtual void reserve(int width, int height)
Reserve RGB image with width & height.
Definition: frame.cpp:586
virtual std::string dumpPayload()
Dumps internal payload data.
Definition: frame.cpp:599
virtual void print(std::ostream &os) const
How to print this frame to output stream.
Definition: frame.cpp:622
Custom payload Frame.
Definition: frame.h:166
void copyFromAVPacket(AVPacket *avpkt)
Copy data from AVPacket structure.
Definition: frame.cpp:202
void fillAVPacket(AVPacket *avpkt)
Copy payload to AVPacket structure.
Definition: frame.cpp:178
H264Pars h264_pars
H264 parameters, extracted from the payload.
Definition: frame.h:197
void resize(std::size_t n_bytes)
Init space for internal payload.
Definition: frame.cpp:159
virtual void dumpPayloadToFile(std::ofstream &fout)
Dumps internal payload data into a file.
Definition: frame.cpp:116
virtual void reset()
Reset the internal data.
Definition: frame.cpp:121
void filterFromAVPacket(AVPacket *avpkt, AVCodecContext *codec_ctx, AVBitStreamFilterContext *filter)
Copy data from AVPacket structure.
Definition: frame.cpp:212
virtual bool isSeekable()
for H264 true if sps, other codecs, always true
Definition: frame.cpp:128
IdNumber read(RawReader &raw_reader)
Read the frame from filestream. Returns device id.
Definition: frame.cpp:266
void fillPars()
Fill codec-dependent parameters based on the payload.
Definition: frame.cpp:164
AVCodecID codec_id
AVCodeCID of the media.
Definition: frame.h:194
virtual std::string dumpPayload()
Dumps internal payload data.
Definition: frame.cpp:107
std::size_t calcSize()
How much this frame occupies in bytes when serialized.
Definition: frame.cpp:235
virtual ~BasicFrame()
Default virtual dtor.
Definition: frame.cpp:93
bool dump(IdNumber device_id, RaWriter &raw_writer)
Write the frame to filestream with a certain device id.
Definition: frame.cpp:247
AVMediaType media_type
Type of the media (video/audio)
Definition: frame.h:193
void reserve(std::size_t n_bytes)
Reserve space for internal payload.
Definition: frame.cpp:154
void fillH264Pars()
Inspects payload and fills BasicFrame::h264_pars;.
Definition: frame.cpp:171
virtual void print(std::ostream &os) const
How to print this frame to output stream.
Definition: frame.cpp:98
std::vector< uint8_t > payload
Raw payload data (use .data() to get the pointer from std::vector)
Definition: frame.h:192
BasicFrame()
Default ctor.
Definition: frame.cpp:89
Frame: An abstract queueable class.
Definition: frame.h:112
virtual void updateAux()
Update internal auxiliary state variables.
Definition: frame.cpp:79
virtual std::string dumpPayload()
Dumps internal payload data.
Definition: frame.cpp:58
virtual void update()
Update helper points (call always)
Definition: frame.cpp:84
virtual bool isSeekable()
Can we seek to this frame? (e.g. is it a key-frame .. for H264 sps packets are used as seek markers)
Definition: frame.cpp:73
virtual void dumpPayloadToFile(std::ofstream &fout)
Dumps internal payload data into a file.
Definition: frame.cpp:63
void copyMetaFrom(Frame *f)
Copy metadata (slot, subsession index, timestamp) to this frame.
Definition: frame.cpp:51
int subsession_index
Media subsession index.
Definition: frame.h:144
virtual void reset()
Reset the internal data.
Definition: frame.cpp:67
FrameClass frameclass
Declares frametype for correct typecast. Used by Frame::getFrameClass()
Definition: frame.h:140
virtual ~Frame()
Default virtual dtor.
Definition: frame.cpp:42
Frame()
Default ctor.
Definition: frame.cpp:38
virtual void print(std::ostream &os) const
Produces frame output.
Definition: frame.cpp:46
long int mstimestamp
Presentation time stamp (PTS) in milliseconds.
Definition: frame.h:145
SlotNumber n_slot
Slot number identifying the media source.
Definition: frame.h:143
Definition: frame.h:622
virtual void reset()
Reset the internal data.
Definition: frame.cpp:935
MarkerFrame()
Default ctor.
Definition: frame.cpp:910
virtual void print(std::ostream &os) const
How to print this frame to output stream.
Definition: frame.cpp:917
virtual ~MarkerFrame()
Default virtual dtor.
Definition: frame.cpp:913
bool fs_end
Filesystem start / end // this controlled better at the python level.
Definition: frame.h:636
bool tm_end
Transmission start / end.
Definition: frame.h:637
A muxed packet (in some container format)
Definition: frame.h:220
MuxMetaType meta_type
Mux type that mandates how meta_blob is casted.
Definition: frame.h:253
void resize(std::size_t n_bytes)
Init space for internal payload.
Definition: frame.cpp:358
virtual void dumpPayloadToFile(std::ofstream &fout)
Dumps internal payload data into a file.
Definition: frame.cpp:339
std::vector< uint8_t > payload
Raw payload data (use .data() to get the pointer from std::vector)
Definition: frame.h:247
void reserve(std::size_t n_bytes)
Reserve space for internal payload.
Definition: frame.cpp:352
std::vector< uint8_t > meta_blob
Byte blob that is casted to correct metadata struct.
Definition: frame.h:252
AVCodecID codec_id
AVCodeCID of the underlying elementary stream.
Definition: frame.h:249
virtual void print(std::ostream &os) const
Produces frame output.
Definition: frame.cpp:323
virtual ~MuxFrame()
Default virtual dtor.
Definition: frame.cpp:319
virtual void reset()
Reset the internal data.
Definition: frame.cpp:344
AVMediaType media_type
Type of the media (video/audio) of the underlying elementary stream.
Definition: frame.h:248
virtual std::string dumpPayload()
Dumps internal payload data.
Definition: frame.cpp:330
MuxFrame()
Default ctor.
Definition: frame.cpp:312
Our own RGB24 structure.
Definition: frame.h:542
std::vector< uint8_t > payload
RGB24 data as continuous bytes. 3 bytes per pixel.
Definition: frame.h:550
virtual void reset()
Reset the internal data.
Definition: frame.cpp:873
void fromAVRGBFrame(AVRGBFrame *f)
Copies data from (temporary) AVRGBFrame .. set the width & height members.
Definition: frame.cpp:880
virtual std::string dumpPayload()
Dumps internal payload data.
Definition: frame.cpp:853
virtual void print(std::ostream &os) const
How to print this frame to output stream.
Definition: frame.cpp:865
Definition: rawrite.h:67
Definition: rawrite.h:96
Setup frame.
Definition: frame.h:277
AVCodecID codec_id
For subtype stream_init.
Definition: frame.h:300
virtual void print(std::ostream &os) const
How to print this frame to output stream.
Definition: frame.cpp:374
virtual ~SetupFrame()
Default virtual dtor.
Definition: frame.cpp:369
SetupFrame()
Default ctor.
Definition: frame.cpp:364
SetupFrameType sub_type
Type of the SetupFrame.
Definition: frame.h:297
virtual void reset()
Reset the internal data.
Definition: frame.cpp:386
AbstractFileState stream_state
For subtype stream_state.
Definition: frame.h:302
AVMediaType media_type
For subtype stream_init.
Definition: frame.h:299
A frame, signaling internal thread commands, states of recorded video, etc.
Definition: frame.h:589
ValkkaFSReaderSignalContext valkkafsreader_signal_ctx
Thread commands to ValkkaFSReaderThread.
Definition: frame.h:604
virtual void reset()
Reset the internal data.
Definition: frame.cpp:901
OpenGLSignalContext opengl_signal_ctx
< For making correct typecast of custom_ctx_buf. See also threadsignal.h
Definition: frame.h:601
std::vector< uint8_t > signal_ctx_buf
A byte-buffer where the signal context is serialized.
Definition: frame.h:607
AVSignalContext av_signal_ctx
Thread commands to AVThread.
Definition: frame.h:602
ValkkaFSWriterSignalContext valkkafswriter_signal_ctx
Thread commands to ValkkFSWriterThread.
Definition: frame.h:603
SignalFrame()
Default ctor.
Definition: frame.cpp:897
virtual ~SignalFrame()
Default virtual dtor.
Definition: frame.cpp:906
A GPU YUV frame.
Definition: frame.h:492
GLubyte * y_payload
direct memory access memory address, returned by GPU
Definition: frame.h:522
void release()
Releases data on the GPU. Used by the destructor only.
Definition: frame.cpp:710
void fromAVBitmapFrame(AVBitmapFrame *f)
Copies data to the GPU from AVBitmapFrame.
Definition: frame.cpp:719
GLuint u_index
internal OpenGL/GPU index
Definition: frame.h:518
virtual ~YUVFrame()
Default virtual dtor.
Definition: frame.cpp:677
virtual void print(std::ostream &os) const
How to print this frame to output stream.
Definition: frame.cpp:830
GLuint y_index
internal OpenGL/GPU index
Definition: frame.h:517
virtual void reset()
Reset the internal data.
Definition: frame.cpp:837
GLuint v_index
internal OpenGL/GPU index
Definition: frame.h:519
GLubyte * v_payload
direct memory access memory address, returned by GPU
Definition: frame.h:524
virtual std::string dumpPayload()
Dumps internal payload data.
Definition: frame.cpp:804
void reserve()
Reserve data on the GPU. Used by the constructor only.
Definition: frame.cpp:684
YUVFrame(BitmapPars bmpars)
Default ctor.
Definition: frame.cpp:672
GLubyte * u_payload
direct memory access memory address, returned by GPU
Definition: frame.h:523
Codec definitions (slightly outdated)
List of common header files.
Constant/default values, version numbers.
TimeCorrectionType
Methods to correct frame timestamps.
Definition: frame.h:87
AbstractFileState
Describes the state of a stream.
Definition: threadsignal.h:43
FrameClass
Enumeration of Frame classes used by Valkka.
Definition: frame.h:53
@ yuv
data at the GPU
@ avmedia
data at ffmpeg av_frame and ffmpeg av_codec_context
@ none
unknown
@ avbitmap
child of avmedia: video
@ signal
signal to AVThread or OpenGLThread. Also custom signals to custom Threads
@ avpkt
data at ffmpeg avpkt
@ setup
setup data
@ avaudio
child of avmedia: audio
@ marker
Used when sending blocks of frames: mark filesystem and block start and end.
@ avrgb
rgb interpolated from yuv
@ rgb
our own RGB24 data structure
@ basic
data at payload
@ mux
Muxed streams, for example, MP4 or matroska.
libValkka pre-reserves all frames, both byte payload and metadata payload. After memory reservation,...
MuxMetaType
Definition: metadata.h:47
OpenGL calls for reserving PBOs and TEXtures, plus some auxiliary routines.
Write directly to files and devices with POSIX O_DIRECT.
Redefinition of characteristic signal contexts (info that goes with the signal) for AVThread thread.
Definition: threadsignal.h:94
For AVBitmapFrames, linesizes are the widths + padding bytes.
Definition: constant.h:132
Definition: codec.h:71
Encapsulates data sent by the signal.
Definition: threadsignal.h:149
Encapsulate data sent in the ValkkaFSReaderSignal.
Definition: threadsignal.h:220
Encapsulate data sent in the ValkkaFSWriterSignal.
Definition: threadsignal.h:185
Auxiliary routines.
@ none
undefined (initial value)
Definition: usbthread.h:143