Permalink
Browse files

AvFormatDecoder: Add support for font attachments.

Refs #9294
  • Loading branch information...
Mark Kendall
Mark Kendall committed May 3, 2011
1 parent a0b999d commit fa52b41a16060e2c570a2b7d85d12dfe40d24d83
@@ -1689,6 +1689,7 @@ int AvFormatDecoder::ScanStreams(bool novideo)
bitrate = 0;
fps = 0;
+ tracks[kTrackTypeAttachment].clear();
tracks[kTrackTypeAudio].clear();
tracks[kTrackTypeSubtitle].clear();
tracks[kTrackTypeTeletextCaptions].clear();
@@ -1912,6 +1913,16 @@ int AvFormatDecoder::ScanStreams(bool novideo)
.arg(ff_codec_type_string(enc->codec_type)));
break;
}
+ case CODEC_TYPE_ATTACHMENT:
+ {
+ if (enc->codec_id == CODEC_ID_TTF)
+ tracks[kTrackTypeAttachment].push_back(
+ StreamInfo(i, 0, 0, ic->streams[i]->id, 0));
+ bitrate += enc->bit_rate;
+ VERBOSE(VB_PLAYBACK, LOC + QString("Attachment codec (%1)")
+ .arg(ff_codec_type_string(enc->codec_type)));
+ break;
+ }
default:
{
bitrate += enc->bit_rate;
@@ -3378,6 +3389,19 @@ QByteArray AvFormatDecoder::GetSubHeader(uint trackNo) const
ic->streams[index]->codec->subtitle_header_size);
}
+void AvFormatDecoder::GetAttachmentData(uint trackNo, QByteArray &filename,
+ QByteArray &data)
+{
+ if (trackNo >= tracks[kTrackTypeAttachment].size())
+ return;
+
+ int index = tracks[kTrackTypeAttachment][trackNo].av_stream_index;
+ // TODO deprecated - use AVMetaData
+ filename = QByteArray(ic->streams[index]->filename);
+ data = QByteArray((char *)ic->streams[index]->codec->extradata,
+ ic->streams[index]->codec->extradata_size);
+}
+
bool AvFormatDecoder::SetAudioByComponentTag(int tag)
{
for (uint i = 0; i < tracks[kTrackTypeAudio].size(); i++)
@@ -169,6 +169,8 @@ class AvFormatDecoder : public DecoderBase
virtual QString GetXDS(const QString&) const;
virtual QByteArray GetSubHeader(uint trackNo) const;
+ virtual void GetAttachmentData(uint trackNo, QByteArray &filename,
+ QByteArray &data);
// MHEG stuff
virtual bool SetAudioByComponentTag(int tag);
@@ -31,6 +31,7 @@ typedef enum TrackTypes
kTrackTypeTeletextCaptions,
kTrackTypeTeletextMenu,
kTrackTypeRawText,
+ kTrackTypeAttachment,
kTrackTypeCount,
kTrackTypeTextSubtitle,
@@ -195,6 +196,8 @@ class DecoderBase
virtual QString GetXDS(const QString&) const { return QString::null; }
virtual QByteArray GetSubHeader(uint trackNo) const { return QByteArray(); }
+ virtual void GetAttachmentData(uint trackNo, QByteArray &filename,
+ QByteArray &data) {}
// MHEG/MHI stuff
virtual bool SetAudioByComponentTag(int) { return false; }

0 comments on commit fa52b41

Please sign in to comment.