25 #ifndef _SB_GSTREAMER_VIDEO_TRANSCODE_H_
26 #define _SB_GSTREAMER_VIDEO_TRANSCODE_H_
28 #include <nsAutoLock.h>
30 #include <nsCOMArray.h>
33 #include <nsStringGlue.h>
37 #include "sbITranscodeVideoJob.h"
38 #include "sbIJobProgress.h"
39 #include "sbIJobCancelable.h"
40 #include "sbITranscodingConfigurator.h"
41 #include "sbITranscodeError.h"
42 #include "sbIMediaFormatMutable.h"
48 #define SB_GSTREAMER_VIDEO_TRANSCODE_CID \
49 { 0x227551a3, 0x24dc, 0x42e7, \
50 { 0x9a, 0xb6, 0x95, 0x25, 0xe9, 0x89, 0xed, 0xfd } }
52 #define SB_GSTREAMER_VIDEO_TRANSCODE_CONTRACTID \
53 "@songbirdnest.com/Songbird/Mediacore/Transcode/GStreamerVideo;1"
54 #define SB_GSTREAMER_VIDEO_TRANSCODE_CLASSNAME "GStreamerVideoTranscode"
66 NS_DECL_SBITRANSCODEVIDEOJOB
67 NS_DECL_SBIJOBPROGRESS
68 NS_DECL_SBIJOBPROGRESSTIME
69 NS_DECL_SBIJOBCANCELABLE
70 NS_DECL_NSITIMERCALLBACK
79 virtual ~sbGStreamerVideoTranscoder();
81 nsresult OnJobProgress();
83 void HandleErrorMessage(GstMessage *
message);
84 void HandleEOSMessage(GstMessage *message);
86 GstClockTime QueryPosition();
87 GstClockTime QueryDuration();
89 nsresult StartProgressReporting();
90 nsresult StopProgressReporting();
92 void AsyncStopPipeline();
97 nsresult BuildTranscodePipeline (
const gchar *pipelineName);
103 nsresult CleanupPipeline();
111 nsresult ClearStatus();
115 nsresult InitializeConfigurator ();
128 void TranscodingFatalError (
const char *errorName);
131 static void decodebin_pad_added_cb (GstElement *
element, GstPad *pad,
132 sbGStreamerVideoTranscoder *transcoder);
133 static void decodebin_no_more_pads_cb (
135 sbGStreamerVideoTranscoder *transcoder);
136 static void pad_blocked_cb (GstPad *pad, gboolean
blocked,
137 sbGStreamerVideoTranscoder *transcoder);
138 static void pad_notify_caps_cb (GObject *obj, GParamSpec *pspec,
139 sbGStreamerVideoTranscoder *transcoder);
145 nsresult DecoderPadAdded(GstElement *uridecodebin, GstPad *pad);
151 nsresult DecoderNoMorePads(GstElement *uridecodebin);
154 nsresult PadBlocked (GstPad *pad, gboolean blocked);
157 nsresult PadNotifyCaps (GstPad *pad);
161 nsresult CheckForAllCaps ();
164 GstCaps *GetCapsFromPad (GstPad *pad);
167 nsresult BuildRemainderOfPipeline();
172 nsresult AddAudioBin (GstPad *inputAudioSrcPad, GstPad **outputAudioSrcPad);
177 nsresult BuildAudioBin (GstCaps *inputAudioCaps, GstElement **audioBin);
182 nsresult AddVideoBin (GstPad *inputVideoSrcPad, GstPad **outputVideoSrcPad);
187 nsresult BuildVideoBin (GstCaps *inputVideoCaps, GstElement **videoBin);
195 nsresult AddMuxer (GstPad **muxerSrcPad, GstPad *audioPad, GstPad *videoPad);
198 nsresult AddSink (GstPad *muxerSrcPad);
202 nsresult CreateSink (GstElement **sink);
206 GstPad * GetCompatiblePad (GstElement *element, GstPad *pad);
210 GstPad * GetPadFromTemplate (GstElement *element, GstPadTemplate *templ);
214 void ConfigureVideoBox (GstElement *videobox, GstCaps *aInputVideoCaps,
215 gint outputWidth, gint outputHeight, gint outputParN, gint outputParD);
218 nsresult SetMetadataOnTagSetters();
221 nsresult AddImageToTagList(GstTagList *aTags, nsIInputStream *aStream);
224 nsresult GetRawAudioCaps(GstCaps **aResultCaps);
226 nsCOMPtr<sbIPropertyArray> mMetadata;
227 nsCOMPtr<nsIInputStream> mImageStream;
228 nsCOMPtr<sbITranscodingConfigurator> mConfigurator;
235 nsCOMPtr<nsIOutputStream> mDestStream;
238 nsTArray<nsCOMPtr<sbITranscodeError> > mErrors;
240 nsCOMArray<sbIJobProgressListener> mProgressListeners;
241 nsCOMPtr<nsITimer> mProgressTimer;
243 PRBool mPipelineBuilt;
244 PRBool mWaitingForCaps;
248 GstPad *mAudioQueueSrc;
249 GstPad *mVideoQueueSrc;
264 #endif // _SB_GSTREAMER_TRANSCODE_H_
An object capable of transcoding a source URI to a destination file.
Songbird Job Utility Definitions.
Generic interface extending sbIJobProgress that can track expected time, etc in addition to abstract ...
NS_DECL_ISUPPORTS NS_DECL_NSICLASSINFO NS_DECL_SBITRANSCODEVIDEOJOB NS_DECL_SBIJOBPROGRESS NS_DECL_SBIJOBPROGRESSTIME NS_DECL_SBIJOBCANCELABLE NS_DECL_NSITIMERCALLBACK sbGStreamerVideoTranscoder()
virtual nsresult BuildPipeline()
NS_IMETHOD PlayPipeline()
NS_IMETHOD StopPipeline()
readonly attribute boolean blocked
If true, progress of job is blocked (e.g., due to locked resource).