MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / msp_read_header

Function msp_read_header

libavformat/mspdec.c:51–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51static int msp_read_header(AVFormatContext *s)
52{
53 MSPContext * cntx = s->priv_data;
54 AVIOContext *pb = s->pb;
55 AVStream *st;
56
57 st = avformat_new_stream(s, NULL);
58 if (!st)
59 return AVERROR(ENOMEM);
60
61 st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
62 st->codecpar->codec_id = avio_rl32(pb) == MKTAG('D', 'a', 'n', 'M') ? AV_CODEC_ID_RAWVIDEO : AV_CODEC_ID_MSP2;
63
64 st->codecpar->width = avio_rl16(pb);
65 st->codecpar->height = avio_rl16(pb);
66 st->codecpar->format = AV_PIX_FMT_MONOBLACK;
67
68 st->sample_aspect_ratio.num = avio_rl16(pb);
69 st->sample_aspect_ratio.den = avio_rl16(pb);
70 avio_skip(pb, 20);
71
72 if (st->codecpar->codec_id == AV_CODEC_ID_RAWVIDEO) {
73 cntx->packet_size = av_image_get_buffer_size(st->codecpar->format, st->codecpar->width, st->codecpar->height, 1);
74 } else
75 cntx->packet_size = 2 * st->codecpar->height;
76
77 if (cntx->packet_size <= 0)
78 return cntx->packet_size < 0 ? cntx->packet_size : AVERROR_INVALIDDATA;
79
80 return 0;
81}
82
83static int msp_read_packet(AVFormatContext *s, AVPacket *pkt)
84{

Callers

nothing calls this directly

Calls 5

avformat_new_streamFunction · 0.85
avio_rl32Function · 0.85
avio_rl16Function · 0.85
avio_skipFunction · 0.85
av_image_get_buffer_sizeFunction · 0.85

Tested by

no test coverage detected