2018-10-25 10:00:17 +08:00
|
|
|
|
/*
|
2020-04-04 20:30:09 +08:00
|
|
|
|
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
|
2018-10-25 10:00:17 +08:00
|
|
|
|
*
|
|
|
|
|
|
* This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit).
|
|
|
|
|
|
*
|
2020-04-04 20:30:09 +08:00
|
|
|
|
* Use of this source code is governed by MIT license that can be found in the
|
|
|
|
|
|
* LICENSE file in the root of the source tree. All contributing project authors
|
|
|
|
|
|
* may be found in the AUTHORS file in the root of the source tree.
|
2018-10-25 10:00:17 +08:00
|
|
|
|
*/
|
2020-04-04 20:30:09 +08:00
|
|
|
|
|
2019-06-28 17:25:53 +08:00
|
|
|
|
#include "Rtmp.h"
|
|
|
|
|
|
#include "Extension/Factory.h"
|
2018-10-24 17:17:55 +08:00
|
|
|
|
namespace mediakit{
|
|
|
|
|
|
|
2019-09-23 16:47:20 +08:00
|
|
|
|
VideoMeta::VideoMeta(const VideoTrack::Ptr &video,int datarate ){
|
2019-06-28 17:25:53 +08:00
|
|
|
|
if(video->getVideoWidth() > 0 ){
|
2019-09-23 16:47:20 +08:00
|
|
|
|
_metadata.set("width", video->getVideoWidth());
|
2019-06-28 17:25:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
if(video->getVideoHeight() > 0 ){
|
2019-09-23 16:47:20 +08:00
|
|
|
|
_metadata.set("height", video->getVideoHeight());
|
2019-06-28 17:25:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
if(video->getVideoFps() > 0 ){
|
2019-09-23 16:47:20 +08:00
|
|
|
|
_metadata.set("framerate", video->getVideoFps());
|
2019-06-28 17:25:53 +08:00
|
|
|
|
}
|
2019-09-23 16:47:20 +08:00
|
|
|
|
_metadata.set("videodatarate", datarate);
|
2019-06-28 17:25:53 +08:00
|
|
|
|
_codecId = video->getCodecId();
|
2019-09-23 16:47:20 +08:00
|
|
|
|
_metadata.set("videocodecid", Factory::getAmfByCodecId(_codecId));
|
2019-06-28 17:25:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-09-23 16:47:20 +08:00
|
|
|
|
AudioMeta::AudioMeta(const AudioTrack::Ptr &audio,int datarate){
|
|
|
|
|
|
_metadata.set("audiodatarate", datarate);
|
2019-06-28 17:25:53 +08:00
|
|
|
|
if(audio->getAudioSampleRate() > 0){
|
2019-09-23 16:47:20 +08:00
|
|
|
|
_metadata.set("audiosamplerate", audio->getAudioSampleRate());
|
2019-06-28 17:25:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
if(audio->getAudioSampleBit() > 0){
|
2019-09-23 16:47:20 +08:00
|
|
|
|
_metadata.set("audiosamplesize", audio->getAudioSampleBit());
|
2019-06-28 17:25:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
if(audio->getAudioChannel() > 0){
|
2019-09-23 16:47:20 +08:00
|
|
|
|
_metadata.set("audiochannels", audio->getAudioChannel());
|
|
|
|
|
|
_metadata.set("stereo", audio->getAudioChannel() > 1);
|
2019-06-28 17:25:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
_codecId = audio->getCodecId();
|
2019-09-23 16:47:20 +08:00
|
|
|
|
_metadata.set("audiocodecid", Factory::getAmfByCodecId(_codecId));
|
2019-06-28 17:25:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}//namespace mediakit
|