Mercurial > libavformat.hg
comparison rmdec.c @ 4691:eb3f12a921ab libavformat
Revert to r17908.
author | rbultje |
---|---|
date | Mon, 09 Mar 2009 22:02:06 +0000 |
parents | 0905585d48fd |
children | 71f1392ab8d4 |
comparison
equal
deleted
inserted
replaced
4690:2249417477c5 | 4691:eb3f12a921ab |
---|---|
466 } | 466 } |
467 if (i == s->nb_streams) { | 467 if (i == s->nb_streams) { |
468 skip: | 468 skip: |
469 /* skip packet if unknown number */ | 469 /* skip packet if unknown number */ |
470 url_fskip(pb, len); | 470 url_fskip(pb, len); |
471 rm->remaining_len = 0; | 471 rm->remaining_len -= len; |
472 continue; | 472 continue; |
473 } | 473 } |
474 *stream_index= i; | 474 *stream_index= i; |
475 | 475 |
476 return len; | 476 return len; |
689 } | 689 } |
690 | 690 |
691 static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) | 691 static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) |
692 { | 692 { |
693 RMDemuxContext *rm = s->priv_data; | 693 RMDemuxContext *rm = s->priv_data; |
694 ByteIOContext *pb = s->pb; | |
694 AVStream *st; | 695 AVStream *st; |
695 int i, len, seq = 1; | 696 int i, len; |
696 int64_t timestamp, pos; | 697 int64_t timestamp, pos; |
697 int flags; | 698 int flags; |
698 | 699 |
699 if (rm->audio_pkt_cnt) { | 700 if (rm->audio_pkt_cnt) { |
700 // If there are queued audio packet return them first | 701 // If there are queued audio packet return them first |
701 st = s->streams[rm->audio_stream_num]; | 702 st = s->streams[rm->audio_stream_num]; |
702 ff_rm_retrieve_cache(s, s->pb, st, st->priv_data, pkt); | 703 ff_rm_retrieve_cache(s, s->pb, st, st->priv_data, pkt); |
703 } else if (rm->old_format) { | 704 } else if (rm->old_format) { |
704 RMStream *ast = s->streams[0]->priv_data; | 705 RMStream *ast; |
705 int res, y, h = ast->audio_framesize ? ast->sub_packet_h : 1; | 706 |
706 | 707 st = s->streams[0]; |
707 timestamp = AV_NOPTS_VALUE; | 708 ast = st->priv_data; |
708 len = ast->audio_framesize ? ast->coded_framesize * h / 2 : RAW_PACKET_SIZE; | 709 if (st->codec->codec_id == CODEC_ID_RA_288) { |
709 for (y = 0; y < h; y++) { | 710 int x, y; |
710 flags = !y ? 2 : 0; | 711 |
711 res = ff_rm_parse_packet(s, s->pb, s->streams[0], ast, len, pkt, | 712 for (y = 0; y < ast->sub_packet_h; y++) |
712 &seq, &flags, ×tamp); | 713 for (x = 0; x < ast->sub_packet_h/2; x++) |
713 } | 714 if (get_buffer(pb, ast->pkt.data+x*2*ast->audio_framesize+y*ast->coded_framesize, ast->coded_framesize) <= 0) |
714 if (res < 0) | 715 return AVERROR(EIO); |
715 return res; | 716 rm->audio_stream_num = 0; |
717 rm->audio_pkt_cnt = ast->sub_packet_h * ast->audio_framesize / st->codec->block_align - 1; | |
718 // Release first audio packet | |
719 av_new_packet(pkt, st->codec->block_align); | |
720 memcpy(pkt->data, ast->pkt.data, st->codec->block_align); //FIXME avoid this | |
721 pkt->flags |= PKT_FLAG_KEY; // Mark first packet as keyframe | |
722 pkt->stream_index = 0; | |
723 } else { | |
724 /* just read raw bytes */ | |
725 len = RAW_PACKET_SIZE; | |
726 len= av_get_packet(pb, pkt, len); | |
727 pkt->stream_index = 0; | |
728 if (len <= 0) { | |
729 return AVERROR(EIO); | |
730 } | |
731 pkt->size = len; | |
732 } | |
733 rm_ac3_swap_bytes(st, pkt); | |
716 } else { | 734 } else { |
735 int seq=1; | |
717 resync: | 736 resync: |
718 len=sync(s, ×tamp, &flags, &i, &pos); | 737 len=sync(s, ×tamp, &flags, &i, &pos); |
719 if(len<0) | 738 if(len<0) |
720 return AVERROR(EIO); | 739 return AVERROR(EIO); |
721 st = s->streams[i]; | 740 st = s->streams[i]; |