summaryrefslogtreecommitdiffstats
path: root/src/gstplayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gstplayer.cpp')
-rw-r--r--src/gstplayer.cpp182
1 files changed, 91 insertions, 91 deletions
diff --git a/src/gstplayer.cpp b/src/gstplayer.cpp
index 092a8b2..a17a0ef 100644
--- a/src/gstplayer.cpp
+++ b/src/gstplayer.cpp
@@ -22,13 +22,13 @@
#include <math.h>
#include <config.h>
#include <dcopclient.h>
-#include <qcstring.h>
-#include <qtimer.h>
-#include <qfile.h>
-#include <qurl.h>
-#include <qthread.h>
-#include <qmutex.h>
-#include <qdom.h>
+#include <tqcstring.h>
+#include <tqtimer.h>
+#include <tqfile.h>
+#include <tqurl.h>
+#include <tqthread.h>
+#include <tqmutex.h>
+#include <tqdom.h>
#include "kmplayer_backend.h"
#include "kmplayer_callback_stub.h"
#include "kmplayer_callback.h"
@@ -48,7 +48,7 @@ static Display *display;
static KGStreamerPlayer *gstapp;
static KMPlayer::Callback_stub * callback;
static Window wid;
-static QMutex mutex (true);
+static TQMutex mutex (true);
static bool window_created = true;
static bool wants_config;
static bool verbose;
@@ -59,15 +59,15 @@ static int movie_height;
static int movie_length;
static int repeat_count;
static int screen;
-static const int event_finished = QEvent::User;
-static const int event_playing = QEvent::User + 1;
-static const int event_size = QEvent::User + 2;
-static const int event_eos = QEvent::User + 3;
-static const int event_progress = QEvent::User + 4;
-static const int event_error = QEvent::User + 5;
-static const int event_video = QEvent::User + 6;
-static QString mrl;
-static QString sub_mrl;
+static const int event_finished = TQEvent::User;
+static const int event_playing = TQEvent::User + 1;
+static const int event_size = TQEvent::User + 2;
+static const int event_eos = TQEvent::User + 3;
+static const int event_progress = TQEvent::User + 4;
+static const int event_error = TQEvent::User + 5;
+static const int event_video = TQEvent::User + 6;
+static TQString mrl;
+static TQString sub_mrl;
static const char *ao_driver;
static const char *vo_driver;
static const char *playbin_name = "player";
@@ -75,24 +75,24 @@ static const char *dvd_device;
static const char *vcd_device;
static GstElement *gst_elm_play;
static GstBus *gst_bus;
-static unsigned int /*GstMessageType*/ ignore_messages_mask;
+static unsigned int /*GstMessageType*/ ignore_messages_tqmask;
static GstXOverlay *xoverlay;
static GstColorBalance *color_balance;
static gulong gst_bus_sync;
static gulong gst_bus_async;
-static QString elmentry ("entry");
-static QString elmitem ("item");
-static QString attname ("NAME");
-static QString atttype ("TYPE");
-static QString attdefault ("DEFAULT");
-static QString attvalue ("VALUE");
-static QString attstart ("START");
-static QString attend ("END");
-static QString valrange ("range");
-static QString valnum ("num");
-static QString valbool ("bool");
-static QString valenum ("enum");
-static QString valstring ("string");
+static TQString elmentry ("entry");
+static TQString elmitem ("item");
+static TQString attname ("NAME");
+static TQString atttype ("TYPE");
+static TQString attdefault ("DEFAULT");
+static TQString attvalue ("VALUE");
+static TQString attstart ("START");
+static TQString attend ("END");
+static TQString valrange ("range");
+static TQString valnum ("num");
+static TQString valbool ("bool");
+static TQString valenum ("enum");
+static TQString valstring ("string");
extern "C" {
// nothing yet
@@ -111,7 +111,7 @@ cb_error (GstElement * play,
fprintf (stderr, "cb_error: %s %s\n", err->message, debug);
if (GST_STATE (play) == GST_STATE_PLAYING)
gst_element_set_state (play, GST_STATE_READY);
- QApplication::postEvent (gstapp, new QEvent ((QEvent::Type)event_finished));
+ TQApplication::postEvent (gstapp, new TQEvent ((TQEvent::Type)event_finished));
}
// NULL -> READY -> PAUSED -> PLAYING
@@ -124,7 +124,7 @@ gstCapsSet (GstPad *pad,
GstCaps *caps = gst_pad_get_negotiated_caps (pad);
if (!caps)
return;
- QApplication::postEvent (gstapp, new QEvent ((QEvent::Type) event_video));
+ TQApplication::postEvent (gstapp, new TQEvent ((TQEvent::Type) event_video));
const GstStructure * s = gst_caps_get_structure (caps, 0);
if (s) {
const GValue *par;
@@ -140,7 +140,7 @@ gstCapsSet (GstPad *pad,
else
movie_height = (int) ((float) den * movie_height / num);
}
- QApplication::postEvent (gstapp, new GstSizeEvent (movie_length, movie_width, movie_height));
+ TQApplication::postEvent (gstapp, new GstSizeEvent (movie_length, movie_width, movie_height));
}
gst_caps_unref (caps);
}
@@ -204,7 +204,7 @@ static void gstGetDuration () {
if (movie_length != len / (GST_MSECOND * 100)) {
movie_length = len / (GST_MSECOND * 100);
fprintf (stderr, "new length %d\n", movie_length);
- QApplication::postEvent (gstapp, new GstSizeEvent (movie_length, movie_width, movie_height));
+ TQApplication::postEvent (gstapp, new GstSizeEvent (movie_length, movie_width, movie_height));
}
}
@@ -217,12 +217,12 @@ static void gstTag (const GstTagList *, const gchar *tag, gpointer) {
static void gstBusMessage (GstBus *, GstMessage * message, gpointer) {
GstMessageType msg_type = GST_MESSAGE_TYPE (message);
/* somebody else is handling the message, probably in gstPolForStateChange*/
- if (ignore_messages_mask & msg_type)
+ if (ignore_messages_tqmask & msg_type)
return;
switch (msg_type) {
case GST_MESSAGE_ERROR:
fprintf (stderr, "error msg\n");
- QApplication::postEvent (gstapp, new QEvent ((QEvent::Type) event_error));
+ TQApplication::postEvent (gstapp, new TQEvent ((TQEvent::Type) event_error));
if (gst_elm_play) {
gst_element_set_state (gst_elm_play, GST_STATE_NULL);
//gstPollForStateChange (gst_elm_play, GST_STATE_NULL);
@@ -246,7 +246,7 @@ static void gstBusMessage (GstBus *, GstMessage * message, gpointer) {
case GST_MESSAGE_BUFFERING: {
gint percent = 0;
gst_structure_get_int (message->structure, "buffer-percent", &percent);
- QApplication::postEvent (gstapp, new GstProgressEvent (percent));
+ TQApplication::postEvent (gstapp, new GstProgressEvent (percent));
//fprintf (stderr, "Buffering message (%u%%)\n", percent);
break;
}
@@ -266,7 +266,7 @@ static void gstBusMessage (GstBus *, GstMessage * message, gpointer) {
if (old_state == GST_STATE_PAUSED &&
new_state >= GST_STATE_PLAYING) {
gstGetDuration ();
- QApplication::postEvent (gstapp, new QEvent ((QEvent::Type) event_playing));
+ TQApplication::postEvent (gstapp, new TQEvent ((TQEvent::Type) event_playing));
} else if (old_state >= GST_STATE_PAUSED &&
new_state <= GST_STATE_READY) {
if (repeat_count-- > 0 &&
@@ -274,8 +274,8 @@ static void gstBusMessage (GstBus *, GstMessage * message, gpointer) {
gstPollForStateChange(gst_elm_play, GST_STATE_PAUSED)))
gst_element_set_state(gst_elm_play, GST_STATE_PLAYING);
else
- QApplication::postEvent (gstapp,
- new QEvent ((QEvent::Type) event_finished));
+ TQApplication::postEvent (gstapp,
+ new TQEvent ((TQEvent::Type) event_finished));
}
}
//g_free (src_name);
@@ -310,14 +310,14 @@ static bool gstPollForStateChange (GstElement *element, GstState state, gint64 t
GError **error = 0L;
events = GST_MESSAGE_STATE_CHANGED | GST_MESSAGE_ERROR | GST_MESSAGE_EOS;
- saved_events = ignore_messages_mask;
+ saved_events = ignore_messages_tqmask;
if (element && element == gst_elm_play) {
/* we do want the main handler to process state changed messages for
* playbin as well, otherwise it won't hook up the timeout etc. */
- ignore_messages_mask |= (events ^ GST_MESSAGE_STATE_CHANGED);
+ ignore_messages_tqmask |= (events ^ GST_MESSAGE_STATE_CHANGED);
} else {
- ignore_messages_mask |= events;
+ ignore_messages_tqmask |= events;
}
while (true) {
@@ -367,14 +367,14 @@ static bool gstPollForStateChange (GstElement *element, GstState state, gint64 t
success:
/* state change succeeded */
fprintf (stderr, "state change to %s succeeded\n", gst_element_state_get_name (state));
- ignore_messages_mask = saved_events;
+ ignore_messages_tqmask = saved_events;
return true;
timed_out:
/* it's taking a long time to open -- just tell totem it was ok, this allows
* the user to stop the loading process with the normal stop button */
fprintf (stderr, "state change to %s timed out, returning success and handling errors asynchroneously\n", gst_element_state_get_name (state));
- ignore_messages_mask = saved_events;
+ ignore_messages_tqmask = saved_events;
return true;
error:
@@ -382,20 +382,20 @@ error:
gst_element_state_get_name (state),
(error && *error) ? (*error)->message : "unknown");
/* already set *error */
- ignore_messages_mask = saved_events;
- QApplication::postEvent (gstapp, new QEvent ((QEvent::Type) event_error));
+ ignore_messages_tqmask = saved_events;
+ TQApplication::postEvent (gstapp, new TQEvent ((TQEvent::Type) event_error));
return false;
}
//-----------------------------------------------------------------------------
GstSizeEvent::GstSizeEvent (int l, int w, int h)
- : QEvent ((QEvent::Type) event_size),
+ : TQEvent ((TQEvent::Type) event_size),
length (l), width (w), height (h)
{}
GstProgressEvent::GstProgressEvent (const int p)
- : QEvent ((QEvent::Type) event_progress), progress (p)
+ : TQEvent ((TQEvent::Type) event_progress), progress (p)
{}
//-----------------------------------------------------------------------------
@@ -403,16 +403,16 @@ GstProgressEvent::GstProgressEvent (const int p)
using namespace KMPlayer;
Backend::Backend ()
- : DCOPObject (QCString ("Backend")) {
+ : DCOPObject (TQCString ("Backend")) {
}
Backend::~Backend () {}
-void Backend::setURL (QString url) {
+void Backend::setURL (TQString url) {
mrl = url;
}
-void Backend::setSubTitleURL (QString url) {
+void Backend::setSubTitleURL (TQString url) {
sub_mrl = url;
}
@@ -421,7 +421,7 @@ void Backend::play (int repeat) {
}
void Backend::stop () {
- QTimer::singleShot (0, gstapp, SLOT (stop ()));
+ TQTimer::singleShot (0, gstapp, TQT_SLOT (stop ()));
}
void Backend::pause () {
@@ -455,10 +455,10 @@ void Backend::volume (int v, bool) {
void Backend::frequency (int) {
}
-void Backend::setAudioLang (int, QString) {
+void Backend::setAudioLang (int, TQString) {
}
-void Backend::setSubtitle (int, QString) {
+void Backend::setSubtitle (int, TQString) {
}
void Backend::quit () {
@@ -467,29 +467,29 @@ void Backend::quit () {
if (running)
stop ();
else
- QTimer::singleShot (0, qApp, SLOT (quit ()));
+ TQTimer::singleShot (0, tqApp, TQT_SLOT (quit ()));
}
-bool updateConfigEntry (const QString & name, const QString & value) {
+bool updateConfigEntry (const TQString & name, const TQString & value) {
fprintf (stderr, "%s=%s\n", name.ascii (), (const char *) value.local8Bit ());
return true;
}
-void Backend::setConfig (QByteArray /*data*/) {
- /*QString err;
+void Backend::setConfig (TQByteArray /*data*/) {
+ /*TQString err;
int line, column;
- QDomDocument dom;
+ TQDomDocument dom;
if (dom.setContent (data, false, &err, &line, &column)) {
if (dom.childNodes().length() == 1) {
- for (QDomNode node = dom.firstChild().firstChild();
+ for (TQDomNode node = dom.firstChild().firstChild();
!node.isNull ();
node = node.nextSibling ()) {
- QDomNamedNodeMap attr = node.attributes ();
+ TQDomNamedNodeMap attr = node.attributes ();
updateConfigEntry (attr.namedItem (attname).nodeValue (),
attr.namedItem (attvalue).nodeValue ());
}
} else
- err = QString ("invalid data");
+ err = TQString ("invalid data");
}
if (callback)
callback->errorMessage (0, err);*/
@@ -503,7 +503,7 @@ bool Backend::isPlaying () {
}
KGStreamerPlayer::KGStreamerPlayer (int _argc, char ** _argv)
- : QApplication (_argc, _argv, false) {
+ : TQApplication (_argc, _argv, false) {
}
void KGStreamerPlayer::init () {
@@ -540,11 +540,11 @@ KGStreamerPlayer::~KGStreamerPlayer () {
gstapp = 0L;
}
-void getConfigEntries (QByteArray & buf) {
- QDomDocument doc;
- QDomElement root = doc.createElement (QString ("document"));
+void getConfigEntries (TQByteArray & buf) {
+ TQDomDocument doc;
+ TQDomElement root = doc.createElement (TQString ("document"));
doc.appendChild (root);
- QCString exp = doc.toCString ();
+ TQCString exp = doc.toCString ();
buf = exp;
buf.resize (exp.length ()); // strip terminating \0
}
@@ -573,7 +573,7 @@ void KGStreamerPlayer::play (int repeat) {
fprintf (stderr, "couldn't create playbin\n");
goto fail;
}
- ignore_messages_mask = 0;
+ ignore_messages_tqmask = 0;
gst_bus = gst_element_get_bus (gst_elm_play);
gst_bus_add_signal_watch (gst_bus);
@@ -634,13 +634,13 @@ void KGStreamerPlayer::play (int repeat) {
if (GST_STATE (gst_elm_play) > GST_STATE_READY)
gst_element_set_state (gst_elm_play, GST_STATE_READY);
- if (mrl.startsWith (QChar ('/')))
- mrl = QString ("file://") + mrl;
+ if (mrl.startsWith (TQChar ('/')))
+ mrl = TQString ("file://") + mrl;
uri = g_strdup (mrl.local8Bit ());
g_object_set (gst_elm_play, "uri", uri, NULL);
if (!sub_mrl.isEmpty ()) {
- if (sub_mrl.startsWith (QChar ('/')))
- sub_mrl = QString ("file://") + sub_mrl;
+ if (sub_mrl.startsWith (TQChar ('/')))
+ sub_mrl = TQString ("file://") + sub_mrl;
sub_uri = g_strdup (sub_mrl.local8Bit ());
g_object_set (gst_elm_play, "suburi", sub_uri, NULL);
g_free (sub_uri);
@@ -653,7 +653,7 @@ void KGStreamerPlayer::play (int repeat) {
gstPollForStateChange (gst_elm_play, GST_STATE_PLAYING);
}
g_free (uri);
- QTimer::singleShot (500, this, SLOT (updatePosition ()));
+ TQTimer::singleShot (500, this, TQT_SLOT (updatePosition ()));
return;
fail:
if (videosink) {
@@ -665,7 +665,7 @@ fail:
gst_object_unref (audiosink);
}
mutex.unlock ();
- QApplication::postEvent (gstapp, new QEvent ((QEvent::Type)event_finished));
+ TQApplication::postEvent (gstapp, new TQEvent ((TQEvent::Type)event_finished));
}
void KGStreamerPlayer::pause () {
@@ -697,11 +697,11 @@ void KGStreamerPlayer::stop () {
}
mutex.unlock ();
if (!gst_elm_play || (gst_elm_play && !notified_playing))
- QApplication::postEvent (gstapp, new QEvent ((QEvent::Type) event_finished));
+ TQApplication::postEvent (gstapp, new TQEvent ((TQEvent::Type) event_finished));
}
void KGStreamerPlayer::finished () {
- QTimer::singleShot (10, this, SLOT (stop ()));
+ TQTimer::singleShot (10, this, TQT_SLOT (stop ()));
}
static void adjustColorSetting (const char * channel, int val) {
@@ -770,11 +770,11 @@ void KGStreamerPlayer::updatePosition () {
callback->moviePosition (int (val / (GST_MSECOND * 100)));
}
mutex.unlock ();
- QTimer::singleShot (500, this, SLOT (updatePosition ()));
+ TQTimer::singleShot (500, this, TQT_SLOT (updatePosition ()));
}
}
-bool KGStreamerPlayer::event (QEvent * e) {
+bool KGStreamerPlayer::event (TQEvent * e) {
switch (e->type()) {
case event_finished: {
fprintf (stderr, "event_finished\n");
@@ -797,7 +797,7 @@ bool KGStreamerPlayer::event (QEvent * e) {
if (callback)
callback->finished ();
else
- QTimer::singleShot (0, this, SLOT (quit ()));
+ TQTimer::singleShot (0, this, TQT_SLOT (quit ()));
break;
}
//callback->movieParams (se->length/100, se->width, se->height, se->height ? 1.0*se->width/se->height : 1.0);
@@ -806,7 +806,7 @@ bool KGStreamerPlayer::event (QEvent * e) {
fprintf (stderr, "movie parms: %d %d %d\n", se->length, se->width, se->height);
if (callback) {
if (se->length < 0) se->length = 0;
- callback->movieParams (se->length, se->width, se->height, se->height ? 1.0*se->width/se->height : 1.0, QStringList (), QStringList ());
+ callback->movieParams (se->length, se->width, se->height, se->height ? 1.0*se->width/se->height : 1.0, TQStringList (), TQStringList ());
}
if (window_created && movie_width > 0 && movie_height > 0) {
XLockDisplay (display);
@@ -832,7 +832,7 @@ bool KGStreamerPlayer::event (QEvent * e) {
break;
case event_video:
if (callback)
- callback->statusMessage ((int) KMPlayer::Callback::stat_hasvideo, QString ());
+ callback->statusMessage ((int) KMPlayer::Callback::stat_hasvideo, TQString ());
break;
default:
return false;
@@ -840,12 +840,12 @@ bool KGStreamerPlayer::event (QEvent * e) {
return true;
}
-void KGStreamerPlayer::saveState (QSessionManager & sm) {
+void KGStreamerPlayer::saveState (TQSessionManager & sm) {
if (callback)
- sm.setRestartHint (QSessionManager::RestartNever);
+ sm.setRestartHint (TQSessionManager::RestartNever);
}
-class XEventThread : public QThread {
+class XEventThread : public TQThread {
protected:
void run () {
Time prev_click_time = 0;
@@ -967,8 +967,8 @@ int main(int argc, char **argv) {
} else if (!strcmp (argv [i], "-loop") && i < argc - 1) {
repeat_count = atol (argv [++i]);
} else if (!strcmp (argv [i], "-cb")) {
- QString str = argv [++i];
- int pos = str.find ('/');
+ TQString str = argv [++i];
+ int pos = str.tqfind ('/');
if (pos > -1) {
fprintf (stderr, "callback is %s %s\n", str.left (pos).ascii (), str.mid (pos + 1).ascii ());
callback = new KMPlayer::Callback_stub
@@ -979,7 +979,7 @@ int main(int argc, char **argv) {
delete gstapp;
return 1;
} else {
- mrl = QString::fromLocal8Bit (argv[i]);
+ mrl = TQString::fromLocal8Bit (argv[i]);
}
}
@@ -993,12 +993,12 @@ int main(int argc, char **argv) {
gstapp->init ();
if (callback) {
- QByteArray buf;
+ TQByteArray buf;
if (wants_config)
getConfigEntries (buf);
callback->started (dcopclient.appId (), buf);
} else
- QTimer::singleShot (10, gstapp, SLOT (play (int)));
+ TQTimer::singleShot (10, gstapp, TQT_SLOT (play (int)));
gstapp->exec ();