mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 02:34:26 +08:00
新增mk_media_source_get_track方法: #2530
This commit is contained in:
parent
d3f1c2fab1
commit
24fb666fb3
@ -12,6 +12,7 @@
|
|||||||
#define MK_EVENT_OBJECTS_H
|
#define MK_EVENT_OBJECTS_H
|
||||||
#include "mk_common.h"
|
#include "mk_common.h"
|
||||||
#include "mk_tcp.h"
|
#include "mk_tcp.h"
|
||||||
|
#include "mk_track.h"
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -95,6 +96,10 @@ API_EXPORT const char* API_CALL mk_media_source_get_stream(const mk_media_source
|
|||||||
API_EXPORT int API_CALL mk_media_source_get_reader_count(const mk_media_source ctx);
|
API_EXPORT int API_CALL mk_media_source_get_reader_count(const mk_media_source ctx);
|
||||||
//MediaSource::totalReaderCount()
|
//MediaSource::totalReaderCount()
|
||||||
API_EXPORT int API_CALL mk_media_source_get_total_reader_count(const mk_media_source ctx);
|
API_EXPORT int API_CALL mk_media_source_get_total_reader_count(const mk_media_source ctx);
|
||||||
|
// get track count from MediaSource
|
||||||
|
API_EXPORT int API_CALL mk_media_source_get_track_count(const mk_media_source ctx);
|
||||||
|
// get track by index from MediaSource
|
||||||
|
API_EXPORT mk_track API_CALL mk_media_source_get_track(const mk_media_source ctx, int index);
|
||||||
/**
|
/**
|
||||||
* 直播源在ZLMediaKit中被称作为MediaSource,
|
* 直播源在ZLMediaKit中被称作为MediaSource,
|
||||||
* 目前支持3种,分别是RtmpMediaSource、RtspMediaSource、HlsMediaSource
|
* 目前支持3种,分别是RtmpMediaSource、RtspMediaSource、HlsMediaSource
|
||||||
|
@ -198,6 +198,22 @@ API_EXPORT int API_CALL mk_media_source_get_total_reader_count(const mk_media_so
|
|||||||
return src->totalReaderCount();
|
return src->totalReaderCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
API_EXPORT int API_CALL mk_media_source_get_track_count(const mk_media_source ctx) {
|
||||||
|
assert(ctx);
|
||||||
|
MediaSource *src = (MediaSource *)ctx;
|
||||||
|
return src->getTracks(false).size();
|
||||||
|
}
|
||||||
|
|
||||||
|
API_EXPORT mk_track API_CALL mk_media_source_get_track(const mk_media_source ctx, int index) {
|
||||||
|
assert(ctx);
|
||||||
|
MediaSource *src = (MediaSource *)ctx;
|
||||||
|
auto tracks = src->getTracks(false);
|
||||||
|
if (index < 0 && index >= tracks.size()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return reinterpret_cast<mk_track>(& (tracks[index]));
|
||||||
|
}
|
||||||
|
|
||||||
API_EXPORT int API_CALL mk_media_source_close(const mk_media_source ctx,int force){
|
API_EXPORT int API_CALL mk_media_source_close(const mk_media_source ctx,int force){
|
||||||
assert(ctx);
|
assert(ctx);
|
||||||
MediaSource *src = (MediaSource *)ctx;
|
MediaSource *src = (MediaSource *)ctx;
|
||||||
|
Loading…
Reference in New Issue
Block a user