cc_stream.cpp 619 B

123456789101112131415161718192021222324
  1. #include "cc_stream.h"
  2. namespace ffmpeg {
  3. CCStream::CCStream(
  4. AVFormatContext* inputCtx,
  5. int index,
  6. bool convertPtsToWallTime,
  7. const SubtitleFormat& format)
  8. : SubtitleStream(inputCtx, index, convertPtsToWallTime, format) {
  9. format_.type = TYPE_CC;
  10. }
  11. AVCodec* CCStream::findCodec(AVCodecParameters* params) {
  12. if (params->codec_id == AV_CODEC_ID_BIN_DATA &&
  13. params->codec_type == AVMEDIA_TYPE_DATA) {
  14. // obtain subtitles codec
  15. params->codec_id = AV_CODEC_ID_MOV_TEXT;
  16. params->codec_type = AVMEDIA_TYPE_SUBTITLE;
  17. }
  18. return Stream::findCodec(params);
  19. }
  20. } // namespace ffmpeg