sbGStreamerMetadataHandler.h
Go to the documentation of this file.
1 // vim: set sw=2 :
2 /*
3 //
4 // BEGIN SONGBIRD GPL
5 //
6 // This file is part of the Songbird web player.
7 //
8 // Copyright(c) 2005-2008 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 __SB_GSTREAMER_METADATA_HANDLER_H__
29 #define __SB_GSTREAMER_METADATA_HANDLER_H__
30 
31 #include "sbIMetadataHandler.h"
33 
34 #include <sbIMediacoreFactory.h>
35 
36 #include <nsIChannel.h>
37 #include <nsITimer.h>
38 
39 #include <prlock.h>
40 #include <nsAutoLock.h>
41 #include <nsCOMPtr.h>
42 #include <nsStringGlue.h>
43 
44 #include <gst/gst.h>
45 
47  public sbIMetadataHandler,
48  public nsITimerCallback
49 {
50 public:
52  NS_DECL_SBIMETADATAHANDLER
53  NS_DECL_NSITIMERCALLBACK
54 
55  /* sbGstreamerMessageHandler */
56  virtual void HandleMessage(GstMessage *message);
57  virtual PRBool HandleSynchronousMessage(GstMessage *message);
58 
60 
61  nsresult Init();
62 
63 private:
65 
66 protected:
67 
68  /* protects access to all member variables; use nsAutoLock */
69  PRLock *mLock;
70  GstElement *mPipeline; // owning
71 
72  // Metadata, both in original GstTagList form, and transformed into an
73  // sbIPropertyArray. Both may be NULL. mProperties will explicitly be null
74  // if we have failed to read the data.
75  GstTagList *mTags;
76  nsCOMPtr<sbIMutablePropertyArray> mProperties;
77 
78  PRBool mHasAudio;
79  PRBool mHasVideo;
80 
81  static void on_pad_added(GstElement *decodeBin,
82  GstPad *newPad,
84  static void on_pad_caps_changed(GstPad *pad,
85  GParamSpec *pspec,
87 
88  void HandleTagMessage(GstMessage *message);
89 
90  nsCOMPtr<nsIChannel> mChannel;
91  nsCOMPtr<nsITimer> mTimer; // for timeout
92  nsCOMPtr<sbIMediacoreFactory> mFactory; // for voting
93  nsCString mSpec;
94  PRBool mCompleted;
95 
96  // the lock should be held when calling these methods
97 
102  nsresult FinalizeTags(PRBool aSucceeded);
103 };
104 
105 #define SB_GSTREAMER_METADATA_HANDLER_CLASSNAME \
106  "sbGStreamerMetadataHandler"
107 #define SB_GSTREAMER_METADATA_HANDLER_DESCRIPTION \
108  "Songbird GStreamer Metadata Handler"
109 #define SB_GSTREAMER_METADATA_HANDLER_CONTRACTID \
110  "@songbirdnest.com/Songbird/MetadataHandler/GStreamer;1"
111 #define SB_GSTREAMER_METADATA_HANDLER_CID \
112  {0x58cc7fbd, 0xdfa3, 0x4e36, {0x95, 0xd6, 0xb3, 0x6d, 0x67, 0x7a, 0x6e, 0xab}}
113 
114 #endif /* __SB_GSTREAMER_METADATA_HANDLER_H__ */
nsCOMPtr< sbIMutablePropertyArray > mProperties
nsresult FinalizeTags(PRBool aSucceeded)
virtual PRBool HandleSynchronousMessage(GstMessage *message)
An object capable of manipulating the metadata tags for a media file.
GstMessage * message
nsCOMPtr< sbIMediacoreFactory > mFactory
NS_DECL_ISUPPORTS NS_DECL_SBIMETADATAHANDLER virtual NS_DECL_NSITIMERCALLBACK void HandleMessage(GstMessage *message)
static void on_pad_caps_changed(GstPad *pad, GParamSpec *pspec, sbGStreamerMetadataHandler *data)
observe data
Definition: FeedWriter.js:1329
nsITimerCallback
static void on_pad_added(GstElement *decodeBin, GstPad *newPad, sbGStreamerMetadataHandler *self)
void HandleTagMessage(GstMessage *message)