mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
avformat/s337m: Use av_get_packet() to read packet
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
47d0b86cf3
commit
84b02bbb78
@ -147,7 +147,6 @@ static int s337m_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
uint64_t state = 0;
|
uint64_t state = 0;
|
||||||
int ret, data_type, data_size, offset;
|
int ret, data_type, data_size, offset;
|
||||||
enum AVCodecID codec;
|
enum AVCodecID codec;
|
||||||
int64_t pos;
|
|
||||||
|
|
||||||
while (!IS_LE_MARKER(state)) {
|
while (!IS_LE_MARKER(state)) {
|
||||||
state = (state << 8) | avio_r8(pb);
|
state = (state << 8) | avio_r8(pb);
|
||||||
@ -163,19 +162,11 @@ static int s337m_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
data_size = avio_rl24(pb);
|
data_size = avio_rl24(pb);
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = avio_tell(pb);
|
|
||||||
|
|
||||||
if ((ret = s337m_get_offset_and_codec(s, state, data_type, data_size, &offset, &codec)) < 0)
|
if ((ret = s337m_get_offset_and_codec(s, state, data_type, data_size, &offset, &codec)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if ((ret = av_new_packet(pkt, offset)) < 0)
|
if ((ret = av_get_packet(pb, pkt, offset)) != offset)
|
||||||
return ret;
|
return ret < 0 ? ret : AVERROR_EOF;
|
||||||
|
|
||||||
pkt->pos = pos;
|
|
||||||
|
|
||||||
if (avio_read(pb, pkt->data, pkt->size) < pkt->size) {
|
|
||||||
return AVERROR_EOF;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IS_16LE_MARKER(state))
|
if (IS_16LE_MARKER(state))
|
||||||
ff_spdif_bswap_buf16((uint16_t *)pkt->data, (uint16_t *)pkt->data, pkt->size >> 1);
|
ff_spdif_bswap_buf16((uint16_t *)pkt->data, (uint16_t *)pkt->data, pkt->size >> 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user