mirror of
https://gitee.com/xia-chu/ZLMediaKit.git
synced 2026-05-23 01:57:50 +08:00
Pre Merge pull request !21 from Leon/master
This commit is contained in:
commit
5a470120a5
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
|
||||
*
|
||||
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
|
||||
@ -373,6 +373,7 @@ Value makeMediaSourceJson(MediaSource &media){
|
||||
}
|
||||
case TrackVideo : {
|
||||
auto video_track = dynamic_pointer_cast<VideoTrack>(track);
|
||||
video_track->flush();
|
||||
obj["width"] = video_track->getVideoWidth();
|
||||
obj["height"] = video_track->getVideoHeight();
|
||||
obj["fps"] = round(video_track->getVideoFps());
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
|
||||
*
|
||||
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
|
||||
@ -142,6 +142,17 @@ float H264Track::getVideoFps() const {
|
||||
return _fps;
|
||||
}
|
||||
|
||||
void H264Track::flush() const {
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
float fps = 0.0;
|
||||
if(getAVCInfo(_sps, w, h, fps)){
|
||||
_width = w;
|
||||
_height = h;
|
||||
_fps = fps;
|
||||
}
|
||||
}
|
||||
|
||||
bool H264Track::ready() {
|
||||
return !_sps.empty() && !_pps.empty();
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
|
||||
*
|
||||
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
|
||||
@ -128,6 +128,7 @@ public:
|
||||
int getVideoHeight() const override;
|
||||
int getVideoWidth() const override;
|
||||
float getVideoFps() const override;
|
||||
void flush() override;
|
||||
bool inputFrame(const Frame::Ptr &frame) override;
|
||||
|
||||
private:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
|
||||
*
|
||||
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
|
||||
@ -88,6 +88,17 @@ float H265Track::getVideoFps() const {
|
||||
return _fps;
|
||||
}
|
||||
|
||||
void H265Track::flush() {
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
float fps = 0.0;
|
||||
if(getHEVCInfo(_vps,_sps, w, h, fps)){
|
||||
_width = w;
|
||||
_height = h;
|
||||
_fps = fps;
|
||||
}
|
||||
}
|
||||
|
||||
bool H265Track::ready() {
|
||||
return !_vps.empty() && !_sps.empty() && !_pps.empty();
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
|
||||
*
|
||||
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
|
||||
@ -150,6 +150,7 @@ public:
|
||||
int getVideoWidth() const override;
|
||||
int getVideoHeight() const override;
|
||||
float getVideoFps() const override;
|
||||
void flush() override;
|
||||
bool inputFrame(const Frame::Ptr &frame) override;
|
||||
|
||||
private:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
|
||||
*
|
||||
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
|
||||
@ -92,6 +92,12 @@ public:
|
||||
* 返回视频fps
|
||||
*/
|
||||
virtual float getVideoFps() const {return 0;};
|
||||
|
||||
/**
|
||||
* 刷新宽高帧率
|
||||
*/
|
||||
|
||||
virtual void flush() {return;};
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user