Skip to content

Commit

Permalink
Add support for xrgb/xbgr 2101010 formats
Browse files Browse the repository at this point in the history
  • Loading branch information
mstoeckl authored and ammen99 committed May 1, 2022
1 parent 9cad079 commit f2b7791
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/frame-writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ AVPixelFormat FrameWriter::get_input_format()
return AV_PIX_FMT_RGB565LE;
case INPUT_FORMAT_BGR565:
return AV_PIX_FMT_BGR565LE;
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(56, 55, 100)
case INPUT_FORMAT_X2RGB10:
return AV_PIX_FMT_X2RGB10LE;
#endif
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 7, 100)
case INPUT_FORMAT_X2BGR10:
return AV_PIX_FMT_X2BGR10LE;
#endif
default:
std::cerr << "Unknown format: " << params.format << std::endl;
std::exit(-1);
Expand Down
2 changes: 2 additions & 0 deletions src/frame-writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ enum InputFormat
INPUT_FORMAT_BGR8,
INPUT_FORMAT_RGB565,
INPUT_FORMAT_BGR565,
INPUT_FORMAT_X2RGB10,
INPUT_FORMAT_X2BGR10,
};

struct FrameWriterParams
Expand Down
6 changes: 6 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,12 @@ static InputFormat get_input_format(wf_buffer& buffer)
return INPUT_FORMAT_RGB565;
case WL_SHM_FORMAT_BGR565:
return INPUT_FORMAT_BGR565;
case WL_SHM_FORMAT_ARGB2101010:
case WL_SHM_FORMAT_XRGB2101010:
return INPUT_FORMAT_X2RGB10;
case WL_SHM_FORMAT_ABGR2101010:
case WL_SHM_FORMAT_XBGR2101010:
return INPUT_FORMAT_X2BGR10;
default:
fprintf(stderr, "Unsupported buffer format %d, exiting.", buffer.format);
std::exit(0);
Expand Down

0 comments on commit f2b7791

Please sign in to comment.