~ubuntu-branches/ubuntu/utopic/ardour3/utopic

« back to all changes in this revision

Viewing changes to libs/audiographer/audiographer/broadcast_info.h

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler
  • Date: 2013-09-21 19:05:02 UTC
  • Revision ID: package-import@ubuntu.com-20130921190502-8gsftrku6jnzhd7v
Tags: upstream-3.4~dfsg
ImportĀ upstreamĀ versionĀ 3.4~dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (C) 2008 Paul Davis
 
3
    Author: Sakari Bergen
 
4
 
 
5
    This program is free software; you can redistribute it and/or modify
 
6
    it 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
    This program is distributed in the hope that it will be useful,
 
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
    GNU General Public License for more details.
 
14
 
 
15
    You should have received a copy of the GNU General Public License
 
16
    along with this program; if not, write to the Free Software
 
17
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
18
 
 
19
*/
 
20
 
 
21
#ifndef AUDIOGRAPHER_BROADCAST_INFO_H
 
22
#define AUDIOGRAPHER_BROADCAST_INFO_H
 
23
 
 
24
#include <string>
 
25
#include <ctime>
 
26
 
 
27
#include <sndfile.h>
 
28
 
 
29
namespace AudioGrapher
 
30
{
 
31
 
 
32
class SndfileHandle;    
 
33
 
 
34
class BroadcastInfo
 
35
{
 
36
  public:
 
37
 
 
38
        /// Construct empty broadcast info
 
39
        BroadcastInfo ();
 
40
        virtual ~BroadcastInfo ();
 
41
 
 
42
        /// Returns last error sring from libsndfile
 
43
        std::string get_error () const { return error; }
 
44
 
 
45
        /* Reading */
 
46
 
 
47
        bool load_from_file (std::string const & filename);
 
48
        bool load_from_file (SNDFILE* sf);
 
49
 
 
50
        std::string get_description () const;
 
51
        int64_t get_time_reference () const;
 
52
        struct tm get_origination_time () const;
 
53
        std::string get_originator () const;
 
54
        std::string get_originator_ref () const;
 
55
 
 
56
        /* Writing */
 
57
 
 
58
        bool write_to_file (std::string const & filename);
 
59
        bool write_to_file (SNDFILE* sf);
 
60
        bool write_to_file (SndfileHandle* sf);
 
61
 
 
62
        void set_description (std::string const & desc);
 
63
        void set_time_reference (int64_t when);
 
64
        void set_origination_time (struct tm * now = 0); // if 0, use time generated at construction
 
65
        virtual void set_originator (std::string const & str = "");
 
66
        void set_originator_ref (std::string const & str = "");
 
67
 
 
68
        /* State info */
 
69
 
 
70
        /// Returns true if a info has been succesfully loaded or anything has been manually set
 
71
        bool has_info () const { return _has_info; }
 
72
 
 
73
protected:
 
74
 
 
75
        SF_BROADCAST_INFO * info;
 
76
        struct tm _time;
 
77
 
 
78
        void update_error ();
 
79
        std::string error;
 
80
 
 
81
        bool _has_info;
 
82
};
 
83
 
 
84
} // namespace AudioGrapher
 
85
 
 
86
#endif /* AUDIOGRAPHER_BROADCAST_INFO_H */