comparison utils.c @ 3566:77a07b9dbe98 libavformat

Move add_to_pktbuf() before av_read_packet(). My future work on codec identification cleanup will need this.
author michael
date Sat, 12 Jul 2008 14:28:27 +0000
parents b3e976d080cd
children c24546b44906
comparison
equal deleted inserted replaced
3565:b3e976d080cd 3566:77a07b9dbe98
518 518
519 } 519 }
520 520
521 /*******************************************************/ 521 /*******************************************************/
522 522
523 static AVPacket *add_to_pktbuf(AVPacketList **packet_buffer, AVPacket *pkt){
524 AVPacketList *pktl;
525 AVPacketList **plast_pktl= packet_buffer;
526
527 while(*plast_pktl) plast_pktl= &(*plast_pktl)->next; //FIXME maybe maintain pointer to the last?
528
529 pktl = av_mallocz(sizeof(AVPacketList));
530 if (!pktl)
531 return NULL;
532
533 /* add the packet in the buffered packet list */
534 *plast_pktl = pktl;
535 pktl->pkt= *pkt;
536 return &pktl->pkt;
537 }
538
523 int av_read_packet(AVFormatContext *s, AVPacket *pkt) 539 int av_read_packet(AVFormatContext *s, AVPacket *pkt)
524 { 540 {
525 int ret; 541 int ret;
526 AVStream *st; 542 AVStream *st;
527 av_init_packet(pkt); 543 av_init_packet(pkt);
941 pkt->dts, 957 pkt->dts,
942 pkt->size, 958 pkt->size,
943 pkt->flags); 959 pkt->flags);
944 960
945 return 0; 961 return 0;
946 }
947
948 static AVPacket *add_to_pktbuf(AVPacketList **packet_buffer, AVPacket *pkt){
949 AVPacketList *pktl;
950 AVPacketList **plast_pktl= packet_buffer;
951
952 while(*plast_pktl) plast_pktl= &(*plast_pktl)->next; //FIXME maybe maintain pointer to the last?
953
954 pktl = av_mallocz(sizeof(AVPacketList));
955 if (!pktl)
956 return NULL;
957
958 /* add the packet in the buffered packet list */
959 *plast_pktl = pktl;
960 pktl->pkt= *pkt;
961 return &pktl->pkt;
962 } 962 }
963 963
964 int av_read_frame(AVFormatContext *s, AVPacket *pkt) 964 int av_read_frame(AVFormatContext *s, AVPacket *pkt)
965 { 965 {
966 AVPacketList *pktl; 966 AVPacketList *pktl;