mirror of
https://github.com/Genymobile/scrcpy.git
synced 2024-09-19 05:31:21 +02:00
Retrieve icon decoder directly
The call to av_find_best_stream() gives the decoder directly, there is no need to retrieve it afterwards in a separate step.
This commit is contained in:
parent
9ea4446369
commit
77ebafd96c
1 changed files with 4 additions and 7 deletions
|
@ -78,7 +78,10 @@ decode_image(const char *path) {
|
||||||
goto close_input;
|
goto close_input;
|
||||||
}
|
}
|
||||||
|
|
||||||
int stream = av_find_best_stream(ctx, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0);
|
const AVCodec *codec;
|
||||||
|
|
||||||
|
int stream =
|
||||||
|
av_find_best_stream(ctx, AVMEDIA_TYPE_VIDEO, -1, -1, &codec, 0);
|
||||||
if (stream < 0 ) {
|
if (stream < 0 ) {
|
||||||
LOGE("Could not find best image stream");
|
LOGE("Could not find best image stream");
|
||||||
goto close_input;
|
goto close_input;
|
||||||
|
@ -86,12 +89,6 @@ decode_image(const char *path) {
|
||||||
|
|
||||||
AVCodecParameters *params = ctx->streams[stream]->codecpar;
|
AVCodecParameters *params = ctx->streams[stream]->codecpar;
|
||||||
|
|
||||||
const AVCodec *codec = avcodec_find_decoder(params->codec_id);
|
|
||||||
if (!codec) {
|
|
||||||
LOGE("Could not find image decoder");
|
|
||||||
goto close_input;
|
|
||||||
}
|
|
||||||
|
|
||||||
AVCodecContext *codec_ctx = avcodec_alloc_context3(codec);
|
AVCodecContext *codec_ctx = avcodec_alloc_context3(codec);
|
||||||
if (!codec_ctx) {
|
if (!codec_ctx) {
|
||||||
LOG_OOM();
|
LOG_OOM();
|
||||||
|
|
Loading…
Reference in a new issue