[FFmpeg-devel] avdevice/v4l2enc: Allow writing non-rawvideos to v4l2
Mark Thompson
sw at jkqxz.net
Sat May 9 17:53:05 EEST 2020
On 04/05/2020 15:19, Jan Ekström wrote:
> On Sun, Apr 26, 2020 at 11:26 PM David Manouchehri
> <david.manouchehri at riseup.net> wrote:
>>
>> Resubmit of a previous patch, not sure why the diff didn't come through.
>> _______________________________________________
>>
>> @@ -56,7 +55,13 @@ static av_cold int write_header(AVFormatContext *s1)
>>
>> par = s1->streams[0]->codecpar;
>>
>> - v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO);
>> + if(s1->streams[0]->codecpar->codec_id == AV_CODEC_ID_RAWVIDEO) {
>> + v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO);
>> + }
>> + else {
>> + v4l2_pixfmt = ff_fmt_ff2v4l(AV_PIX_FMT_NONE, s1->streams[0]->codecpar->codec_id);
>> + }
>> +
>
> Hi,
>
> A small nit. Wouldn't the variable `par` be usable there that was just
> created right on top of this if/else structure ? A la `par->codec_id`
> instead of poking at s1->streams[0] again?
>
> Otherwise looks good to me, linked this today on IRC as someone needed
> to test a v4l2 device they were developing with MJPEG. Didn't work,
> but that could be due to our MJPEG encoder adding all the metadata
> headers etc into the bit stream.
Yep, applied with that change.
Thank you!
- Mark
More information about the ffmpeg-devel
mailing list