Project

General

Profile

Bug #4679 ยป 0004-libva-2.patch

Michael Marley, 2017-11-08 00:47

View differences:

src/libav.c 2017-11-07 10:54:55.214736351 -0500
1 1
#include "transcoding/transcode.h"
2 2
#include "libav.h"
3
#if ENABLE_VAAPI
4
#include <va/va.h>
5
#endif
6 3

  
7 4
/**
8 5
 *
......
226 223
/**
227 224
 *
228 225
 */
229
#if ENABLE_VAAPI
230
#ifdef VA_FOURCC_I010
231
static void libav_va_log(int severity, const char *msg)
232
{
233
  char *s;
234
  int l;
235

  
236
  if (msg == NULL || *msg == '\0')
237
    return;
238
  s = tvh_strdupa(msg);
239
  l = strlen(s);
240
  if (s[l-1] == '\n')
241
    s[l-1] = '\0';
242
  tvhlog(severity, LS_VAAPI, "%s", s);
243
}
244

  
245
static void libav_va_error_callback(const char *msg)
246
{
247
  libav_va_log(LOG_ERR, msg);
248
}
249

  
250
static void libav_va_info_callback(const char *msg)
251
{
252
  libav_va_log(LOG_INFO, msg);
253
}
254
#endif
255
#endif
256

  
257
/**
258
 *
259
 */
260
static void
261
libav_vaapi_init(void)
262
{
263
#if ENABLE_VAAPI
264
#ifdef VA_FOURCC_I010
265
  vaSetErrorCallback(libav_va_error_callback);
266
  vaSetInfoCallback(libav_va_info_callback);
267
#endif
268
#endif
269
}
270

  
271
/**
272
 *
273
 */
274 226
void
275 227
libav_set_loglevel(void)
276 228
{
......
284 236
void
285 237
libav_init(void)
286 238
{
287
  libav_vaapi_init();
288 239
  libav_set_loglevel();
289 240
  av_log_set_callback(libav_log_callback);
290 241
  av_register_all();
......
301 252
{
302 253
  transcode_done();
303 254
  avformat_network_deinit();
304
}
255
}
305
-- src.old/transcoding/transcode/hwaccels/vaapi.c        2017-10-13 17:18:13.704323335 -0400
256
++ src/transcoding/transcode/hwaccels/vaapi.c  2017-11-07 09:22:02.316712298 -0500
......
51 51

  
52 52
static LIST_HEAD(, tvh_vaapi_device) tvhva_devices;
53 53

  
54
/**
55
 *
56
 */
57
#ifdef VA_FOURCC_I010
58
static void libav_va_log(int severity, const char *msg)
59
{
60
  char *s;
61
  int l;
62

  
63
  if (msg == NULL || *msg == '\0')
64
    return;
65
  s = tvh_strdupa(msg);
66
  l = strlen(s);
67
  if (s[l-1] == '\n')
68
    s[l-1] = '\0';
69
  tvhlog(severity, LS_VAAPI, "%s", s);
70
}
71

  
72
#if VA_CHECK_VERSION(1, 0, 0)
73
static void libav_va_error_callback(void *context, const char *msg)
74
#else
75
static void libav_va_error_callback(const char *msg)
76
#endif
77
{
78
  libav_va_log(LOG_ERR, msg);
79
}
80

  
81
#if VA_CHECK_VERSION(1, 0, 0)
82
static void libav_va_info_callback(void *context, const char *msg)
83
#else
84
static void libav_va_info_callback(const char *msg)
85
#endif
86
{
87
  libav_va_log(LOG_INFO, msg);
88
}
89
#endif
90

  
91

  
54 92

  
55 93
static AVBufferRef *
56 94
tvhva_init(const char *device)
......
409 447
    if (!(self->display = tvhva_context_display(self, avctx))) {
410 448
        return -1;
411 449
    }
450

  
451
#ifdef VA_FOURCC_I010
452
#if VA_CHECK_VERSION(1, 0, 0)
453
    vaSetErrorCallback(self->display, libav_va_error_callback, NULL);
454
    vaSetInfoCallback(self->display, libav_va_info_callback, NULL);
455
#else
456
    vaSetErrorCallback(libav_va_error_callback);
457
    vaSetInfoCallback(libav_va_info_callback);
458
#endif
459
#endif
460

  
412 461
    if ((profile = tvhva_context_profile(self, avctx)) == VAProfileNone ||
413 462
        tvhva_context_check_profile(self, profile)) {
414 463
        tvherror(LS_VAAPI, "%s: unsupported codec: %s and/or profile: %s",
    (1-1/1)