Ejemplo n.º 1
0
void
AlbumItem::setShowArtist( const bool showArtist )
{
    if( showArtist != m_showArtist )
    {
        m_showArtist = showArtist;
        metadataChanged( m_album );
    }
}
Ejemplo n.º 2
0
void MprisPlayer::setMetadata(const QVariantMap &metadata)
{
    if (m_metadata == metadata) {
        return;
    }

    m_metadata = metadata;
    m_typedMetadata = typeMetadata(metadata);
    emit metadataChanged();
}
Ejemplo n.º 3
0
void
TrackItem::setTrack( Meta::TrackPtr trackPtr )
{
    if( m_track )
        unsubscribeFrom( m_track );
    m_track = trackPtr;
    subscribeTo( m_track );

    metadataChanged( m_track );
}
Ejemplo n.º 4
0
void ImportMusicDialog::showEditMetadataDialog()
{
    if (m_tracks->size() == 0)
        return;

    Metadata *editMeta = m_tracks->at(m_currentTrack)->metadata;

    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();

    EditMetadataDialog *editDialog = new EditMetadataDialog(mainStack, editMeta);
    editDialog->setSaveMetadataOnly();

    if (!editDialog->Create())
    {
        delete editDialog;
        return;
    }

    connect(editDialog, SIGNAL(metadataChanged()), this, SLOT(metadataChanged()));

    mainStack->AddScreen(editDialog);
}
Ejemplo n.º 5
0
/*------------------------------------------------------------------------------
|    OMX_VideoProcessor::cleanup
+-----------------------------------------------------------------------------*/
void OMX_MediaProcessor::cleanup()
{
   LOG_INFORMATION(LOG_TAG, "Cleaning up...");

#if 0
   if (m_refresh)
   {
      m_BcmHost.vc_tv_hdmi_power_on_best(
               tv_state.width,
               tv_state.height,
               tv_state.frame_rate,
               HDMI_NONINTERLACED,
               (EDID_MODE_MATCH_FLAG_T)(HDMI_MODE_MATCH_FRAMERATE|
                                        HDMI_MODE_MATCH_RESOLUTION|HDMI_MODE_MATCH_SCANMODE)
               );
   }
#endif

   LOG_VERBOSE(LOG_TAG, "Closing players...");
#ifdef ENABLE_SUBTITLES
   m_player_subtitles->Close();
#endif
   m_player_video->Close();
   m_player_audio->Close();

   if (m_omx_pkt) {
      m_omx_reader->FreePacket(m_omx_pkt);
      m_omx_pkt = NULL;
   }

   LOG_VERBOSE(LOG_TAG, "Closing players...");
   m_omx_reader->Close();
   m_metadata.clear();
   emit metadataChanged(m_metadata);

   vc_tv_show_info(0);

   // lcarlon: free the texture. Invoke freeTexture so that it is the user
   // of the class to do it cause it is commonly required to do it in the
   // current OpenGL and EGL context. Do it here, after the stop command is
   // considered finished: this is needed to avoid hardlock in case the
   // used wants to free the texture in his own thread, which would still
   // be blocked waiting for the stop command to finish.
   LOG_VERBOSE(LOG_TAG, "Freeing texture...");
   m_provider->freeTexture(m_textureData);
   m_textureData = NULL;
   emit textureInvalidated();

   LOG_INFORMATION(LOG_TAG, "Cleanup done.");
}
Ejemplo n.º 6
0
void BrushPresetManager::setPreset(const QString &path)
{
	if (path.isEmpty())
		return;
	
	auto preset = Json::readFromFile(path).toMap();
	
	if (preset.isEmpty())
		return;
	
	_preset = preset;
	emit presetChanged(preset, path);
	emit metadataChanged(metadata());
	emit strokerChanged(stroker());
	emit settingsChanged(settings());
}
Ejemplo n.º 7
0
NowPlaying::NowPlaying(QObject *parent, const QVariantList &args)
    : Plasma::Applet(parent, args),
      m_controller(0),
      m_state(NoPlayer),
      m_currentLayout(NoLayout),
      m_volume(0),
      m_length(0),
      m_textPanel(new InfoPanel)
{
    resize(300, 200); // ideal planar size

    connect(this, SIGNAL(metadataChanged(QMap<QString,QString>)),
            m_textPanel, SLOT(updateMetadata(QMap<QString,QString>)));
    connect(this, SIGNAL(coverChanged(QPixmap)),
            m_textPanel, SLOT(updateArtwork(QPixmap)));
}
Ejemplo n.º 8
0
PlayerStatus *PlayerStatus::setMetadata(
        QString songTitle,
        QString songArtist,
        QString songAlbum,
        QString songArt,
        qlonglong songProgressMax,
        qlonglong songProgressMin
) {
    if (title != songTitle) {
        title = songTitle;
        artist = songArtist;
        album = songAlbum;
        art = songArt;
        progressMax = songProgressMax;
        progressMin = songProgressMin;

        emit metadataChanged();
    }

    return this;
}
Ejemplo n.º 9
0
QT_BEGIN_NAMESPACE

