MCPcopy Create free account
hub / github.com/FFMS/ffms2 / FillAP

Function FillAP

src/core/utils.cpp:65–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void FillAP(FFMS_AudioProperties &AP, AVCodecContext *CTX, FFMS_Track &Frames) {
66 AP.SampleFormat = static_cast<FFMS_SampleFormat>(av_get_packed_sample_fmt(CTX->sample_fmt));
67 AP.BitsPerSample = av_get_bytes_per_sample(CTX->sample_fmt) * 8;
68 AP.Channels = CTX->ch_layout.nb_channels;
69
70 if (CTX->ch_layout.order == AV_CHANNEL_ORDER_NATIVE) {
71 AP.ChannelLayout = CTX->ch_layout.u.mask;
72 } else if (CTX->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) {
73 AVChannelLayout ch = {};
74 av_channel_layout_default(&ch, CTX->ch_layout.nb_channels);
75 AP.ChannelLayout = ch.u.mask;
76 } else {
77 throw FFMS_Exception(FFMS_ERROR_DECODING, FFMS_ERROR_UNSUPPORTED, "Ambisonics and custom channel orders not supported");
78 }
79
80 AP.SampleRate = CTX->sample_rate;
81 if (!Frames.empty()) {
82 AP.NumSamples = (Frames.back()).SampleStart + (Frames.back()).SampleCount;
83 AP.FirstTime = ((Frames.front().PTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000;
84 AP.LastTime = ((Frames.back().PTS * Frames.TB.Num) / (double)Frames.TB.Den) / 1000;
85 AP.LastEndTime = (((Frames.back().PTS + Frames.LastDuration) * Frames.TB.Num) / (double)Frames.TB.Den) / 1000;
86 }
87}
88
89void LAVFOpenFile(const char *SourceFile, AVFormatContext *&FormatContext, int Track, const std::map<std::string, std::string> &LAVFOpts) {
90 AVDictionary *Dict = nullptr;

Callers 1

InitMethod · 0.85

Calls 4

FFMS_ExceptionClass · 0.85
emptyMethod · 0.80
backMethod · 0.80
frontMethod · 0.80

Tested by

no test coverage detected