[FFmpeg-devel] [PATCH] avcodec/qsv: export session management functionality

2016-04-11 Thread nablet developer
Signed-off-by: nablet developer 
---
 libavcodec/qsv.c  | 64 +--
 libavcodec/qsv.h  | 53 +++
 libavcodec/qsv_api.c  | 26 +++
 libavcodec/qsv_internal.h | 15 +--
 libavcodec/qsvdec.c   | 13 +-
 libavcodec/qsvdec.h   |  3 ++-
 libavcodec/qsvenc.c   | 16 ++--
 libavcodec/qsvenc.h   |  2 +-
 8 files changed, 125 insertions(+), 67 deletions(-)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 4c8e6b0..81d1f0c 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -18,14 +18,19 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include 
-#include 
-
 #include 
 #include 
 
 #include "libavutil/avstring.h"
 #include "libavutil/error.h"
+#include "libavutil/log.h"
+
+#include "qsv.h"
+
+#if CONFIG_QSV
+
+#include 
+#include 
 
 #include "avcodec.h"
 #include "qsv_internal.h"
@@ -51,7 +56,7 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
 return AVERROR(ENOSYS);
 }
 
-int ff_qsv_error(int mfx_err)
+int av_qsv_error(int mfx_err)
 {
 switch (mfx_err) {
 case MFX_ERR_NONE:
@@ -85,7 +90,7 @@ int ff_qsv_error(int mfx_err)
 return AVERROR_UNKNOWN;
 }
 }
