Skip to content

Commit

Permalink
Enable libva message callbacks.
Browse files Browse the repository at this point in the history
  • Loading branch information
rofafor committed Mar 4, 2018
1 parent 66568ea commit 957ede1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ extern void LogMessage(int trace, int level, const char *format, ...) __attribut
#define Debug10(a...) LogMessage(10, 2, a) // FFMPEG: info
#define Debug11(a...) LogMessage(11, 2, a) // FFMPEG: warning
#define Debug12(a...) LogMessage(12, 2, a) // FFMPEG: error
#define Debug13(a...) LogMessage(13, 2, a) // TBD
#define Debug13(a...) LogMessage(13, 2, a) // libva
#define Debug14(a...) LogMessage(14, 2, a) // TBD
#define Debug15(a...) LogMessage(14, 2, a) // TBD
#define Debug16(a...) LogMessage(16, 2, a) // TBD
Expand Down
21 changes: 21 additions & 0 deletions video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,20 @@ static void VaapiInitSurfaceFlags(VaapiDecoder * decoder)
}
}

#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57,107,100) // FFMPEG 3.4
#if VA_CHECK_VERSION(1,0,0)
static void VaapiInfoCallback(void *context, const char *msg)
{
Debug13("libva: %s", msg);
}

static void VaapiErrorCallback(void *context, const char *msg)
{
Debug13("libva/error: %s", msg);
}
#endif
#endif

///
/// Allocate new VA-API decoder.
///
Expand Down Expand Up @@ -1207,6 +1221,13 @@ static VaapiDecoder *VaapiNewHwDecoder(VideoStream * stream)
decoder->VideoWidth = VideoWindowWidth;
decoder->VideoHeight = VideoWindowHeight;

#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57,107,100) // FFMPEG 3.4
#if VA_CHECK_VERSION(1,0,0)
vaSetInfoCallback(decoder->VaDisplay, VaapiInfoCallback, NULL);
vaSetErrorCallback(decoder->VaDisplay, VaapiErrorCallback, NULL);
#endif
#endif

VaapiInitSurfaceFlags(decoder);

decoder->Image->image_id = VA_INVALID_ID;
Expand Down

0 comments on commit 957ede1

Please sign in to comment.