-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide output pixel format #24
Provide output pixel format #24
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks!
There are two small things we should fix before merging: av_get_pix_fmt can receive inccorect data and we should update docs for Xav.Decoder.new/2
as it states that data is always returned in RGB format.
I also wonder if we should somehow let people know (besides changelog) that rgb is no longer the default out format 🤔
The list of accepted formats are all `ffmpeg` pixel formats. For a complete list run: | ||
|
||
```sh | ||
ffmpeg -pix_fmts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate instruction how to get a list of possible formats!
c_src/xav/decoder.h
Outdated
@@ -16,7 +17,7 @@ struct Decoder { | |||
|
|||
struct Decoder *decoder_alloc(); | |||
|
|||
int decoder_init(struct Decoder *decoder, const char *codec); | |||
int decoder_init(struct Decoder *decoder, const char *codec, const char* format); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick, and could we do the same in decoder.c?
int decoder_init(struct Decoder *decoder, const char *codec, const char* format); | |
int decoder_init(struct Decoder *decoder, const char *codec, const char* out_format); |
if (out_pix_fmt == AV_PIX_FMT_NONE) { | ||
return xav_nif_video_frame_to_term(env, frame); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thnk we should distinct between a case where someone didn't pass out_format
and someone passed out_format
but it was incorrect.
In decoder_init
, we should check whether out_format
is nil. If yes, set out_format
field in decoder to null. If not, try to call av_get_pix_fmt
. If av_get_pix_fmt
returns AV_PIX_FMT_NONE
, return an error.
Would be great! |
Perhaps we can add a warning log if the |
Let's leave it as it is. Such warning would be too noisy imo |
Fix #23
Later on I'll extract the converter to be standalone (to be used as an Elixir module independent of the decoder, it may be useful)