LCOV - code coverage report
Current view: top level - src/libvalent/media - valent-media-player.h (source / functions) Coverage Total Hit
Test: Code Coverage Lines: 100.0 % 1 1
Test Date: 2024-04-23 06:02:46 Functions: 100.0 % 1 1
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 40.9 % 22 9

             Branch data     Line data    Source code
       1                 :             : // SPDX-License-Identifier: GPL-3.0-or-later
       2                 :             : // SPDX-FileCopyrightText: Andy Holmes <andrew.g.r.holmes@gmail.com>
       3                 :             : 
       4                 :             : #pragma once
       5                 :             : 
       6                 :             : #if !defined (VALENT_INSIDE) && !defined (VALENT_COMPILATION)
       7                 :             : # error "Only <valent.h> can be included directly."
       8                 :             : #endif
       9                 :             : 
      10                 :             : #include "../core/valent-object.h"
      11                 :             : 
      12                 :             : G_BEGIN_DECLS
      13                 :             : 
      14                 :             : /**
      15                 :             :  * ValentMediaActions:
      16                 :             :  * @VALENT_MEDIA_ACTION_NONE: The player can not be controlled
      17                 :             :  * @VALENT_MEDIA_ACTION_PLAY: Start or resume playback
      18                 :             :  * @VALENT_MEDIA_ACTION_PAUSE: Pause playback
      19                 :             :  * @VALENT_MEDIA_ACTION_STOP: Stop playback
      20                 :             :  * @VALENT_MEDIA_ACTION_NEXT: Next track
      21                 :             :  * @VALENT_MEDIA_ACTION_PREVIOUS: Previous track
      22                 :             :  * @VALENT_MEDIA_ACTION_SEEK: Change the playback position
      23                 :             :  * @VALENT_MEDIA_ACTION_RESERVED1: Reserved
      24                 :             :  * @VALENT_MEDIA_ACTION_RESERVED2: Reserved
      25                 :             :  *
      26                 :             :  * Media action flags.
      27                 :             :  *
      28                 :             :  * Since: 1.0
      29                 :             :  */
      30                 :             : typedef enum
      31                 :             : {
      32                 :             :   VALENT_MEDIA_ACTION_NONE,
      33                 :             :   VALENT_MEDIA_ACTION_PLAY      = (1<<0),
      34                 :             :   VALENT_MEDIA_ACTION_PAUSE     = (1<<1),
      35                 :             :   VALENT_MEDIA_ACTION_STOP      = (1<<2),
      36                 :             :   VALENT_MEDIA_ACTION_NEXT      = (1<<3),
      37                 :             :   VALENT_MEDIA_ACTION_PREVIOUS  = (1<<4),
      38                 :             :   VALENT_MEDIA_ACTION_SEEK      = (1<<5),
      39                 :             :   VALENT_MEDIA_ACTION_RESERVED1 = (1<<6),
      40                 :             :   VALENT_MEDIA_ACTION_RESERVED2 = (1<<7)
      41                 :             : } ValentMediaActions;
      42                 :             : 
      43                 :             : 
      44                 :             : /**
      45                 :             :  * ValentMediaRepeat:
      46                 :             :  * @VALENT_MEDIA_REPEAT_NONE: Repeat off.
      47                 :             :  * @VALENT_MEDIA_REPEAT_ALL: Repeat all items.
      48                 :             :  * @VALENT_MEDIA_REPEAT_ONE: Repeat one items.
      49                 :             :  *
      50                 :             :  * Enumeration of loop modes.
      51                 :             :  *
      52                 :             :  * Since: 1.0
      53                 :             :  */
      54                 :             : typedef enum
      55                 :             : {
      56                 :             :   VALENT_MEDIA_REPEAT_NONE,
      57                 :             :   VALENT_MEDIA_REPEAT_ALL,
      58                 :             :   VALENT_MEDIA_REPEAT_ONE,
      59                 :             : } ValentMediaRepeat;
      60                 :             : 
      61                 :             : 
      62                 :             : /**
      63                 :             :  * ValentMediaState:
      64                 :             :  * @VALENT_MEDIA_STATE_STOPPED: The player state is unknown.
      65                 :             :  * @VALENT_MEDIA_STATE_PLAYING: Playback is active.
      66                 :             :  * @VALENT_MEDIA_STATE_PAUSED: Playback is paused.
      67                 :             :  *
      68                 :             :  * Media state flags.
      69                 :             :  *
      70                 :             :  * Since: 1.0
      71                 :             :  */
      72                 :             : typedef enum
      73                 :             : {
      74                 :             :   VALENT_MEDIA_STATE_STOPPED,
      75                 :             :   VALENT_MEDIA_STATE_PLAYING,
      76                 :             :   VALENT_MEDIA_STATE_PAUSED,
      77                 :             : } ValentMediaState;
      78                 :             : 
      79                 :             : 
      80                 :             : #define VALENT_TYPE_MEDIA_PLAYER (valent_media_player_get_type())
      81                 :             : 
      82                 :             : VALENT_AVAILABLE_IN_1_0
      83   [ +  -  +  -  :        1044 : G_DECLARE_DERIVABLE_TYPE (ValentMediaPlayer, valent_media_player, VALENT, MEDIA_PLAYER, ValentObject)
          +  -  +  -  +  
          -  -  -  +  -  
          -  -  +  -  +  
                -  +  - ]
      84                 :             : 
      85                 :             : struct _ValentMediaPlayerClass
      86                 :             : {
      87                 :             :   ValentObjectClass    parent_class;
      88                 :             : 
      89                 :             :   /* virtual functions */
      90                 :             :   ValentMediaActions   (*get_flags)    (ValentMediaPlayer *player);
      91                 :             :   GVariant           * (*get_metadata) (ValentMediaPlayer *player);
      92                 :             :   const char         * (*get_name)     (ValentMediaPlayer *player);
      93                 :             :   double               (*get_position) (ValentMediaPlayer *player);
      94                 :             :   void                 (*set_position) (ValentMediaPlayer *player,
      95                 :             :                                         double             position);
      96                 :             :   ValentMediaRepeat    (*get_repeat)   (ValentMediaPlayer *player);
      97                 :             :   void                 (*set_repeat)   (ValentMediaPlayer *player,
      98                 :             :                                         ValentMediaRepeat  repeat);
      99                 :             :   gboolean             (*get_shuffle)  (ValentMediaPlayer *player);
     100                 :             :   void                 (*set_shuffle)  (ValentMediaPlayer *player,
     101                 :             :                                         gboolean           shuffle);
     102                 :             :   ValentMediaState     (*get_state)    (ValentMediaPlayer *player);
     103                 :             :   double               (*get_volume)   (ValentMediaPlayer *player);
     104                 :             :   void                 (*set_volume)   (ValentMediaPlayer *player,
     105                 :             :                                         double             volume);
     106                 :             :   void                 (*next)         (ValentMediaPlayer *player);
     107                 :             :   void                 (*pause)        (ValentMediaPlayer *player);
     108                 :             :   void                 (*play)         (ValentMediaPlayer *player);
     109                 :             :   void                 (*previous)     (ValentMediaPlayer *player);
     110                 :             :   void                 (*seek)         (ValentMediaPlayer *player,
     111                 :             :                                         double             offset);
     112                 :             :   void                 (*stop)         (ValentMediaPlayer *player);
     113                 :             : 
     114                 :             :   /*< private >*/
     115                 :             :   gpointer             padding[8];
     116                 :             : };
     117                 :             : 
     118                 :             : VALENT_AVAILABLE_IN_1_0
     119                 :             : ValentMediaActions   valent_media_player_get_flags    (ValentMediaPlayer *player);
     120                 :             : VALENT_AVAILABLE_IN_1_0
     121                 :             : GVariant           * valent_media_player_get_metadata (ValentMediaPlayer *player);
     122                 :             : VALENT_AVAILABLE_IN_1_0
     123                 :             : const char         * valent_media_player_get_name     (ValentMediaPlayer *player);
     124                 :             : VALENT_AVAILABLE_IN_1_0
     125                 :             : double               valent_media_player_get_position (ValentMediaPlayer *player);
     126                 :             : VALENT_AVAILABLE_IN_1_0
     127                 :             : void                 valent_media_player_set_position (ValentMediaPlayer *player,
     128                 :             :                                                        double             position);
     129                 :             : VALENT_AVAILABLE_IN_1_0
     130                 :             : ValentMediaRepeat    valent_media_player_get_repeat   (ValentMediaPlayer *player);
     131                 :             : VALENT_AVAILABLE_IN_1_0
     132                 :             : void                 valent_media_player_set_repeat   (ValentMediaPlayer *player,
     133                 :             :                                                        ValentMediaRepeat  repeat);
     134                 :             : VALENT_AVAILABLE_IN_1_0
     135                 :             : gboolean             valent_media_player_get_shuffle  (ValentMediaPlayer *player);
     136                 :             : VALENT_AVAILABLE_IN_1_0
     137                 :             : void                 valent_media_player_set_shuffle  (ValentMediaPlayer *player,
     138                 :             :                                                        gboolean           shuffle);
     139                 :             : VALENT_AVAILABLE_IN_1_0
     140                 :             : ValentMediaState     valent_media_player_get_state    (ValentMediaPlayer *player);
     141                 :             : VALENT_AVAILABLE_IN_1_0
     142                 :             : double               valent_media_player_get_volume   (ValentMediaPlayer *player);
     143                 :             : VALENT_AVAILABLE_IN_1_0
     144                 :             : void                 valent_media_player_set_volume   (ValentMediaPlayer *player,
     145                 :             :                                                        double             volume);
     146                 :             : VALENT_AVAILABLE_IN_1_0
     147                 :             : void                 valent_media_player_next         (ValentMediaPlayer *player);
     148                 :             : VALENT_AVAILABLE_IN_1_0
     149                 :             : void                 valent_media_player_pause        (ValentMediaPlayer *player);
     150                 :             : VALENT_AVAILABLE_IN_1_0
     151                 :             : void                 valent_media_player_play         (ValentMediaPlayer *player);
     152                 :             : VALENT_AVAILABLE_IN_1_0
     153                 :             : void                 valent_media_player_previous     (ValentMediaPlayer *player);
     154                 :             : VALENT_AVAILABLE_IN_1_0
     155                 :             : void                 valent_media_player_seek         (ValentMediaPlayer *player,
     156                 :             :                                                        double             offset);
     157                 :             : VALENT_AVAILABLE_IN_1_0
     158                 :             : void                 valent_media_player_stop         (ValentMediaPlayer *player);
     159                 :             : 
     160                 :             : G_END_DECLS
     161                 :             : 
        

Generated by: LCOV version 2.0-1