Put a buffer with a known fixed size into the demuxer's context instead of allocating it separately. This also allows to remove the demuxer's read_close()-function.
Unified · Split
| @@ -50,7 +50,7 @@ typedef struct DSSDemuxContext { · 49 unmodified lines | ||
| 50 | 50 | int counter; |
| 51 | 51 | int swap; |
| 52 | 52 | int dss_sp_swap_byte; |
| 53 | − int8_t *dss_sp_buf; | |
| 53 | + int8_t dss_sp_buf[DSS_FRAME_SIZE + 1]; | |
| 54 | 54 | |
| 55 | 55 | int packet_size; |
| 56 | 56 | int dss_header_size; |
| @@ -168,10 +168,6 @@ static int dss_read_header(AVFormatContext *s) · 111 unmodified lines | ||
| 168 | 168 | ctx->counter = 0; |
| 169 | 169 | ctx->swap = 0; |
| 170 | 170 | |
| 171 | − ctx->dss_sp_buf = av_malloc(DSS_FRAME_SIZE + 1); | |
| 172 | − if (!ctx->dss_sp_buf) | |
| 173 | − return AVERROR(ENOMEM); | |
| 174 | − | |
| 175 | 171 | return 0; |
| 176 | 172 | } |
| 177 | 173 | |
| @@ -327,15 +323,6 @@ static int dss_read_packet(AVFormatContext *s, AVPacket *pkt) · 149 unmodified lines | ||
| 327 | 323 | return dss_723_1_read_packet(s, pkt); |
| 328 | 324 | } |
| 329 | 325 | |
| 330 | −static int dss_read_close(AVFormatContext *s) | |
| 331 | −{ | |
| 332 | − DSSDemuxContext *ctx = s->priv_data; | |
| 333 | − | |
| 334 | − av_freep(&ctx->dss_sp_buf); | |
| 335 | − | |
| 336 | − return 0; | |
| 337 | −} | |
| 338 | − | |
| 339 | 326 | static int dss_read_seek(AVFormatContext *s, int stream_index, |
| 340 | 327 | int64_t timestamp, int flags) |
| 341 | 328 | { |
| @@ -382,7 +369,6 @@ AVInputFormat ff_dss_demuxer = { · 40 unmodified lines | ||
| 382 | 369 | .read_probe = dss_probe, |
| 383 | 370 | .read_header = dss_read_header, |
| 384 | 371 | .read_packet = dss_read_packet, |
| 385 | − .read_close = dss_read_close, | |
| 386 | 372 | .read_seek = dss_read_seek, |
| 387 | 373 | .extensions = "dss" |
| 388 | 374 | }; |