~ubuntu-branches/ubuntu/lucid/gnome-subtitles/lucid

« back to all changes in this revision

Viewing changes to sublib-0.8/src/SubLib/Application/SubtitleProperties.cs

  • Committer: Bazaar Package Importer
  • Author(s): Tiago Bortoletto Vaz
  • Date: 2007-12-03 20:52:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20071203205252-2y6uuv4gcw9mi9n5
Tags: 0.7-1
* New upstream release;
* Add libxml-parser-perl to Build-Depends-Indep. Thanks to Lucas Nussbaum.
  (Closes: #445799);
* Fixes manpage issue with dpatch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of SubLib.
 
3
 * Copyright (C) 2005-2007 Pedro Castro
 
4
 *
 
5
 * SubLib 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
 * SubLib 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 */
 
19
 
 
20
using System;
 
21
using System.IO;
 
22
using System.Text;
 
23
 
 
24
namespace SubLib {
 
25
        
 
26
/// <summary>Represents the properties of subtitles.</summary>
 
27
/// <remarks>This class acts as a container which allows you to get and set a 
 
28
/// variety of properties. Some of these properties are used in syncronization
 
29
/// and timing calculations.</remarks>
 
30
public class SubtitleProperties {
 
31
        private Headers headers = new Headers();
 
32
        
 
33
        private float originalFrameRate = 25;
 
34
        private float currentFrameRate = 25;
 
35
 
 
36
        
 
37
        public SubtitleProperties () {
 
38
        }
 
39
        
 
40
        public SubtitleProperties (Headers headers, float originalFrameRate, float currentFrameRate) {
 
41
                this.headers = headers;
 
42
                this.originalFrameRate = originalFrameRate;
 
43
                this.currentFrameRate = currentFrameRate;
 
44
        }
 
45
        
 
46
        /// <summary>Initializes a new instance of the <see cref="SubtitleProperties" />
 
47
        /// class, with defaults for all properties.</summary>
 
48
        internal SubtitleProperties (ParsingProperties properties) {
 
49
                headers = properties.Headers;
 
50
                originalFrameRate = properties.OriginalFrameRate;
 
51
        }
 
52
        
 
53
        
 
54
        /// <summary>The headers used in some subtitle formats.</summary>
 
55
        public Headers Headers {
 
56
                get { return headers; }
 
57
        }
 
58
                
 
59
        /// <summary>The frame rate originally applied to the subtitles.</summary>
 
60
        /// <remarks>When converting between frame rates, this is the frame rate of the subtitles
 
61
        /// when they are opened. This is sometimes refered to as the input frame rate.</remarks>
 
62
        public float OriginalFrameRate {
 
63
                get { return originalFrameRate; }
 
64
        }
 
65
        
 
66
        /// <summary>The frame rate currently being used in the subtitles.</summary>
 
67
        /// <remarks>When converting between frame rates, this is the target frame rate of the
 
68
        /// subtitles. This is sometimes refered to as the output frame rate.</remarks>
 
69
        public float CurrentFrameRate {
 
70
                get { return currentFrameRate; }
 
71
        }
 
72
        
 
73
        public override string ToString () {
 
74
                return "Original FPS = " + originalFrameRate + ", Current FPS = " + currentFrameRate + "\n" + headers.ToString();
 
75
        }
 
76
        
 
77
        /* Internal members */
 
78
        
 
79
        internal void SetCurrentFrameRate (float frameRate) {
 
80
                currentFrameRate = frameRate;
 
81
        }
 
82
        
 
83
        internal void SetOriginalFrameRate (float frameRate) {
 
84
                originalFrameRate = frameRate;
 
85
        }
 
86
        
 
87
}
 
88
 
 
89
}