Implement LibVLC based player with QT-part2
In this blog i will demonstrate how to create player using LibVLC and Qt.
-
Implementing player class and linking with libVLC
-
Create new c++ Class from the Qt create and set the name as Player.cpp and Player.h
-
Linking with Libvlc
- Right click on the project and select the add library
- Click on the External library
- Select the libvlc.so from the /usr/bin directry for libraary file as below
- click next and finish the changes
- run the project to see weather any exceptions occur.
-
Setting the player class structure
- add the following declarations to Player.h
#ifndef PLAYER_H
#define PLAYER_H
#include <vlc/vlc.h>
#include <stdio.h>
#include <pre>
using namespace std;
class Player
{
private:
libvlc_instance_t *inst;
libvlc_media_player_t *mp;
libvlc_media_t *m;
public:
Player();
void play();
void pause();
void stop();
int getTime();
int getLength();
bool isPLay();
int getPosition();
void changePosition(int pos);
void changeVolume(int val);
};
#endif // PLAYER_H
- Then add declared functions to the Player.cpp file
#include "player.h"
Player::Player(){
}
void Player::play(){
}
void Player::pause(){
}
void Player::stop(){
}
int Player::getTime(){
}
int Player::getLength(){
}
int Player::getPosition() {
}
void Player::changePosition(int pos) {
}
void Player::changeVolume(int val) {
}
Add Comment
Comments (0)