<div dir="ltr">Yes sure! </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 12 Oct 2020 at 12:45, Thomas Guillem <<a href="mailto:thomas@gllm.fr">thomas@gllm.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u><div><div>LGTM, but I would remove the gstvlc.h file and put the GetGstVLCFourcc() declaration in top of gstvlcpictureplaneallocator.c<br></div><div><br></div><div>If you are OK, I can do this change myself and push.<br></div><div><br></div><div>On Mon, Oct 12, 2020, at 05:26, Vikram Fugro wrote:<br></div><blockquote type="cite" id="gmail-m_-5688957323864710437qt"><div dir="ltr">Please review.<br></div><div><br></div><div><div dir="ltr">On Sun, 27 Sep 2020 at 23:58, Vikram Fugro <<a href="mailto:vikram.fugro@gmail.com" target="_blank">vikram.fugro@gmail.com</a>> wrote:<br></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Add raw video fourcc conversion support to convert<br></div><div> from gstreamer representation (for strings that are<br></div><div> not equal to length 4) to vlc representation.<br></div><div> ---<br></div><div> modules/codec/Makefile.am | 4 +-<br></div><div> modules/codec/gstreamer/fourcc.c | 92 +++++++++++++++++++<br></div><div> modules/codec/gstreamer/gstvlc.h | 34 +++++++<br></div><div> .../gstreamer/gstvlcpictureplaneallocator.c | 26 +++++-<br></div><div> 4 files changed, 151 insertions(+), 5 deletions(-)<br></div><div> create mode 100644 modules/codec/gstreamer/fourcc.c<br></div><div> create mode 100644 modules/codec/gstreamer/gstvlc.h<br></div><div> <br></div><div> diff --git a/modules/codec/Makefile.am b/modules/codec/Makefile.am<br></div><div> index f8ff8b35bc..cd61920831 100644<br></div><div> --- a/modules/codec/Makefile.am<br></div><div> +++ b/modules/codec/Makefile.am<br></div><div> @@ -604,7 +604,9 @@ libgstdecode_plugin_la_SOURCES = codec/gstreamer/gstdecode.c \<br></div><div> codec/gstreamer/gstvlcvideopool.c \<br></div><div> codec/gstreamer/gstvlcvideopool.h \<br></div><div> codec/gstreamer/gstvlcvideosink.c \<br></div><div> - codec/gstreamer/gstvlcvideosink.h<br></div><div> + codec/gstreamer/gstvlcvideosink.h \<br></div><div> + codec/gstreamer/fourcc.c \<br></div><div> + codec/gstreamer/gstvlc.h<br></div><div> libgstdecode_plugin_la_CFLAGS = $(AM_CFLAGS) $(GST_VIDEO_CFLAGS) $(GST_APP_CFLAGS)<br></div><div> libgstdecode_plugin_la_LIBADD = $(GST_VIDEO_LIBS) $(GST_APP_LIBS)<br></div><div> if HAVE_GST_DECODE<br></div><div> diff --git a/modules/codec/gstreamer/fourcc.c b/modules/codec/gstreamer/fourcc.c<br></div><div> new file mode 100644<br></div><div> index 0000000000..28d92890bf<br></div><div> --- /dev/null<br></div><div> +++ b/modules/codec/gstreamer/fourcc.c<br></div><div> @@ -0,0 +1,92 @@<br></div><div> +<br></div><div> +/*****************************************************************************<br></div><div> + * fourcc.c: convert between gst <-> vlc formats<br></div><div> + *****************************************************************************<br></div><div> + * Copyright (C) 2020 VLC authors and VideoLAN<br></div><div> + * $Id:<br></div><div> + *<br></div><div> + * Author: Vikram Fugro <<a href="mailto:vikram.fugro@gmail.com" target="_blank">vikram.fugro@gmail.com</a>><br></div><div> + *<br></div><div> + * This library is free software; you can redistribute it and/or<br></div><div> + * modify it under the terms of the GNU Library General Public<br></div><div> + * License as published by the Free Software Foundation; either<br></div><div> + * version 2.1 of the License, or (at your option) any later version.<br></div><div> + *<br></div><div> + * This library is distributed in the hope that it will be useful,<br></div><div> + * but WITHOUT ANY WARRANTY; without even the implied warranty of<br></div><div> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU<br></div><div> + * Lesser General Public License for more details.<br></div><div> + *<br></div><div> + * You should have received a copy of the GNU Library General Public<br></div><div> + * License along with this library; if not, write to the Free Software<br></div><div> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA<br></div><div> + *****************************************************************************/<br></div><div> +<br></div><div> +/*****************************************************************************<br></div><div> + * Preamble<br></div><div> + *****************************************************************************/<br></div><div> +<br></div><div> +#include "gstvlc.h"<br></div><div> +<br></div><div> +typedef struct<br></div><div> +{<br></div><div> + char gst [10];<br></div><div> + vlc_fourcc_t i_fourcc;<br></div><div> +} gst_vlc_rawvideo_fourcc;<br></div><div> +<br></div><div> +/*<br></div><div> + * Raw Video Formats<br></div><div> + */<br></div><div> +static const gst_vlc_rawvideo_fourcc raw_video_fmts[] =<br></div><div> +{<br></div><div> + // NOTE: These should be sorted entries, keyed by `gst` field<br></div><div> + // cat entries | tr -dc "[:alnum:][:space:]_" | sort -n -k1 | xargs printf "{ \"%s\", %s },\n"<br></div><div> + { "I420_10BE", VLC_CODEC_I420_10B },<br></div><div> + { "I420_10LE", VLC_CODEC_I420_10L },<br></div><div> + { "I420_12BE", VLC_CODEC_I420_12B },<br></div><div> + { "I420_12LE", VLC_CODEC_I420_12L },<br></div><div> + { "I420_16BE", VLC_CODEC_I420_16B },<br></div><div> + { "I420_16LE", VLC_CODEC_I420_16L },<br></div><div> + { "I420_9BE", VLC_CODEC_I420_9B },<br></div><div> + { "I420_9LE", VLC_CODEC_I420_9L },<br></div><div> + { "I422_10BE", VLC_CODEC_I422_10B },<br></div><div> + { "I422_10LE", VLC_CODEC_I422_10L },<br></div><div> + { "I422_12BE", VLC_CODEC_I422_12B },<br></div><div> + { "I422_12LE", VLC_CODEC_I422_12L },<br></div><div> + { "I422_16BE", VLC_CODEC_I422_16B },<br></div><div> + { "I422_16LE", VLC_CODEC_I422_16L },<br></div><div> + { "I422_9BE", VLC_CODEC_I422_9B },<br></div><div> + { "I422_9LE", VLC_CODEC_I422_9L },<br></div><div> + { "I444_10BE", VLC_CODEC_I444_10B },<br></div><div> + { "I444_10LE", VLC_CODEC_I444_10L },<br></div><div> + { "I444_12BE", VLC_CODEC_I444_12B },<br></div><div> + { "I444_12LE", VLC_CODEC_I444_12L },<br></div><div> + { "I444_16BE", VLC_CODEC_I444_16B },<br></div><div> + { "I444_16LE", VLC_CODEC_I444_16L },<br></div><div> + { "I444_9BE", VLC_CODEC_I444_9B },<br></div><div> + { "I444_9LE", VLC_CODEC_I444_9L },<br></div><div> +};<br></div><div> +<br></div><div> +static int compare_func( const void* key, const void* ent )<br></div><div> +{<br></div><div> + return strcmp( (char*)key, ((gst_vlc_rawvideo_fourcc*)ent)->gst );<br></div><div> +}<br></div><div> +<br></div><div> +vlc_fourcc_t GetGstVLCFourcc( const char* gst )<br></div><div> +{<br></div><div> + gst_vlc_rawvideo_fourcc* found = NULL;<br></div><div> +<br></div><div> + if( !gst )<br></div><div> + {<br></div><div> + return VLC_CODEC_UNKNOWN;<br></div><div> + }<br></div><div> +<br></div><div> + found = bsearch( gst, raw_video_fmts,<br></div><div> + ARRAY_SIZE(raw_video_fmts), sizeof(gst_vlc_rawvideo_fourcc),<br></div><div> + compare_func );<br></div><div> +<br></div><div> + if( !found )<br></div><div> + return VLC_CODEC_UNKNOWN;<br></div><div> + else<br></div><div> + return found->i_fourcc;<br></div><div> +}<br></div><div> diff --git a/modules/codec/gstreamer/gstvlc.h b/modules/codec/gstreamer/gstvlc.h<br></div><div> new file mode 100644<br></div><div> index 0000000000..f99b827d8f<br></div><div> --- /dev/null<br></div><div> +++ b/modules/codec/gstreamer/gstvlc.h<br></div><div> @@ -0,0 +1,34 @@<br></div><div> +/*****************************************************************************<br></div><div> + * gst.h:<br></div><div> + *****************************************************************************<br></div><div> + * Copyright (C) 2020 VLC authors and VideoLAN<br></div><div> + *<br></div><div> + * Author: Vikram Fugro <<a href="mailto:vikram.fugro@gmail.com" target="_blank">vikram.fugro@gmail.com</a>><br></div><div> + *<br></div><div> + * This library is free software; you can redistribute it and/or<br></div><div> + * modify it under the terms of the GNU Library General Public<br></div><div> + * License as published by the Free Software Foundation; either<br></div><div> + * version 2.1 of the License, or (at your option) any later version.<br></div><div> + *<br></div><div> + * This library is distributed in the hope that it will be useful,<br></div><div> + * but WITHOUT ANY WARRANTY; without even the implied warranty of<br></div><div> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU<br></div><div> + * Lesser General Public License for more details.<br></div><div> + *<br></div><div> + * You should have received a copy of the GNU Library General Public<br></div><div> + * License along with this library; if not, write to the Free Software<br></div><div> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA<br></div><div> + *****************************************************************************/<br></div><div> +<br></div><div> +/*****************************************************************************<br></div><div> + * Preamble<br></div><div> + *****************************************************************************/<br></div><div> +#ifndef VLC_GST_H_<br></div><div> +#define VLC_GST_H_<br></div><div> +<br></div><div> +#include <vlc_common.h><br></div><div> +#include <vlc_codec.h><br></div><div> +<br></div><div> +vlc_fourcc_t GetGstVLCFourcc( const char* );<br></div><div> +<br></div><div> +#endif /* VLC_GST_H_ */<br></div><div> diff --git a/modules/codec/gstreamer/gstvlcpictureplaneallocator.c b/modules/codec/gstreamer/gstvlcpictureplaneallocator.c<br></div><div> index 2245ee551a..e240435107 100644<br></div><div> --- a/modules/codec/gstreamer/gstvlcpictureplaneallocator.c<br></div><div> +++ b/modules/codec/gstreamer/gstvlcpictureplaneallocator.c<br></div><div> @@ -27,6 +27,7 @@<br></div><div> #include <gst/gst.h><br></div><div> <br></div><div> #include "gstvlcpictureplaneallocator.h"<br></div><div> +#include "gstvlc.h"<br></div><div> <br></div><div> #include <vlc_common.h><br></div><div> <br></div><div> @@ -130,6 +131,22 @@ static GstMemory* gst_vlc_picture_plane_copy(<br></div><div> return NULL;<br></div><div> }<br></div><div> <br></div><div> +static vlc_fourcc_t gst_vlc_to_map_format( char* psz_fourcc )<br></div><div> +{<br></div><div> + if( !psz_fourcc )<br></div><div> + return VLC_CODEC_UNKNOWN;<br></div><div> +<br></div><div> + if( strlen( psz_fourcc ) != 4 )<br></div><div> + {<br></div><div> + return GetGstVLCFourcc( psz_fourcc );<br></div><div> + }<br></div><div> + else<br></div><div> + {<br></div><div> + return vlc_fourcc_GetCodecFromString(<br></div><div> + VIDEO_ES, psz_fourcc );<br></div><div> + }<br></div><div> +}<br></div><div> +<br></div><div> void gst_vlc_picture_plane_allocator_release(<br></div><div> GstVlcPicturePlaneAllocator *p_allocator, GstBuffer *p_buffer )<br></div><div> {<br></div><div> @@ -212,6 +229,7 @@ bool gst_vlc_picture_plane_allocator_alloc(<br></div><div> return true;<br></div><div> }<br></div><div> <br></div><div> +<br></div><div> bool gst_vlc_set_vout_fmt( GstVideoInfo *p_info, GstVideoAlignment *p_align,<br></div><div> GstCaps *p_caps, decoder_t *p_dec )<br></div><div> {<br></div><div> @@ -221,10 +239,10 @@ bool gst_vlc_set_vout_fmt( GstVideoInfo *p_info, GstVideoAlignment *p_align,<br></div><div> vlc_fourcc_t i_chroma;<br></div><div> int i_padded_width, i_padded_height;<br></div><div> <br></div><div> - i_chroma = p_outfmt->i_codec = vlc_fourcc_GetCodecFromString(<br></div><div> - VIDEO_ES,<br></div><div> - gst_structure_get_string( p_str, "format" ) );<br></div><div> - if( !i_chroma )<br></div><div> + const char* psz_fourcc = gst_structure_get_string( p_str, "format" );<br></div><div> +<br></div><div> + i_chroma = p_outfmt->i_codec = gst_vlc_to_map_format( psz_fourcc );<br></div><div> + if( !i_chroma || i_chroma == VLC_CODEC_UNKNOWN )<br></div><div> {<br></div><div> msg_Err( p_dec, "video chroma type not supported" );<br></div><div> return false;<br></div><div> -- <br></div><div> 2.25.1<br></div><div> <br></div></blockquote></div><div>_______________________________________________<br></div><div>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div><a href="https://mailman.videolan.org/listinfo/vlc-devel" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div></blockquote><div><br></div></div>_______________________________________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="https://mailman.videolan.org/listinfo/vlc-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a></blockquote></div>