[vlc-commits] avformat: mux: handle subtitle metadata
Alexandre Janniaux
git at videolan.org
Thu Feb 13 12:03:45 CET 2020
vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Wed Dec 11 16:23:13 2019 +0100| [befd367c39d649b020443712a88b1257bd3dbb59] | committer: Jean-Baptiste Kempf
avformat: mux: handle subtitle metadata
Some information are added through the metadata dictionary attached
to the stream object. In these information, the following keys are
used by the avformat Matroska muxer:
+ title: correspond to the TrackName, we're putting it in
psz_description field in the Matroska parser module.
+ language: correspond to the TrackLanguage, we're putting it in
the psz_language field in the Matroska parser module.
Replicate the behaviour so that these metadata are not lost after
remuxing.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=befd367c39d649b020443712a88b1257bd3dbb59
---
modules/demux/avformat/mux.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index b9d9c378c8..a02206efbf 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -263,6 +263,18 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
}
break;
+ case SPU_ES:
+ codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
+ /* psz_description and psz_language are expected to be compliant with
+ * the muxing format. It should be the case when muxing a compliant
+ * source to the same muxing format, but we have no general guarantee
+ * at this point in the code. */
+ if (fmt->psz_description != NULL && *fmt->psz_description != '\0')
+ av_dict_set( &stream->metadata, "title", fmt->psz_description, 0 );
+ if (fmt->psz_language != NULL && *fmt->psz_language != '\0')
+ av_dict_set( &stream->metadata, "language", fmt->psz_language, 0 );
+ break;
+
case VIDEO_ES:
if( !fmt->video.i_frame_rate || !fmt->video.i_frame_rate_base ) {
msg_Warn( p_mux, "Missing frame rate, assuming 25fps" );
More information about the vlc-commits
mailing list