mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #316, add codec info to stream.
This commit is contained in:
parent
8bf60895a9
commit
04f3f2a8f8
8 changed files with 286 additions and 50 deletions
|
@ -33,6 +33,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include <srs_kernel_codec.hpp>
|
||||
|
||||
class SrsRequest;
|
||||
|
||||
struct SrsStatisticVhost
|
||||
|
@ -53,9 +55,33 @@ public:
|
|||
std::string app;
|
||||
std::string stream;
|
||||
std::string url;
|
||||
public:
|
||||
bool has_video;
|
||||
SrsCodecVideo vcodec;
|
||||
// profile_idc, H.264-AVC-ISO_IEC_14496-10.pdf, page 45.
|
||||
u_int8_t avc_profile;
|
||||
// level_idc, H.264-AVC-ISO_IEC_14496-10.pdf, page 45.
|
||||
u_int8_t avc_level;
|
||||
public:
|
||||
bool has_audio;
|
||||
SrsCodecAudio acodec;
|
||||
SrsCodecAudioSampleRate asample_rate;
|
||||
SrsCodecAudioSoundType asound_type;
|
||||
/**
|
||||
* audio specified
|
||||
* audioObjectType, in 1.6.2.1 AudioSpecificConfig, page 33,
|
||||
* 1.5.1.1 Audio object type definition, page 23,
|
||||
* in aac-mp4a-format-ISO_IEC_14496-3+2001.pdf.
|
||||
*/
|
||||
u_int8_t aac_profile;
|
||||
public:
|
||||
SrsStatisticStream();
|
||||
virtual ~SrsStatisticStream();
|
||||
public:
|
||||
/**
|
||||
* close the stream.
|
||||
*/
|
||||
virtual void close();
|
||||
};
|
||||
|
||||
struct SrsStatisticClient
|
||||
|
@ -73,7 +99,7 @@ private:
|
|||
int64_t _server_id;
|
||||
// key: vhost name, value: vhost object.
|
||||
std::map<std::string, SrsStatisticVhost*> vhosts;
|
||||
// key: stream name, value: stream object.
|
||||
// key: stream url, value: stream object.
|
||||
std::map<std::string, SrsStatisticStream*> streams;
|
||||
// key: client id, value: stream object.
|
||||
std::map<int, SrsStatisticClient*> clients;
|
||||
|
@ -82,6 +108,24 @@ private:
|
|||
virtual ~SrsStatistic();
|
||||
public:
|
||||
static SrsStatistic* instance();
|
||||
public:
|
||||
/**
|
||||
* when got video info for stream.
|
||||
*/
|
||||
virtual int on_video_info(SrsRequest* req,
|
||||
SrsCodecVideo vcodec, u_int8_t avc_profile, u_int8_t avc_level
|
||||
);
|
||||
/**
|
||||
* when got audio info for stream.
|
||||
*/
|
||||
virtual int on_audio_info(SrsRequest* req,
|
||||
SrsCodecAudio acodec, SrsCodecAudioSampleRate asample_rate, SrsCodecAudioSoundType asound_type,
|
||||
u_int8_t aac_profile
|
||||
);
|
||||
/**
|
||||
* when close stream.
|
||||
*/
|
||||
virtual void on_stream_close(SrsRequest* req);
|
||||
public:
|
||||
/**
|
||||
* when got a client to publish/play stream,
|
||||
|
@ -90,9 +134,9 @@ public:
|
|||
*/
|
||||
virtual int on_client(int id, SrsRequest* req);
|
||||
/**
|
||||
* client close
|
||||
* client disconnect
|
||||
*/
|
||||
virtual void on_close(int id);
|
||||
virtual void on_disconnect(int id);
|
||||
public:
|
||||
/**
|
||||
* get the server id, used to identify the server.
|
||||
|
@ -107,6 +151,9 @@ public:
|
|||
* dumps the streams to sstream in json.
|
||||
*/
|
||||
virtual int dumps_streams(std::stringstream& ss);
|
||||
private:
|
||||
virtual SrsStatisticVhost* create_vhost(SrsRequest* req);
|
||||
virtual SrsStatisticStream* create_stream(SrsStatisticVhost* vhost, SrsRequest* req);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue