comparison utils.c @ 11560:8a4984c5cacc libavcodec

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 7089198d1d10
children 1025297f5624
comparison
equal deleted inserted replaced
11559:444f4b594fdb 11560:8a4984c5cacc
495 ret = AVERROR(EINVAL); 495 ret = AVERROR(EINVAL);
496 goto free_and_end; 496 goto free_and_end;
497 } 497 }
498 498
499 avctx->codec = codec; 499 avctx->codec = codec;
500 if ((avctx->codec_type == CODEC_TYPE_UNKNOWN || avctx->codec_type == codec->type) && 500 if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) &&
501 avctx->codec_id == CODEC_ID_NONE) { 501 avctx->codec_id == CODEC_ID_NONE) {
502 avctx->codec_type = codec->type; 502 avctx->codec_type = codec->type;
503 avctx->codec_id = codec->id; 503 avctx->codec_id = codec->id;
504 } 504 }
505 if(avctx->codec_id != codec->id || avctx->codec_type != codec->type){ 505 if(avctx->codec_id != codec->id || avctx->codec_type != codec->type){
773 { 773 {
774 int bit_rate; 774 int bit_rate;
775 int bits_per_sample; 775 int bits_per_sample;
776 776
777 switch(ctx->codec_type) { 777 switch(ctx->codec_type) {
778 case CODEC_TYPE_VIDEO: 778 case AVMEDIA_TYPE_VIDEO:
779 bit_rate = ctx->bit_rate; 779 bit_rate = ctx->bit_rate;
780 break; 780 break;
781 case CODEC_TYPE_AUDIO: 781 case AVMEDIA_TYPE_AUDIO:
782 bits_per_sample = av_get_bits_per_sample(ctx->codec_id); 782 bits_per_sample = av_get_bits_per_sample(ctx->codec_id);
783 bit_rate = bits_per_sample ? ctx->sample_rate * ctx->channels * bits_per_sample : ctx->bit_rate; 783 bit_rate = bits_per_sample ? ctx->sample_rate * ctx->channels * bits_per_sample : ctx->bit_rate;
784 break; 784 break;
785 case CODEC_TYPE_DATA: 785 case AVMEDIA_TYPE_DATA:
786 bit_rate = ctx->bit_rate; 786 bit_rate = ctx->bit_rate;
787 break; 787 break;
788 case CODEC_TYPE_SUBTITLE: 788 case AVMEDIA_TYPE_SUBTITLE:
789 bit_rate = ctx->bit_rate; 789 bit_rate = ctx->bit_rate;
790 break; 790 break;
791 case CODEC_TYPE_ATTACHMENT: 791 case AVMEDIA_TYPE_ATTACHMENT:
792 bit_rate = ctx->bit_rate; 792 bit_rate = ctx->bit_rate;
793 break; 793 break;
794 default: 794 default:
795 bit_rate = 0; 795 bit_rate = 0;
796 break; 796 break;
834 } 834 }
835 codec_name = buf1; 835 codec_name = buf1;
836 } 836 }
837 837
838 switch(enc->codec_type) { 838 switch(enc->codec_type) {
839 case CODEC_TYPE_VIDEO: 839 case AVMEDIA_TYPE_VIDEO:
840 snprintf(buf, buf_size, 840 snprintf(buf, buf_size,
841 "Video: %s%s", 841 "Video: %s%s",
842 codec_name, enc->mb_decision ? " (hq)" : ""); 842 codec_name, enc->mb_decision ? " (hq)" : "");
843 if (enc->pix_fmt != PIX_FMT_NONE) { 843 if (enc->pix_fmt != PIX_FMT_NONE) {
844 snprintf(buf + strlen(buf), buf_size - strlen(buf), 844 snprintf(buf + strlen(buf), buf_size - strlen(buf),
869 if (encode) { 869 if (encode) {
870 snprintf(buf + strlen(buf), buf_size - strlen(buf), 870 snprintf(buf + strlen(buf), buf_size - strlen(buf),
871 ", q=%d-%d", enc->qmin, enc->qmax); 871 ", q=%d-%d", enc->qmin, enc->qmax);
872 } 872 }
873 break; 873 break;
874 case CODEC_TYPE_AUDIO: 874 case AVMEDIA_TYPE_AUDIO:
875 snprintf(buf, buf_size, 875 snprintf(buf, buf_size,
876 "Audio: %s", 876 "Audio: %s",
877 codec_name); 877 codec_name);
878 if (enc->sample_rate) { 878 if (enc->sample_rate) {
879 snprintf(buf + strlen(buf), buf_size - strlen(buf), 879 snprintf(buf + strlen(buf), buf_size - strlen(buf),
884 if (enc->sample_fmt != SAMPLE_FMT_NONE) { 884 if (enc->sample_fmt != SAMPLE_FMT_NONE) {
885 snprintf(buf + strlen(buf), buf_size - strlen(buf), 885 snprintf(buf + strlen(buf), buf_size - strlen(buf),
886 ", %s", avcodec_get_sample_fmt_name(enc->sample_fmt)); 886 ", %s", avcodec_get_sample_fmt_name(enc->sample_fmt));
887 } 887 }
888 break; 888 break;
889 case CODEC_TYPE_DATA: 889 case AVMEDIA_TYPE_DATA:
890 snprintf(buf, buf_size, "Data: %s", codec_name); 890 snprintf(buf, buf_size, "Data: %s", codec_name);
891 break; 891 break;
892 case CODEC_TYPE_SUBTITLE: 892 case AVMEDIA_TYPE_SUBTITLE:
893 snprintf(buf, buf_size, "Subtitle: %s", codec_name); 893 snprintf(buf, buf_size, "Subtitle: %s", codec_name);
894 break; 894 break;
895 case CODEC_TYPE_ATTACHMENT: 895 case AVMEDIA_TYPE_ATTACHMENT:
896 snprintf(buf, buf_size, "Attachment: %s", codec_name); 896 snprintf(buf, buf_size, "Attachment: %s", codec_name);
897 break; 897 break;
898 default: 898 default:
899 snprintf(buf, buf_size, "Invalid Codec type %d", enc->codec_type); 899 snprintf(buf, buf_size, "Invalid Codec type %d", enc->codec_type);
900 return; 900 return;