mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-05 19:08:09 +08:00
优化播放器接口
This commit is contained in:
@@ -52,7 +52,8 @@ int main(int argc, char *argv[]){
|
||||
player->setOnShutdown([&](const SockException &ex){
|
||||
--alivePlayerCnt;
|
||||
});
|
||||
player->play(argv[3], "", "", (PlayerBase::eRtpType)atoi(argv[4]));
|
||||
(*player)[RtspPlayer::kRtpType] = atoi(argv[4]);
|
||||
player->play(argv[3]);
|
||||
playerList.push_back(player);
|
||||
return playerCnt--;
|
||||
});
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include <iostream>
|
||||
#include "Poller/EventPoller.h"
|
||||
#include "Rtsp/UDPServer.h"
|
||||
#include "Player/MediaPlayer.h"
|
||||
#include "Util/onceToken.h"
|
||||
#include "Device/PlayerProxy.h"
|
||||
#include "H264Decoder.h"
|
||||
#include "YuvDisplayer.h"
|
||||
#include "Network/sockutil.h"
|
||||
@@ -18,7 +18,7 @@ using namespace ZL::Util;
|
||||
using namespace ZL::Thread;
|
||||
using namespace ZL::Network;
|
||||
using namespace ZL::Rtsp;
|
||||
using namespace ZL::DEV;
|
||||
using namespace ZL::Player;
|
||||
|
||||
void programExit(int arg) {
|
||||
EventPoller::Instance().shutdown();
|
||||
@@ -30,9 +30,9 @@ int main(int argc, char *argv[]){
|
||||
//Logger::Instance().setWriter(std::make_shared<AsyncLogWriter>());
|
||||
signal(SIGINT, programExit);
|
||||
|
||||
if(argc != 5){
|
||||
FatalL << "\r\n测试方法:./test_player rtxp_url rtsp_user rtsp_pwd rtp_type\r\n"
|
||||
<< "例如:./test_player rtsp://127.0.0.1/live/0 admin 123456 0\r\n"
|
||||
if(argc != 3){
|
||||
FatalL << "\r\n测试方法:./test_player rtxp_url rtp_type\r\n"
|
||||
<< "例如:./test_player rtsp://admin:123456@127.0.0.1/live/0 0\r\n"
|
||||
<<endl;
|
||||
Logger::Destory();
|
||||
return 0;
|
||||
@@ -46,9 +46,8 @@ int main(int argc, char *argv[]){
|
||||
player->setOnShutdown([](const SockException &ex) {
|
||||
ErrorL << "OnShutdown:" << ex.what();
|
||||
});
|
||||
|
||||
//DebugL << argv[1] << " " << argv[2] << " " << argv[3] << " " << argv[4] << endl;
|
||||
player->play(argv[1],argv[2],argv[3],(PlayerBase::eRtpType)atoi(argv[4]));
|
||||
(*player)[RtspPlayer::kRtpType] = atoi(argv[2]);
|
||||
player->play(argv[1]);
|
||||
|
||||
H264Decoder decoder;
|
||||
YuvDisplayer displayer;
|
||||
|
||||
@@ -49,7 +49,7 @@ int main(int argc,char *argv[]){
|
||||
//support rtmp and rtsp url
|
||||
//just support H264+AAC
|
||||
auto urlList = {"rtmp://live.hkstv.hk.lxdns.com/live/hks",
|
||||
"rtsp://184.72.239.149/vod/mp4://BigBuckBunny_175k.mov"};
|
||||
"rtsp://admin:jzan123456@192.168.0.122/"};
|
||||
map<string , PlayerProxy::Ptr> proxyMap;
|
||||
int i=0;
|
||||
for(auto url : urlList){
|
||||
@@ -63,6 +63,7 @@ int main(int argc,char *argv[]){
|
||||
//rtsp://127.0.0.1/record/live/0/2017-04-11/11-09-38.mp4
|
||||
//rtmp://127.0.0.1/record/live/0/2017-04-11/11-09-38.mp4
|
||||
PlayerProxy::Ptr player(new PlayerProxy("live",to_string(i++).data()));
|
||||
(*player)[PlayerProxy::kAliveSecond] = 10;//录制10秒
|
||||
player->play(url);
|
||||
proxyMap.emplace(string(url),player);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user