Skip to contentSkip to conversation

V4L2_PIX_FMT_MPEG and S_FMT

DISCUSSION Christian Gmeiner 2 participants 3 messages Jun 18, 2011 – Jun 26, 2011 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hi all,

I am still in the process of porting a driver to v4l2 framework. This device is capable of decoding MPEG-1 and MPEG-2 streams. See http://dxr3.sourceforge.net/about.html for more details. So I have programmed this:

static int vidioc_enum_fmt_vid_out(struct file *file, void *fh,
struct v4l2_fmtdesc *fmt)

{
	if (fmt->index > 0)
		return -EINVAL;

	fmt->flags = V4L2_FMT_FLAG_COMPRESSED;
	fmt->pixelformat = V4L2_PIX_FMT_MPEG;
	strlcpy(fmt->description, "MPEG 1/2", sizeof(fmt->description));

	return 0;
}

There is nothing in struct v4l2_format which indicates MPEG1, MPEG2 or MPEG4. As a result
of this, it is not possible to return -EINVAL if somebody wants to decode/playback MPEG4 content.

Any ideas how to achieve it?

Thanks
--
Christian Gmeiner, MSc

#1 lore raw
Quoted 4 lines · On Saturday, June 18, 2011 21:11:37 Christian Gmeiner wrote:

Hi all,

I am still in the process of porting a driver to v4l2 framework. This device is capable of decoding MPEG-1 and MPEG-2 streams.

Are we talking about decoding multiplexed streams or elementary streams? E.g., audio+video or just the elementary video stream?

For decoding elementary streams pixelformats are being defined in an RFC by Kamil Debski:

http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/34229

For multiplexed streams ivtv just uses V4L2_PIX_FMT_MPEG which can be used for any MPEG program or transport stream. There is currently no method of communicating to userspace which audio/video formats inside that PS/TS stream are supported.

The problem is that that information is hidden inside the stream. If your hardware does multiplexed stream decoding, then what happens when you give it an mpeg stream with unsupported codecs? Does the hardware give an error?

Regards,

Hans

Quoted 32 lines

See http://dxr3.sourceforge.net/about.html for more details. So I have programmed this:

static int vidioc_enum_fmt_vid_out(struct file *file, void *fh,
struct v4l2_fmtdesc *fmt)

{
	if (fmt->index > 0)
		return -EINVAL;

	fmt->flags = V4L2_FMT_FLAG_COMPRESSED;
	fmt->pixelformat = V4L2_PIX_FMT_MPEG;
	strlcpy(fmt->description, "MPEG 1/2", sizeof(fmt->description));

	return 0;
}

There is nothing in struct v4l2_format which indicates MPEG1, MPEG2 or MPEG4. As a result
of this, it is not possible to return -EINVAL if somebody wants to decode/playback MPEG4 content.

Any ideas how to achieve it?

Thanks
--
Christian Gmeiner, MSc
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 9 lines · On Saturday, June 18, 2011 21:11:37 Christian Gmeiner wrote:
Quoted 4 lines

Hi all,

I am still in the process of porting a driver to v4l2 framework. This device is capable of decoding MPEG-1 and MPEG-2 streams.

Are we talking about decoding multiplexed streams or elementary streams? E.g., audio+video or just the elementary video stream?

We are talking about elementary video stream only.

Quoted 5 lines

For decoding elementary streams pixelformats are being defined in an RFC by Kamil Debski:

http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/34229

That would fix the problem I have - fine.

Quoted 5 lines

For multiplexed streams ivtv just uses V4L2_PIX_FMT_MPEG which can be used for any MPEG program or transport stream. There is currently no method of communicating to userspace which audio/video formats inside that PS/TS stream are supported.

Quoted 41 lines

The problem is that that information is hidden inside the stream. If your hardware does multiplexed stream decoding, then what happens when you give it an mpeg stream with unsupported codecs? Does the hardware give an error?

Regards,

       Hans

Quoted 32 lines

See http://dxr3.sourceforge.net/about.html for more details. So I have programmed this:

static int vidioc_enum_fmt_vid_out(struct file *file, void *fh, struct v4l2_fmtdesc *fmt) {
      if (fmt->index > 0)
              return -EINVAL;

      fmt->flags = V4L2_FMT_FLAG_COMPRESSED; fmt->pixelformat = V4L2_PIX_FMT_MPEG; strlcpy(fmt->description, "MPEG 1/2", sizeof(fmt->description));

      return 0;
}

There is nothing in struct v4l2_format which indicates MPEG1, MPEG2 or MPEG4. As a result
of this, it is not possible to return -EINVAL if somebody wants to decode/playback MPEG4 content.

Any ideas how to achieve it?

Thanks
--
Christian Gmeiner, MSc
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Christian Gmeiner, MSc