-static int ff_qsv_set_display_handle(AVCodecContext *avctx, QSVSession *qs)
+static int ff_qsv_set_display_handle(AVClass *avccl, struct AVQSVSession *qs)
 {
 // this code is only required for Linux.  It searches for a valid
 // display handle.  First in /dev/dri/renderD then in /dev/dri/card
@@ -115,14 +120,14 @@ static int ff_qsv_set_display_handle(AVCodecContext 
*avctx, QSVSession *qs)
 
 fd = open(adapterpath, O_RDWR);
 if (fd < 0) {
-av_log(avctx, AV_LOG_ERROR,
+av_log(avccl, AV_LOG_ERROR,
 "mfx init: %s fd open failed\n", adapterpath);
 continue;
 }
 
 va_dpy = vaGetDisplayDRM(fd);
 if (!va_dpy) {
-av_log(avctx, AV_LOG_ERROR,
+av_log(avccl, AV_LOG_ERROR,
 "mfx init: %s vaGetDisplayDRM failed\n", adapterpath);
 close(fd);
 continue;
@@ -130,22 +135,22 @@ static int ff_qsv_set_display_handle(AVCodecContext 
*avctx, QSVSession *qs)
 
 va_res = vaInitialize(va_dpy, &major_version, &minor_version);
 if (VA_STATUS_SUCCESS != va_res) {
-av_log(avctx, AV_LOG_ERROR,
+av_log(avccl, AV_LOG_ERROR,
 "mfx init: %s vaInitialize failed\n", adapterpath);
 close(fd);
 fd = -1;
 continue;
 } else {
-av_log(avctx, AV_LOG_VERBOSE,
+av_log(avccl, AV_LOG_VERBOSE,
 "mfx initialization: %s vaInitialize successful\n",adapterpath);
 qs->fd_display = fd;
 qs->va_display = va_dpy;
 ret = MFXVideoCORE_SetHandle(qs->session,
   (mfxHandleType)MFX_HANDLE_VA_DISPLAY, (mfxHDL)va_dpy);
 if (ret < 0) {
-av_log(avctx, AV_LOG_ERROR,
+av_log(avccl, AV_LOG_ERROR,
 "Error %d during set display handle\n", ret);
-return ff_qsv_error(ret);
+return av_qsv_error(ret);
 }
 break;
 }
@@ -153,22 +158,7 @@ static int ff_qsv_set_display_handle(AVCodecContext 
*avctx, QSVSession *qs)
 #endif //AVCODEC_QSV_LINUX_SESSION_HANDLE
 return 0;
 }
-/**
- * @brief Initialize a MSDK session
- *
- * Media SDK is based on sessions, so this is the prerequisite
- * initialization for HW acceleration.  For Windows the session is
- * complete and ready to use, for Linux a display handle is
- * required.  For releases of Media Server Studio >= 2015 R4 the
- * render nodes interface is preferred (/dev/dri/renderD).
- * Using Media Server Studio 2015 R4 or newer is recommended
- * but the older /dev/dri/card interface is also searched
- * for broader compatibility.
- *
- * @param avctxffmpeg metadata for this codec context
- * @param session  the MSDK session used
- */
-int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
+int av_qsv_init_session(AVClass *avccl, struct AVQSVSession *qs,
  const char *load_plugins)
 {
 mfxIMPL impl   = MFX_IMPL_AUTO_ANY;
@@ -179,11 +169,11 @@ int ff_qsv_init_internal_session(AVCodecContext *avctx, 
QSVSession *qs,
 
 ret = MFXInit(impl, &ver, &qs->session);
 if (ret < 0) {
-av_log(avctx, AV_LOG_ERROR, "Error initializing an internal MFX 
session\n");
-return ff_qsv_error(ret);
+av_log(avccl, AV_LOG_ERROR, "Error initializing an internal MFX 
session\n");
+return av_qsv_error(ret);
 }
 
-ret = ff_qsv_set_display_handle(avctx, qs);
+ret = ff_qsv_set_display_handle(avccl, qs);
 if (ret < 0)
 return ret;
 
@@ -212,7 +202,7 @@ int ff_qsv_init_internal_session(AVCodecContext *avctx, 

Re: [FFmpeg-devel] [PATCH] avcodec/qsv: export session management functionality

2016-04-11 Thread Michael Niedermayer
On Thu, Apr 07, 2016 at 11:44:20AM -0400, nablet developer wrote:
> Signed-off-by: nablet developer 
> ---
>  libavcodec/qsv.c  | 64 
> +--
>  libavcodec/qsv.h  | 53 +++
>  libavcodec/qsv_api.c  | 26 +++
>  libavcodec/qsv_internal.h | 15 +--
>  libavcodec/qsvdec.c   | 13 +-
>  libavcodec/qsvdec.h   |  3 ++-
>  libavcodec/qsvenc.c   | 16 ++--
>  libavcodec/qsvenc.h   |  2 +-
>  8 files changed, 125 insertions(+), 67 deletions(-)

commit message is missing the explanation for "why?"


> 
> diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
> index 4c8e6b0..81d1f0c 100644
> --- a/libavcodec/qsv.c
> +++ b/libavcodec/qsv.c
> @@ -18,14 +18,19 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
>   */
>  
> -#include 
> -#include 
> -
>  #include 
>  #include 
>  
>  #include "libavutil/avstring.h"
>  #include "libavutil/error.h"
> +#include "libavutil/log.h"
> +
> +#include "qsv.h"
> +
> +#if CONFIG_QSV

conditional compilation belongs in the Makefile

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/qsv: export session management functionality

2016-04-11 Thread nablet developer

>> 
>> diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
>> index 4c8e6b0..81d1f0c 100644
>> --- a/libavcodec/qsv.c
>> +++ b/libavcodec/qsv.c
>> @@ -18,14 +18,19 @@
>>  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
>> USA
>>  */
>> 
>> -#include 
>> -#include 
>> -
>> #include 
>> #include 
>> 
>> #include "libavutil/avstring.h"
>> #include "libavutil/error.h"
>> +#include "libavutil/log.h"
>> +
>> +#include "qsv.h"
>> +
>> +#if CONFIG_QSV
> 
> conditional compilation belongs in the Makefile


the idea here is to provide API functions for QuickSync 
initialisation/de-initializtion stuff.
as I understand, ffmpeg API functions must be always present, regardless if 
QuickSync is available or not.
if QuickSync is not available, then "dummy" functions are provides that do 
nothing and just return an error.
so, do I right understand that correct approach for it is providing two files : 
one with actual implementation (qsv.c), and another with dummy implementation 
(e.g. qsv_dummy.c), and select one of them in makefile?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/qsv: export session management functionality

2016-04-12 Thread nablet developer

> On 11 Apr 2016, at 18:30, nablet developer  wrote:
> 
> 
>>> 
>>> diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
>>> index 4c8e6b0..81d1f0c 100644
>>> --- a/libavcodec/qsv.c
>>> +++ b/libavcodec/qsv.c
>>> @@ -18,14 +18,19 @@
>>> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
>>> USA
>>> */
>>> 
>>> -#include 
>>> -#include 
>>> -
>>> #include 
>>> #include 
>>> 
>>> #include "libavutil/avstring.h"
>>> #include "libavutil/error.h"
>>> +#include "libavutil/log.h"
>>> +
>>> +#include "qsv.h"
>>> +
>>> +#if CONFIG_QSV
>> 
>> conditional compilation belongs in the Makefile
> 
> 
> the idea here is to provide API functions for QuickSync 
> initialisation/de-initializtion stuff.
> as I understand, ffmpeg API functions must be always present, regardless if 
> QuickSync is available or not.
> if QuickSync is not available, then "dummy" functions are provides that do 
> nothing and just return an error.
> so, do I right understand that correct approach for it is providing two files 
> : one with actual implementation (qsv.c), and another with dummy 
> implementation (e.g. qsv_dummy.c), and select one of them in makefile?
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
ping. please recommend how to deal with that.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/qsv: export session management functionality

2016-04-13 Thread wm4
On Thu,  7 Apr 2016 11:44:20 -0400
nablet developer  wrote:

> Signed-off-by: nablet developer 
> ---
>  libavcodec/qsv.c  | 64 
> +--
>  libavcodec/qsv.h  | 53 +++
>  libavcodec/qsv_api.c  | 26 +++
>  libavcodec/qsv_internal.h | 15 +--
>  libavcodec/qsvdec.c   | 13 +-
>  libavcodec/qsvdec.h   |  3 ++-
>  libavcodec/qsvenc.c   | 16 ++--
>  libavcodec/qsvenc.h   |  2 +-
>  8 files changed, 125 insertions(+), 67 deletions(-)
> 
> diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
> index 4c8e6b0..81d1f0c 100644
> --- a/libavcodec/qsv.c
> +++ b/libavcodec/qsv.c
> @@ -18,14 +18,19 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
>   */
>  
> -#include 
> -#include 
> -
>  #include 
>  #include 
>  
>  #include "libavutil/avstring.h"
>  #include "libavutil/error.h"
> +#include "libavutil/log.h"
> +
> +#include "qsv.h"
> +
> +#if CONFIG_QSV
> +
> +#include 
> +#include 
>  
>  #include "avcodec.h"
>  #include "qsv_internal.h"
> @@ -51,7 +56,7 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
>  return AVERROR(ENOSYS);
>  }
>  
> -int ff_qsv_error(int mfx_err)
> +int av_qsv_error(int mfx_err)
>  {
>  switch (mfx_err) {
>  case MFX_ERR_NONE:
> @@ -85,7 +90,7 @@ int ff_qsv_error(int mfx_err)
>  return AVERROR_UNKNOWN;
>  }
>  }
> -static int ff_qsv_set_display_handle(AVCodecContext *avctx, QSVSession *qs)
> +static int ff_qsv_set_display_handle(AVClass *avccl, struct AVQSVSession *qs)
>  {
>  // this code is only required for Linux.  It searches for a valid
>  // display handle.  First in /dev/dri/renderD then in /dev/dri/card
> @@ -115,14 +120,14 @@ static int ff_qsv_set_display_handle(AVCodecContext 
> *avctx, QSVSession *qs)
>  
>  fd = open(adapterpath, O_RDWR);
>  if (fd < 0) {
> -av_log(avctx, AV_LOG_ERROR,
> +av_log(avccl, AV_LOG_ERROR,
>  "mfx init: %s fd open failed\n", adapterpath);
>  continue;
>  }
>  
>  va_dpy = vaGetDisplayDRM(fd);
>  if (!va_dpy) {
> -av_log(avctx, AV_LOG_ERROR,
> +av_log(avccl, AV_LOG_ERROR,
>  "mfx init: %s vaGetDisplayDRM failed\n", adapterpath);
>  close(fd);
>  continue;
> @@ -130,22 +135,22 @@ static int ff_qsv_set_display_handle(AVCodecContext 
> *avctx, QSVSession *qs)
>  
>  va_res = vaInitialize(va_dpy, &major_version, &minor_version);
>  if (VA_STATUS_SUCCESS != va_res) {
> -av_log(avctx, AV_LOG_ERROR,
> +av_log(avccl, AV_LOG_ERROR,
>  "mfx init: %s vaInitialize failed\n", adapterpath);
>  close(fd);
>  fd = -1;
>  continue;
>  } else {
> -av_log(avctx, AV_LOG_VERBOSE,
> +av_log(avccl, AV_LOG_VERBOSE,
>  "mfx initialization: %s vaInitialize successful\n",adapterpath);
>  qs->fd_display = fd;
>  qs->va_display = va_dpy;
>  ret = MFXVideoCORE_SetHandle(qs->session,
>(mfxHandleType)MFX_HANDLE_VA_DISPLAY, (mfxHDL)va_dpy);
>  if (ret < 0) {
> -av_log(avctx, AV_LOG_ERROR,
> +av_log(avccl, AV_LOG_ERROR,
>  "Error %d during set display handle\n", ret);
> -return ff_qsv_error(ret);
> +return av_qsv_error(ret);
>  }
>  break;
>  }
> @@ -153,22 +158,7 @@ static int ff_qsv_set_display_handle(AVCodecContext 
> *avctx, QSVSession *qs)
>  #endif //AVCODEC_QSV_LINUX_SESSION_HANDLE
>  return 0;
>  }
> -/**
> - * @brief Initialize a MSDK session
> - *
> - * Media SDK is based on sessions, so this is the prerequisite
> - * initialization for HW acceleration.  For Windows the session is
> - * complete and ready to use, for Linux a display handle is
> - * required.  For releases of Media Server Studio >= 2015 R4 the
> - * render nodes interface is preferred (/dev/dri/renderD).
> - * Using Media Server Studio 2015 R4 or newer is recommended
> - * but the older /dev/dri/card interface is also searched
> - * for broader compatibility.
> - *
> - * @param avctxffmpeg metadata for this codec context
> - * @param session  the MSDK session used
> - */
> -int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
> +int av_qsv_init_session(AVClass *avccl, struct AVQSVSession *qs,
>   const char *load_plugins)
>  {
>  mfxIMPL impl   = MFX_IMPL_AUTO_ANY;
> @@ -179,11 +169,11 @@ int ff_qsv_init_internal_session(AVCodecContext *avctx, 
> QSVSession *qs,
>  
>  ret = MFXInit(impl, &ver, &qs->session);
>  if (ret < 0) {
> -av_log(avctx, AV_LOG_ERROR, "Error initializing an internal MFX 
> session\n");
> -return ff_qsv_error(ret);
> + 

Re: [FFmpeg-devel] [PATCH] avcodec/qsv: export session management functionality

2016-04-13 Thread Hendrik Leppkes
On Thu, Apr 7, 2016 at 5:44 PM, nablet developer  wrote:
>
> +/**
> + * Initialize a MSDK session
> + *
> + * Media SDK is based on sessions, so this is the prerequisite
> + * initialization for HW acceleration.  For Windows the session is
> + * complete and ready to use, for Linux a display handle is
> + * required.  For releases of Media Server Studio >= 2015 R4 the
> + * render nodes interface is preferred (/dev/dri/renderD).
> + * Using Media Server Studio 2015 R4 or newer is recommended
> + * but the older /dev/dri/card interface is also searched
> + * for broader compatibility.
> + *
> + * @param avccl pointer to AVClass, uses for logging
> + * @param qsthe MSDK session used
> + * @param load_plugins  list of hexadecimal plug-in UIDs delimeted by colons.
> + */
> +int av_qsv_init_session(AVClass *avccl, AVQSVSession *qs,
> +const char *load_plugins);

This looks wrong, we don't pass pointers to an AVClass around. The
logging functions want a pointer to a pointer to a AVClass either way
(ie. a AVClass pointer embedded in another struct)
If you want to pass a generic logging context, make it accept a void*,
not AVClass.

The same for all other methods where this applies.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/qsv: export session management functionality

2016-04-13 Thread nablet developer

> On 13 Apr 2016, at 14:16, Hendrik Leppkes  wrote:
> 
> On Thu, Apr 7, 2016 at 5:44 PM, nablet developer  wrote:
>> 
>> +/**
>> + * Initialize a MSDK session
>> + *
>> + * Media SDK is based on sessions, so this is the prerequisite
>> + * initialization for HW acceleration.  For Windows the session is
>> + * complete and ready to use, for Linux a display handle is
>> + * required.  For releases of Media Server Studio >= 2015 R4 the
>> + * render nodes interface is preferred (/dev/dri/renderD).
>> + * Using Media Server Studio 2015 R4 or newer is recommended
>> + * but the older /dev/dri/card interface is also searched
>> + * for broader compatibility.
>> + *
>> + * @param avccl pointer to AVClass, uses for logging
>> + * @param qsthe MSDK session used
>> + * @param load_plugins  list of hexadecimal plug-in UIDs delimeted by 
>> colons.
>> + */
>> +int av_qsv_init_session(AVClass *avccl, AVQSVSession *qs,
>> +const char *load_plugins);
> 
> This looks wrong, we don't pass pointers to an AVClass around. The
> logging functions want a pointer to a pointer to a AVClass either way
> (ie. a AVClass pointer embedded in another struct)
> If you want to pass a generic logging context, make it accept a void*,
> not AVClass.
> 
> The same for all other methods where this applies.

thanks, roger that. I'll correct that today and prepare & send new patch.

> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/qsv: export session management functionality

2016-04-13 Thread nablet developer

> On 13 Apr 2016, at 14:08, wm4  wrote:
> 
> On Thu,  7 Apr 2016 11:44:20 -0400
> nablet developer mailto:s...@nablet.com>> wrote:
> 
>> Signed-off-by: nablet developer 
>> ---
>> libavcodec/qsv.c  | 64 
>> +--
>> libavcodec/qsv.h  | 53 +++
>> libavcodec/qsv_api.c  | 26 +++
>> libavcodec/qsv_internal.h | 15 +--
>> libavcodec/qsvdec.c   | 13 +-
>> libavcodec/qsvdec.h   |  3 ++-
>> libavcodec/qsvenc.c   | 16 ++--
>> libavcodec/qsvenc.h   |  2 +-
>> 8 files changed, 125 insertions(+), 67 deletions(-)
>> 
>> diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
>> index 4c8e6b0..81d1f0c 100644
>> --- a/libavcodec/qsv.c
>> +++ b/libavcodec/qsv.c
>> @@ -18,14 +18,19 @@
>>  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
>> USA
>>  */
>> 
>> -#include 
>> -#include 
>> -
>> #include 
>> #include 
>> 
>> #include "libavutil/avstring.h"
>> #include "libavutil/error.h"
>> +#include "libavutil/log.h"
>> +
>> +#include "qsv.h"
>> +
>> +#if CONFIG_QSV
>> +
>> +#include 
>> +#include 
>> 
>> #include "avcodec.h"
>> #include "qsv_internal.h"
>> @@ -51,7 +56,7 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
>> return AVERROR(ENOSYS);
>> }
>> 
>> -int ff_qsv_error(int mfx_err)
>> +int av_qsv_error(int mfx_err)
>> {
>> switch (mfx_err) {
>> case MFX_ERR_NONE:
>> @@ -85,7 +90,7 @@ int ff_qsv_error(int mfx_err)
>> return AVERROR_UNKNOWN;
>> }
>> }
>> -static int ff_qsv_set_display_handle(AVCodecContext *avctx, QSVSession *qs)
>> +static int ff_qsv_set_display_handle(AVClass *avccl, struct AVQSVSession 
>> *qs)
>> {
>> // this code is only required for Linux.  It searches for a valid
>> // display handle.  First in /dev/dri/renderD then in /dev/dri/card
>> @@ -115,14 +120,14 @@ static int ff_qsv_set_display_handle(AVCodecContext 
>> *avctx, QSVSession *qs)
>> 
>> fd = open(adapterpath, O_RDWR);
>> if (fd < 0) {
>> -av_log(avctx, AV_LOG_ERROR,
>> +av_log(avccl, AV_LOG_ERROR,
>> "mfx init: %s fd open failed\n", adapterpath);
>> continue;
>> }
>> 
>> va_dpy = vaGetDisplayDRM(fd);
>> if (!va_dpy) {
>> -av_log(avctx, AV_LOG_ERROR,
>> +av_log(avccl, AV_LOG_ERROR,
>> "mfx init: %s vaGetDisplayDRM failed\n", adapterpath);
>> close(fd);
>> continue;
>> @@ -130,22 +135,22 @@ static int ff_qsv_set_display_handle(AVCodecContext 
>> *avctx, QSVSession *qs)
>> 
>> va_res = vaInitialize(va_dpy, &major_version, &minor_version);
>> if (VA_STATUS_SUCCESS != va_res) {
>> -av_log(avctx, AV_LOG_ERROR,
>> +av_log(avccl, AV_LOG_ERROR,
>> "mfx init: %s vaInitialize failed\n", adapterpath);
>> close(fd);
>> fd = -1;
>> continue;
>> } else {
>> -av_log(avctx, AV_LOG_VERBOSE,
>> +av_log(avccl, AV_LOG_VERBOSE,
>> "mfx initialization: %s vaInitialize successful\n",adapterpath);
>> qs->fd_display = fd;
>> qs->va_display = va_dpy;
>> ret = MFXVideoCORE_SetHandle(qs->session,
>>   (mfxHandleType)MFX_HANDLE_VA_DISPLAY, (mfxHDL)va_dpy);
>> if (ret < 0) {
>> -av_log(avctx, AV_LOG_ERROR,
>> +av_log(avccl, AV_LOG_ERROR,
>> "Error %d during set display handle\n", ret);
>> -return ff_qsv_error(ret);
>> +return av_qsv_error(ret);
>> }
>> break;
>> }
>> @@ -153,22 +158,7 @@ static int ff_qsv_set_display_handle(AVCodecContext 
>> *avctx, QSVSession *qs)
>> #endif //AVCODEC_QSV_LINUX_SESSION_HANDLE
>> return 0;
>> }
>> -/**
>> - * @brief Initialize a MSDK session
>> - *
>> - * Media SDK is based on sessions, so this is the prerequisite
>> - * initialization for HW acceleration.  For Windows the session is
>> - * complete and ready to use, for Linux a display handle is
>> - * required.  For releases of Media Server Studio >= 2015 R4 the
>> - * render nodes interface is preferred (/dev/dri/renderD).
>> - * Using Media Server Studio 2015 R4 or newer is recommended
>> - * but the older /dev/dri/card interface is also searched
>> - * for broader compatibility.
>> - *
>> - * @param avctxffmpeg metadata for this codec context
>> - * @param session  the MSDK session used
>> - */
>> -int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
>> +int av_qsv_init_session(AVClass *avccl, struct AVQSVSession *qs,
>>  const char *load_plugins)
>> {
>> mfxIMPL impl   = MFX_IMPL_AUTO_ANY;
>> @@ -179,11 +169,11 @@ int ff_qsv_init_internal_session(AVCodecContext 
>> *avctx, QSVSession *qs,
>> 
>> ret = MFXInit(impl, &ver, &qs->session);
>> if (ret <

Re: [FFmpeg-devel] [PATCH] avcodec/qsv: export session management functionality

2016-04-13 Thread wm4
On Wed, 13 Apr 2016 14:14:37 +0600
nablet developer  wrote:

> > Why would this API need to be exported?  
> 
> previously QuickSync was used only by libavcodec and its components - e.g. 
> there are QSV encoder and decoders for AVC and MPEG-2. so it was OK that 
> QuickSync initialisation and cleanup functions were local for libavcodec.
> 
> but right now we're adding QuickSync VPP component to libavfilter, so 
> mentioned functions now become shared at least between libavcodec and 
> libavfilter.
> therefore, patch to add QSV VPP filter was rejected because it accessed 
> libavcodec functions which were local, and it was suggested that such 
> functions are need to be exported from libavcodec, so libavfilter can use 
> them.

Wouldn't it be better to keep it internal then? Sharing code between
the sub-libs is unfortunately messy, but possible. For example, you
could create a dummy .c file in libavfilter that includes the
libavcodec one. Not beautiful, but might be better than making the API
public. Not sure what other devs think about this.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/qsv: export session management functionality

2016-04-13 Thread nablet developer

> On 13 Apr 2016, at 14:33, wm4  wrote:
> 
> On Wed, 13 Apr 2016 14:14:37 +0600
> nablet developer  wrote:
> 
>>> Why would this API need to be exported?  
>> 
>> previously QuickSync was used only by libavcodec and its components - e.g. 
>> there are QSV encoder and decoders for AVC and MPEG-2. so it was OK that 
>> QuickSync initialisation and cleanup functions were local for libavcodec.
>> 
>> but right now we're adding QuickSync VPP component to libavfilter, so 
>> mentioned functions now become shared at least between libavcodec and 
>> libavfilter.
>> therefore, patch to add QSV VPP filter was rejected because it accessed 
>> libavcodec functions which were local, and it was suggested that such 
>> functions are need to be exported from libavcodec, so libavfilter can use 
>> them.
> 
> Wouldn't it be better to keep it internal then? Sharing code between
> the sub-libs is unfortunately messy, but possible. For example, you
> could create a dummy .c file in libavfilter that includes the
> libavcodec one. Not beautiful, but might be better than making the API
> public. Not sure what other devs think about this.

I suppose it might cause linking issues in static builds (duplicated symbols).

> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/qsv: export session management functionality

2016-04-13 Thread Mark Thompson
On 13/04/16 09:14, nablet developer wrote:
> 
>> On 13 Apr 2016, at 14:08, wm4  wrote:
>>
>> On Thu,  7 Apr 2016 11:44:20 -0400
>> nablet developer mailto:s...@nablet.com>> wrote:
>>
>>> Signed-off-by: nablet developer 
>>> ---
>>> libavcodec/qsv.c  | 64 
>>> +--
>>> libavcodec/qsv.h  | 53 +++
>>> libavcodec/qsv_api.c  | 26 +++
>>> libavcodec/qsv_internal.h | 15 +--
>>> libavcodec/qsvdec.c   | 13 +-
>>> libavcodec/qsvdec.h   |  3 ++-
>>> libavcodec/qsvenc.c   | 16 ++--
>>> libavcodec/qsvenc.h   |  2 +-
>>> 8 files changed, 125 insertions(+), 67 deletions(-)
>>
>> Why would this API need to be exported?
> 
> previously QuickSync was used only by libavcodec and its components - e.g. 
> there are QSV encoder and decoders for AVC and MPEG-2. so it was OK that 
> QuickSync initialisation and cleanup functions were local for libavcodec.
> 
> but right now we're adding QuickSync VPP component to libavfilter, so 
> mentioned functions now become shared at least between libavcodec and 
> libavfilter.
> therefore, patch to add QSV VPP filter was rejected because it accessed 
> libavcodec functions which were local, and it was suggested that such 
> functions are need to be exported from libavcodec, so libavfilter can use 
> them.
> 

This is precisely one of the problems that the hwcontext code was designed to
solve.  I suggest using that rather than adding new ad-hoc codec-specific API
calls - make libavutil/hwcontext_qsv.c; it should not require any new API calls
at all.  As a bonus, it also solves the context propagation problem which you
will run into later when combining multiple filter and codec components.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/qsv: export session management functionality

2016-04-13 Thread nablet developer

> On 13 Apr 2016, at 14:48, Mark Thompson  wrote:
> 
> On 13/04/16 09:14, nablet developer wrote:
>> 
>>> On 13 Apr 2016, at 14:08, wm4  wrote:
>>> 
>>> On Thu,  7 Apr 2016 11:44:20 -0400
>>> nablet developer mailto:s...@nablet.com>> wrote:
>>> 
 Signed-off-by: nablet developer 
 ---
 libavcodec/qsv.c  | 64 
 +--
 libavcodec/qsv.h  | 53 +++
 libavcodec/qsv_api.c  | 26 +++
 libavcodec/qsv_internal.h | 15 +--
 libavcodec/qsvdec.c   | 13 +-
 libavcodec/qsvdec.h   |  3 ++-
 libavcodec/qsvenc.c   | 16 ++--
 libavcodec/qsvenc.h   |  2 +-
 8 files changed, 125 insertions(+), 67 deletions(-)
>>> 
>>> Why would this API need to be exported?
>> 
>> previously QuickSync was used only by libavcodec and its components - e.g. 
>> there are QSV encoder and decoders for AVC and MPEG-2. so it was OK that 
>> QuickSync initialisation and cleanup functions were local for libavcodec.
>> 
>> but right now we're adding QuickSync VPP component to libavfilter, so 
>> mentioned functions now become shared at least between libavcodec and 
>> libavfilter.
>> therefore, patch to add QSV VPP filter was rejected because it accessed 
>> libavcodec functions which were local, and it was suggested that such 
>> functions are need to be exported from libavcodec, so libavfilter can use 
>> them.
>> 
> 
> This is precisely one of the problems that the hwcontext code was designed to
> solve.  I suggest using that rather than adding new ad-hoc codec-specific API
> calls - make libavutil/hwcontext_qsv.c; it should not require any new API 
> calls
> at all.  As a bonus, it also solves the context propagation problem which you
> will run into later when combining multiple filter and codec components.

okay, I will add libavutil/hwcontext_qsv and prepare new patch. thanks a lot 
for the suggestion.

> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/qsv: export session management functionality

2016-04-13 Thread Nicolas George
Le quintidi 25 germinal, an CCXXIV, wm4 a écrit :
> Wouldn't it be better to keep it internal then? Sharing code between
> the sub-libs is unfortunately messy

Once again, I think we should merge the libs. (Without API change, of
course; just the linking: -lffmpeg instead of -lavfilter -lavformat
-lavcodec -lswscale -lswresample -lavutil.)

Regards,

-- 
  Nicolas George
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/qsv: export session management functionality (variant #3)

2015-12-15 Thread Ivan Uskov
Hello All,

There is updated patch version initially introduced by Sven Dueking 


This patch expose 3 QSV functions as public.
This is needed because the VPP needs access to these functions too.

Please review.


-- 
Best regards,
 Ivan  mailto:ivan.us...@nablet.com

0001-avcodec-qsv-export-session-management-functionality.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel