comparison swf.c @ 462:b69898ffc92a libavformat

move time_base (pts_num/pts_den) from AVFormatContext -> AVStream
author michael
date Fri, 21 May 2004 20:43:21 +0000
parents 845f9de2c883
children 60f897e8dd2d
comparison
equal deleted inserted replaced
461:63540e5504f7 462:b69898ffc92a
803 len = (4 * nbits - 3 + 7) / 8; 803 len = (4 * nbits - 3 + 7) / 8;
804 url_fskip(pb, len); 804 url_fskip(pb, len);
805 frame_rate = get_le16(pb); 805 frame_rate = get_le16(pb);
806 get_le16(pb); /* frame count */ 806 get_le16(pb); /* frame count */
807 807
808 av_set_pts_info(s, 24, 1, 1000); /* 24 bit pts in ms */
809
810 /* The Flash Player converts 8.8 frame rates 808 /* The Flash Player converts 8.8 frame rates
811 to milliseconds internally. Do the same to get 809 to milliseconds internally. Do the same to get
812 a correct framerate */ 810 a correct framerate */
813 swf->ms_per_frame = ( 1000 * 256 ) / frame_rate; 811 swf->ms_per_frame = ( 1000 * 256 ) / frame_rate;
814 swf->samples_per_frame = 0; 812 swf->samples_per_frame = 0;
835 get_le16(pb); 833 get_le16(pb);
836 get_byte(pb); 834 get_byte(pb);
837 /* Check for FLV1 */ 835 /* Check for FLV1 */
838 if ( get_byte(pb) == SWF_VIDEO_CODEC_FLV1 ) { 836 if ( get_byte(pb) == SWF_VIDEO_CODEC_FLV1 ) {
839 vst = av_new_stream(s, 0); 837 vst = av_new_stream(s, 0);
838 av_set_pts_info(vst, 24, 1, 1000); /* 24 bit pts in ms */
839
840 vst->codec.codec_type = CODEC_TYPE_VIDEO; 840 vst->codec.codec_type = CODEC_TYPE_VIDEO;
841 vst->codec.codec_id = CODEC_ID_FLV1; 841 vst->codec.codec_id = CODEC_ID_FLV1;
842 if ( swf->samples_per_frame ) { 842 if ( swf->samples_per_frame ) {
843 vst->codec.frame_rate = 1000. / swf->ms_per_frame; 843 vst->codec.frame_rate = 1000. / swf->ms_per_frame;
844 vst->codec.frame_rate_base = 1; 844 vst->codec.frame_rate_base = 1;
855 if ((v & 0x20) != 0) { 855 if ((v & 0x20) != 0) {
856 if ( tag == TAG_STREAMHEAD2 ) { 856 if ( tag == TAG_STREAMHEAD2 ) {
857 get_le16(pb); 857 get_le16(pb);
858 } 858 }
859 ast = av_new_stream(s, 1); 859 ast = av_new_stream(s, 1);
860 av_set_pts_info(ast, 24, 1, 1000); /* 24 bit pts in ms */
860 if (!ast) 861 if (!ast)
861 return -ENOMEM; 862 return -ENOMEM;
862 863
863 if (v & 0x01) 864 if (v & 0x01)
864 ast->codec.channels = 2; 865 ast->codec.channels = 2;