Mercurial > libavformat.hg
comparison rmdec.c @ 5910:536e5527c1e0 libavformat
Define AVMediaType enum, and use it instead of enum CodecType, which
is deprecated and will be dropped at the next major bump.
author | stefano |
---|---|
date | Tue, 30 Mar 2010 23:30:55 +0000 |
parents | 6ff00deb94fb |
children | 11bb10c37225 |
comparison
equal
deleted
inserted
replaced
5909:b8041f85c327 | 5910:536e5527c1e0 |
---|---|
159 // Skip extra header crap (this should never happen) | 159 // Skip extra header crap (this should never happen) |
160 if ((startpos + header_size) > url_ftell(pb)) | 160 if ((startpos + header_size) > url_ftell(pb)) |
161 url_fskip(pb, header_size + startpos - url_ftell(pb)); | 161 url_fskip(pb, header_size + startpos - url_ftell(pb)); |
162 st->codec->sample_rate = 8000; | 162 st->codec->sample_rate = 8000; |
163 st->codec->channels = 1; | 163 st->codec->channels = 1; |
164 st->codec->codec_type = CODEC_TYPE_AUDIO; | 164 st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
165 st->codec->codec_id = CODEC_ID_RA_144; | 165 st->codec->codec_id = CODEC_ID_RA_144; |
166 } else { | 166 } else { |
167 int flavor, sub_packet_h, coded_framesize, sub_packet_size; | 167 int flavor, sub_packet_h, coded_framesize, sub_packet_size; |
168 int codecdata_length; | 168 int codecdata_length; |
169 /* old version (4) */ | 169 /* old version (4) */ |
193 buf[4] = 0; | 193 buf[4] = 0; |
194 } else { | 194 } else { |
195 get_str8(pb, buf, sizeof(buf)); /* desc */ | 195 get_str8(pb, buf, sizeof(buf)); /* desc */ |
196 get_str8(pb, buf, sizeof(buf)); /* desc */ | 196 get_str8(pb, buf, sizeof(buf)); /* desc */ |
197 } | 197 } |
198 st->codec->codec_type = CODEC_TYPE_AUDIO; | 198 st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
199 st->codec->codec_tag = AV_RL32(buf); | 199 st->codec->codec_tag = AV_RL32(buf); |
200 st->codec->codec_id = ff_codec_get_id(rm_codec_tags, st->codec->codec_tag); | 200 st->codec->codec_id = ff_codec_get_id(rm_codec_tags, st->codec->codec_tag); |
201 switch (st->codec->codec_id) { | 201 switch (st->codec->codec_id) { |
202 case CODEC_ID_AC3: | 202 case CODEC_ID_AC3: |
203 st->need_parsing = AVSTREAM_PARSE_FULL; | 203 st->need_parsing = AVSTREAM_PARSE_FULL; |
314 goto fail1; | 314 goto fail1; |
315 st->codec->width = get_be16(pb); | 315 st->codec->width = get_be16(pb); |
316 st->codec->height = get_be16(pb); | 316 st->codec->height = get_be16(pb); |
317 st->codec->time_base.num= 1; | 317 st->codec->time_base.num= 1; |
318 fps= get_be16(pb); | 318 fps= get_be16(pb); |
319 st->codec->codec_type = CODEC_TYPE_VIDEO; | 319 st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
320 get_be32(pb); | 320 get_be32(pb); |
321 fps2= get_be16(pb); | 321 fps2= get_be16(pb); |
322 get_be16(pb); | 322 get_be16(pb); |
323 | 323 |
324 if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (url_ftell(pb) - codec_pos))) < 0) | 324 if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (url_ftell(pb) - codec_pos))) < 0) |
477 duration = get_be32(pb); /* duration */ | 477 duration = get_be32(pb); /* duration */ |
478 st->start_time = start_time; | 478 st->start_time = start_time; |
479 st->duration = duration; | 479 st->duration = duration; |
480 get_str8(pb, buf, sizeof(buf)); /* desc */ | 480 get_str8(pb, buf, sizeof(buf)); /* desc */ |
481 get_str8(pb, buf, sizeof(buf)); /* mimetype */ | 481 get_str8(pb, buf, sizeof(buf)); /* mimetype */ |
482 st->codec->codec_type = CODEC_TYPE_DATA; | 482 st->codec->codec_type = AVMEDIA_TYPE_DATA; |
483 st->priv_data = ff_rm_alloc_rmstream(); | 483 st->priv_data = ff_rm_alloc_rmstream(); |
484 if (ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data, | 484 if (ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data, |
485 get_be32(pb)) < 0) | 485 get_be32(pb)) < 0) |
486 return -1; | 486 return -1; |
487 break; | 487 break; |
723 AVStream *st, RMStream *ast, int len, AVPacket *pkt, | 723 AVStream *st, RMStream *ast, int len, AVPacket *pkt, |
724 int *seq, int flags, int64_t timestamp) | 724 int *seq, int flags, int64_t timestamp) |
725 { | 725 { |
726 RMDemuxContext *rm = s->priv_data; | 726 RMDemuxContext *rm = s->priv_data; |
727 | 727 |
728 if (st->codec->codec_type == CODEC_TYPE_VIDEO) { | 728 if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { |
729 rm->current_stream= st->id; | 729 rm->current_stream= st->id; |
730 if(rm_assemble_video_frame(s, pb, rm, ast, pkt, len, seq)) | 730 if(rm_assemble_video_frame(s, pb, rm, ast, pkt, len, seq)) |
731 return -1; //got partial frame | 731 return -1; //got partial frame |
732 } else if (st->codec->codec_type == CODEC_TYPE_AUDIO) { | 732 } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { |
733 if ((st->codec->codec_id == CODEC_ID_RA_288) || | 733 if ((st->codec->codec_id == CODEC_ID_RA_288) || |
734 (st->codec->codec_id == CODEC_ID_COOK) || | 734 (st->codec->codec_id == CODEC_ID_COOK) || |
735 (st->codec->codec_id == CODEC_ID_ATRAC3) || | 735 (st->codec->codec_id == CODEC_ID_ATRAC3) || |
736 (st->codec->codec_id == CODEC_ID_SIPR)) { | 736 (st->codec->codec_id == CODEC_ID_SIPR)) { |
737 int x; | 737 int x; |
788 av_get_packet(pb, pkt, len); | 788 av_get_packet(pb, pkt, len); |
789 | 789 |
790 pkt->stream_index = st->index; | 790 pkt->stream_index = st->index; |
791 | 791 |
792 #if 0 | 792 #if 0 |
793 if (st->codec->codec_type == CODEC_TYPE_VIDEO) { | 793 if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { |
794 if(st->codec->codec_id == CODEC_ID_RV20){ | 794 if(st->codec->codec_id == CODEC_ID_RV20){ |
795 int seq= 128*(pkt->data[2]&0x7F) + (pkt->data[3]>>1); | 795 int seq= 128*(pkt->data[2]&0x7F) + (pkt->data[3]>>1); |
796 av_log(s, AV_LOG_DEBUG, "%d %"PRId64" %d\n", *timestamp, *timestamp*512LL/25, seq); | 796 av_log(s, AV_LOG_DEBUG, "%d %"PRId64" %d\n", *timestamp, *timestamp*512LL/25, seq); |
797 | 797 |
798 seq |= (timestamp&~0x3FFF); | 798 seq |= (timestamp&~0x3FFF); |
804 | 804 |
805 pkt->pts= timestamp; | 805 pkt->pts= timestamp; |
806 if (flags & 2) | 806 if (flags & 2) |
807 pkt->flags |= PKT_FLAG_KEY; | 807 pkt->flags |= PKT_FLAG_KEY; |
808 | 808 |
809 return st->codec->codec_type == CODEC_TYPE_AUDIO ? rm->audio_pkt_cnt : 0; | 809 return st->codec->codec_type == AVMEDIA_TYPE_AUDIO ? rm->audio_pkt_cnt : 0; |
810 } | 810 } |
811 | 811 |
812 int | 812 int |
813 ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb, | 813 ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb, |
814 AVStream *st, RMStream *ast, AVPacket *pkt) | 814 AVStream *st, RMStream *ast, AVPacket *pkt) |
930 len=sync(s, &dts, &flags, &stream_index2, &pos); | 930 len=sync(s, &dts, &flags, &stream_index2, &pos); |
931 if(len<0) | 931 if(len<0) |
932 return AV_NOPTS_VALUE; | 932 return AV_NOPTS_VALUE; |
933 | 933 |
934 st = s->streams[stream_index2]; | 934 st = s->streams[stream_index2]; |
935 if (st->codec->codec_type == CODEC_TYPE_VIDEO) { | 935 if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { |
936 h= get_byte(s->pb); len--; | 936 h= get_byte(s->pb); len--; |
937 if(!(h & 0x40)){ | 937 if(!(h & 0x40)){ |
938 seq = get_byte(s->pb); len--; | 938 seq = get_byte(s->pb); len--; |
939 } | 939 } |
940 } | 940 } |