smf/smfservermodule/smfcommon/smfsubtitle.h
changeset 18 013a02bf2bb0
child 25 a180113055cb
equal deleted inserted replaced
17:106a4bfcb866 18:013a02bf2bb0
       
     1 /**
       
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the "Eclipse Public License v1.0" 
       
     6  * which accompanies  this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html"
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Contributors:
       
    13  * Manasij Roy, Nalina Hariharan
       
    14  * 
       
    15  * Description:
       
    16  * The subtitle class represents information about a track's subtitle
       
    17  *
       
    18  */
       
    19 
       
    20 #ifndef SMFSUBTITLE_H_
       
    21 #define SMFSUBTITLE_H_
       
    22 
       
    23 #include <qdatastream.h>
       
    24 #include <QDateTime>
       
    25 #include <QSharedData>
       
    26 #include "smfclientglobal.h"
       
    27 #include <QMetaType>
       
    28 
       
    29 enum SmfSubtitleSearchFilter
       
    30 	{
       
    31 	SubtitleLanguage = 0,
       
    32 	SubtitleFrameRate,		// value = 1
       
    33 	SubtitleDuration,		// value = 2
       
    34 	SubtitleReleaseYear,	// value = 3
       
    35 	SubtitleAll = SubtitleLanguage | SubtitleFrameRate | 
       
    36 			SubtitleDuration | SubtitleReleaseYear
       
    37 	};
       
    38 
       
    39 class SmfSubtitlePrivate;
       
    40 
       
    41 /**
       
    42  * @ingroup smf_common_group
       
    43  * The subtitle class represents information about a track's subtitle
       
    44  */
       
    45 class SMFCOMMON_EXPORT SmfSubtitle
       
    46 	{
       
    47 public:
       
    48 	/**
       
    49 	 * Constructor with default argument
       
    50 	 */
       
    51 	SmfSubtitle( );
       
    52 	
       
    53 	/**
       
    54 	 * Copy Constructor
       
    55 	 * @param aOther The reference object
       
    56 	 */
       
    57 	SmfSubtitle( const SmfSubtitle &aOther );
       
    58 	
       
    59 	/**
       
    60 	 * Overloaded = operator
       
    61 	 * @param aOther The reference object
       
    62 	 */
       
    63 	SmfSubtitle& operator=( const SmfSubtitle &aOther );
       
    64 	
       
    65 	/**
       
    66 	 * Destructor
       
    67 	 */
       
    68 	~SmfSubtitle( );
       
    69 	
       
    70 	/**
       
    71 	 * Method to get the subtitle as a bytearray
       
    72 	 * @return The subtitle content
       
    73 	 */
       
    74 	QByteArray subtitle( ) const;
       
    75 	
       
    76 	/**
       
    77 	 * Method to get the language
       
    78 	 * @return The language
       
    79 	 */
       
    80 	QString language( ) const;
       
    81 	
       
    82 	/**
       
    83 	 * Method to get the frame rate
       
    84 	 * @return the frame rate
       
    85 	 */
       
    86 	double frameRate( ) const;
       
    87 	
       
    88 	/**
       
    89 	 * Method to get the duration
       
    90 	 * @return the duration
       
    91 	 */
       
    92 	double duration( ) const;
       
    93 	
       
    94 	/**
       
    95 	 * Method to get the release year
       
    96 	 * @return The release year
       
    97 	 */
       
    98 	QDateTime releaseYear( ) const;
       
    99 	
       
   100 	/**
       
   101 	 * Method to get the id of the subtitle
       
   102 	 * @return The ID value 
       
   103 	 */
       
   104 	QString id( ) const;
       
   105 	
       
   106 	/**
       
   107 	 * Method to set the subtitle as a bytearray
       
   108 	 * @param aSubtitle The subtitle content
       
   109 	 */
       
   110 	void setSubtitle( const QByteArray &aSubtitle );
       
   111 	
       
   112 	/**
       
   113 	 * Method to set the language
       
   114 	 * @param aLang The language
       
   115 	 */
       
   116 	void setLanguage( const QString &aLang );
       
   117 	
       
   118 	/**
       
   119 	 * Method to set the frame rate
       
   120 	 * @param aFramerate the frame rate
       
   121 	 */
       
   122 	void setFrameRate( const double &aFramerate );
       
   123 	
       
   124 	/**
       
   125 	 * Method to set the duration
       
   126 	 * @param aDuration the duration
       
   127 	 */
       
   128 	void setDuration( const double &aDuration );
       
   129 	
       
   130 	/**
       
   131 	 * Method to set the release year
       
   132 	 * @param aRelYear The release year
       
   133 	 */
       
   134 	void setReleaseYear( const QDateTime &aRelYear );
       
   135 	
       
   136 	/**
       
   137 	 * Method to set the id of the subtitle
       
   138 	 * @param aId The ID value 
       
   139 	 */
       
   140 	void setId( const QString &aId );
       
   141 	
       
   142 private:
       
   143 	QSharedDataPointer<SmfSubtitlePrivate> d;
       
   144 	
       
   145 	friend QDataStream &operator<<( QDataStream &aDataStream, 
       
   146 			const SmfSubtitle &aSubtitle );
       
   147 
       
   148 	friend QDataStream &operator>>( QDataStream &aDataStream, 
       
   149 			SmfSubtitle &aSubtitle );
       
   150 	
       
   151 	};
       
   152 
       
   153 
       
   154 /**
       
   155  * Method for Externalization. Writes the SmfSubtitle object to 
       
   156  * the stream and returns a reference to the stream.
       
   157  * @param aDataStream Stream to be written
       
   158  * @param aSubtitle The SmfSubtitle object to be externalized
       
   159  * @return reference to the written stream
       
   160  */
       
   161 SMFCOMMON_EXPORT  QDataStream &operator<<( QDataStream &aDataStream, 
       
   162 		const SmfSubtitle &aSubtitle );
       
   163 
       
   164 /**
       
   165  * Method for Internalization. Reads a SmfSubtitle object from 
       
   166  * the stream and returns a reference to the stream.
       
   167  * @param aDataStream Stream to be read
       
   168  * @param aSubtitle The SmfSubtitle object to be internalized
       
   169  * @return reference to the stream
       
   170  */
       
   171 SMFCOMMON_EXPORT QDataStream &operator>>( QDataStream &aDataStream, 
       
   172 		SmfSubtitle &aSubtitle);
       
   173 
       
   174 
       
   175 typedef QList<SmfSubtitle> SmfSubtitleList;
       
   176 
       
   177 // Make the class SmfSubtitle known to QMetaType, so that as to register it.
       
   178 Q_DECLARE_METATYPE(SmfSubtitle)
       
   179 Q_DECLARE_METATYPE(QList<SmfSubtitle>)
       
   180 
       
   181 #endif /* SMFSUBTITLE_H_ */