[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/asobj/NetStreamGst.cpp
From: |
Tomas Groth |
Subject: |
[Gnash-commit] gnash ChangeLog server/asobj/NetStreamGst.cpp |
Date: |
Sun, 06 May 2007 15:48:14 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Tomas Groth <tgc> 07/05/06 15:48:14
Modified files:
. : ChangeLog
server/asobj : NetStreamGst.cpp
Log message:
* server/asobj/NetStreamGst.cpp: Moved gst-init to the
contructor, fixes bug #19795. Only create audio/video elements
if needed.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3110&r2=1.3111
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamGst.cpp?cvsroot=gnash&r1=1.31&r2=1.32
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3110
retrieving revision 1.3111
diff -u -b -r1.3110 -r1.3111
--- ChangeLog 6 May 2007 13:35:36 -0000 1.3110
+++ ChangeLog 6 May 2007 15:48:14 -0000 1.3111
@@ -4,6 +4,9 @@
a movie, fixes bug #19568.
* server/asobj/NetStreamFfmpeg.cpp: Fixed return time.
* server/asobj/NetStreamFfmpeg.h: Added a comment.
+ * server/asobj/NetStreamGst.cpp: Moved gst-init to the
+ contructor, fixes bug #19795. Only create audio/video elements
+ if needed.
2007-05-04 Sandro Santilli <address@hidden>
Index: server/asobj/NetStreamGst.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamGst.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- server/asobj/NetStreamGst.cpp 5 May 2007 13:31:44 -0000 1.31
+++ server/asobj/NetStreamGst.cpp 6 May 2007 15:48:14 -0000 1.32
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: NetStreamGst.cpp,v 1.31 2007/05/05 13:31:44 strk Exp $ */
+/* $Id: NetStreamGst.cpp,v 1.32 2007/05/06 15:48:14 tgc Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -94,6 +94,7 @@
m_pausePlayback(false),
m_start_onbuffer(false)
{
+ gst_init (NULL, NULL);
}
NetStreamGst::~NetStreamGst()
@@ -340,7 +341,7 @@
return;
}
nc->seek(0);
- if (head[0] == 'F'|| head[1] == 'L' || head[2] == 'V') {
+ if (head[0] == 'F' && head[1] == 'L' && head[2] == 'V') {
ns->m_isFLV = true;
ns->m_parser = new FLVParser(); // TODO: define ownership, use
auto_ptr !
if (!nc->connectParser(*(ns->m_parser))) {
@@ -351,23 +352,24 @@
}
}
- // init GStreamer
- gst_init (NULL, NULL);
-
// setup the GnashNC plugin if we are not decoding FLV
if (!ns->m_isFLV) _gst_plugin_register_static (&gnash_plugin_desc);
// setup the pipeline
ns->pipeline = gst_pipeline_new (NULL);
- // Check if the creation of the gstreamer pipeline and audiosink was a
succes
+ // Check if the creation of the gstreamer pipeline was a succes
if (!ns->pipeline) {
gnash::log_error(_("The gstreamer pipeline element could not be
created"));
return;
}
+ bool video = false;
+ bool sound = false;
+
// If sound is enabled we set it up
- sound_handler* sound = get_sound_handler();
+ if (get_sound_handler()) sound = true;
+
if (sound) {
// create an audio sink - use oss, alsa or...? make a
commandline option?
// we first try autodetect, then alsa, then oss, then esd,
then...?
@@ -384,21 +386,21 @@
log_error(_("The gstreamer audiosink element could not
be created"));
return;
}
- } else {
- ns->audiosink = gst_element_factory_make ("fakesink", NULL);
- }
-
// setup the audio converter
ns->audioconv = gst_element_factory_make ("audioconvert", NULL);
// setup the volume controller
ns->volume = gst_element_factory_make ("volume", NULL);
- if (!ns->audioconv || !ns->volume) {
+ if (!ns->audioconv || !ns->volume || !ns->audiosink) {
log_error(_("Gstreamer audio element(s) for movie handling
could not be created"));
return;
}
+ } else {
+ ns->audiosink = gst_element_factory_make ("fakesink", NULL);
+ }
+
// setup gnashnc source if we are not decoding FLV (our homegrown
source element)
if (!ns->m_isFLV) {
ns->source = gst_element_factory_make ("gnashsrc", NULL);
@@ -409,19 +411,16 @@
} else {
FLVVideoInfo* videoInfo = ns->m_parser->getVideoInfo();
- FLVAudioInfo* audioInfo = ns->m_parser->getAudioInfo();
- ns->audiosource = gst_element_factory_make ("fakesrc", NULL);
+ if (videoInfo) {
+ video = true;
ns->videosource = gst_element_factory_make ("fakesrc", NULL);
- // setup fake sources
- g_object_set (G_OBJECT (ns->audiosource),
- "sizetype", 2, "can-activate-pull",
FALSE, "signal-handoffs", TRUE, NULL);
+ // setup fake source
g_object_set (G_OBJECT (ns->videosource),
"sizetype", 2, "can-activate-pull",
FALSE, "signal-handoffs", TRUE, NULL);
- // Setup the callbacks
- g_signal_connect (ns->audiosource, "handoff", G_CALLBACK
(NetStreamGst::audio_callback_handoff), ns);
+ // Setup the callback
g_signal_connect (ns->videosource, "handoff", G_CALLBACK
(NetStreamGst::video_callback_handoff), ns);
// Setup the input capsfilter
@@ -481,21 +480,26 @@
g_object_set (G_OBJECT (ns->videoinputcaps), "caps",
videonincaps, NULL);
gst_caps_unref (videonincaps);
+ }
+
+ FLVAudioInfo* audioInfo = ns->m_parser->getAudioInfo();
+ if (!audioInfo) sound = false;
+
+ if (sound) {
+ ns->audiosource = gst_element_factory_make ("fakesrc",
NULL);
+
+ // setup fake source
+ g_object_set (G_OBJECT (ns->audiosource),
+ "sizetype", 2,
"can-activate-pull", FALSE, "signal-handoffs", TRUE, NULL);
+
+ g_signal_connect (ns->audiosource, "handoff",
G_CALLBACK (NetStreamGst::audio_callback_handoff), ns);
+
if (audioInfo->codec == AUDIO_CODEC_MP3) {
ns->audiodecoder = gst_element_factory_make ("mad",
NULL);
- if (ns->audiodecoder == NULL) {
- ns->audiodecoder = gst_element_factory_make
("flump3dec", NULL);
- if (ns->audiodecoder != NULL &&
!gst_default_registry_check_feature_version("flump3dec", 0, 10, 4))
- {
- static bool warned = false;
- if ( ! warned )
- {
- log_error(_("This version of Fluendo's
mp3 plugin does not support flash streaming sounds, please upgrade to version
0.10.4 or higher."));
- warned=true;
- }
- }
- }
+
+ if (ns->audiodecoder == NULL) ns->audiodecoder
= gst_element_factory_make ("flump3dec", NULL);
+
// Check if the element was correctly created
if (!ns->audiodecoder) {
log_error(_("A gstreamer mp3-decoder element
could not be created! You probably need to install a mp3-decoder plugin like
gstreamer0.10-mad or gstreamer0.10-fluendo-mp3."));
@@ -517,6 +521,7 @@
return;
}
}
+ }
// setup the decoder with callback, but only if we are not decoding a
FLV
if (!ns->m_isFLV) {
@@ -524,6 +529,7 @@
g_signal_connect (ns->decoder, "new-decoded-pad", G_CALLBACK
(NetStreamGst::callback_newpad), ns);
}
+ if (video) {
// setup the video colorspaceconverter converter
ns->colorspace = gst_element_factory_make ("ffmpegcolorspace", NULL);
@@ -545,48 +551,54 @@
ns->videosink = gst_element_factory_make ("fakesink", NULL);
g_object_set (G_OBJECT (ns->videosink), "signal-handoffs", TRUE,
"sync", TRUE, NULL);
g_signal_connect (ns->videosink, "handoff", G_CALLBACK
(NetStreamGst::callback_output), ns);
+ }
if (ns->m_isFLV) {
- if (!ns->videosource || !ns->audiosource || !ns->videoinputcaps
|| !ns->audioinputcaps) {
+ if (video && (!ns->videosource || !ns->videoinputcaps)) {
log_error(_("Gstreamer source element(s) for video
movie handling could not be created, you probably need to install
gstreamer0.10-core for fakesrc and capsfilter support."));
return;
}
+ if (sound && (!ns->audiosource || !ns->audioinputcaps)) {
+ log_error(_("Gstreamer source element(s) for audio
movie handling could not be created, you probably need to install
gstreamer0.10-core for fakesrc and capsfilter support."));
+ return;
+ }
+
} else {
if (!ns->decoder || !ns->source) {
- log_error(_("Gstreamer element(s) for video movie
handling could not be created, you probably need to install gstreamer0.10-base
for decodebin support."));
+ log_error(_("Gstreamer element(s) for movie handling
could not be created, you probably need to install gstreamer0.10-base for
decodebin support."));
return;
}
}
- if (!ns->colorspace || !ns->videocaps || !ns->videorate ||
!ns->videosink) {
+ if (video && (!ns->colorspace || !ns->videocaps || !ns->videorate ||
!ns->videosink)) {
log_error(_("Gstreamer element(s) for video movie handling
could not be created, you probably need to install gstreamer0.10-base for
ffmpegcolorspace and videorate support."));
return;
}
// put it all in the pipeline and link the elements
if (!ns->m_isFLV) {
- if (sound) gst_bin_add_many (GST_BIN
(ns->pipeline),ns->audiosink, ns->audioconv, NULL);
- gst_bin_add_many (GST_BIN (ns->pipeline), ns->source,
ns->decoder, ns->colorspace,
- ns->videosink, ns->videorate, ns->videocaps,
ns->volume, NULL);
+ if (sound) gst_bin_add_many (GST_BIN
(ns->pipeline),ns->audiosink, ns->audioconv, ns->volume, NULL);
+ if (video) gst_bin_add_many (GST_BIN (ns->pipeline),
ns->source, ns->decoder, ns->colorspace,
+ ns->videosink, ns->videorate,
ns->videocaps, NULL);
- gst_element_link(ns->source, ns->decoder);
- gst_element_link_many(ns->colorspace, ns->videocaps,
ns->videorate, ns->videosink, NULL);
+ if (video || sound) gst_element_link(ns->source, ns->decoder);
+ if (video) gst_element_link_many(ns->colorspace, ns->videocaps,
ns->videorate, ns->videosink, NULL);
if (sound) gst_element_link_many(ns->audioconv, ns->volume,
ns->audiosink, NULL);
} else {
- gst_bin_add_many (GST_BIN (ns->pipeline), ns->videosource,
ns->videoinputcaps, ns->videodecoder, ns->colorspace, ns->videocaps,
ns->videorate, ns->videosink, NULL);
+ if (video) gst_bin_add_many (GST_BIN (ns->pipeline),
ns->videosource, ns->videoinputcaps, ns->videodecoder, ns->colorspace,
ns->videocaps, ns->videorate, ns->videosink, NULL);
if (sound) gst_bin_add_many (GST_BIN (ns->pipeline),
ns->audiosource, ns->audioinputcaps, ns->audiodecoder, ns->audioconv,
ns->volume, ns->audiosink, NULL);
if (sound) gst_element_link_many(ns->audiosource,
ns->audioinputcaps, ns->audiodecoder, ns->audioconv, ns->volume, ns->audiosink,
NULL);
- gst_element_link_many(ns->videosource, ns->videoinputcaps,
ns->videodecoder, ns->colorspace, ns->videocaps, ns->videorate, ns->videosink,
NULL);
+ if (video) gst_element_link_many(ns->videosource,
ns->videoinputcaps, ns->videodecoder, ns->colorspace, ns->videocaps,
ns->videorate, ns->videosink, NULL);
}
// start playing
if (!ns->m_isFLV) {
- gst_element_set_state (GST_ELEMENT (ns->pipeline),
GST_STATE_PLAYING);
+ if (video || sound) gst_element_set_state (GST_ELEMENT
(ns->pipeline), GST_STATE_PLAYING);
} else {
- gst_element_set_state (GST_ELEMENT (ns->pipeline),
GST_STATE_PAUSED);
+ if (video || sound) gst_element_set_state (GST_ELEMENT
(ns->pipeline), GST_STATE_PAUSED);
ns->m_pause = true;
ns->m_start_onbuffer = true;
}
- [Gnash-commit] gnash ChangeLog server/asobj/NetStreamGst.cpp,
Tomas Groth <=