mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
libav: extract frame from AVFormatContext
This commit is contained in:
parent
66b06e9d91
commit
66432c37e1
@ -9,6 +9,23 @@ int notcurses_image_open(struct notcurses* nc, const char* filename){
|
||||
fprintf(stderr, "Couldn't open %s (%s)\n", filename, av_err2str(ret));
|
||||
return ret;
|
||||
}
|
||||
if((ret = avformat_find_stream_info(ps, NULL)) < 0){
|
||||
fprintf(stderr, "Error extracting stream info from %s (%s)\n", filename,
|
||||
av_err2str(ret));
|
||||
avformat_free_context(ps);
|
||||
return ret;
|
||||
}
|
||||
// av_dump_format(ps, 0, filename, false);
|
||||
AVPacket* packet = av_packet_alloc();
|
||||
if((ret = av_read_frame(ps, packet)) < 0){
|
||||
fprintf(stderr, "Error reading frame info from %s (%s)\n", filename,
|
||||
av_err2str(ret));
|
||||
av_packet_free(&packet);
|
||||
avformat_free_context(ps);
|
||||
return -1;
|
||||
}
|
||||
// FIXME
|
||||
av_packet_free(&packet);
|
||||
avformat_free_context(ps);
|
||||
return 0;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ TEST_F(NcplaneTest, VerticalLines) {
|
||||
ASSERT_LT(0, y);
|
||||
ASSERT_LT(0, x);
|
||||
cell c{};
|
||||
cell_load(n_, &c, "-");
|
||||
cell_load(n_, &c, "|");
|
||||
for(int xidx = 0 ; xidx < x - 1 ; ++xidx){
|
||||
EXPECT_EQ(0, ncplane_cursor_move_yx(n_, 1, xidx));
|
||||
EXPECT_EQ(y - 2, ncplane_vline(n_, &c, y - 2));
|
||||
|
Loading…
Reference in New Issue
Block a user