Pre Merge pull request !21 from Leon/master

This commit is contained in:
Leon 2022-10-20 03:01:50 +00:00 committed by Gitee
commit 5a470120a5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 37 additions and 6 deletions

View File

@ -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());

View File

@ -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();
}

View File

@ -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:

View File

@ -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();
}

View File

@ -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:

View File

@ -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;};
};
/**