Browse Source

avcodec/v4l2_m2m: Use consistent logging context

Before this commit v4l2_m2m used two different logging contexts (from
V4L2m2mPriv and AVCodecContext). For consistency always use AVCodecContext.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
tags/n4.3
Andriy Gelman Mark Thompson 5 years ago
parent
commit
73e23b404c
2 changed files with 10 additions and 10 deletions
  1. +1
    -1
      libavcodec/v4l2_context.c
  2. +9
    -9
      libavcodec/v4l2_m2m.c

+ 1
- 1
libavcodec/v4l2_context.c View File

@@ -50,7 +50,7 @@ static inline V4L2m2mContext *ctx_to_m2mctx(V4L2Context *ctx)


static inline AVClass *logger(V4L2Context *ctx) static inline AVClass *logger(V4L2Context *ctx)
{ {
return ctx_to_m2mctx(ctx)->priv;
return ctx_to_m2mctx(ctx)->avctx;
} }


static inline unsigned int v4l2_get_width(struct v4l2_format *fmt) static inline unsigned int v4l2_get_width(struct v4l2_format *fmt)


+ 9
- 9
libavcodec/v4l2_m2m.c View File

@@ -63,7 +63,7 @@ static inline int v4l2_mplane_video(struct v4l2_capability *cap)
static int v4l2_prepare_contexts(V4L2m2mContext* s, int probe) static int v4l2_prepare_contexts(V4L2m2mContext* s, int probe)
{ {
struct v4l2_capability cap; struct v4l2_capability cap;
void *log_ctx = s->priv;
void *log_ctx = s->avctx;
int ret; int ret;


s->capture.done = s->output.done = 0; s->capture.done = s->output.done = 0;
@@ -99,7 +99,7 @@ static int v4l2_prepare_contexts(V4L2m2mContext* s, int probe)


static int v4l2_probe_driver(V4L2m2mContext* s) static int v4l2_probe_driver(V4L2m2mContext* s)
{ {
void *log_ctx = s->priv;
void *log_ctx = s->avctx;
int ret; int ret;


s->fd = open(s->devname, O_RDWR | O_NONBLOCK, 0); s->fd = open(s->devname, O_RDWR | O_NONBLOCK, 0);
@@ -135,7 +135,7 @@ done:


static int v4l2_configure_contexts(V4L2m2mContext* s) static int v4l2_configure_contexts(V4L2m2mContext* s)
{ {
void *log_ctx = s->priv;
void *log_ctx = s->avctx;
int ret; int ret;
struct v4l2_format ofmt, cfmt; struct v4l2_format ofmt, cfmt;


@@ -204,7 +204,7 @@ error:
******************************************************************************/ ******************************************************************************/
int ff_v4l2_m2m_codec_reinit(V4L2m2mContext* s) int ff_v4l2_m2m_codec_reinit(V4L2m2mContext* s)
{ {
void *log_ctx = s->priv;
void *log_ctx = s->avctx;
int ret; int ret;


av_log(log_ctx, AV_LOG_DEBUG, "reinit context\n"); av_log(log_ctx, AV_LOG_DEBUG, "reinit context\n");
@@ -340,11 +340,11 @@ int ff_v4l2_m2m_codec_end(V4L2m2mPriv *priv)


ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMOFF); ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMOFF);
if (ret) if (ret)
av_log(priv, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->output.name);
av_log(s->avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->output.name);


ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF); ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF);
if (ret) if (ret)
av_log(priv, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->capture.name);
av_log(s->avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->capture.name);


ff_v4l2_context_release(&s->output); ff_v4l2_context_release(&s->output);


@@ -373,7 +373,7 @@ int ff_v4l2_m2m_codec_init(V4L2m2mPriv *priv)
continue; continue;


snprintf(node, sizeof(node), "/dev/%s", entry->d_name); snprintf(node, sizeof(node), "/dev/%s", entry->d_name);
av_log(priv, AV_LOG_DEBUG, "probing device %s\n", node);
av_log(s->avctx, AV_LOG_DEBUG, "probing device %s\n", node);
strncpy(s->devname, node, strlen(node) + 1); strncpy(s->devname, node, strlen(node) + 1);
ret = v4l2_probe_driver(s); ret = v4l2_probe_driver(s);
if (!ret) if (!ret)
@@ -383,13 +383,13 @@ int ff_v4l2_m2m_codec_init(V4L2m2mPriv *priv)
closedir(dirp); closedir(dirp);


if (ret) { if (ret) {
av_log(priv, AV_LOG_ERROR, "Could not find a valid device\n");
av_log(s->avctx, AV_LOG_ERROR, "Could not find a valid device\n");
memset(s->devname, 0, sizeof(s->devname)); memset(s->devname, 0, sizeof(s->devname));


return ret; return ret;
} }


av_log(priv, AV_LOG_INFO, "Using device %s\n", node);
av_log(s->avctx, AV_LOG_INFO, "Using device %s\n", node);


return v4l2_configure_contexts(s); return v4l2_configure_contexts(s);
} }


Loading…
Cancel
Save