Only VLC_CODEC_YV12 has the U/V planes swapped compared to the libavutil
chroma. We need to let the caller know when mapping VLC chromas to
FFmpeg ones.
The original format may be using a chroma that relies on the RGB masks.
Since we change the chroma we should not reuse the mask from the previous
chroma.
channels and channel_layout has been deprecated in FFMPEG 5.1 and will be removed eventually
also always create the mapping, as ch_layout is always there
Ensure the client calling the export to block_t is also responsible for
releasing the picture it exports.
Previous commits were adding the release to match behaviour of the
converter before refactoring everything, but it was a mistake and led to
issues with other parts of the pipeline, in particular the transcoder,
and some clients were more adapted to the converter path + hold of
original rather than the non-conversion path, which would then have been
simpler to do from the start.
This MR adds the necessary hold and release to remove those from the
encoders and the clients, and is tested against the unmerged
libvlc/media.c test for thumbnailing too.
Revert "png: fix picture release on encoder"
This reverts commit d4c93a29a2.
Revert "jpeg: fix picture release on encoder"
This reverts commit cccc085e30.
Revert "avcodec: encoder: fix picture release"
This reverts commit 5a145f34fa.
Revert "codec: vpx: fix picture release on encoder"
This reverts commit 5dde7db39c.
Revert "image: fix picture leak in case of error"
This reverts commit 1bf09fe8d6.
Revert "misc: thumbnailer: release picture when interrupted"
This reverts commit 004b9900f8.
av_init_packet is deprecated in new major version of ffmpeg.
Also use av_packet_free instead of unref.
Use av_packet_clone and AVPacket * in vlc_av_packet_t.
Since ffmpeg 4.4 specifying channel layout or channel number is required
to call `avcodec_send_frame()` without error.
This is new requirement is due to a change in the avcodec internal API
brought by 827d6fe73d2f5472c1c2128eb14fab6a4db29032 (ffmpeg repo). They
now call `av_frame_ref` which needs the channels fields to be valid.
Fixes: #25851
Sidedata AV_PKT_DATA_QUALITY_STATS has been present since 2015 on
version 56.51.100. Also previous coded_frame->pict_type doesn't seem to
be present anymore in ffmpeg master.
With this change, transcoding to multiple outputs with intermediate encode works.
Example sout-chain used to test:
--sout="#transcode{vcodec=I420,deinterlace}:duplicate{dst={transcode{vcodec=h264,vfilter=canvas{width=640,height=320}}},dst={transcode{vcodec=h264,vfilter=canvas{width=320,height=240}}}}:file{dst=test_output.ts}"
Without this change, rawvideo codec will complain about invalid frame size.
If the required codec is invalid or doesn't match the required codec id,
we must release the string obtained from var_GetString.
Signed-off-by: Tristan Matthews <tmatth@videolan.org>