[vlc-devel] [PATCH 2/2] avformat: enable SPU_ES muxing for text subtitles

Steve Lhomme robux4 at ycbcr.xyz
Wed Nov 27 11:13:37 CET 2019


On 2019-11-27 11:03, Alexandre Janniaux wrote:
> Hi,
> 
> I only tested with subrip subtitles, so I feared enabling
> other formats would break things that I don't understand.
> 
> That being said, you're right that I should still use
> GetFfmpegCodec to ensure using the correct format in any case
> in the second patch, but should probably keep this patch as
> is.
> 
> What do you think ?

I agree. Also if we add a stream for a codec that lavf cannot mux it's 
the same as if an audio or video codec cannot be muxed. I supposed this 
case should be handled already for audio/video streams.

> Regards,
> --
> Alexandre Janniaux
> Videolabs
> 
> On Wed, Nov 27, 2019 at 08:14:26AM +0100, Steve Lhomme wrote:
>> On 2019-11-26 23:54, Alexandre Janniaux wrote:
>>> Allows SPU_ES to be muxed as long as they carry text subtitles. It
>>> releases a little bit the constraint on muxing capabilities of avformat
>>> but in particular allows muxing subrip within matroska files.
>>> ---
>>>    modules/demux/avformat/mux.c | 11 ++++++++++-
>>>    1 file changed, 10 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
>>> index 76a3c1da4a..e1d3eb99a4 100644
>>> --- a/modules/demux/avformat/mux.c
>>> +++ b/modules/demux/avformat/mux.c
>>> @@ -220,12 +220,21 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
>>>            i_codec_id = AV_CODEC_ID_MP3;
>>>        }
>>> -    if( fmt->i_cat != VIDEO_ES && fmt->i_cat != AUDIO_ES)
>>> +    if( fmt->i_cat != VIDEO_ES
>>> +     && fmt->i_cat != AUDIO_ES
>>> +     && fmt->i_cat != SPU_ES )
>>>        {
>>>            msg_Warn( p_mux, "Unhandled ES category" );
>>>            return VLC_EGENERIC;
>>>        }
>>> +    if( fmt->i_cat == SPU_ES && fmt->i_codec != VLC_CODEC_SUBT )
>>> +    {
>>> +        msg_Warn( p_mux, "Unhandled SPU format `%4.4s'",
>>> +                  (const char*)&fmt->i_codec );
>>> +        return VLC_EGENERIC;
>>
>> Shouldn't the GetFfmpegCodec() call to find the appropriate codec_id be
>> enough to tell if the SPU format can be handled by ffmpeg or not ?
>>
>>> +    }
>>> +
>>>        /* */
>>>        p_input->p_sys = malloc( sizeof( int ) );
>>>        if( unlikely(p_input->p_sys == NULL) )
>>> --
>>> 2.24.0
>>>
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list