sbTranscodeUtils.h
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2010 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
25 #include <nsIURI.h>
26 
27 #include <sbITranscodeError.h>
28 #include <sbITranscodeManager.h>
29 
30 #include <nsStringGlue.h>
31 
32 class nsIURI;
33 class sbIMediaItem;
34 
39 inline nsresult
40 SB_NewTranscodeError(const nsAString& aMessageWithItem,
41  const nsAString& aMessageWithoutItem,
42  const nsAString& aDetails,
43  const nsAString& aUri,
44  sbIMediaItem* aMediaItem,
45  sbITranscodeError** _retval)
46 {
47  NS_ENSURE_ARG_POINTER(_retval);
48  nsresult rv;
49  nsCOMPtr<sbITranscodeError> error =
50  do_CreateInstance(SONGBIRD_TRANSCODEERROR_CONTRACTID, &rv);
51  NS_ENSURE_SUCCESS(rv, rv);
52  rv = error->Init(aMessageWithItem, aMessageWithoutItem, aDetails);
53  NS_ENSURE_SUCCESS(rv, rv);
54  rv = error->SetSourceUri(aUri);
55  NS_ENSURE_SUCCESS(rv, rv);
56  rv = error->SetSourceItem(aMediaItem);
57  NS_ENSURE_SUCCESS(rv, rv);
58  error.forget(_retval);
59  return NS_OK;
60 }
61 inline nsresult
62 SB_NewTranscodeError(const nsAString& aMessageWithItem,
63  const nsAString& aMessageWithoutItem,
64  const nsAString& aDetails,
65  nsIURI* aUri,
66  sbIMediaItem* aMediaItem,
67  sbITranscodeError** _retval)
68 {
69  NS_ENSURE_ARG_POINTER(aUri);
70  nsCString uri;
71  nsresult rv = aUri->GetSpec(uri);
72  NS_ENSURE_SUCCESS(rv, rv);
73  return SB_NewTranscodeError(aMessageWithItem, aMessageWithoutItem, aDetails,
74  NS_ConvertUTF8toUTF16(uri), aMediaItem, _retval);
75 }
76 inline nsresult
77 SB_NewTranscodeError(const char* aMessageWithItem,
78  const char* aMessageWithoutItem,
79  const char* aDetails,
80  nsIURI* aUri,
81  sbIMediaItem* aMediaItem,
82  sbITranscodeError** _retval)
83 {
84  return SB_NewTranscodeError(NS_ConvertASCIItoUTF16(aMessageWithItem),
85  NS_ConvertASCIItoUTF16(aMessageWithoutItem),
86  NS_ConvertASCIItoUTF16(aDetails),
87  aUri,
88  aMediaItem,
89  _retval);
90 }
91 inline nsresult
92 SB_NewTranscodeError(const char* aMessageWithItem,
93  const char* aMessageWithoutItem,
94  const char* aDetails,
95  const char* aUri,
96  sbIMediaItem* aMediaItem,
97  sbITranscodeError** _retval)
98 {
99  return SB_NewTranscodeError(NS_ConvertASCIItoUTF16(aMessageWithItem),
100  NS_ConvertASCIItoUTF16(aMessageWithoutItem),
101  NS_ConvertASCIItoUTF16(aDetails),
102  NS_ConvertASCIItoUTF16(aUri),
103  aMediaItem,
104  _retval);
105 }
106 
107 
#define SONGBIRD_TRANSCODEERROR_CONTRACTID
return NS_OK
nsresult SB_NewTranscodeError(const nsAString &aMessageWithItem, const nsAString &aMessageWithoutItem, const nsAString &aDetails, const nsAString &aUri, sbIMediaItem *aMediaItem, sbITranscodeError **_retval)
var uri
Definition: FeedWriter.js:1135
Interface that defines a single item of media in the system.