On Wed, Sep 4, 2019 at 9:40 AM Alexis Ballier <aball...@gentoo.org> wrote:
> On Mon, 2 Sep 2019 18:02:10 -0700 > Aman Gupta <ffm...@tmm1.net> wrote: > [...] > > @@ -289,15 +290,59 @@ static int v4l2_bufref_to_buf(V4L2Buffer *out, > > int plane, const uint8_t* data, i int > > ff_v4l2_buffer_avframe_to_buf(const AVFrame *frame, V4L2Buffer *out) { > > int i, ret; > > + struct v4l2_format fmt = out->context->format; > > + int pixel_format = V4L2_TYPE_IS_MULTIPLANAR(fmt.type) ? > > + fmt.fmt.pix_mp.pixelformat : > > fmt.fmt.pix.pixelformat; > > + int height = V4L2_TYPE_IS_MULTIPLANAR(fmt.type) ? > > + fmt.fmt.pix_mp.height : fmt.fmt.pix.height; > > + int is_planar_format = 0; > > + > > + switch (pixel_format) { > > + case V4L2_PIX_FMT_YUV420M: > > + case V4L2_PIX_FMT_YVU420M: > > + case V4L2_PIX_FMT_YUV422M: > > + case V4L2_PIX_FMT_YVU422M: > > + case V4L2_PIX_FMT_YUV444M: > > + case V4L2_PIX_FMT_YVU444M: > > + case V4L2_PIX_FMT_NV12M: > > + case V4L2_PIX_FMT_NV21M: > > + case V4L2_PIX_FMT_NV12MT_16X16: > > + case V4L2_PIX_FMT_NV12MT: > > + case V4L2_PIX_FMT_NV16M: > > + case V4L2_PIX_FMT_NV61M: > > + is_planar_format = 1; > > + } > > > can't this be inlined as 'int is_planar_format = > V4L2_TYPE_IS_MULTIPLANAR(fmt.type)' as done 2 lines above ? > Unfortunately not. That macro differentiates between the original splane v4l2 api vs the newer mplane api. But even if you're using the newer api, it still support contiguous planar formats (YUV420 vs YUV420M). So the macro decides which fields in the struct to use (pix vs pix_mp), and then the pixel format itself decides if the planes are contiguous in memory or stored in separate buffers. Aman > > [...] > > > Alexis. > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".