History

avformat/dss: Remove unnecessary allocation

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.

Andreas Rheinhardt committed 6 years ago

Commit aebf3141 parent ab502fa1 file · +1 −15Browse files

Unified · Split

libavformat/dss.c+1−15
@@ -50,7 +50,7 @@ typedef struct DSSDemuxContext { · 49 unmodified lines
50 int counter;50 int counter;
51 int swap;51 int swap;
52 int dss_sp_swap_byte;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 int packet_size;55 int packet_size;
56 int dss_header_size;56 int dss_header_size;
@@ -168,10 +168,6 @@ static int dss_read_header(AVFormatContext *s) · 111 unmodified lines
168 ctx->counter = 0;168 ctx->counter = 0;
169 ctx->swap = 0;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 return 0;171 return 0;
176}172}
177 173
@@ -327,15 +323,6 @@ static int dss_read_packet(AVFormatContext *s, AVPacket *pkt) · 149 unmodified lines
327 return dss_723_1_read_packet(s, pkt);323 return dss_723_1_read_packet(s, pkt);
328}324}
329 325
330static 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
339static int dss_read_seek(AVFormatContext *s, int stream_index,326static int dss_read_seek(AVFormatContext *s, int stream_index,
340 int64_t timestamp, int flags)327 int64_t timestamp, int flags)
341{328{
@@ -382,7 +369,6 @@ AVInputFormat ff_dss_demuxer = { · 40 unmodified lines
382 .read_probe = dss_probe,369 .read_probe = dss_probe,
383 .read_header = dss_read_header,370 .read_header = dss_read_header,
384 .read_packet = dss_read_packet,371 .read_packet = dss_read_packet,
385 .read_close = dss_read_close,
386 .read_seek = dss_read_seek,372 .read_seek = dss_read_seek,
387 .extensions = "dss"373 .extensions = "dss"
388};374};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t