mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
[media] use c allocation to match ncvisual api
This commit is contained in:
parent
3ea1a79250
commit
c1ee44b1b7
@ -280,11 +280,13 @@ auto ffmpeg_details_init(void) -> ncvisual_details* {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto ffmpeg_create() -> ncvisual* {
|
auto ffmpeg_create() -> ncvisual* {
|
||||||
auto nc = new ncvisual{};
|
ncvisual* nc = static_cast<ncvisual*>(malloc(sizeof(*nc)));
|
||||||
|
if(nc){
|
||||||
if((nc->details = ffmpeg_details_init()) == nullptr){
|
if((nc->details = ffmpeg_details_init()) == nullptr){
|
||||||
delete nc;
|
free(nc);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nc;
|
return nc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "visual-details.h"
|
#include "visual-details.h"
|
||||||
|
|
||||||
auto none_create() -> ncvisual* {
|
ncvisual* none_create(){
|
||||||
return new ncvisual{};
|
return malloc(sizeof(ncvisual));
|
||||||
}
|
}
|
||||||
|
|
||||||
int none_decode(ncvisual* nc){
|
int none_decode(ncvisual* nc){
|
||||||
@ -15,7 +15,7 @@ int none_decode(ncvisual* nc) {
|
|||||||
|
|
||||||
ncvisual* none_from_file(const char* filename){
|
ncvisual* none_from_file(const char* filename){
|
||||||
(void)filename;
|
(void)filename;
|
||||||
return nullptr;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int none_decode_loop(ncvisual* ncv){
|
int none_decode_loop(ncvisual* ncv){
|
||||||
@ -46,8 +46,8 @@ int none_blit(struct ncvisual* ncv, int rows, int cols,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto none_stream(notcurses* nc, ncvisual* ncv, float timescale,
|
int none_stream(notcurses* nc, ncvisual* ncv, float timescale,
|
||||||
streamcb streamer, const struct ncvisual_options* vopts, void* curry) -> int {
|
streamcb streamer, const struct ncvisual_options* vopts, void* curry){
|
||||||
(void)nc;
|
(void)nc;
|
||||||
(void)ncv;
|
(void)ncv;
|
||||||
(void)timescale;
|
(void)timescale;
|
||||||
@ -59,34 +59,14 @@ auto none_stream(notcurses* nc, ncvisual* ncv, float timescale,
|
|||||||
|
|
||||||
char* none_subtitle(const ncvisual* ncv){ // no support in none
|
char* none_subtitle(const ncvisual* ncv){ // no support in none
|
||||||
(void)ncv;
|
(void)ncv;
|
||||||
return nullptr;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME before we can enable this, we need build an none::APPBUFFER-style
|
void none_details_seed(ncvisual* ncv){
|
||||||
// ImageBuf in ncvisual in ncvisual_from_rgba().
|
|
||||||
/*
|
|
||||||
auto ncvisual_rotate(ncvisual* ncv, double rads) -> int {
|
|
||||||
none::ROI roi(0, ncv->cols, 0, ncv->rows, 0, 1, 0, 4);
|
|
||||||
auto tmpibuf = std::move(*ncv->details->ibuf);
|
|
||||||
ncv->details->ibuf = std::make_unique<none::ImageBuf>();
|
|
||||||
none::ImageSpec sp{};
|
|
||||||
sp.set_format(none::TypeDesc(none::TypeDesc::UINT8, 4));
|
|
||||||
sp.nchannels = 4;
|
|
||||||
ncv->details->ibuf->reset();
|
|
||||||
if(!none::ImageBufAlgo::rotate(*ncv->details->ibuf, tmpibuf, rads, "", 0, true, roi)){
|
|
||||||
return NCERR_DECODE; // FIXME need we do anything further?
|
|
||||||
}
|
|
||||||
ncv->rowstride = ncv->cols * 4;
|
|
||||||
ncvisual_set_data(ncv, static_cast<uint32_t*>(ncv->details->ibuf->localpixels()), false);
|
|
||||||
return NCERR_SUCCESS;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
auto none_details_seed(ncvisual* ncv) -> void {
|
|
||||||
(void)ncv;
|
(void)ncv;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto none_details_destroy(struct ncvisual_details* ncv) -> void {
|
void none_details_destroy(struct ncvisual_details* ncv){
|
||||||
(void)ncv;
|
(void)ncv;
|
||||||
}
|
}
|
||||||
|
|
@ -34,11 +34,13 @@ auto oiio_details_destroy(ncvisual_details* deets) -> void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto oiio_create() -> ncvisual* {
|
auto oiio_create() -> ncvisual* {
|
||||||
auto nc = new ncvisual{};
|
ncvisual* nc = static_cast<ncvisual*>(malloc(sizeof(*nc)));
|
||||||
|
if(nc){
|
||||||
if((nc->details = oiio_details_init()) == nullptr){
|
if((nc->details = oiio_details_init()) == nullptr){
|
||||||
delete nc;
|
free(nc);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nc;
|
return nc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user