summaryrefslogtreecommitdiffstats
path: root/demux/packet.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-24 17:45:28 +0200
committerwm4 <wm4@nowhere>2014-08-25 00:46:26 +0200
commit758f8f7bd46388cba9330ad47701c0ebacc2d963 (patch)
tree5fcecbf5218d13888af60251c8f8fd821c983cfd /demux/packet.h
parentef1c6e9295f40a4633685eeae3c12706f8290bb0 (diff)
downloadmpv-758f8f7bd46388cba9330ad47701c0ebacc2d963.tar.bz2
mpv-758f8f7bd46388cba9330ad47701c0ebacc2d963.tar.xz
demux: always use AVPacket
This is a simplification, because it lets us use the AVPacket functions, instead of handling the details manually. It also allows the libavcodec rawvideo decoder to use reference counting, so it doesn't have to memcpy() the full image data. The change in av_common.c enables this. This change is somewhat risky, because we rely on the following AVPacket implementation details and assumptions: - av_packet_ref() doesn't access the input padding, and just copies the data. By the API, AVPacket is always padded, and we violate this. The lavc implementation would have to go out of its way to make this a real problem, though. - We hope that the way we make the AVPacket refcountable in av_common.c is actually supported API-usage. It's hard to tell whether it is. Of course we still use our own "old" demux_packet struct, just so that libav* API usage is somewhat isolated.
Diffstat (limited to 'demux/packet.h')
-rw-r--r--demux/packet.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/demux/packet.h b/demux/packet.h
index 21c0a6dc8f..9c4e560e05 100644
--- a/demux/packet.h
+++ b/demux/packet.h
@@ -34,13 +34,11 @@ typedef struct demux_packet {
bool keyframe;
int stream; // source stream index
struct demux_packet *next;
- void *allocation;
- struct AVPacket *avpacket; // original libavformat packet (demux_lavf)
+ struct AVPacket *avpacket; // keep the buffer allocation
} demux_packet_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);
+struct demux_packet *new_demux_packet_from_avpacket(struct AVPacket *avpkt);
struct demux_packet *new_demux_packet_from(void *data, size_t len);
void demux_packet_shorten(struct demux_packet *dp, size_t len);
void free_demux_packet(struct demux_packet *dp);