fix up averr->ncerr #532

pull/534/head
nick black 4 years ago committed by Nick Black
parent a28a4f281e
commit 21822f98e7

@ -5,6 +5,15 @@ rearrangements of Notcurses.
* The `ncdplot` type has been added for plots based on `double`s rather than
`uint64_t`s. The `ncplot` type and all `ncplot_*` functions were renamed
`ncuplot` for symmetry.
* FFMpeg types are no longer leaked through the Notcurses API. `AVERROR`
is no longer applicable, and `ncvisual_decode()` no longer returns a
`struct AVframe*`. Instead, the `nc_err_e` enumeration has been introduced.
Functions which once accepted a value-result `AVERROR` now accept a value-
result `nc_err_e`. The relevant constants can be found in
`notcurses/ncerrs.h`.
* CMake no longer uses the `USE_FFMPEG` option. Instead, the `USE_MULTIMEDIA`
option can be defined as `ffmpeg`, `oiio`, or `none`. In `cmake-gui`, this
item will now appear as an option selector.
* 1.3.2 (2020-04-19)
* `ncdirect_cursor_push()`, `notcurses_cursor_pop()`, and

@ -13,7 +13,7 @@ extern "C" {
typedef enum {
NCERR_SUCCESS = 0,
NCERR_NOMEM = ENOMEM,
NCERR_EOF = 0x464f45, // matches AVERROR_EOF
NCERR_EOF = 0x20464f45, // matches AVERROR_EOF
} nc_err_e;
static inline const char*

@ -163,6 +163,7 @@ char* ncvisual_subtitle(const ncvisual* ncv){
static nc_err_e
averr2ncerr(int averr){
// FIXME need to map averror codes to ncerrors
//fprintf(stderr, "AVERR: %d/%x %d/%x\n", averr, averr, -averr, -averr);
return -averr;
}

@ -49,12 +49,12 @@ TEST_CASE("Multimedia") {
}
SUBCASE("LoadImage") {
nc_err_e ncerr;
nc_err_e ncerr = NCERR_SUCCESS;
int dimy, dimx;
ncplane_dim_yx(ncp_, &dimy, &dimx);
auto ncv = ncplane_visual_open(ncp_, find_data("changes.jpg"), &ncerr);
REQUIRE(ncv);
REQUIRE(0 == ncerr);
REQUIRE(NCERR_SUCCESS == ncerr);
auto frame = ncvisual_decode(ncv, &ncerr);
REQUIRE(frame);
REQUIRE(0 == ncerr);
@ -69,15 +69,15 @@ TEST_CASE("Multimedia") {
}
SUBCASE("PlaneDuplicate") {
nc_err_e ncerr;
nc_err_e ncerr = NCERR_SUCCESS;
int dimy, dimx;
ncplane_dim_yx(ncp_, &dimy, &dimx);
auto ncv = ncplane_visual_open(ncp_, find_data("changes.jpg"), &ncerr);
REQUIRE(ncv);
REQUIRE(0 == ncerr);
REQUIRE(NCERR_SUCCESS == ncerr);
auto frame = ncvisual_decode(ncv, &ncerr);
REQUIRE(frame);
REQUIRE(0 == ncerr);
REQUIRE(NCERR_SUCCESS == ncerr);
CHECK(dimy * 2 == frame->height);
CHECK(dimx == frame->width);
CHECK(0 < ncvisual_render(ncv, 0, 0, -1, -1));
@ -96,12 +96,12 @@ TEST_CASE("Multimedia") {
}
SUBCASE("LoadVideo") {
nc_err_e ncerr;
nc_err_e ncerr = NCERR_SUCCESS;
int dimy, dimx;
ncplane_dim_yx(ncp_, &dimy, &dimx);
auto ncv = ncplane_visual_open(ncp_, find_data("samoa.avi"), &ncerr);
REQUIRE(ncv);
CHECK(0 == ncerr);
CHECK(NCERR_SUCCESS == ncerr);
for(;;){ // run at the highest speed we can
auto frame = ncvisual_decode(ncv, &ncerr);
if(!frame){
@ -118,15 +118,15 @@ TEST_CASE("Multimedia") {
}
SUBCASE("LoadVideoCreatePlane") {
nc_err_e ncerr;
nc_err_e ncerr = NCERR_SUCCESS;
int dimy, dimx;
ncplane_dim_yx(ncp_, &dimy, &dimx);
auto ncv = ncvisual_open_plane(nc_, find_data("notcursesI.avi"), &ncerr, 0, 0, NCSCALE_STRETCH);
REQUIRE(ncv);
CHECK(0 == ncerr);
CHECK(NCERR_SUCCESS == ncerr);
auto frame = ncvisual_decode(ncv, &ncerr);
REQUIRE_NE(nullptr, frame);
CHECK(0 == ncerr);
CHECK(NCERR_SUCCESS == ncerr);
CHECK(dimy * 2 == frame->height);
CHECK(dimx == frame->width);
CHECK(0 < ncvisual_render(ncv, 0, 0, -1, -1));

Loading…
Cancel
Save