Commit a5b4ebf1 authored by François Grisez's avatar François Grisez
Browse files

Rewrite MSVideoToolboxH264Decoder into C++

parent 8b6587f0
......@@ -31,10 +31,11 @@ namespace mediastreamer {
virtual MSVideoSize getVideoSize() const = 0;
virtual float getFps() const = 0;
virtual const MSFmtDescriptor *getOutFmt() const = 0;
virtual const MSFmtDescriptor *getOutputFmt() const = 0;
virtual void addFmtp(const char *fmtp) = 0;
virtual void enableAvpf(bool enable) = 0;
virtual bool freezeOnErrorEnabled() const = 0;
virtual void enableFreezeOnError(bool enable) = 0;
virtual void resetFirstImage() = 0;
};
......
......@@ -45,8 +45,8 @@ protected:
void notify(unsigned int id) {ms_filter_notify_no_arg(_f, id);}
void lock() {ms_filter_lock(_f);}
void unlock() {ms_filter_unlock(_f);}
void lock() const {ms_filter_lock(_f);}
void unlock() const {ms_filter_unlock(_f);}
private:
MSFilter *_f = nullptr;
......
......@@ -65,7 +65,7 @@ int DecodingFilterWrapper::onGetFpsCall(MSFilter *f, void *arg) {
int DecodingFilterWrapper::onGetOutFmtCall(MSFilter *f, void *arg) {
try {
MSPinFormat *pinFormat = static_cast<MSPinFormat *>(arg);
pinFormat->fmt = static_cast<DecodingFilterImpl *>(f->data)->getOutFmt();
pinFormat->fmt = static_cast<DecodingFilterImpl *>(f->data)->getOutputFmt();
return 0;
} catch (const DecodingFilterImpl::MethodCallFailed &) {
return -1;
......@@ -92,4 +92,14 @@ int DecodingFilterWrapper::onEnableFreezeOnErrorCall(MSFilter *f, void *arg) {
}
}
int DecodingFilterWrapper::onFreezeOnErrorEnabledCall(MSFilter *f, void *arg) {
try {
bool_t *foeEnabled = static_cast<bool_t *>(arg);
*foeEnabled = static_cast<DecodingFilterImpl *>(f->data)->freezeOnErrorEnabled();
return 0;
} catch (const DecodingFilterImpl::MethodCallFailed &) {
return -1;
}
}
}
......@@ -35,21 +35,23 @@ public:
static int onGetOutFmtCall(MSFilter *f, void *arg);
static int onEnableAvpfCall(MSFilter *f, void *arg);
static int onEnableFreezeOnErrorCall(MSFilter *f, void *arg);
static int onFreezeOnErrorEnabledCall(MSFilter *f, void *arg);
};
};
}
#define MS_DECODING_FILTER_WRAPPER_METHODS_DECLARATION(base_name) \
static MSFilterMethod MS_FILTER_WRAPPER_METHODS_NAME(base_name)[] = { \
{ MS_FILTER_ADD_FMTP , DecodingFilterWrapper::onAddFmtpCall }, \
{ MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION , DecodingFilterWrapper::onResetFirstImageCall }, \
{ MS_FILTER_GET_VIDEO_SIZE , DecodingFilterWrapper::onGetVideoSizeCall }, \
{ MS_FILTER_GET_FPS , DecodingFilterWrapper::onGetFpsCall }, \
{ MS_FILTER_GET_OUTPUT_FMT , DecodingFilterWrapper::onGetOutFmtCall }, \
{ MS_VIDEO_DECODER_ENABLE_AVPF , DecodingFilterWrapper::onEnableAvpfCall }, \
{ MS_VIDEO_DECODER_FREEZE_ON_ERROR , DecodingFilterWrapper::onEnableFreezeOnErrorCall }, \
{ 0 , nullptr } \
};
{ MS_FILTER_ADD_FMTP , DecodingFilterWrapper::onAddFmtpCall }, \
{ MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION , DecodingFilterWrapper::onResetFirstImageCall }, \
{ MS_FILTER_GET_VIDEO_SIZE , DecodingFilterWrapper::onGetVideoSizeCall }, \
{ MS_FILTER_GET_FPS , DecodingFilterWrapper::onGetFpsCall }, \
{ MS_FILTER_GET_OUTPUT_FMT , DecodingFilterWrapper::onGetOutFmtCall }, \
{ MS_VIDEO_DECODER_ENABLE_AVPF , DecodingFilterWrapper::onEnableAvpfCall }, \
{ MS_VIDEO_DECODER_FREEZE_ON_ERROR , DecodingFilterWrapper::onEnableFreezeOnErrorCall }, \
{ MS_VIDEO_DECODER_FREEZE_ON_ERROR_ENABLED , DecodingFilterWrapper::onFreezeOnErrorEnabledCall }, \
{ 0 , nullptr } \
}
#define MS_DECODING_FILTER_WRAPPER_DESCRIPTION_DECLARATION(base_name, id, text, enc_fmt, flags) \
MS_FILTER_WRAPPER_FILTER_DESCRIPTION_BASE(base_name, id, text, MS_FILTER_DECODER, enc_fmt, 1, 1, flags)
This diff is collapsed.
......@@ -340,7 +340,7 @@ float MediaCodecDecoderFilterImpl::getFps() const {
return ms_average_fps_get(&_fps);
}
const MSFmtDescriptor *MediaCodecDecoderFilterImpl::getOutFmt() const {
const MSFmtDescriptor *MediaCodecDecoderFilterImpl::getOutputFmt() const {
return ms_factory_get_video_format(getFactory(), "YUV420P", ms_video_size_make(_vsize.width, _vsize.height), 0, nullptr);
}
......
......@@ -87,7 +87,7 @@ public:
MSVideoSize getVideoSize() const override;
float getFps() const override;
const MSFmtDescriptor *getOutFmt() const override;
const MSFmtDescriptor *getOutputFmt() const override;
void addFmtp(const char *fmtp) override {}
void enableAvpf(bool enable) override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment