Exemplo n.º 1
0
void done(void)
{
    onSeek();
    if (filter_coefs_lfe)
    {
        free(filter_coefs_lfe);
    }
    filter_coefs_lfe = nullptr;
}
Exemplo n.º 2
0
bool SoundStream::fillAndPushBuffer(unsigned int bufferNum, bool immediateLoop)
{
    bool requestStop = false;

    // Acquire audio data, also address EOF and error cases if they occur
    Chunk data = {NULL, 0};
    for (Uint32 retryCount = 0; !onGetData(data) && (retryCount < BufferRetries); ++retryCount)
    {
        // Mark the buffer as the last one (so that we know when to reset the playing position)
        m_endBuffers[bufferNum] = true;

        // Check if the stream must loop or stop
        if (!m_loop)
        {
            // Not looping: request stop
            requestStop = true;
            break;
        }

        // Return to the beginning of the stream source
        onSeek(Time::Zero);

        // If we got data, break and process it, else try to fill the buffer once again
        if (data.samples && data.sampleCount)
            break;

        // If immediateLoop is specified, we have to immediately adjust the sample count
        if (immediateLoop)
        {
            // We just tried to begin preloading at EOF: reset the sample count
            m_samplesProcessed = 0;
            m_endBuffers[bufferNum] = false;
        }

        // We're a looping sound that got no data, so we retry onGetData()
    }

    // Fill the buffer if some data was returned
    if (data.samples && data.sampleCount)
    {
        unsigned int buffer = m_buffers[bufferNum];

        // Fill the buffer
        ALsizei size = static_cast<ALsizei>(data.sampleCount) * sizeof(Int16);
        alCheck(alBufferData(buffer, m_format, data.samples, size, m_sampleRate));

        // Push it into the sound queue
        alCheck(alSourceQueueBuffers(m_source, 1, &buffer));
    }
    else
    {
        // If we get here, we most likely ran out of retries
        requestStop = true;
    }

    return requestStop;
}
Exemplo n.º 3
0
void SoundStream::setPlayingOffset(Time timeOffset)
{
    // Stop the stream
    stop();

    // Let the derived class update the current position
    onSeek(timeOffset);

    // Restart streaming
    m_samplesProcessed = static_cast<Uint64>(timeOffset.asSeconds() * m_sampleRate * m_channelCount);
    m_isStreaming = true;
    m_thread.launch();
}
Exemplo n.º 4
0
void SoundStream::stop()
{
    // Request the thread to terminate
    {
        Lock lock(m_threadMutex);
        m_isStreaming = false;
    }

    // Wait for the thread to terminate
    m_thread.wait();

    // Move to the beginning
    onSeek(Time::Zero);

    // Reset the playing position
    m_samplesProcessed = 0;
}
Exemplo n.º 5
0
bool SoundStream::fillAndPushBuffer(unsigned int bufferNum)
{
    bool requestStop = false;

    // Acquire audio data
    Chunk data = {NULL, 0};
    if (!onGetData(data))
    {
        // Mark the buffer as the last one (so that we know when to reset the playing position)
        m_endBuffers[bufferNum] = true;

        // Check if the stream must loop or stop
        if (m_loop)
        {
            // Return to the beginning of the stream source
            onSeek(Time::Zero);

            // If we previously had no data, try to fill the buffer once again
            if (!data.samples || (data.sampleCount == 0))
            {
                return fillAndPushBuffer(bufferNum);
            }
        }
        else
        {
            // Not looping: request stop
            requestStop = true;
        }
    }

    // Fill the buffer if some data was returned
    if (data.samples && data.sampleCount)
    {
        unsigned int buffer = m_buffers[bufferNum];

        // Fill the buffer
        ALsizei size = static_cast<ALsizei>(data.sampleCount) * sizeof(Int16);
        alCheck(alBufferData(buffer, m_format, data.samples, size, m_sampleRate));

        // Push it into the sound queue
        alCheck(alSourceQueueBuffers(m_source, 1, &buffer));
    }

    return requestStop;
}
Exemplo n.º 6
0
void SoundStream::play()
{
    // Check if the sound parameters have been set
    if (m_format == 0)
    {
        err() << "Failed to play audio stream: sound parameters have not been initialized (call initialize() first)" << std::endl;
        return;
    }

    bool isStreaming = false;
    Status threadStartState = Stopped;

    {
        Lock lock(m_threadMutex);

        isStreaming = m_isStreaming;
        threadStartState = m_threadStartState;
    }


    if (isStreaming && (threadStartState == Paused))
    {
        // If the sound is paused, resume it
        Lock lock(m_threadMutex);
        m_threadStartState = Playing;
        alCheck(alSourcePlay(m_source));
        return;
    }
    else if (isStreaming && (threadStartState == Playing))
    {
        // If the sound is playing, stop it and continue as if it was stopped
        stop();
    }

    // Move to the beginning
    onSeek(Time::Zero);

    // Start updating the stream in a separate thread to avoid blocking the application
    m_samplesProcessed = 0;
    m_isStreaming = true;
    m_threadStartState = Playing;
    m_thread.launch();
}
Exemplo n.º 7
0
void SoundStream::play()
{
    // Check if the sound parameters have been set
    if (m_format == 0)
    {
        err() << "Failed to play audio stream: sound parameters have not been initialized (call Initialize first)" << std::endl;
        return;
    }

    // If the sound is already playing (probably paused), just resume it
    if (m_isStreaming)
    {
        alCheck(alSourcePlay(m_source));
        return;
    }

    // Move to the beginning
    onSeek(Time::Zero);

    // Start updating the stream in a separate thread to avoid blocking the application
    m_samplesProcessed = 0;
    m_isStreaming = true;
    m_thread.launch();
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    //Create central widget and set main layout
    wgtMain_ = new QWidget(this);
    lytMain_ = new QGridLayout(wgtMain_);
    wgtMain_->setLayout(lytMain_);
    setCentralWidget(wgtMain_);

    //Crear el menu

    //Menu Archivo
    mnuArchivo_ = new QMenu("Archivo");
    menuBar()->addMenu(mnuArchivo_);
    actAbrir_ = new QAction ("Abrir", this);
    mnuArchivo_ ->addAction(actAbrir_);
    mnuRecent_ = new QMenu ("Archivos Recientes", this);
    mnuArchivo_ ->addMenu(mnuRecent_);

    actStreaming_ = new QAction ("Reproducir Streaming", this);
    mnuArchivo_ ->addAction(actStreaming_);

    //Menu Ver
    mnuVer_ = new QMenu("Ver");
    menuBar()->addMenu(mnuVer_);
    actFullScreen_ = new QAction ("Full Screen", this);
    mnuVer_ ->addAction(actFullScreen_);
    actMetaData_ = new QAction ("Metadata", this);
    mnuVer_ ->addAction(actMetaData_);


    //Initialize widgets
    mediaPlayer_  = new QMediaPlayer(this);
    playerSlider_ = new QSlider(Qt::Horizontal, this);
    videoWidget_  = new QVideoWidget(this);
    volumeSlider_ = new QSlider(Qt::Horizontal, this);
    btnOpen_      = new QToolButton(this);
    btnPlay_      = new QToolButton(this);
    btnPause_     = new QToolButton(this);
    btnStop_      = new QToolButton(this);

    //Setup widwgets
    videoWidget_->setMinimumSize(400, 400);
    mediaPlayer_->setVideoOutput(videoWidget_);
    mediaPlayer_->setVolume(75);
    videoWidget_->setAspectRatioMode(Qt::KeepAspectRatio);
    volumeSlider_->setRange(0, 100);
    volumeSlider_->setSliderPosition(75);

    //Populate grid layout
    lytMain_->addWidget(videoWidget_,  0, 0, 1, 5);
    lytMain_->addWidget(playerSlider_, 1, 0, 1, 5);
    lytMain_->addWidget(btnOpen_,      2, 0, 1, 1);
    lytMain_->addWidget(btnPlay_,      2, 1, 1, 1);
    lytMain_->addWidget(btnPause_,     2, 2, 1, 1);
    lytMain_->addWidget(btnStop_,      2, 3, 1, 1);
    lytMain_->addWidget(volumeSlider_, 2, 4, 1, 1);

    //Buttons icons
    btnOpen_->setIcon(QIcon(QPixmap(":/icons/resources/eject.png")));
    btnPause_->setIcon(QIcon(QPixmap(":/icons/resources/pause.png")));
    btnPlay_->setIcon(QIcon(QPixmap(":/icons/resources/play.png")));
    btnStop_->setIcon(QIcon(QPixmap(":/icons/resources/stop.png")));

    //Connections
    connect(btnOpen_,      SIGNAL(pressed()),               this,         SLOT(onOpen()));
    connect(btnPlay_,      SIGNAL(pressed()),               mediaPlayer_, SLOT(play()));
    connect(btnPause_,     SIGNAL(pressed()),               mediaPlayer_, SLOT(pause()));
    connect(btnStop_,      SIGNAL(pressed()),               mediaPlayer_, SLOT(stop()));
    connect(playerSlider_, SIGNAL(sliderReleased()),        this,         SLOT(onSeek()));
    connect(mediaPlayer_,  SIGNAL(durationChanged(qint64)), this,         SLOT(onDurationChanged(qint64)));
    connect(mediaPlayer_,  SIGNAL(positionChanged(qint64)), this,         SLOT(onPositionChanged(qint64)));
    connect(volumeSlider_, SIGNAL(sliderMoved(int)),        this,         SLOT(onVolumeChanged(int)));
    //*****
    connect(actAbrir_, SIGNAL(triggered()), this, SLOT(onOpen()));
    connect(actMetaData_ , SIGNAL(triggered()), this, SLOT(onMetaData()));
    connect(mnuRecent_, SIGNAL(triggered(QAction*)), this, SLOT(onRecentFiles(QAction*)));
    connect(actFullScreen_, SIGNAL(triggered()), this, SLOT(onFullScreen()));
    connect(actStreaming_, SIGNAL(triggered()), this, SLOT(onStreaming()));

    videoWidget_->installEventFilter(this); //Instalar el event filter a este widget
}
HRESULT TvideoCodecLibmpeg2::BeginFlush()
{
    onSeek(0);
    return S_OK;
}
Exemplo n.º 10
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    //Create central widget and set main layout
    wgtMain_ = new QWidget(this);
    lytMain_ = new QGridLayout(wgtMain_);
    wgtMain_->setLayout(lytMain_);
    setCentralWidget(wgtMain_);

    //Initialize widgets
    mediaPlayer_  = new QMediaPlayer(this);
    playerSlider_ = new QSlider(Qt::Horizontal, this);
    videoWidget_  = new QVideoWidget(this);
    //volumeSlider_ = new QSlider(Qt::Horizontal, this);
    volumeSlider_ = new QSlider(Qt::Vertical,this);
    btnOpen_      = new QToolButton(this);
    btnPlay_      = new QToolButton(this);
    btnPause_     = new QToolButton(this);
    btnStop_      = new QToolButton(this);

    btnMinimizar_ = new QToolButton(this);
    //botones nuevos para las tareas
    btnAleatoria_ = new QToolButton(this);
    btnBucle_ = new QToolButton(this);


    //Sliders para el brillo, contraste y saturación
    brightnessSlider_ = new QSlider(Qt::Vertical);
    contrastSlider_ =   new QSlider(Qt::Vertical);
    saturavionSlider_ = new QSlider(Qt::Vertical);


    //Setup widwgets
    videoWidget_->setMinimumSize(600, 400);
    mediaPlayer_->setVideoOutput(videoWidget_);
    mediaPlayer_->setVolume(50);
    videoWidget_->setAspectRatioMode(Qt::KeepAspectRatio);
    volumeSlider_->setRange(0, 100);
    volumeSlider_->setSliderPosition(100);

    //Populate grid layout
    lytMain_->addWidget(videoWidget_,  0, 0, 1, 5);
    lytMain_->addWidget(playerSlider_, 1, 0, 1, 5);
    lytMain_->addWidget(btnOpen_,      2, 0, 1, 1);
    lytMain_->addWidget(btnPlay_,      2, 1, 1, 1);
    lytMain_->addWidget(btnPause_,     2, 2, 1, 1);
    lytMain_->addWidget(btnStop_,      2, 3, 1, 1);

    lytMain_->addWidget(btnMinimizar_, 0, 5, 1, 1);

    //botones nuevos
    lytMain_->addWidget(btnAleatoria_, 2,4,1,1);
    lytMain_->addWidget(btnBucle_, 2,5,1,1);


    lytMain_->addWidget(volumeSlider_, 2, 6, 1, 1);


    //Buttons icons
    btnOpen_->setIcon(QIcon(QPixmap(":/icons/resources/eject.png")));
    btnPause_->setIcon(QIcon(QPixmap(":/icons/resources/pause.png")));
    btnPlay_->setIcon(QIcon(QPixmap(":/icons/resources/play.png")));
    btnStop_->setIcon(QIcon(QPixmap(":/icons/resources/stop.png")));

    btnMinimizar_->setIcon(QIcon(QPixmap(":/icons/resources/minimizar.png")));

    //Buttons nuevos tareas icons
    btnAleatoria_->setIcon(QIcon(QPixmap(":/icons/resources/aleatoria.jpg")));
    btnBucle_->setIcon(QIcon(QPixmap(":/icons/resources/repetir.jpg")));

    //menu principal
    main_menu_= new QMenuBar(this);

    menu_archivo_= new QMenu ("Archivo", this);
    main_menu_->addMenu(menu_archivo_);
    setMenuBar(main_menu_);


    menu_ver_ = new QMenu ("Ver", this);
    main_menu_->addMenu(menu_ver_);
    setMenuBar(main_menu_);


    //Abrir
    Abrir_ = new QAction("Abrir", this);
    menu_archivo_->addAction(Abrir_);

    //Recientes
    Recientes_ = new QAction("Reciente", this);
    menu_archivo_->addAction(Recientes_);
    lista_recientes_ = new QListWidget();

    Cerrar_Recientes_ = new QAction("Cerrar Recientes", this);

    //rrecientes_ = new QMenu(tr("Recientes"),this);
    //rrecientes_->addAction(Recientes_);
    //menu_archivo_->addMenu(rrecientes_);
    menu_archivo_->addAction(Cerrar_Recientes_);

    Cargar_Lista_Reproduccion_ = new QAction("Cargar Lista",this);
    menu_archivo_->addAction(Cargar_Lista_Reproduccion_);


    this->setWindowIcon(QIcon(QPixmap(":/icons/resources/repro.png")));


    playlist_ = new QMediaPlaylist();


    //Ayuda
    Ayuda_ = new QAction("Ayuda", this);
    menu_archivo_->addAction(Ayuda_);


    menu_editar_ = new QMenu("Editar", this);
    main_menu_->addMenu(menu_editar_);
    Editar_ = new QAction("Imagen", this);

    menu_editar_->addAction(Editar_);


    //Ver pantalla completa
    Ver_pantalla_completa_ = new QAction("Ver_completa", this);
    Metadatas_ = new QAction("Metadata", this);
    menu_ver_->addAction(Ver_pantalla_completa_);
    menu_ver_->addAction(Metadatas_);

   // pantalla_completa_deshacer_ = new QAction(this);
   // pantalla_completa_deshacer_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));



    //salir de marcha
    Salir_ = new QAction("Salir", this);
    menu_archivo_->addAction(Salir_);



    //Connections
    connect(btnOpen_,      SIGNAL(pressed()),               this,         SLOT(onOpen()));
    connect(btnPlay_,      SIGNAL(pressed()),               mediaPlayer_, SLOT(play()));
    connect(btnPause_,     SIGNAL(pressed()),               mediaPlayer_, SLOT(pause()));
    connect(btnStop_,      SIGNAL(pressed()),               mediaPlayer_, SLOT(stop()));
    connect(playerSlider_, SIGNAL(sliderReleased()),        this,         SLOT(onSeek()));
    connect(mediaPlayer_,  SIGNAL(durationChanged(qint64)), this,         SLOT(onDurationChanged(qint64)));
    connect(mediaPlayer_,  SIGNAL(positionChanged(qint64)), this,         SLOT(onPositionChanged(qint64)));
    connect(volumeSlider_, SIGNAL(sliderMoved(int)),        this,         SLOT(onVolumeChanged(int)));

    //Connections NEW BUTTONS
    connect(btnBucle_,      SIGNAL(pressed()),              this,         SLOT(Bucle()));
    connect(btnAleatoria_,  SIGNAL(pressed()),              this,         SLOT(Aleatoria()));

    //boton minimizado
    connect(btnMinimizar_, SIGNAL(pressed()),              this,         SLOT(Minimizar()));

    //SLIDERS CONTRASTE SATURACION y BRILLO
    connect(contrastSlider_,      SIGNAL(sliderMoved(int)),               videoWidget_,         SLOT(setContrast(int)));
    connect(saturavionSlider_,      SIGNAL(sliderMoved(int)),               videoWidget_,         SLOT(setSaturation(int)));
    connect(brightnessSlider_,      SIGNAL(sliderMoved(int)),               videoWidget_,         SLOT(setBrightness(int)));


    connect(Editar_, SIGNAL(triggered()), this, SLOT(Ver_controles_edicion()) );

    //menu archivo
    connect(Abrir_, SIGNAL(triggered()), this, SLOT(Abrir()));

    connect(Recientes_, SIGNAL(triggered()), this, SLOT(Recientes_leer()));
    connect(Cerrar_Recientes_, SIGNAL(triggered()), this, SLOT(Cerrar_Recientes()));

    connect(Cargar_Lista_Reproduccion_,SIGNAL(triggered()), this, SLOT(Cargar_lista_reproduccion()));


    connect(Salir_, SIGNAL(triggered()), this, SLOT(Salir()));

    //menu ver pantalla completa
    connect(Ver_pantalla_completa_, SIGNAL(triggered()), this, SLOT(Pantalla_completa()));
    //connect(pantalla_completa_deshacer_, SIGNAL(pressed()), this, SLOT(Deshacer_pantalla_completa()));

    //METADATA
    connect(Metadatas_, SIGNAL(triggered()), this, SLOT(Ver_metadatos()));




}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    //Create central widget and set main layout
    wgtMain_ = new QWidget(this);
    lytMain_ = new QGridLayout(wgtMain_);
    wgtMain_->setLayout(lytMain_);
    setCentralWidget(wgtMain_);

    //Initialize widgets
    mediaPlayer_  = new QMediaPlayer(this); // Objeto que se encarga del video
    playerSlider_ = new QSlider(Qt::Horizontal, this); // Barra de tiempo de reproducción
    videoWidget_  = new QVideoWidget(this); // Recuadro negro de vídeo
    volumeSlider_ = new QSlider(Qt::Horizontal, this); // Barra de volumen
    btnOpen_      = new QToolButton(this);
    btnPlay_      = new QToolButton(this);
    btnPause_     = new QToolButton(this);
    btnStop_      = new QToolButton(this);

    //Setup widwgets
    videoWidget_->setMinimumSize(400, 400);
    mediaPlayer_->setVideoOutput(videoWidget_); // Añadir el recuadro al reproductor
    mediaPlayer_->setVolume(100);
    videoWidget_->setAspectRatioMode(Qt::KeepAspectRatio);
    volumeSlider_->setRange(0, 100);
    volumeSlider_->setSliderPosition(100);

    //Populate grid layout
    lytMain_->addWidget(videoWidget_,  0, 0, 1, 5);
    lytMain_->addWidget(playerSlider_, 1, 0, 1, 5);
    lytMain_->addWidget(btnOpen_,      2, 0, 1, 1);
    lytMain_->addWidget(btnPlay_,      2, 1, 1, 1);
    lytMain_->addWidget(btnPause_,     2, 2, 1, 1);
    lytMain_->addWidget(btnStop_,      2, 3, 1, 1);
    lytMain_->addWidget(volumeSlider_, 2, 4, 1, 1);

    //Buttons icons
    btnOpen_->setIcon(QIcon(QPixmap(":/icons/resources/eject.png")));
    btnPause_->setIcon(QIcon(QPixmap(":/icons/resources/pause.png")));
    btnPlay_->setIcon(QIcon(QPixmap(":/icons/resources/play.png")));
    btnStop_->setIcon(QIcon(QPixmap(":/icons/resources/stop.png")));

    //Connections
    connect(btnOpen_,      SIGNAL(pressed()),               this,         SLOT(onOpen()));
    connect(btnPlay_,      SIGNAL(pressed()),               mediaPlayer_, SLOT(play()));
    connect(btnPause_,     SIGNAL(pressed()),               mediaPlayer_, SLOT(pause()));
    connect(btnStop_,      SIGNAL(pressed()),               mediaPlayer_, SLOT(stop()));
    connect(playerSlider_, SIGNAL(sliderReleased()),        this,         SLOT(onSeek()));
    connect(mediaPlayer_,  SIGNAL(durationChanged(qint64)), this,         SLOT(onDurationChanged(qint64)));
    connect(mediaPlayer_,  SIGNAL(positionChanged(qint64)), this,         SLOT(onPositionChanged(qint64)));
    connect(volumeSlider_, SIGNAL(sliderMoved(int)),        this,         SLOT(onVolumeChanged(int)));

    // Inicializamos los elementos del menú
    mainMenu_ = new QMenuBar(this);
    mnuArchivo_ = new QMenu(tr("&Archivo"), this);
    mnuVer_ = new QMenu(tr("&Ver"), this);
    mnuAyuda_ = new QMenu(tr("&Ayuda"), this);
    mnuStreaming_ = new QMenu(tr("&Streaming"), this);

    // Añadimos los elementos al menú
    mainMenu_->addMenu(mnuArchivo_);
    mainMenu_->addMenu(mnuVer_);
    mainMenu_->addMenu(mnuAyuda_);
    mainMenu_->addMenu(mnuStreaming_);

    // Inicializamos acciones de los elementos del menú
    // Añadimos las acciones a los elementos
    // Añadimos los shortcuts correspondientes
    actArchivoAbrir_ = new QAction(tr("Abrir..."), this);
    actArchivoAbrir_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
    mnuArchivo_->addAction(actArchivoAbrir_);

    mnuArchivoRecientes_ = new QMenu(tr("Recientes"), this);
    mnuArchivo_->addMenu(mnuArchivoRecientes_);

    actVerMetadatos_ = new QAction(tr("Metadatos"), this);
    mnuVer_->addAction(actVerMetadatos_);

    actVerPantallaCompleta_ = new QAction(tr("Pantalla completa"), this);
    actVerPantallaCompleta_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F11));
    mnuVer_->addAction(actVerPantallaCompleta_);

    actAyudaAcercaDe_ = new QAction(tr("Acerca de"), this);
    mnuAyuda_->addAction(actAyudaAcercaDe_);

    actStreamingReproducir_ = new QAction(tr("Reproducir fuente"), this);
    mnuStreaming_->addAction(actStreamingReproducir_);

    // Añadir barra de menús a la ventana
    setMenuBar(mainMenu_);

    // Conexiones del menú
    connect(actArchivoAbrir_, SIGNAL(triggered()), this, SLOT(onOpen()));
    connect(actVerPantallaCompleta_, SIGNAL(triggered()), this, SLOT(pantallaCompleta()));
    connect(actVerMetadatos_, SIGNAL(triggered()), this, SLOT(showMetadata()));
    connect(actAyudaAcercaDe_, SIGNAL(triggered()), this, SLOT(alAcercade()));
    connect(actStreamingReproducir_, SIGNAL(triggered()), this, SLOT(alStreaming()));

    // Hace que funcione el eventfilter
    videoWidget_->installEventFilter(this);

    // Mostramos el historial de recientes
    this->alRecientes();

    // Inicializamos una fuente de streaming por defecto
    maximaFM_ = "http://208.92.53.87:80/MAXIMAFM";
}
Exemplo n.º 12
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    //Create central widget and set main layout //Centra ventana
    wgtMain_ = new QWidget(this);//Estam la ventana principal
    lytMain_ = new QGridLayout(wgtMain_);//Permite dividir el espacio y añadir elementos (ver matriz)
    wgtMain_->setLayout(lytMain_);
    setCentralWidget(wgtMain_);

    //Initialize widgets
    mediaPlayer_  = new QMediaPlayer(this);
    playerSlider_ = new QSlider(Qt::Horizontal, this);//Indicamos si es vertical u horizontal
    videoWidget_  = new QVideoWidget(this);
    volumeSlider_ = new QSlider(Qt::Horizontal, this);
    btnOpen_      = new QToolButton(this);
    btnPlay_      = new QToolButton(this);
    btnPause_     = new QToolButton(this);
    btnStop_      = new QToolButton(this);

    //Setup widwgets
    videoWidget_->setMinimumSize(400, 400);//Cuadro negro definimos el tamaño para verlo
    mediaPlayer_->setVideoOutput(videoWidget_);//Objeto de decodificacion del video
    mediaPlayer_->setVolume(100);
    videoWidget_->setAspectRatioMode(Qt::KeepAspectRatio);//Redimensionar se establezca
    volumeSlider_->setRange(0, 100);//El volumen
    volumeSlider_->setSliderPosition(100);//Colocacion del slider

    //Populate grid layout
    lytMain_->addWidget(videoWidget_,  0, 0, 1, 5);//Coordenadas (ultimo fila y columna te espandes)
    lytMain_->addWidget(playerSlider_, 1, 0, 1, 5);
    lytMain_->addWidget(btnOpen_,      2, 0, 1, 1);
    lytMain_->addWidget(btnPlay_,      2, 1, 1, 1);
    lytMain_->addWidget(btnPause_,     2, 2, 1, 1);
    lytMain_->addWidget(btnStop_,      2, 3, 1, 1);
    lytMain_->addWidget(volumeSlider_, 2, 4, 1, 1);

    //Buttons icons
    btnOpen_->setIcon(QIcon(QPixmap(":/icons/resources/eject.png")));
    btnPause_->setIcon(QIcon(QPixmap(":/icons/resources/pause.png")));
    btnPlay_->setIcon(QIcon(QPixmap(":/icons/resources/play.png")));
    btnStop_->setIcon(QIcon(QPixmap(":/icons/resources/stop.png")));

    //Menu
    mainMenu_= new QMenuBar(this);

    //Archivo
    mnuArchivo_ = new QMenu (tr("&Archivo"), this);//Especificamos el texto del menu
    mainMenu_-> addMenu(mnuArchivo_);

    mnuArchivoRecientes_ = new QMenu (tr("&Recientes"), this);
    mnuArchivo_-> addMenu(mnuArchivoRecientes_);

    //abrir
    actArchivoAbrir_ = new QAction(QIcon(":/icons/resources/eject.png"),tr("&Abrir"),this);
    actArchivoAbrir_-> setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));

    //Ver
    mnuVer_ = new QMenu(tr("&Ver"), this);
    mainMenu_-> addMenu(mnuVer_);

    //PantallaCompleta
    actVerCompleta_= new QAction (tr("&Pantalla Completa"),this);
    actVerCompleta_-> setShortcut(QKeySequence(Qt::ALT + Qt::Key_F));

    //Metadatos
    actMetadatos_=new QAction(tr("&Metadados"),this);



    //Ayuda
    mnuAyuda_ = new QMenu(tr("&Ayuda"), this);
    mainMenu_->addMenu(mnuAyuda_);

    //Acercade
    actAyudaAcerca_=new QAction(tr("&Acerca de"), this);


    //add acciones
    mnuArchivo_->addAction(actArchivoAbrir_);

    mnuAyuda_->addAction(actAyudaAcerca_);
    mnuVer_->addAction(actVerCompleta_);
    mnuVer_->addAction(actMetadatos_);


    //Colocacion de elementos
    //le decimos donde colocarse la barra del menu y la de herramientas
    setMenuBar(mainMenu_);



    //Connections
    connect(btnOpen_,      SIGNAL(pressed()),               this,         SLOT(onOpen()));
    connect(btnPlay_,      SIGNAL(pressed()),               mediaPlayer_, SLOT(play()));
    connect(btnPause_,     SIGNAL(pressed()),               mediaPlayer_, SLOT(pause()));
    connect(btnStop_,      SIGNAL(pressed()),               mediaPlayer_, SLOT(stop()));
    connect(playerSlider_, SIGNAL(sliderReleased()),        this,         SLOT(onSeek()));
    connect(mediaPlayer_,  SIGNAL(durationChanged(qint64)), this,         SLOT(onDurationChanged(qint64)));
    connect(mediaPlayer_,  SIGNAL(positionChanged(qint64)), this,         SLOT(onPositionChanged(qint64)));
    connect(volumeSlider_, SIGNAL(sliderMoved(int)),        this,         SLOT(onVolumeChanged(int)));
    connect(actArchivoAbrir_, SIGNAL(triggered()),this, SLOT (onOpen()));
    connect(actAyudaAcerca_, SIGNAL(triggered()), this, SLOT (acerca()));
    connect(actVerCompleta_,SIGNAL(triggered()),this,SLOT (pantallaCompleta()));
    connect(actMetadatos_,SIGNAL(triggered()),this,SLOT(metadatos()));
}