]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/s337m.c
avformat: Remove getters and setters
[ffmpeg] / libavformat / s337m.c
index 36e1047af82429c5c57debd17258e8be836d59b2..9d1b52eb614bcd1e1bd120eea5235fa8af64b27d 100644 (file)
@@ -147,7 +147,6 @@ static int s337m_read_packet(AVFormatContext *s, AVPacket *pkt)
     uint64_t state = 0;
     int ret, data_type, data_size, offset;
     enum AVCodecID codec;
-    int64_t pos;
 
     while (!IS_LE_MARKER(state)) {
         state = (state << 8) | avio_r8(pb);
@@ -163,19 +162,11 @@ static int s337m_read_packet(AVFormatContext *s, AVPacket *pkt)
         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)
         return ret;
 
-    if ((ret = av_new_packet(pkt, offset)) < 0)
-        return ret;
-
-    pkt->pos = pos;
-
-    if (avio_read(pb, pkt->data, pkt->size) < pkt->size) {
-        return AVERROR_EOF;
-    }
+    if ((ret = av_get_packet(pb, pkt, offset)) != offset)
+        return ret < 0 ? ret : AVERROR_EOF;
 
     if (IS_16LE_MARKER(state))
         ff_spdif_bswap_buf16((uint16_t *)pkt->data, (uint16_t *)pkt->data, pkt->size >> 1);
@@ -189,6 +180,7 @@ static int s337m_read_packet(AVFormatContext *s, AVPacket *pkt)
         }
         st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
         st->codecpar->codec_id   = codec;
+        st->need_parsing         = AVSTREAM_PARSE_HEADERS;
     }
 
     return 0;