sbTranscodeProgressListener.h
Go to the documentation of this file.
1 /* vim: set sw=2 :miv */
2 /*
3 //
4 // BEGIN SONGBIRD GPL
5 //
6 // This file is part of the Songbird web player.
7 //
8 // Copyright(c) 2005-2009 POTI, Inc.
9 // http://songbirdnest.com
10 //
11 // This file may be licensed under the terms of of the
12 // GNU General Public License Version 2 (the "GPL").
13 //
14 // Software distributed under the License is distributed
15 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
16 // express or implied. See the GPL for the specific language
17 // governing rights and limitations.
18 //
19 // You should have received a copy of the GPL along with this
20 // program. If not, go to http://www.gnu.org/licenses/gpl.html
21 // or write to the Free Software Foundation, Inc.,
22 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 //
24 // END SONGBIRD GPL
25 //
26 */
27 
28 #ifndef sbTranscodeProgressListener_H_
29 #define sbTranscodeProgressListener_H_
30 
31 // Songbird includes
32 #include "sbBaseDevice.h"
33 #include <sbIJobProgress.h>
34 #include <sbIMediacoreEventListener.h>
35 // Forward class declarations
36 
37 class sbIJobCancelable;
41 
47 {
48 public:
50  NS_DECL_SBIJOBPROGRESSLISTENER
51  NS_DECL_SBIMEDIACOREEVENTLISTENER
52 
57  {
58  public:
63  StatusProperty(sbIMediaItem * aSourceItem = nsnull,
64  nsAString const & aPropertyName = nsString()) :
65  mSourceItem(aSourceItem),
66  mPropertyName(aPropertyName)
67  {
68  }
72  nsresult SetValue(nsAString const & aValue)
73  {
74  if (!mPropertyName.IsEmpty() && mSourceItem) {
75  nsresult rv = mSourceItem->SetProperty(mPropertyName, aValue);
76  NS_ENSURE_SUCCESS(rv, rv);
77  }
78  return NS_OK;
79  }
80  private:
81  nsCOMPtr<sbIMediaItem> mSourceItem;
82  nsString mPropertyName;
83  };
85  New(sbBaseDevice * aDeviceBase,
86  sbDeviceStatusHelper * aDeviceStatusHelper,
87  sbIMediaItem *aItem,
88  PRMonitor * aCompleteNotifyMonitor = nsnull,
89  StatusProperty const & aStatusProperty = StatusProperty(),
90  sbIJobCancelable * aCancel = nsnull);
91 
92  PRBool IsComplete() const { return mIsComplete; };
93  PRBool IsAborted() const { return mAborted; }
94 private:
95  inline
97  sbDeviceStatusHelper * aDeviceStatusHelper,
98  sbIMediaItem *aItem,
99  PRMonitor * aCompleteNotifyMonitor,
100  StatusProperty const & aStatusProperty,
101  sbIJobCancelable * aCancel);
102 
108  nsresult Completed(sbIJobProgress * aJobProgress);
109 
114  nsresult SetProgress(sbIJobProgress * aJobProgress);
115 
119  inline
120  nsresult SetStatusProperty(sbStatusPropertyValue const & aValue);
121 
122  // Raw manually ref counted pointer because nsISupports is ambiguous
123  sbBaseDevice * mBaseDevice;
124 
125  // Non-owning reference, reference to mBaseDevice will keep this alive
126  sbDeviceStatusHelper * mStatus;
127 
128  nsCOMPtr<sbIMediaItem> mItem;
129  PRMonitor *mCompleteNotifyMonitor;
130  PRInt32 mIsComplete;
131  PRUint32 mTotal;
132  StatusProperty mStatusProperty;
133  nsCOMPtr<sbIJobCancelable> mCancel;
134  PRBool mAborted;
135 };
136 
137 
138 #endif /* sbTranscodeProgressListener_H_ */
return NS_OK
onPageChanged aValue
Definition: FeedWriter.js:1395
Generic interface for exposing long running jobs to the UI.
static sbTranscodeProgressListener * New(sbBaseDevice *aDeviceBase, sbDeviceStatusHelper *aDeviceStatusHelper, sbIMediaItem *aItem, PRMonitor *aCompleteNotifyMonitor=nsnull, StatusProperty const &aStatusProperty=StatusProperty(), sbIJobCancelable *aCancel=nsnull)
Implemented to receive notifications from sbIJobProgress interfaces.
Interface that defines a single item of media in the system.
StatusProperty(sbIMediaItem *aSourceItem=nsnull, nsAString const &aPropertyName=nsString())