BMediaEncoder: Proper handling of i/o formats

This commit is contained in:
Dario Casalinuovo
2015-12-04 01:33:52 +01:00
parent 3bc039b9f1
commit 2d50879085
+6 -10
View File
@@ -16,8 +16,6 @@
#include "debug.h" #include "debug.h"
//TODO: SetTo, SetFormat, Enode Class
/************************************************************* /*************************************************************
* public BMediaEncoder * public BMediaEncoder
*************************************************************/ *************************************************************/
@@ -81,13 +79,8 @@ BMediaEncoder::SetTo(const media_format* outputFormat)
err = gPluginManager.CreateEncoder(&fEncoder, format); err = gPluginManager.CreateEncoder(&fEncoder, format);
if (fEncoder != NULL && err == B_OK) { if (fEncoder != NULL && err == B_OK) {
err = _AttachToEncoder(); err = _AttachToEncoder();
if (err == B_OK) { if (err == B_OK)
err = SetFormat(NULL, &format); return err;
if (err == B_OK) {
fInitStatus = B_OK;
return B_OK;
}
}
} }
ReleaseEncoder(); ReleaseEncoder();
fInitStatus = err; fInitStatus = err;
@@ -127,7 +120,10 @@ BMediaEncoder::SetFormat(media_format* inputFormat,
if (!fEncoder) if (!fEncoder)
return B_NO_INIT; return B_NO_INIT;
//TODO: How we support output_format and mfi? if (outputFormat != NULL)
SetTo(outputFormat);
//TODO: How we support mfi?
return fEncoder->SetUp(inputFormat); return fEncoder->SetUp(inputFormat);
} }