forked from forks/ffprobe-wasm
Compare commits
1 Commits
54b90ac7f5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
62ae9d08f0
|
@@ -47,6 +47,7 @@ typedef struct Stream {
|
|||||||
int channels;
|
int channels;
|
||||||
int sample_rate;
|
int sample_rate;
|
||||||
int frame_size;
|
int frame_size;
|
||||||
|
std::vector<Tag> tags;
|
||||||
} Stream;
|
} Stream;
|
||||||
|
|
||||||
typedef struct Chapter {
|
typedef struct Chapter {
|
||||||
@@ -54,6 +55,7 @@ typedef struct Chapter {
|
|||||||
std::string time_base;
|
std::string time_base;
|
||||||
float start;
|
float start;
|
||||||
float end;
|
float end;
|
||||||
|
std::vector<Tag> tags;
|
||||||
} Chapter;
|
} Chapter;
|
||||||
|
|
||||||
typedef struct Frame {
|
typedef struct Frame {
|
||||||
@@ -152,6 +154,15 @@ FileInfoResponse get_file_info(std::string filename) {
|
|||||||
.frame_size = (int)pLocalCodecParameters->frame_size,
|
.frame_size = (int)pLocalCodecParameters->frame_size,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Add tags to stream.
|
||||||
|
const AVDictionaryEntry *tag = NULL;
|
||||||
|
while ((tag = av_dict_get(pFormatContext->streams[i]->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
|
||||||
|
Tag t = {
|
||||||
|
.key = tag->key,
|
||||||
|
.value = tag->value,
|
||||||
|
};
|
||||||
|
stream.tags.push_back(t);
|
||||||
|
}
|
||||||
|
|
||||||
r.streams.push_back(stream);
|
r.streams.push_back(stream);
|
||||||
}
|
}
|
||||||
@@ -172,6 +183,15 @@ FileInfoResponse get_file_info(std::string filename) {
|
|||||||
.end = (float)chapter->end,
|
.end = (float)chapter->end,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Add tags to chapter.
|
||||||
|
const AVDictionaryEntry *tag = NULL;
|
||||||
|
while ((tag = av_dict_get(chapter->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
|
||||||
|
Tag t = {
|
||||||
|
.key = tag->key,
|
||||||
|
.value = tag->value,
|
||||||
|
};
|
||||||
|
c.tags.push_back(t);
|
||||||
|
}
|
||||||
|
|
||||||
r.chapters.push_back(c);
|
r.chapters.push_back(c);
|
||||||
}
|
}
|
||||||
@@ -334,6 +354,7 @@ EMSCRIPTEN_BINDINGS(structs) {
|
|||||||
.field("channels", &Stream::channels)
|
.field("channels", &Stream::channels)
|
||||||
.field("sample_rate", &Stream::sample_rate)
|
.field("sample_rate", &Stream::sample_rate)
|
||||||
.field("frame_size", &Stream::frame_size)
|
.field("frame_size", &Stream::frame_size)
|
||||||
|
.field("tags", &Stream::tags)
|
||||||
;
|
;
|
||||||
register_vector<Stream>("Stream");
|
register_vector<Stream>("Stream");
|
||||||
|
|
||||||
@@ -342,6 +363,7 @@ EMSCRIPTEN_BINDINGS(structs) {
|
|||||||
.field("time_base", &Chapter::time_base)
|
.field("time_base", &Chapter::time_base)
|
||||||
.field("start", &Chapter::start)
|
.field("start", &Chapter::start)
|
||||||
.field("end", &Chapter::end)
|
.field("end", &Chapter::end)
|
||||||
|
.field("tags", &Chapter::tags)
|
||||||
;
|
;
|
||||||
register_vector<Chapter>("Chapter");
|
register_vector<Chapter>("Chapter");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user