diff options
author | Uoti Urpala <uau@mplayer2.org> | 2011-08-19 04:59:01 +0300 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-08-19 21:32:47 +0300 |
commit | 6e8d420a419329d95ac35d520c7a26588f7a51cc (patch) | |
tree | fa56028f11f839101ee3f8a8a9a64848655588fb /libmpdemux/demuxer.h | |
parent | 6ec60c976f6fa990ed1c7efa0ceb7e7634d163c7 (diff) | |
download | mpv-6e8d420a419329d95ac35d520c7a26588f7a51cc.tar.bz2 mpv-6e8d420a419329d95ac35d520c7a26588f7a51cc.tar.xz |
demux: avoid a copy of demux packets with lavf, reduce padding
When demux_lavf read a new packet it used to copy the data from
libavformat's struct AVPacket to struct demux_packet and then free the
lavf packet. Change it to instead keep the AVPacket allocated and
point demux_packet fields to the buffer in that.
Also change MP_INPUT_BUFFER_PADDING_SIZE to 8 which matches
FF_INPUT_BUFFER_PADDING SIZE; demux_lavf packets won't have more
padding now anyway (it was increased from 8 earlier when
FF_INPUT_BUFFER_PADDING_SIZE was increased in libavcodec, but that
change was reverted).
Diffstat (limited to 'libmpdemux/demuxer.h')
-rw-r--r-- | libmpdemux/demuxer.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h index b3fef45ed7..6f51dc76dc 100644 --- a/libmpdemux/demuxer.h +++ b/libmpdemux/demuxer.h @@ -122,7 +122,8 @@ enum timestamp_type { #define SEEK_FORWARD (1 << 2) #define SEEK_BACKWARD (1 << 3) -#define MP_INPUT_BUFFER_PADDING_SIZE 64 +// demux_lavf can pass lavf buffers using FF_INPUT_BUFFER_PADDING_SIZE instead +#define MP_INPUT_BUFFER_PADDING_SIZE 8 // Holds one packet/frame/whatever typedef struct demux_packet { @@ -136,6 +137,7 @@ typedef struct demux_packet { int refcount; // counter for the master packet, if 0, buffer can be free()d struct demux_packet *master; //in clones, pointer to the master packet struct demux_packet *next; + struct AVPacket *avpacket; // original libavformat packet (demux_lavf) } demux_packet_t; typedef struct demux_stream { @@ -302,6 +304,8 @@ typedef struct { } demux_program_t; struct demux_packet *new_demux_packet(size_t len); +// data must already have suitable padding +struct demux_packet *new_demux_packet_fromdata(void *data, size_t len); void resize_demux_packet(struct demux_packet *dp, size_t len); struct demux_packet *clone_demux_packet(struct demux_packet *pack); void free_demux_packet(struct demux_packet *dp); |