Decode a subtitle message.
Return a negative value on error, otherwise return the number of bytes used.
If no subtitle could be decompressed, got_sub_ptr is zero.
Otherwise, the subtitle is stored in *sub.
Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for
simplicity, because the performance difference is expect to be negligible
and reusing a get_buffer written for video codecs would probably perform badly
due to a potentially very different allocation pattern.
Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input
and output. This means that for some packets they will not immediately
produce decoded output and need to be flushed at the end of decoding to get
all the decoded data. Flushing is done by calling this function with packets
with avpkt->data set to NULL and avpkt->size set to 0 until it stops
returning subtitles. It is safe to flush even those decoders that are not
marked with AV_CODEC_CAP_DELAY, then no subtitles will be returned.
@note The AVCodecContext MUST have been opened with @ref avcodec_open2()
before packets may be fed to the decoder.
@param avctx the codec context
@paramout sub The Preallocated AVSubtitle in which the decoded subtitle will be stored,
must be freed with avsubtitle_free if *got_sub_ptr is set.
@param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero.
@paramin avpkt The input AVPacket containing the input buffer.
Decode a subtitle message. Return a negative value on error, otherwise return the number of bytes used. If no subtitle could be decompressed, got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for simplicity, because the performance difference is expect to be negligible and reusing a get_buffer written for video codecs would probably perform badly due to a potentially very different allocation pattern.
Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input and output. This means that for some packets they will not immediately produce decoded output and need to be flushed at the end of decoding to get all the decoded data. Flushing is done by calling this function with packets with avpkt->data set to NULL and avpkt->size set to 0 until it stops returning subtitles. It is safe to flush even those decoders that are not marked with AV_CODEC_CAP_DELAY, then no subtitles will be returned.
@note The AVCodecContext MUST have been opened with @ref avcodec_open2() before packets may be fed to the decoder.
@param avctx the codec context @paramout sub The Preallocated AVSubtitle in which the decoded subtitle will be stored, must be freed with avsubtitle_free if *got_sub_ptr is set. @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero. @paramin avpkt The input AVPacket containing the input buffer.