compute the bandwidth used by each stream */
| 3798 | |
| 3799 | /* compute the bandwidth used by each stream */ |
| 3800 | static void compute_bandwidth(void) |
| 3801 | { |
| 3802 | unsigned bandwidth; |
| 3803 | int i; |
| 3804 | FFStream *stream; |
| 3805 | |
| 3806 | for(stream = first_stream; stream != NULL; stream = stream->next) { |
| 3807 | bandwidth = 0; |
| 3808 | for(i=0;i<stream->nb_streams;i++) { |
| 3809 | AVStream *st = stream->streams[i]; |
| 3810 | switch(st->codec->codec_type) { |
| 3811 | case AVMEDIA_TYPE_AUDIO: |
| 3812 | case AVMEDIA_TYPE_VIDEO: |
| 3813 | bandwidth += st->codec->bit_rate; |
| 3814 | break; |
| 3815 | default: |
| 3816 | break; |
| 3817 | } |
| 3818 | } |
| 3819 | stream->bandwidth = (bandwidth + 999) / 1000; |
| 3820 | } |
| 3821 | } |
| 3822 | |
| 3823 | /* add a codec and set the default parameters */ |
| 3824 | static void add_codec(FFStream *stream, AVCodecContext *av) |