/*------------------------------------------------------------------------------
|    OpenMAXILPlayerControl::OpenMAXILPlayerControl
+-----------------------------------------------------------------------------*/
OpenMAXILPlayerControl::OpenMAXILPlayerControl(QObject *parent)
   : QMediaPlayerControl(parent)
   , m_ownStream(false)
   , m_seekToStartPending(false)
   , m_pendingSeekPosition(-1)
   , m_mediaProcessor(new OMX_MediaProcessor(make_shared<OMX_EGLBufferProvider>()))
   , m_textureData(NULL)
   , m_sceneGraphInitialized(false)
   , m_quickItem(NULL)
{
   log_debug_func;

   connect(m_mediaProcessor, SIGNAL(stateChanged(OMX_MediaProcessor::OMX_MediaProcessorState)),
           this, SLOT(onStateChanged(OMX_MediaProcessor::OMX_MediaProcessorState)));
   connect(m_mediaProcessor, SIGNAL(metadataChanged(QVariantMap)),
           this, SIGNAL(metaDataChanged(QVariantMap)));
}
Ejemplo n.º 10
0
void PEMetadataView::familyEntry() {
	if (m_familyEdit->isModified()) {
		emit metadataChanged("family", m_familyEdit->text());
        m_familyEdit->setModified(false);
	}
}
Ejemplo n.º 11
0
void EditMetadataCommon::saveToMetadata()
{
    *m_sourceMetadata = *m_metadata;
    emit metadataChanged();
    cleanupAndClose();
}
Ejemplo n.º 12
0
/*------------------------------------------------------------------------------
|    OMX_MediaProcessor::setFilenameInt
+-----------------------------------------------------------------------------*/
inline
bool OMX_MediaProcessor::setFilenameInt(QString filename, OMX_TextureData*& textureData)
{
   switch (m_state) {
   case STATE_INACTIVE:
      break;
   case STATE_STOPPED:
      cleanup();
      break;
   case STATE_PAUSED:
   case STATE_PLAYING:
      return false; // TODO: Reimplement.
   }

   LOG_VERBOSE(LOG_TAG, "Opening %s...", qPrintable(filename));

   // It seems that omxplayer expects path and not local URIs.
   QUrl url(filename);
   if (url.isLocalFile() && filename.startsWith("file://"))
      filename = url.path();

   if (!m_omx_reader->Open(filename.toStdString(), true)) {
      LOG_ERROR(LOG_TAG, "Failed to open source.");
      return false;
   }

   // Emit a signal transmitting the matadata. Anyway, I'm not sure where to check for
   // metadata actually changed or not... I emit the signal anyway, then the receiver
   // decides.
   LOG_VERBOSE(LOG_TAG, "Copy metatada...");
   convertMetaData();
   emit metadataChanged(m_metadata);

   m_filename = filename;

   m_has_video     = m_omx_reader->VideoStreamCount();
   m_has_audio     = m_omx_reader->AudioStreamCount();
#ifdef ENABLE_SUBTITLES
   m_has_subtitle  = m_omx_reader->SubtitleStreamCount();
#endif
   m_loop          = m_loop && m_omx_reader->CanSeek();

   LOG_VERBOSE(LOG_TAG, "Initializing OMX clock...");
   if (!m_av_clock->OMXInitialize())
      return false;

   if (ENABLE_HDMI_CLOCK_SYNC && !m_av_clock->HDMIClockSync())
      return false;

   m_av_clock->OMXStateIdle();
   m_av_clock->OMXStop();
   m_av_clock->OMXPause();

   m_omx_reader->GetHints(OMXSTREAM_AUDIO, *m_hints_audio);
   m_omx_reader->GetHints(OMXSTREAM_VIDEO, *m_hints_video);

   if (m_fps > 0.0f)
       m_hints_video->fpsrate = m_fps * DVD_TIME_BASE, m_hints_video->fpsscale = DVD_TIME_BASE;

   // Set audio stream to use.
   // TODO: Implement a way to change it runtime.
#if 0
   m_omx_reader->SetActiveStream(OMXSTREAM_AUDIO, m_audio_index_use);
#endif

   // Seek on start?
#if 0
   if (m_seek_pos !=0 && m_omx_reader->CanSeek()) {
      printf("Seeking start of video to %i seconds\n", m_seek_pos);
      m_omx_reader->SeekTime(m_seek_pos * 1000.0f, false, &startpts);  // from seconds to DVD_TIME_BASE
   }
#endif

   if (m_has_video) {
      LOG_VERBOSE(LOG_TAG, "Opening video using OMX...");
      if (!m_player_video->Open(
             *m_hints_video,
             m_av_clock,
             textureData,
             VS_DEINTERLACEMODE_OFF, /* deinterlace */
             OMX_ImageFilterAnaglyphNone,
             ENABLE_HDMI_CLOCK_SYNC,
             true,                   /* threaded */
             1.0,                    /* display aspect, unused */
             0,                      /* display */
             0,                      /* layer */
             m_video_queue_size, m_video_fifo_size
             ))
         return false;
   }

#ifdef ENABLE_SUBTITLES
   LOG_VERBOSE(LOG_TAG, "Opening subtitles using OMX...");
   if(m_has_subtitle &&
         !m_player_subtitles.Open(m_omx_reader.SubtitleStreamCount(),
                                  std::move(external_subtitles),
                                  m_font_path,
                                  m_italic_font_path,
                                  m_font_size,
                                  m_centered,
                                  m_subtitle_lines,
                                  m_av_clock))
      return false;

   // This is an upper bound check on the subtitle limits. When we pulled the subtitle
   // index from the user we check to make sure that the value is larger than zero, but
   // we couldn't know without scanning the file if it was too high. If this is the case
   // then we replace the subtitle index with the maximum value possible.
   if (m_has_subtitle && m_subtitle_index > (m_omx_reader->SubtitleStreamCount() - 1))
      m_subtitle_index = m_omx_reader->SubtitleStreamCount() - 1;
#endif

   m_omx_reader->GetHints(OMXSTREAM_AUDIO, *m_hints_audio);

#if 0
   if ((m_hints_audio.codec == CODEC_ID_AC3 || m_hints_audio.codec == CODEC_ID_EAC3) &&
       m_BcmHost.vc_tv_hdmi_audio_supported(EDID_AudioFormat_eAC3, 2, EDID_AudioSampleRate_e44KHz, EDID_AudioSampleSize_16bit ) != 0)
      m_passthrough = false;
   if (m_hints_audio.codec == CODEC_ID_DTS &&
       m_BcmHost.vc_tv_hdmi_audio_supported(EDID_AudioFormat_eDTS, 2, EDID_AudioSampleRate_e44KHz, EDID_AudioSampleSize_16bit ) != 0)
      m_passthrough = false;
#endif


   LOG_VERBOSE(LOG_TAG, "Opening audio using OMX...");
   if (m_has_audio) {
      if (!m_player_audio->Open(
             *m_hints_audio,
             m_av_clock,
             m_omx_reader,
             "omx:hdmi",         /* TODO: implement way to change */
             false,              /* TODO: passthrough */
             false,              /* TODO: hw decode */
             false,              /* TODO: downmix boost */
             true,               /* threaded */
             false,              /* is_live */
             PCM_LAYOUT_2_0,
             m_audio_queue_size, m_audio_fifo_size
             ))
         return false;
      if (m_has_audio)
          m_player_audio->SetVolume(pow(10, 0 / 2000.0));
   }

   setState(STATE_STOPPED);
   return true;
}
Ejemplo n.º 13
0
void PEMetadataView::variantEntry() {
	if (m_variantEdit->isModified()) {
		emit metadataChanged("variant", m_variantEdit->text());
        m_variantEdit->setModified(false);
	}
}
Ejemplo n.º 14
0
void PEMetadataView::titleEntry() {
	if (m_titleEdit->isModified()) {
		emit metadataChanged("title", m_titleEdit->text());
        m_titleEdit->setModified(false);
	}
}
Ejemplo n.º 15
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QAction* aRemove = ui->actionRemove_Playlist_Selection;
    QAction* aClear = ui->actionClear_Playlist;

    connect(aRemove, SIGNAL(triggered()), ui->player->playlist(), SLOT(removeSelection()));
    connect(aClear, SIGNAL(triggered()), ui->player->playlist(), SLOT(clear()));

    connect(ui->player->inner_player(), SIGNAL(metaDataChanged(QString,QVariant)), SLOT(metadataChanged(QString,QVariant)));
}
Ejemplo n.º 16
0
void MpvAudioOutput::event_loop() {
    while (true) {
        auto event = mpv_wait_event(handle_, -1);
        //         qDebug() << "mpv event " << mpv_event_name(event->event_id);
        switch (event->event_id) {
        case MPV_EVENT_SHUTDOWN:
            return;
        case MPV_EVENT_QUEUE_OVERFLOW:
            qWarning() << "mpv queue overflow";
            break;
        case MPV_EVENT_START_FILE:
            setState(AudioState::Buffering);
            break;
        case MPV_EVENT_FILE_LOADED:
            setState(AudioState::Playing);
            emit currentSourceChanged();
            setVolume();
            if (seek_offset_ != -1) {
                seek(seek_offset_);
                seek_offset_ = -1;
            }
            break;
        case MPV_EVENT_END_FILE: {
            auto end_ev = reinterpret_cast<mpv_event_end_file *>(event->data);
            if (end_ev->reason == MPV_END_FILE_REASON_ERROR)
                qWarning() << "Ended file: " << mpv_error_string(end_ev->error);
            break;
        }
        case MPV_EVENT_LOG_MESSAGE: {
            auto log = reinterpret_cast<mpv_event_log_message *>(event->data);
            qDebug() << "mpv [" << log->prefix << "] " << log->text;
            break;
        }
        case MPV_EVENT_PROPERTY_CHANGE: {
            auto prop = reinterpret_cast<mpv_event_property *>(event->data);
            if (prop->format != MPV_FORMAT_NONE && prop->data) {
                if (std::string(prop->name) == "playback-time") {
                    std::string pos(*(reinterpret_cast<char **>(prop->data)));
                    emit tick(pos_to_qint64(pos));
                    if (volumeNeverSet_)
                        setVolume();
                } else if (std::string(prop->name) == "idle") {
                    int idle = *reinterpret_cast<int *>(prop->data);
                    if (idle) {
                        setState(AudioState::Stopped);
                        emit finished();
                    } else
                        setState(AudioState::Playing);
                } else if (std::string(prop->name) == "pause") {
                    int pause = *reinterpret_cast<int *>(prop->data);
                    if (pause)
                        setState(AudioState::Paused);
                    else if (state_ == AudioState::Paused)
                        setState(AudioState::Playing);
                } else if (std::string(prop->name) == "duration") {
                    double v = *reinterpret_cast<double *>(prop->data);
                    emit durationChanged(v);
                } else if (std::string(prop->name) == "metadata") {
                    emit metadataChanged(get_property("media-title").toString(),
                                         get_property("audio-format").toString(),
                                         get_property("audio-params/samplerate").toInt());
                }
            }
            break;
        }
        default:
            break;
        }
    }
}
Ejemplo n.º 17
0
void BrushPresetManager::setMetadata(const BrushPresetMetadata &metadata)
{
	_preset["metadata"] = metadata.toVariantMap();
	emit metadataChanged(metadata);
}
Ejemplo n.º 18
0
void PEMetadataView::labelEntry() {
	if (m_labelEdit->isModified()) {
		emit metadataChanged("label", m_labelEdit->text());
        m_labelEdit->setModified(false);
	}
}
Ejemplo n.º 19
0
void PEMetadataView::descriptionEntry() {
	if (m_descriptionEdit->document()->isModified()) {
		emit metadataChanged("description", m_descriptionEdit->toHtml());
        m_descriptionEdit->document()->setModified(false);
	}
}
Ejemplo n.º 20
0
void PEMetadataView::authorEntry() {
	if (m_authorEdit->isModified()) {
		emit metadataChanged("author", m_authorEdit->text());
        m_authorEdit->setModified(false);
	}	
}
Ejemplo n.º 21
0
void NowPlaying::dataUpdated(const QString &name,
                             const Plasma::DataEngine::Data &data)
{
                    //i18n("No media player found")
                    //i18nc("The state of a music player", "Stopped")
    if (name != m_watchingPlayer) {
        kDebug() << "Wasn't expecting an update from" << name << " but watching " << m_watchingPlayer;
        return;
    }
    if (data.isEmpty()) {
        kDebug() << "Got no data";
        findPlayer();
        return;
    }

    State newstate;
    if (data["State"].toString() == "playing") {
        newstate = Playing;
    } else if (data["State"].toString() == "paused") {
        newstate = Paused;
    } else {
        newstate = Stopped;
    }
    if (newstate != m_state) {
        emit stateChanged(newstate);
        m_state = newstate;
    }

    QString timeText;
    int length = data["Length"].toInt();
    if (length != m_length) {
        m_length = length;
    }
    if (length != 0) {
        int pos = data["Position"].toInt();
        timeText = QString::number(pos / 60) + ':' +
                   QString::number(pos % 60).rightJustified(2, '0') + " / " +
                   QString::number(length / 60) + ':' +
                   QString::number(length % 60).rightJustified(2, '0');
    }

    QMap<QString,QString> metadata;
    metadata["Artist"] = data["Artist"].toString();
    metadata["Album"] = data["Album"].toString();
    metadata["Title"] = data["Title"].toString();
    metadata["Time"] = timeText;
    metadata["Track number"] = QString::number(data["Track number"].toInt());
    metadata["Comment"] = data["Comment"].toString();
    metadata["Genre"] = data["Genre"].toString();

    // the time should usually have changed
    emit metadataChanged(metadata);

    // used for seeing when the track has changed
    if ((metadata["Title"] != m_title) || (metadata["Artist"] != m_artist))
    {
        m_title = metadata["Title"];
        m_artist = metadata["Artist"];
        m_artwork = data["Artwork"].value<QPixmap>();
        emit coverChanged(m_artwork);
        if(Plasma::ToolTipManager::self()->isVisible(this)) {
            toolTipAboutToShow();
        }
    }

    update();
}
Ejemplo n.º 22
0
void QProtobufModel::setMetadata(const QUrl &_url)
{
    m_metadata = _url;
    emit metadataChanged(m_metadata);
    checkSourceChange();
}