void MediaView::goForward() { if (canGoForward()) { int currentIndex = getHistoryIndex(); VideoSource *nextVideoSource = history.at(currentIndex + 1); setVideoSource(nextVideoSource, false); } }
MdiMjpegWidget::MdiMjpegWidget(QWidget *parent) : MdiVideoChild(parent) { m_thread = new MjpegThread(); setVideoSource(m_thread); QHBoxLayout *layout = new QHBoxLayout(); m_urlInput = new QLineEdit(); connect(m_urlInput, SIGNAL(returnPressed()), this, SLOT(urlReturnPressed())); layout->addWidget(new QLabel("URL:")); layout->addWidget(m_urlInput); m_layout->addLayout(layout); setWindowTitle("MJPEG"); videoWidget()->setFps(7); QSettings settings; QString lastUrl = settings.value("mdimjpegwidget/last-url","").toString(); if(!lastUrl.isEmpty()) { m_urlInput->setText(lastUrl); urlReturnPressed(); } }
void ControlWindow::setupUi() { setWindowTitle("StageDisplay Control"); connect(ui->sourceBox, SIGNAL(textChanged(QString)), this, SLOT(setVideoSource(QString))); connect(ui->connectBtn, SIGNAL(clicked()), this, SLOT(connectSource())); connect(ui->outX, SIGNAL(valueChanged(int)), this, SLOT(setOutputX(int))); connect(ui->outY, SIGNAL(valueChanged(int)), this, SLOT(setOutputY(int))); connect(ui->outW, SIGNAL(valueChanged(int)), this, SLOT(setOutputW(int))); connect(ui->outH, SIGNAL(valueChanged(int)), this, SLOT(setOutputH(int))); connect(ui->timerEnabled, SIGNAL(toggled(bool)), this, SLOT(setTimerEnabled(bool))); connect(ui->currentTime, SIGNAL(valueChanged(int)), this, SLOT(setCurrentTime(int))); connect(ui->timerBtn, SIGNAL(clicked()), this, SLOT(timerBtn())); connect(ui->resetBtn, SIGNAL(clicked()), this, SLOT(resetTimerBtn())); connect(ui->timerFontSize, SIGNAL(valueChanged(int)), this, SLOT(timerFontSizeChanged(int))); connect(ui->timerDrawBg, SIGNAL(toggled(bool)), this, SLOT(timerDrawBgChanged(bool))); connect(ui->timerPosition, SIGNAL(currentIndexChanged(int)), this, SLOT(timerPositionChanged(int))); connect(ui->message, SIGNAL(textChanged(QString)), this, SLOT(messageChanged(QString))); connect(ui->showMsgBtn, SIGNAL(clicked()), this, SLOT(showMsgBtn())); connect(ui->hideMsgBtn, SIGNAL(clicked()), this, SLOT(hideMsgBtn())); connect(ui->flashMsgBtn, SIGNAL(toggled(bool)), this, SLOT(flashMsgBtnToggled(bool))); connect(ui->flashSpeed, SIGNAL(valueChanged(int)), this, SLOT(flashSpeedChanged(int))); connect(ui->msgFontSize, SIGNAL(valueChanged(int)), this, SLOT(msgFontSizeChanged(int))); connect(ui->msgDrawBg, SIGNAL(toggled(bool)), this, SLOT(msgDrawBgChanged(bool))); connect(ui->msgPosition, SIGNAL(currentIndexChanged(int)), this, SLOT(msgPositionChanged(int))); }
void MediaView::relatedVideos() { Video *video = playlistModel->activeVideo(); if (!video) return; YTSingleVideoSource *singleVideoSource = new YTSingleVideoSource(); singleVideoSource->setVideo(video->clone()); singleVideoSource->setAsyncDetails(true); setVideoSource(singleVideoSource); MainWindow::instance()->getAction("relatedVideos")->setEnabled(false); }
void MediaView::goBack() { if (history.size() > 1) { int currentIndex = getHistoryIndex(); if (currentIndex > 0) { VideoSource *previousVideoSource = history.at(currentIndex - 1); setVideoSource(previousVideoSource, false, true); } } }
LiveVideoFileLayer::~LiveVideoFileLayer() { setVideoSource(0); // doesnt change m_video if(m_video) { delete m_video; m_video = 0; } }
GLVideoInputDrawable::~GLVideoInputDrawable() { setVideoSource(0); if(m_rx) { m_rx->release(this); //delete m_rx; } }
void MediaView::search(SearchParams *searchParams) { if (!searchParams->keywords().isEmpty()) { if (searchParams->keywords().startsWith("http://") || searchParams->keywords().startsWith("https://")) { QString videoId = YTSearch::videoIdFromUrl(searchParams->keywords()); if (!videoId.isEmpty()) { YTSingleVideoSource *singleVideoSource = new YTSingleVideoSource(this); singleVideoSource->setVideoId(videoId); setVideoSource(singleVideoSource); return; } } } YTSearch *ytSearch = new YTSearch(searchParams, this); ytSearch->setAsyncDetails(true); connect(ytSearch, SIGNAL(gotDetails()), playlistModel, SLOT(emitDataChanged())); setVideoSource(ytSearch); }
TrackedStream::TrackedStream(const QString& uid, const QString& name, const ToolPtr &probe, const VideoSourcePtr &videosource) : Data(uid, name), mProbeTool(probe), mVideoSource(VideoSourcePtr()), mImage(ImagePtr()), mSpaceProvider(SpaceProviderPtr()) { if(mProbeTool) emit newTool(mProbeTool); setVideoSource(videosource); }
GLVideoMjpegDrawable::GLVideoMjpegDrawable(QString file, QObject *parent) : GLVideoDrawable(parent) { m_thread = new MjpegThread(); setVideoSource(m_thread); if(!file.isEmpty()) setUrl(file); }
V4LOutput::~V4LOutput() { setVideoSource(0); if(!m_killed) { m_killed = true; quit(); wait(); } }
void LiveVideoFileLayer::setVideo(QtVideoSource *vid) { //qDebug() << "LiveVideoFileLayer::setVideo: "<<vid; // if(vid == m_video) // { // qDebug() << "LiveVideoFileLayer::setVideo: Not setting, vid == m_video"; // return; // } #ifdef HAS_QT_VIDEO_SOURCE setVideoSource(vid); m_video = vid; //setInstanceName(guessTitle(QFileInfo(vid->file()).baseName())); #endif }
BMDOutput::~BMDOutput() { setVideoSource(0); if(!m_killed) { m_killed = true; quit(); wait(); } #ifdef ENABLE_DECKLINK_CAPTURE if(m_bmd) { m_bmd->StopRunning(); delete m_bmd; m_bmd = 0; } #endif }
void VideoWidget::fadeStop() { //qDebug() << "VideoWidget::fadeStop(): m_oldThread:"<<m_oldThread; if(m_fadeToBlack) m_opacity = 0.0; else m_opacity = 1.0; // qDebug() << "VideoWidget::fadeStop(): m_opacity:"<<m_opacity; m_fadeTimer.stop(); discardOldThread(); if(m_queuedSource) { // this will start a cross fade to this source now setVideoSource(m_queuedSource); m_queuedSource = 0; } }
VideoSender::~VideoSender() { setVideoSource(0); m_dataPtr.clear(); // allow the pointer being held to be deleted // Valgrind reported that the pointer in m_dataPtr didnt get deleted at close of program: // ==22564== 326,400 bytes in 3 blocks are possibly lost in loss record 5,903 of 5,912 // ==22564== at 0x4005903: malloc (vg_replace_malloc.c:195) // ==22564== by 0x80A8BB5: VideoSender::processFrame() (VideoSender.cpp:151) // ==22564== by 0x8266001: VideoSender::qt_metacall(QMetaObject::Call, int, void**) (moc_VideoSender.cpp:95) // ==22564== by 0x604CADA: QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) (qmetaobject.cpp:237) // ==22564== by 0x605A5A6: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (qobject.cpp:3285) // ==22564== by 0x60B1176: QTimer::timeout() (moc_qtimer.cpp:134) // ==22564== by 0x606353D: QTimer::timerEvent(QTimerEvent*) (qtimer.cpp:271) // ==22564== by 0x60580AE: QObject::event(QEvent*) (qobject.cpp:1204) // ==22564== by 0x553ABCE: QApplicationPrivate::notify_helper(QObject*, QEvent*) (qapplication.cpp:4300) // ==22564== by 0x553E98D: QApplication::notify(QObject*, QEvent*) (qapplication.cpp:3704) // ==22564== by 0x604650A: QCoreApplication::notifyInternal(QObject*, QEvent*) (qcoreapplication.cpp:704) // ==22564== by 0x60762C2: QTimerInfoList::activateTimers() (qcoreapplication.h:215) }
void MediaView::searchAgain() { VideoSource *currentVideoSource = playlistModel->getVideoSource(); setVideoSource(currentVideoSource, false); }
status_t BnMediaRecorder::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case RELEASE: { ALOGV("RELEASE"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(release()); return NO_ERROR; } break; case INIT: { ALOGV("INIT"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(init()); return NO_ERROR; } break; case CLOSE: { ALOGV("CLOSE"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(close()); return NO_ERROR; } break; case RESET: { ALOGV("RESET"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(reset()); return NO_ERROR; } break; case STOP: { ALOGV("STOP"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(stop()); return NO_ERROR; } break; case START: { ALOGV("START"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(start()); return NO_ERROR; } break; case PREPARE: { ALOGV("PREPARE"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(prepare()); return NO_ERROR; } break; case GET_MAX_AMPLITUDE: { ALOGV("GET_MAX_AMPLITUDE"); CHECK_INTERFACE(IMediaRecorder, data, reply); int max = 0; status_t ret = getMaxAmplitude(&max); reply->writeInt32(max); reply->writeInt32(ret); return NO_ERROR; } break; case SET_VIDEO_SOURCE: { ALOGV("SET_VIDEO_SOURCE"); CHECK_INTERFACE(IMediaRecorder, data, reply); int vs = data.readInt32(); reply->writeInt32(setVideoSource(vs)); return NO_ERROR; } break; case SET_AUDIO_SOURCE: { ALOGV("SET_AUDIO_SOURCE"); CHECK_INTERFACE(IMediaRecorder, data, reply); int as = data.readInt32(); reply->writeInt32(setAudioSource(as)); return NO_ERROR; } break; case SET_OUTPUT_FORMAT: { ALOGV("SET_OUTPUT_FORMAT"); CHECK_INTERFACE(IMediaRecorder, data, reply); int of = data.readInt32(); reply->writeInt32(setOutputFormat(of)); return NO_ERROR; } break; case SET_VIDEO_ENCODER: { ALOGV("SET_VIDEO_ENCODER"); CHECK_INTERFACE(IMediaRecorder, data, reply); int ve = data.readInt32(); reply->writeInt32(setVideoEncoder(ve)); return NO_ERROR; } break; case SET_AUDIO_ENCODER: { ALOGV("SET_AUDIO_ENCODER"); CHECK_INTERFACE(IMediaRecorder, data, reply); int ae = data.readInt32(); reply->writeInt32(setAudioEncoder(ae)); return NO_ERROR; } break; case SET_OUTPUT_FILE_FD: { ALOGV("SET_OUTPUT_FILE_FD"); CHECK_INTERFACE(IMediaRecorder, data, reply); int fd = dup(data.readFileDescriptor()); int64_t offset = data.readInt64(); int64_t length = data.readInt64(); reply->writeInt32(setOutputFile(fd, offset, length)); ::close(fd); return NO_ERROR; } break; case SET_VIDEO_SIZE: { ALOGV("SET_VIDEO_SIZE"); CHECK_INTERFACE(IMediaRecorder, data, reply); int width = data.readInt32(); int height = data.readInt32(); reply->writeInt32(setVideoSize(width, height)); return NO_ERROR; } break; case SET_VIDEO_FRAMERATE: { ALOGV("SET_VIDEO_FRAMERATE"); CHECK_INTERFACE(IMediaRecorder, data, reply); int frames_per_second = data.readInt32(); reply->writeInt32(setVideoFrameRate(frames_per_second)); return NO_ERROR; } break; case SET_PARAMETERS: { ALOGV("SET_PARAMETER"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(setParameters(data.readString8())); return NO_ERROR; } break; case SET_LISTENER: { ALOGV("SET_LISTENER"); CHECK_INTERFACE(IMediaRecorder, data, reply); sp<IMediaRecorderClient> listener = interface_cast<IMediaRecorderClient>(data.readStrongBinder()); reply->writeInt32(setListener(listener)); return NO_ERROR; } break; case SET_CLIENT_NAME: { ALOGV("SET_CLIENT_NAME"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(setClientName(data.readString16())); return NO_ERROR; } case SET_PREVIEW_SURFACE: { ALOGV("SET_PREVIEW_SURFACE"); CHECK_INTERFACE(IMediaRecorder, data, reply); sp<IGraphicBufferProducer> surface = interface_cast<IGraphicBufferProducer>( data.readStrongBinder()); reply->writeInt32(setPreviewSurface(surface)); return NO_ERROR; } break; case SET_CAMERA: { ALOGV("SET_CAMERA"); CHECK_INTERFACE(IMediaRecorder, data, reply); sp<ICamera> camera = interface_cast<ICamera>(data.readStrongBinder()); sp<ICameraRecordingProxy> proxy = interface_cast<ICameraRecordingProxy>(data.readStrongBinder()); reply->writeInt32(setCamera(camera, proxy)); return NO_ERROR; } break; case SET_INPUT_SURFACE: { ALOGV("SET_INPUT_SURFACE"); CHECK_INTERFACE(IMediaRecorder, data, reply); sp<IGraphicBufferConsumer> surface = interface_cast<IGraphicBufferConsumer>( data.readStrongBinder()); reply->writeInt32(setInputSurface(surface)); return NO_ERROR; } break; case QUERY_SURFACE_MEDIASOURCE: { ALOGV("QUERY_SURFACE_MEDIASOURCE"); CHECK_INTERFACE(IMediaRecorder, data, reply); // call the mediaserver side to create // a surfacemediasource sp<IGraphicBufferProducer> surfaceMediaSource = querySurfaceMediaSource(); // The mediaserver might have failed to create a source int returnedNull= (surfaceMediaSource == NULL) ? 1 : 0 ; reply->writeInt32(returnedNull); if (!returnedNull) { reply->writeStrongBinder(IInterface::asBinder(surfaceMediaSource)); } return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } }
VideoFilter::~VideoFilter() { setVideoSource(0); }
status_t BnMediaRecorder::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { case RELEASE: { LOGV("RELEASE"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(release()); return NO_ERROR; } break; case INIT: { LOGV("INIT"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(init()); return NO_ERROR; } break; case CLOSE: { LOGV("CLOSE"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(close()); return NO_ERROR; } break; case RESET: { LOGV("RESET"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(reset()); return NO_ERROR; } break; case STOP: { LOGV("STOP"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(stop()); return NO_ERROR; } break; case START: { LOGV("START"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(start()); return NO_ERROR; } break; case PREPARE: { LOGV("PREPARE"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(prepare()); return NO_ERROR; } break; case GET_MAX_AMPLITUDE: { LOGV("GET_MAX_AMPLITUDE"); CHECK_INTERFACE(IMediaRecorder, data, reply); int max = 0; status_t ret = getMaxAmplitude(&max); reply->writeInt32(max); reply->writeInt32(ret); return NO_ERROR; } break; case SET_VIDEO_SOURCE: { LOGV("SET_VIDEO_SOURCE"); CHECK_INTERFACE(IMediaRecorder, data, reply); int vs = data.readInt32(); reply->writeInt32(setVideoSource(vs)); return NO_ERROR; } break; case SET_AUDIO_SOURCE: { LOGV("SET_AUDIO_SOURCE"); CHECK_INTERFACE(IMediaRecorder, data, reply); int as = data.readInt32(); reply->writeInt32(setAudioSource(as)); return NO_ERROR; } break; case SET_OUTPUT_FORMAT: { LOGV("SET_OUTPUT_FORMAT"); CHECK_INTERFACE(IMediaRecorder, data, reply); int of = data.readInt32(); reply->writeInt32(setOutputFormat(of)); return NO_ERROR; } break; case SET_VIDEO_ENCODER: { LOGV("SET_VIDEO_ENCODER"); CHECK_INTERFACE(IMediaRecorder, data, reply); int ve = data.readInt32(); reply->writeInt32(setVideoEncoder(ve)); return NO_ERROR; } break; case SET_AUDIO_ENCODER: { LOGV("SET_AUDIO_ENCODER"); CHECK_INTERFACE(IMediaRecorder, data, reply); int ae = data.readInt32(); reply->writeInt32(setAudioEncoder(ae)); return NO_ERROR; } break; case SET_OUTPUT_FILE_PATH: { LOGV("SET_OUTPUT_FILE_PATH"); CHECK_INTERFACE(IMediaRecorder, data, reply); const char* path = data.readCString(); reply->writeInt32(setOutputFile(path)); return NO_ERROR; } break; case SET_OUTPUT_FILE_FD: { LOGV("SET_OUTPUT_FILE_FD"); CHECK_INTERFACE(IMediaRecorder, data, reply); int fd = dup(data.readFileDescriptor()); int64_t offset = data.readInt64(); int64_t length = data.readInt64(); reply->writeInt32(setOutputFile(fd, offset, length)); return NO_ERROR; } break; case SET_VIDEO_SIZE: { LOGV("SET_VIDEO_SIZE"); CHECK_INTERFACE(IMediaRecorder, data, reply); int width = data.readInt32(); int height = data.readInt32(); reply->writeInt32(setVideoSize(width, height)); return NO_ERROR; } break; case SET_VIDEO_FRAMERATE: { LOGV("SET_VIDEO_FRAMERATE"); CHECK_INTERFACE(IMediaRecorder, data, reply); int frames_per_second = data.readInt32(); reply->writeInt32(setVideoFrameRate(frames_per_second)); return NO_ERROR; } break; case SET_PARAMETERS: { LOGV("SET_PARAMETER"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(setParameters(data.readString8())); return NO_ERROR; } break; case SET_LISTENER: { LOGV("SET_LISTENER"); CHECK_INTERFACE(IMediaRecorder, data, reply); sp<IMediaPlayerClient> listener = interface_cast<IMediaPlayerClient>(data.readStrongBinder()); reply->writeInt32(setListener(listener)); return NO_ERROR; } break; case SET_PREVIEW_SURFACE: { LOGV("SET_PREVIEW_SURFACE"); CHECK_INTERFACE(IMediaRecorder, data, reply); sp<ISurface> surface = interface_cast<ISurface>(data.readStrongBinder()); reply->writeInt32(setPreviewSurface(surface)); return NO_ERROR; } break; case SET_CAMERA: { LOGV("SET_CAMERA"); CHECK_INTERFACE(IMediaRecorder, data, reply); sp<ICamera> camera = interface_cast<ICamera>(data.readStrongBinder()); reply->writeInt32(setCamera(camera)); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } }