/* * subtitle editor * * http://kitone.free.fr/subtitleeditor/ * * Copyright @ 2005-2006, kitone * * Contact: kitone at free dot fr * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * See gpl.txt for more information regarding the GNU General Public License. * * * \file * \brief * \author kitone (kitone at free dot fr) */ #include "GstMedia.h" #include #include #include #include "Config.h" #include "debug.h" /* * */ GstMedia::GstMedia(const Glib::ustring &uri) :GstLaunch(80), m_audiosink(NULL), m_videosink(NULL) { se_debug_message(SE_DEBUG_GSTREAMER, "uri=%s", uri.c_str()); gchar *pipe = g_strdup_printf("playbin uri=%s", uri.c_str()); if(parse(pipe)) { // config se_debug_message(SE_DEBUG_GSTREAMER, "load config..."); Glib::ustring audiosink, videosink; Config &cfg = Config::getInstance(); if(!cfg.get_value_string("timing-system", "audio-sink", audiosink)) audiosink = "autoaudiosink"; if(!cfg.get_value_string("timing-system", "video-sink", videosink)) videosink = "autovideosink"; se_debug_message(SE_DEBUG_GSTREAMER, "audio-sink=<%s> video-sink=<%s>", audiosink.c_str(), videosink.c_str()); // create sink m_audiosink = gst_element_factory_make(audiosink.c_str(), "audiosink"); m_videosink = gst_element_factory_make(videosink.c_str(), "videosink"); // TODO check m_audiosink & m_videosink se_debug_message(SE_DEBUG_GSTREAMER, "set audio/video sink..."); g_object_set(G_OBJECT(m_pipeline), "video-sink", m_videosink, "audio-sink", m_audiosink, NULL); se_debug_message(SE_DEBUG_GSTREAMER, "set force-aspect-ratio..."); g_object_set(G_OBJECT(m_videosink), //"brightness",100, "force-aspect-ratio", TRUE, NULL); se_debug_message(SE_DEBUG_GSTREAMER, "ready..."); ready(); } else se_debug_message(SE_DEBUG_GSTREAMER, "parse FAILED!"); g_free(pipe); } /* * */ GstMedia::~GstMedia() { se_debug(SE_DEBUG_GSTREAMER); if(m_videosink && GST_IS_X_OVERLAY(m_videosink)) { gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videosink), 0); } } /* * */ GstElement* GstMedia::getAudioSink() { return m_audiosink; } /* * */ GstElement* GstMedia::getVideoSink() { return m_videosink; }