Mercurial > libavformat.hg
comparison mov.c @ 3908:1d3d17de20ba libavformat
Bump Major version, this commit is almost just renaming bits_per_sample to
bits_per_coded_sample but that cannot be done seperately.
Patch by Luca Abeni
Also reset the minor version and fix the forgotton change to libfaad.
Note: The API/ABI should not be considered stable yet, there still may
be a change done here or there if some developer has some cleanup ideas and
patches!
author | michael |
---|---|
date | Mon, 08 Sep 2008 14:24:59 +0000 |
parents | bae4b42939cc |
children | 2d0ac3628020 |
comparison
equal
deleted
inserted
replaced
3907:7c71e9cabf0e | 3908:1d3d17de20ba |
---|---|
794 if (codec_name[0] <= 31) { | 794 if (codec_name[0] <= 31) { |
795 memcpy(st->codec->codec_name, &codec_name[1],codec_name[0]); | 795 memcpy(st->codec->codec_name, &codec_name[1],codec_name[0]); |
796 st->codec->codec_name[codec_name[0]] = 0; | 796 st->codec->codec_name[codec_name[0]] = 0; |
797 } | 797 } |
798 | 798 |
799 st->codec->bits_per_sample = get_be16(pb); /* depth */ | 799 st->codec->bits_per_coded_sample = get_be16(pb); /* depth */ |
800 st->codec->color_table_id = get_be16(pb); /* colortable id */ | 800 st->codec->color_table_id = get_be16(pb); /* colortable id */ |
801 dprintf(c->fc, "depth %d, ctab id %d\n", | 801 dprintf(c->fc, "depth %d, ctab id %d\n", |
802 st->codec->bits_per_sample, st->codec->color_table_id); | 802 st->codec->bits_per_coded_sample, st->codec->color_table_id); |
803 /* figure out the palette situation */ | 803 /* figure out the palette situation */ |
804 color_depth = st->codec->bits_per_sample & 0x1F; | 804 color_depth = st->codec->bits_per_coded_sample & 0x1F; |
805 color_greyscale = st->codec->bits_per_sample & 0x20; | 805 color_greyscale = st->codec->bits_per_coded_sample & 0x20; |
806 | 806 |
807 /* if the depth is 2, 4, or 8 bpp, file is palettized */ | 807 /* if the depth is 2, 4, or 8 bpp, file is palettized */ |
808 if ((color_depth == 2) || (color_depth == 4) || | 808 if ((color_depth == 2) || (color_depth == 4) || |
809 (color_depth == 8)) { | 809 (color_depth == 8)) { |
810 /* for palette traversal */ | 810 /* for palette traversal */ |
812 unsigned char r, g, b; | 812 unsigned char r, g, b; |
813 | 813 |
814 if (color_greyscale) { | 814 if (color_greyscale) { |
815 int color_index, color_dec; | 815 int color_index, color_dec; |
816 /* compute the greyscale palette */ | 816 /* compute the greyscale palette */ |
817 st->codec->bits_per_sample = color_depth; | 817 st->codec->bits_per_coded_sample = color_depth; |
818 color_count = 1 << color_depth; | 818 color_count = 1 << color_depth; |
819 color_index = 255; | 819 color_index = 255; |
820 color_dec = 256 / (color_count - 1); | 820 color_dec = 256 / (color_count - 1); |
821 for (j = 0; j < color_count; j++) { | 821 for (j = 0; j < color_count; j++) { |
822 r = g = b = color_index; | 822 r = g = b = color_index; |
880 get_be16(pb); /* revision level */ | 880 get_be16(pb); /* revision level */ |
881 get_be32(pb); /* vendor */ | 881 get_be32(pb); /* vendor */ |
882 | 882 |
883 st->codec->channels = get_be16(pb); /* channel count */ | 883 st->codec->channels = get_be16(pb); /* channel count */ |
884 dprintf(c->fc, "audio channels %d\n", st->codec->channels); | 884 dprintf(c->fc, "audio channels %d\n", st->codec->channels); |
885 st->codec->bits_per_sample = get_be16(pb); /* sample size */ | 885 st->codec->bits_per_coded_sample = get_be16(pb); /* sample size */ |
886 | 886 |
887 sc->audio_cid = get_be16(pb); | 887 sc->audio_cid = get_be16(pb); |
888 get_be16(pb); /* packet size = 0 */ | 888 get_be16(pb); /* packet size = 0 */ |
889 | 889 |
890 st->codec->sample_rate = ((get_be32(pb) >> 16)); | 890 st->codec->sample_rate = ((get_be32(pb) >> 16)); |
900 } else if(version==2) { | 900 } else if(version==2) { |
901 get_be32(pb); /* sizeof struct only */ | 901 get_be32(pb); /* sizeof struct only */ |
902 st->codec->sample_rate = av_int2dbl(get_be64(pb)); /* float 64 */ | 902 st->codec->sample_rate = av_int2dbl(get_be64(pb)); /* float 64 */ |
903 st->codec->channels = get_be32(pb); | 903 st->codec->channels = get_be32(pb); |
904 get_be32(pb); /* always 0x7F000000 */ | 904 get_be32(pb); /* always 0x7F000000 */ |
905 st->codec->bits_per_sample = get_be32(pb); /* bits per channel if sound is uncompressed */ | 905 st->codec->bits_per_coded_sample = get_be32(pb); /* bits per channel if sound is uncompressed */ |
906 flags = get_be32(pb); /* lcpm format specific flag */ | 906 flags = get_be32(pb); /* lcpm format specific flag */ |
907 sc->bytes_per_frame = get_be32(pb); /* bytes per audio packet if constant */ | 907 sc->bytes_per_frame = get_be32(pb); /* bytes per audio packet if constant */ |
908 sc->samples_per_frame = get_be32(pb); /* lpcm frames per audio packet if constant */ | 908 sc->samples_per_frame = get_be32(pb); /* lpcm frames per audio packet if constant */ |
909 if (format == MKTAG('l','p','c','m')) | 909 if (format == MKTAG('l','p','c','m')) |
910 st->codec->codec_id = mov_get_lpcm_codec_id(st->codec->bits_per_sample, flags); | 910 st->codec->codec_id = mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, flags); |
911 } | 911 } |
912 } | 912 } |
913 | 913 |
914 switch (st->codec->codec_id) { | 914 switch (st->codec->codec_id) { |
915 case CODEC_ID_PCM_S8: | 915 case CODEC_ID_PCM_S8: |
916 case CODEC_ID_PCM_U8: | 916 case CODEC_ID_PCM_U8: |
917 if (st->codec->bits_per_sample == 16) | 917 if (st->codec->bits_per_coded_sample == 16) |
918 st->codec->codec_id = CODEC_ID_PCM_S16BE; | 918 st->codec->codec_id = CODEC_ID_PCM_S16BE; |
919 break; | 919 break; |
920 case CODEC_ID_PCM_S16LE: | 920 case CODEC_ID_PCM_S16LE: |
921 case CODEC_ID_PCM_S16BE: | 921 case CODEC_ID_PCM_S16BE: |
922 if (st->codec->bits_per_sample == 8) | 922 if (st->codec->bits_per_coded_sample == 8) |
923 st->codec->codec_id = CODEC_ID_PCM_S8; | 923 st->codec->codec_id = CODEC_ID_PCM_S8; |
924 else if (st->codec->bits_per_sample == 24) | 924 else if (st->codec->bits_per_coded_sample == 24) |
925 st->codec->codec_id = | 925 st->codec->codec_id = |
926 st->codec->codec_id == CODEC_ID_PCM_S16BE ? | 926 st->codec->codec_id == CODEC_ID_PCM_S16BE ? |
927 CODEC_ID_PCM_S24BE : CODEC_ID_PCM_S24LE; | 927 CODEC_ID_PCM_S24BE : CODEC_ID_PCM_S24LE; |
928 break; | 928 break; |
929 /* set values for old format before stsd version 1 appeared */ | 929 /* set values for old format before stsd version 1 appeared */ |
947 break; | 947 break; |
948 } | 948 } |
949 | 949 |
950 bits_per_sample = av_get_bits_per_sample(st->codec->codec_id); | 950 bits_per_sample = av_get_bits_per_sample(st->codec->codec_id); |
951 if (bits_per_sample) { | 951 if (bits_per_sample) { |
952 st->codec->bits_per_sample = bits_per_sample; | 952 st->codec->bits_per_coded_sample = bits_per_sample; |
953 sc->sample_size = (bits_per_sample >> 3) * st->codec->channels; | 953 sc->sample_size = (bits_per_sample >> 3) * st->codec->channels; |
954 } | 954 } |
955 } else if(st->codec->codec_type==CODEC_TYPE_SUBTITLE){ | 955 } else if(st->codec->codec_type==CODEC_TYPE_SUBTITLE){ |
956 st->codec->codec_id= id; | 956 st->codec->codec_id= id; |
957 } else { | 957 } else { |