diff --git a/avdecoder.cpp b/avdecoder.cpp index 593ddd0..07b7c9c 100644 --- a/avdecoder.cpp +++ b/avdecoder.cpp @@ -1,6 +1,7 @@ #include "avdecoder.h" #include +#include #include AVDecoder::AVDecoder() : @@ -8,9 +9,22 @@ AVDecoder::AVDecoder() : { } +AVDecoder::~AVDecoder() +{ + if(pFormatCtx) { + avformat_close_input(&pFormatCtx); + } +} + +void AVDecoder::init() +{ + av_register_all(); +} + bool AVDecoder::open(const QString filename) { - if(avformat_open_input(&pFormatCtx, filename.toStdString().c_str(), NULL, NULL) != 0) { + + if(avformat_open_input(&pFormatCtx, QFile::encodeName(filename).constData(), NULL, NULL) != 0) { return false; } @@ -45,7 +59,7 @@ void AVDecoder::getAudioMetadata(metadata_t &metadata) metadata.data.music.title = strdup(""); } - av_dict_free(&file_metadata); + metadata.data.music.tracks->data.track_audio.bitrate = pFormatCtx->bit_rate; } void AVDecoder::getVideoMetadata(metadata_t &metadata) @@ -68,10 +82,33 @@ void AVDecoder::getVideoMetadata(metadata_t &metadata) if((entry = av_dict_get(file_metadata, "title", NULL, 0)) != NULL) { metadata.data.video.title = strdup(entry->value); } else { - metadata.data.video.title = strdup(""); + metadata.data.video.title = metadata.name; } - av_dict_free(&file_metadata); + metadata.data.video.tracks->data.track_video.duration = pFormatCtx->duration / 1000; + metadata.data.video.tracks->data.track_video.bitrate = pFormatCtx->bit_rate; + + int stream_index; + AVCodec *codec = NULL; + + if((stream_index = av_find_best_stream(pFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, &codec, 0)) >= 0) { + AVCodecContext *pCodecCtx = pFormatCtx->streams[stream_index]->codec; + metadata.data.video.tracks->data.track_video.width = pCodecCtx->width; + metadata.data.video.tracks->data.track_video.height = pCodecCtx->height; + } +} + +void AVDecoder::getPictureMetadata(metadata_t &metadata) +{ + int stream_index; + AVCodec *codec = NULL; + + if((stream_index = av_find_best_stream(pFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, &codec, 0)) >= 0) { + AVCodecContext *pCodecCtx = pFormatCtx->streams[stream_index]->codec; + metadata.data.photo.tracks->data.track_photo.width = pCodecCtx->width; + metadata.data.photo.tracks->data.track_photo.height = pCodecCtx->height; + } + metadata.data.photo.title = strdup(metadata.name); } QByteArray AVDecoder::getAudioThumbnail(int width, int height) @@ -93,20 +130,6 @@ QByteArray AVDecoder::getAudioThumbnail(int width, int height) return data; } -void AVDecoder::AVFrameToQImage(AVFrame &frame, QImage &image, int width, int height) -{ - quint8 *src = frame.data[0]; - - for (int y = 0; y < height; y++) { - QRgb *scanLine = (QRgb *)image.scanLine(y); - - for (int x = 0; x < width; x++) { - scanLine[x] = qRgb(src[3*x], src[3*x+1], src[3*x+2]); - } - src += frame.linesize[0]; - } -} - AVFrame *AVDecoder::getDecodedFrame(AVCodecContext *pCodecCtx, int stream_index) { AVFrame *pFrame = avcodec_alloc_frame(); @@ -134,6 +157,7 @@ QByteArray AVDecoder::getVideoThumbnail(int width, int height) QByteArray data; int stream_index; AVFrame *pFrame; + AVDictionary *opts = NULL; AVCodec *codec = NULL; AVCodecContext *pCodecCtx = NULL; @@ -145,12 +169,15 @@ QByteArray AVDecoder::getVideoThumbnail(int width, int height) pCodecCtx = pFormatCtx->streams[stream_index]->codec; - if(avcodec_open2(pCodecCtx, codec, NULL) < 0) { + if(avcodec_open2(pCodecCtx, codec, &opts) < 0) { avcodec_close(pCodecCtx); return data; } - if(av_seek_frame(pFormatCtx, stream_index, pFormatCtx->duration * percentage / 100, 0) < 0) { + qint64 seek_pos = pFormatCtx->duration * percentage / (AV_TIME_BASE * 100); + qint64 frame = av_rescale(seek_pos,pFormatCtx->streams[stream_index]->time_base.den, pFormatCtx->streams[stream_index]->time_base.num); + + if(avformat_seek_file(pFormatCtx, stream_index, 0, frame, frame, AVSEEK_FLAG_FRAME) < 0) { avcodec_close(pCodecCtx); return data; } @@ -163,7 +190,7 @@ QByteArray AVDecoder::getVideoThumbnail(int width, int height) AVFrame *pFrameRGB = avcodec_alloc_frame(); int numBytes = avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width, pCodecCtx->height); - uint8_t *buffer = (uint8_t *)av_malloc(numBytes * sizeof(uint8_t)); + uint8_t *buffer = (uint8_t *)av_malloc(numBytes); avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24, pCodecCtx->width, pCodecCtx->height); @@ -174,17 +201,20 @@ QByteArray AVDecoder::getVideoThumbnail(int width, int height) pCodecCtx->width, pCodecCtx->height, PIX_FMT_RGB24, - SWS_BILINEAR, + SWS_BICUBIC, NULL, NULL, NULL ); - QImage img(pCodecCtx->width, pCodecCtx->height, QImage::Format_RGB32); + if(!sws_ctx) { + avcodec_close(pCodecCtx); + return data; + } sws_scale( sws_ctx, - (uint8_t const * const *)pFrame->data, + pFrame->data, pFrame->linesize, 0, pCodecCtx->height, @@ -192,11 +222,15 @@ QByteArray AVDecoder::getVideoThumbnail(int width, int height) pFrameRGB->linesize ); - AVFrameToQImage(*pFrame, img, pCodecCtx->width, pCodecCtx->height); + QImage image(pCodecCtx->width, pCodecCtx->height, QImage::Format_RGB888); + + for(int y = 0, height = pCodecCtx->height, width = pCodecCtx->width; y < height; y++){ + memcpy(image.scanLine(y), pFrameRGB->data[0] + y * pFrameRGB->linesize[0], width * 3); + } QBuffer imgbuffer(&data); imgbuffer.open(QIODevice::WriteOnly); - QImage result = img.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation); + QImage result = image.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation); result.save(&imgbuffer, "JPEG"); av_free(buffer); @@ -211,4 +245,5 @@ QByteArray AVDecoder::getVideoThumbnail(int width, int height) void AVDecoder::close() { avformat_close_input(&pFormatCtx); + pFormatCtx = NULL; } diff --git a/avdecoder.h b/avdecoder.h index afd82de..4e3ca70 100644 --- a/avdecoder.h +++ b/avdecoder.h @@ -15,13 +15,17 @@ class AVDecoder { public: AVDecoder(); + ~AVDecoder(); bool open(const QString filename); QByteArray getAudioThumbnail(int width, int height); QByteArray getVideoThumbnail(int width, int height); + void getPictureMetadata(metadata_t &metadata); void getAudioMetadata(metadata_t &metadata); void getVideoMetadata(metadata_t &metadata); void close(); + static void init(); + private: void AVFrameToQImage(AVFrame &frame, QImage &image, int width, int height); AVFrame *getDecodedFrame(AVCodecContext *pCodecCtx, int stream_index); diff --git a/cmabroadcast.cpp b/cmabroadcast.cpp index 91456c1..a125489 100644 --- a/cmabroadcast.cpp +++ b/cmabroadcast.cpp @@ -48,7 +48,7 @@ CmaBroadcast::CmaBroadcast(QObject *parent) : // generate a GUID if doesn't exist yet in settings uuid = settings.value("guid").toString(); if(uuid.isEmpty()) { - uuid = QUuid::createUuid().toString(); + uuid = QUuid::createUuid().toString().mid(1,36); settings.setValue("guid", uuid); } @@ -73,7 +73,7 @@ void CmaBroadcast::readPendingDatagrams() if(datagram.contains(broadcast_query)) { QMutexLocker locker(&mutex); - socket->writeDatagram(reply.toUtf8(), sender, senderPort); + socket->writeDatagram(reply, sender, senderPort); } else { qWarning("Unknown request: %.*s\n", datagram.length(), datagram.constData()); } @@ -83,19 +83,23 @@ void CmaBroadcast::readPendingDatagrams() void CmaBroadcast::setAvailable() { QMutexLocker locker(&mutex); - reply = broadcast_reply + reply.clear(); + reply.insert(0, broadcast_reply .arg(broadcast_ok, uuid, "win", hostname) .arg(VITAMTP_PROTOCOL_MAX_VERSION, 8, 10, QChar('0')) .arg(QCMA_REQUEST_PORT) - .arg(VITAMTP_WIRELESS_MAX_VERSION, 8, 10, QChar('0')); + .arg(VITAMTP_WIRELESS_MAX_VERSION, 8, 10, QChar('0'))); + reply.append('\0'); } void CmaBroadcast::setUnavailable() { QMutexLocker locker(&mutex); - reply = broadcast_reply + reply.clear(); + reply.insert(0, broadcast_reply .arg(broadcast_unavailable, uuid, "win", hostname) .arg(VITAMTP_PROTOCOL_MAX_VERSION, 8, 10, QChar('0')) .arg(QCMA_REQUEST_PORT) - .arg(VITAMTP_WIRELESS_MAX_VERSION, 8, 10, QChar('0')); + .arg(VITAMTP_WIRELESS_MAX_VERSION, 8, 10, QChar('0'))); + reply.append('\0'); } diff --git a/cmabroadcast.h b/cmabroadcast.h index a30c98f..e997650 100644 --- a/cmabroadcast.h +++ b/cmabroadcast.h @@ -37,7 +37,7 @@ private: QMutex mutex; QString uuid; - QString reply; + QByteArray reply; QString hostname; QUdpSocket *socket; static const QString broadcast_reply; diff --git a/cmaclient.cpp b/cmaclient.cpp index 2ca60cc..1720dfe 100644 --- a/cmaclient.cpp +++ b/cmaclient.cpp @@ -19,8 +19,8 @@ #include "cmaclient.h" #include "capability.h" +#include "avdecoder.h" #include "utils.h" -#include "wirelessworker.h" #include "QApplication" #include @@ -34,17 +34,37 @@ #include metadata_t CmaClient::g_thumbmeta = {0, 0, 0, NULL, NULL, 0, 0, 0, Thumbnail, {{18, 144, 80, 0, 1, 1.0f, 2}}, NULL}; +CmaClient *CmaClient::this_object = NULL; CmaClient::CmaClient(QObject *parent) : BaseWorker(parent) { + this_object = this; + AVDecoder::init(); +} + +int CmaClient::deviceRegistered(const char *deviceid) +{ + qDebug("Got connection request from %s", deviceid); + return 1; +} + +int CmaClient::generatePin(wireless_vita_info_t *info, int *p_err) +{ + qDebug("Registration request from %s (MAC: %s)", info->name, info->mac_addr); + int pin = qrand() % 100000000; + qDebug("Your registration PIN for %s is: %08d", info->name, pin); + *p_err = 0; + emit this_object->receivedPin(pin); + return pin; } vita_device_t *CmaClient::getDeviceConnection() { int num_tries = 0; vita_device_t *vita; - typedef BroadcastSignal BS; + wireless_host_info_t host; + host.port = QCMA_REQUEST_PORT; while(active) { vita = VitaMTP_Get_First_USB_Vita(); @@ -52,7 +72,7 @@ vita_device_t *CmaClient::getDeviceConnection() break; } qDebug("No Vita detected via USB, attempt %i", ++num_tries); - vita = VitaMTP_Get_First_Wireless_Vita(&BS::info, 0, 2, BS::deviceRegistered, BS::generatePin); + vita = VitaMTP_Get_First_Wireless_Vita(&host, 0, 0, CmaClient::deviceRegistered, CmaClient::generatePin); if(vita || !active) { break; } diff --git a/cmaclient.h b/cmaclient.h index 5b6a5c2..4147cc4 100644 --- a/cmaclient.h +++ b/cmaclient.h @@ -69,12 +69,16 @@ private: void vitaEventSendNPAccountInfo(vita_event_t *event, int eventId); void vitaEventRequestTerminate(vita_event_t *event, int eventId); - QWaitCondition waitCondition; + static int deviceRegistered(const char *deviceid); + static int generatePin(wireless_vita_info_t *info, int *p_err); + + QWaitCondition waitCondition; CmaBroadcast broadcast; vita_device_t *device; volatile bool active; volatile bool connected; static metadata_t g_thumbmeta; + static CmaClient *this_object; signals: void receivedPin(int); diff --git a/cmaobject.cpp b/cmaobject.cpp index 6d35124..159846c 100644 --- a/cmaobject.cpp +++ b/cmaobject.cpp @@ -19,15 +19,13 @@ #include "cmaobject.h" #include "sforeader.h" +#include "avdecoder.h" #include "utils.h" #include #include #include -#include -#include - int CMAObject::ohfi_count = OHFI_OFFSET; CMAObject::CMAObject(CMAObject *obj_parent) : @@ -84,21 +82,9 @@ void CMAObject::loadSfoMetadata(const QString &path) void CMAObject::loadMusicMetadata(const QString &path) { - MediaInfoLib::MediaInfo media; - if(media.Open(path.toStdWString())) { - QString data; - data = QString::fromStdWString(media.Get(MediaInfoLib::Stream_General, 0, MediaInfoLib::General_Album)); - metadata.data.music.album = strdup(!data.isEmpty() ? data.toUtf8().data() : (parent->metadata.name ? parent->metadata.name : "")); - data = QString::fromStdWString(media.Get(MediaInfoLib::Stream_General, 0, MediaInfoLib::General_Performer)); - metadata.data.music.artist = strdup(data.toUtf8().data()); - data = QString::fromStdWString(media.Get(MediaInfoLib::Stream_General, 0, MediaInfoLib::General_Title)); - metadata.data.music.title = strdup(!data.isEmpty() ? data.toUtf8().data() : metadata.name); - data = QString::fromStdWString(media.Get(MediaInfoLib::Stream_Audio, 0, MediaInfoLib::Audio_BitRate)); - bool ok; - int bitrate = data.toInt(&ok); - if(ok) { - metadata.data.music.tracks->data.track_audio.bitrate = bitrate; - } + AVDecoder decoder; + if(decoder.open(path)) { + decoder.getAudioMetadata(metadata); } else { metadata.data.music.album = strdup(parent->metadata.name ? parent->metadata.name : ""); metadata.data.music.artist = strdup(""); @@ -108,36 +94,9 @@ void CMAObject::loadMusicMetadata(const QString &path) void CMAObject::loadVideoMetadata(const QString &path) { - MediaInfoLib::MediaInfo media; - if(media.Open(path.toStdWString())) { - bool ok; - QString data; - data = QString::fromStdWString(media.Get(MediaInfoLib::Stream_General, 0, MediaInfoLib::General_Title)); - metadata.data.video.title = strdup(!data.isEmpty() ? data.toUtf8().data() : metadata.name); - data = QString::fromStdWString(media.Get(MediaInfoLib::Stream_General, 0, MediaInfoLib::General_Comment)); - metadata.data.video.explanation = strdup(data.toUtf8().data()); - data = QString::fromStdWString(media.Get(MediaInfoLib::Stream_General, 0, MediaInfoLib::General_Copyright)); - metadata.data.video.copyright = strdup(data.toUtf8().data()); - data = QString::fromStdWString(media.Get(MediaInfoLib::Stream_Video, 0, MediaInfoLib::Video_BitRate)); - int bitrate = data.toInt(&ok); - if(ok) { - metadata.data.video.tracks->data.track_video.bitrate = bitrate; - } - data = QString::fromStdWString(media.Get(MediaInfoLib::Stream_Video, 0, MediaInfoLib::Video_Duration)); - int duration = data.toInt(&ok); - if(ok) { - metadata.data.video.tracks->data.track_video.duration = duration; - } - data = QString::fromStdWString(media.Get(MediaInfoLib::Stream_Video, 0, MediaInfoLib::Video_Width)); - int width = data.toInt(&ok); - if(ok) { - metadata.data.video.tracks->data.track_video.width = width; - } - data = QString::fromStdWString(media.Get(MediaInfoLib::Stream_Video, 0, MediaInfoLib::Video_Height)); - int height = data.toInt(&ok); - if(ok) { - metadata.data.video.tracks->data.track_video.height = height; - } + AVDecoder decoder; + if(decoder.open(path)) { + decoder.getVideoMetadata(metadata); } else { metadata.data.video.title = strdup(metadata.name); metadata.data.video.explanation = strdup(""); @@ -147,21 +106,9 @@ void CMAObject::loadVideoMetadata(const QString &path) void CMAObject::loadPhotoMetadata(const QString &path) { - MediaInfoLib::MediaInfo media; - if(media.Open(path.toStdWString())) { - bool ok; - QString data; - data = QString::fromStdWString(media.Get(MediaInfoLib::Stream_General, 0, MediaInfoLib::General_Title)); - metadata.data.photo.title = strdup(!data.isEmpty() ? data.toUtf8().data() : metadata.name); - data = QString::fromStdWString(media.Get(MediaInfoLib::Stream_Image, 0, MediaInfoLib::Image_Height)); - int height = data.toInt(&ok); - if(ok) { - metadata.data.photo.tracks->data.track_photo.height = height; - } - int width = data.toInt(&ok); - if(ok) { - metadata.data.photo.tracks->data.track_photo.width = width; - } + AVDecoder decoder; + if(decoder.open(path)) { + decoder.getPictureMetadata(metadata); } else { metadata.data.photo.title = strdup(metadata.name); } diff --git a/qcma.pro b/qcma.pro index dbbe44a..aee4621 100644 --- a/qcma.pro +++ b/qcma.pro @@ -14,7 +14,6 @@ TARGET = qcma TEMPLATE = app SOURCES += main.cpp \ - wirelessworker.cpp \ capability.cpp \ database.cpp \ cmaobject.cpp \ @@ -30,7 +29,6 @@ SOURCES += main.cpp \ avdecoder.cpp HEADERS += \ - wirelessworker.h \ capability.h \ database.h \ cmaobject.h \ @@ -46,7 +44,7 @@ HEADERS += \ avdecoder.h CONFIG += link_pkgconfig -PKGCONFIG += libvitamtp libmediainfo libavformat libavcodec libavutil libswscale +PKGCONFIG += libvitamtp libavformat libavcodec libavutil libswscale QMAKE_CXXFLAGS += -Wno-write-strings -Wall @@ -55,7 +53,8 @@ RESOURCES += \ OTHER_FILES += \ resources/psp2-updatelist.xml \ - resources/psv_icon.png + resources/psv_icon.png \ + README.md FORMS += \ configwidget.ui diff --git a/utils.cpp b/utils.cpp index 418425b..8f14184 100644 --- a/utils.cpp +++ b/utils.cpp @@ -18,6 +18,7 @@ */ #include "utils.h" +#include "avdecoder.h" #include #include @@ -30,9 +31,6 @@ #include #endif -#include -#include - bool getDiskSpace(const QString &dir, quint64 *free, quint64 *total) { #ifdef Q_OS_WIN32 @@ -139,24 +137,21 @@ QByteArray getThumbnail(const QString &path, DataType type, metadata_t *metadata // TODO: try to load an album cover from one of the audio files. data = findFolderAlbumArt(path, metadata); } else { - MediaInfoLib::MediaInfo media; + AVDecoder decoder; - if(media.Open(path.toStdWString())) { - QString base64 = QString::fromStdWString(media.Get(MediaInfoLib::Stream_General, 0, MediaInfoLib::General_Cover_Data)); - QImage img; - - if(base64.size() > 0 && img.loadFromData(QByteArray::fromBase64(base64.toUtf8()))) { - QBuffer buffer(&data); - buffer.open(QIODevice::WriteOnly); - // use smooth transformation for the ambum art since is important to display correctly - QImage result = img.scaled(256, 256, Qt::KeepAspectRatio, Qt::SmoothTransformation); - result.save(&buffer, "JPEG"); - metadata->data.thumbnail.width = result.width(); - metadata->data.thumbnail.height = result.height(); - } + if(decoder.open(path)) { + data = decoder.getAudioThumbnail(256, 256); + metadata->data.thumbnail.width = 256; + metadata->data.thumbnail.height = 256; } } + } else if(MASK_SET(type, Video)) { + AVDecoder decoder; + if(decoder.open(path)) { + data = decoder.getVideoThumbnail(256, 256); + metadata->data.thumbnail.width = 256; + metadata->data.thumbnail.height = 256; + } } - //TODO: implement thumbnails for videos return data; } diff --git a/wirelessworker.cpp b/wirelessworker.cpp deleted file mode 100644 index 759e283..0000000 --- a/wirelessworker.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * QCMA: Cross-platform content manager assistant for the PS Vita - * - * Copyright (C) 2013 Codestation - * - * 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 3 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, see . - */ - -#include "wirelessworker.h" -#include "utils.h" - -#include -#include - -#define QCMA_REQUEST_PORT 9309 - -wireless_host_info_t BroadcastSignal::info = {"00000000-0000-0000-0000-000000000000", "win", NULL, QCMA_REQUEST_PORT}; - -BroadcastSignal *BroadcastSignal::this_object = NULL; - -BroadcastSignal::BroadcastSignal(QObject *parent) : - BaseWorker(parent) -{ - qsrand(QTime::currentTime().msec()); - this_object = this; - started = false; - strcpy(hostname, QHostInfo::localHostName().toStdString().c_str()); - BroadcastSignal::info.name = hostname; -} - -BroadcastSignal::~BroadcastSignal() -{ - VitaMTP_Stop_Broadcast(); -} - -int BroadcastSignal::deviceRegistered(const char *deviceid) -{ - qDebug("Got connection request from %s", deviceid); - return 1; -} - -int BroadcastSignal::generatePin(wireless_vita_info_t *info, int *p_err) -{ - qDebug("Registration request from %s (MAC: %s)", info->name, info->mac_addr); - int pin = qrand() % 100000000; - qDebug("Your registration PIN for %s is: %08d", info->name, pin); - *p_err = 0; - emit this_object->receivedPin(pin); - return pin; -} - -void BroadcastSignal::process() -{ - qDebug() <<"Broadcast thread ID: "<< QThread::currentThreadId(); - qDebug("Starting CMA wireless broadcast..."); - - started = true; - if(VitaMTP_Broadcast_Host(&info, 0) < 0) { - qCritical( "An error occured during broadcast. Exiting."); - } else { - qDebug("Broadcast ended."); - } - qDebug("Broadcast thread end."); - emit finished(); -} - -void BroadcastSignal::stopBroadcast() -{ - qDebug("Stopping broadcast"); - VitaMTP_Stop_Broadcast(); - started = false; -} diff --git a/wirelessworker.h b/wirelessworker.h deleted file mode 100644 index 9d40c4c..0000000 --- a/wirelessworker.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * QCMA: Cross-platform content manager assistant for the PS Vita - * - * Copyright (C) 2013 Codestation - * - * 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 3 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, see . - */ - -#ifndef WIRELESSWORKER_H -#define WIRELESSWORKER_H - -#include "baseworker.h" - -#include -#include - -extern "C" { -#include -} - -class BroadcastSignal : public BaseWorker -{ - Q_OBJECT -public: - explicit BroadcastSignal(QObject *parent = 0); - ~BroadcastSignal(); - - static int deviceRegistered(const char *deviceid); - static int generatePin(wireless_vita_info_t *info, int *p_err); - bool isRunning() { return started; } - - static wireless_host_info_t info; - - -private: - volatile bool started; - char hostname[256]; - //used to emit a signal from a static method - static BroadcastSignal *this_object; - -signals: - void receivedPin(int); - -public slots: - void stopBroadcast(); - -protected slots: - void process(); -}; - -#endif // WIRELESSWORKER_H