Mercurial > libavformat.hg
comparison utils.c @ 3564:b016a776ce4b libavformat
Pass AVPacketList instead of the whole context to add_to_pktbuf as that is
all that is needed.
author | michael |
---|---|
date | Sat, 12 Jul 2008 13:15:00 +0000 |
parents | 7ae5e02af8d9 |
children | b3e976d080cd |
comparison
equal
deleted
inserted
replaced
3563:82f150c809c6 | 3564:b016a776ce4b |
---|---|
929 pkt->flags); | 929 pkt->flags); |
930 | 930 |
931 return 0; | 931 return 0; |
932 } | 932 } |
933 | 933 |
934 static AVPacket *add_to_pktbuf(AVFormatContext *s, AVPacket *pkt){ | 934 static AVPacket *add_to_pktbuf(AVPacketList **packet_buffer, AVPacket *pkt){ |
935 AVPacketList *pktl= s->packet_buffer; | 935 AVPacketList *pktl; |
936 AVPacketList **plast_pktl= &s->packet_buffer; | 936 AVPacketList **plast_pktl= packet_buffer; |
937 | 937 |
938 while(*plast_pktl) plast_pktl= &(*plast_pktl)->next; //FIXME maybe maintain pointer to the last? | 938 while(*plast_pktl) plast_pktl= &(*plast_pktl)->next; //FIXME maybe maintain pointer to the last? |
939 | 939 |
940 pktl = av_mallocz(sizeof(AVPacketList)); | 940 pktl = av_mallocz(sizeof(AVPacketList)); |
941 if (!pktl) | 941 if (!pktl) |
989 continue; | 989 continue; |
990 }else | 990 }else |
991 return ret; | 991 return ret; |
992 } | 992 } |
993 | 993 |
994 if(av_dup_packet(add_to_pktbuf(s, pkt)) < 0) | 994 if(av_dup_packet(add_to_pktbuf(&s->packet_buffer, pkt)) < 0) |
995 return AVERROR(ENOMEM); | 995 return AVERROR(ENOMEM); |
996 }else{ | 996 }else{ |
997 assert(!s->packet_buffer); | 997 assert(!s->packet_buffer); |
998 return av_read_frame_internal(s, pkt); | 998 return av_read_frame_internal(s, pkt); |
999 } | 999 } |
1982 } | 1982 } |
1983 } | 1983 } |
1984 break; | 1984 break; |
1985 } | 1985 } |
1986 | 1986 |
1987 pkt= add_to_pktbuf(ic, &pkt1); | 1987 pkt= add_to_pktbuf(&ic->packet_buffer, &pkt1); |
1988 if(av_dup_packet(pkt) < 0) | 1988 if(av_dup_packet(pkt) < 0) |
1989 return AVERROR(ENOMEM); | 1989 return AVERROR(ENOMEM); |
1990 | 1990 |
1991 read_size += pkt->size; | 1991 read_size += pkt->size; |
1992 | 1992 |