avcodec/packet_internal: Add proper PacketList struct
Up until now, we had a PacketList structure which is actually a PacketListEntry; a proper PacketList did not exist and all the related functions just passed pointers to pointers to the head and tail elements around. All these pointers were actually consecutive elements of their containing structs, i.e. the users already treated them as if they were a struct. So add a proper PacketList struct and rename the current PacketList to PacketListEntry; also make the functions use this structure instead of the pair of pointers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -238,7 +238,7 @@ static int
|
||||
dshow_read_close(AVFormatContext *s)
|
||||
{
|
||||
struct dshow_ctx *ctx = s->priv_data;
|
||||
PacketList *pktl;
|
||||
PacketListEntry *pktl;
|
||||
|
||||
if (ctx->control) {
|
||||
IMediaControl_Stop(ctx->control);
|
||||
@@ -298,7 +298,7 @@ dshow_read_close(AVFormatContext *s)
|
||||
|
||||
pktl = ctx->pktl;
|
||||
while (pktl) {
|
||||
PacketList *next = pktl->next;
|
||||
PacketListEntry *next = pktl->next;
|
||||
av_packet_unref(&pktl->pkt);
|
||||
av_free(pktl);
|
||||
pktl = next;
|
||||
@@ -342,7 +342,7 @@ callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, e
|
||||
{
|
||||
AVFormatContext *s = priv_data;
|
||||
struct dshow_ctx *ctx = s->priv_data;
|
||||
PacketList **ppktl, *pktl_next;
|
||||
PacketListEntry **ppktl, *pktl_next;
|
||||
|
||||
// dump_videohdr(s, vdhdr);
|
||||
|
||||
@@ -351,7 +351,7 @@ callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, e
|
||||
if(shall_we_drop(s, index, devtype))
|
||||
goto fail;
|
||||
|
||||
pktl_next = av_mallocz(sizeof(PacketList));
|
||||
pktl_next = av_mallocz(sizeof(*pktl_next));
|
||||
if(!pktl_next)
|
||||
goto fail;
|
||||
|
||||
@@ -1868,7 +1868,7 @@ static int dshow_check_event_queue(IMediaEvent *media_event)
|
||||
static int dshow_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
{
|
||||
struct dshow_ctx *ctx = s->priv_data;
|
||||
PacketList *pktl = NULL;
|
||||
PacketListEntry *pktl = NULL;
|
||||
|
||||
while (!ctx->eof && !pktl) {
|
||||
WaitForSingleObject(ctx->mutex, INFINITE);
|
||||
|
||||
Reference in New Issue
Block a user