static subpicture_t *ConvertSubtitle(decoder_t *, AVSubtitle *, mtime_t pts,
AVCodecContext *avctx);
+static subpicture_t *DecodeSubtitle(decoder_t *, block_t **);
/**
* Initialize subtitle decoder
*/
int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
- AVCodec *codec, int codec_id, const char *namecodec)
+ const AVCodec *codec)
{
decoder_sys_t *sys;
/* */
- switch (codec_id) {
+ switch (codec->id) {
case AV_CODEC_ID_HDMV_PGS_SUBTITLE:
case AV_CODEC_ID_XSUB:
case AV_CODEC_ID_DVB_SUBTITLE:
if (!sys)
return VLC_ENOMEM;
- codec->type = AVMEDIA_TYPE_SUBTITLE;
- context->codec_type = AVMEDIA_TYPE_SUBTITLE;
- context->codec_id = codec_id;
sys->p_context = context;
sys->p_codec = codec;
- sys->i_codec_id = codec_id;
- sys->psz_namecodec = namecodec;
sys->b_delayed_open = false;
/* */
av_dict_free(&options);
if (ret < 0) {
- msg_Err(dec, "cannot open codec (%s)", namecodec);
+ msg_Err(dec, "cannot open codec (%s)", codec->name);
free(context->extradata);
free(sys);
return VLC_EGENERIC;
}
/* */
- msg_Dbg(dec, "libavcodec codec (%s) started", namecodec);
+ msg_Dbg(dec, "libavcodec codec (%s) started", codec->name);
dec->fmt_out.i_cat = SPU_ES;
+ dec->pf_decode_sub = DecodeSubtitle;
return VLC_SUCCESS;
}
/**
* Decode one subtitle
*/
-subpicture_t *DecodeSubtitle(decoder_t *dec, block_t **block_ptr)
+static subpicture_t *DecodeSubtitle(decoder_t *dec, block_t **block_ptr)
{
decoder_sys_t *sys = dec->p_sys;
video_format_t fmt;
memset(&fmt, 0, sizeof(fmt));
- fmt.i_chroma = VLC_FOURCC('R','G','B','A');
+ fmt.i_chroma = VLC_CODEC_RGBA;
fmt.i_width =
fmt.i_visible_width = ffregion->w;
fmt.i_height =