Ginga  0.13.6.2086-83aa
The iTV middleware.
PlayerVideo.h
1 /* Copyright (C) 2006-2018 PUC-Rio/Laboratorio TeleMidia
2 
3 This file is part of Ginga (Ginga-NCL).
4 
5 Ginga is free software: you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9 
10 Ginga is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with Ginga. If not, see <https://www.gnu.org/licenses/>. */
17 
18 #ifndef PLAYER_VIDEO_H
19 #define PLAYER_VIDEO_H
20 
21 #include "Player.h"
22 
23 GINGA_NAMESPACE_BEGIN
24 class Media;
25 class PlayerVideo : public Player
26 {
27 public:
29  ~PlayerVideo ();
30  void start () override;
31  void stop () override;
32  void pause () override;
33  void resume () override;
34  void redraw (cairo_t *) override;
35 
36 protected:
37  bool doSetProperty (Property, const string &, const string &) override;
38  void seek (gint64);
39  void speed (double);
40  gint64 getPipelineTime ();
41  gint64 getStreamMediaTime ();
42  gint64 getStreamMediaDuration ();
43 
44 private:
45  GstElement *_playbin; // pipeline
46  struct
47  { // audio pipeline
48  GstElement *bin; // audio bin
49  GstElement *volume; // volume filter
50  GstElement *pan; // balance filter
51  GstElement *equalizer; // equalizer filter
52  GstElement *convert; // convert audio format
53  GstElement *sink; // audio sink
54  } _audio;
55  struct
56  { // video pipeline
57  GstElement *bin; // video bin
58  GstElement *caps; // caps filter
59  GstElement *sink; // app sink
60  } _video;
61  int _sample_flag; // true if new sample is available
62  GstAppSinkCallbacks _callbacks; // video app-sink callback data
63  struct
64  {
65  bool mute; // true if mute is on
66  double balance; // balance sound level
67  double volume; // sound level
68  double treble; // treble level (Default: 0; Range: -24 and +12)
69  double bass; // bass level (Default: 0; Range: -24 and +12)
70  bool freeze; // true if player should freeze
71  double speed; // playback speed (Default: 1)
72  } _prop;
73  typedef struct
74  {
75  Property code;
76  string name;
77  string value;
79  list<PlayerVideoAction> _stack_actions;
80  void
81  initProperties (set<string> *); // Init default values to properties
82  // without go to doSetProperty function
83  void stackAction (Property, const string &, const string &);
84  void doStackedActions ();
85  bool getFreeze ();
86  string getPipelineState ();
87 
88  // GStreamer callbacks.
89  static gboolean cb_Bus (GstBus *, GstMessage *, PlayerVideo *);
90  static GstFlowReturn cb_NewSample (GstAppSink *, gpointer);
91 };
92 
93 GINGA_NAMESPACE_END
94 
95 #endif // PLAYER_VIDEO_H
Definition: PlayerVideo.h:25
Definition: PlayerVideo.h:73
Interface between libginga and the external world.
Definition: Formatter.h:37
Definition: Media.h:26
Definition: Player.h:28