* The following code is the main loop of the file converter */
| 1747 | * The following code is the main loop of the file converter |
| 1748 | */ |
| 1749 | static int av_transcode(AVFormatContext **output_files, |
| 1750 | int nb_output_files, |
| 1751 | AVFormatContext **input_files, |
| 1752 | int nb_input_files, |
| 1753 | AVStreamMap *stream_maps, int nb_stream_maps) |
| 1754 | { |
| 1755 | int ret = 0, i, j, k, n, nb_istreams = 0, nb_ostreams = 0; |
| 1756 | AVFormatContext *is, *os; |
| 1757 | AVCodecContext *codec, *icodec; |
| 1758 | AVOutputStream *ost, **ost_table = NULL; |
| 1759 | AVInputStream *ist, **ist_table = NULL; |
| 1760 | AVInputFile *file_table; |
| 1761 | char error[1024]; |
| 1762 | int key; |
| 1763 | int want_sdp = 1; |
| 1764 | uint8_t no_packet[MAX_FILES]={0}; |
| 1765 | int no_packet_count=0; |
| 1766 | |
| 1767 | file_table= av_mallocz(nb_input_files * sizeof(AVInputFile)); |
| 1768 | if (!file_table) |
| 1769 | goto fail; |
| 1770 | |
| 1771 | /* input stream init */ |
| 1772 | j = 0; |
| 1773 | for(i=0;i<nb_input_files;i++) { |
| 1774 | is = input_files[i]; |
| 1775 | file_table[i].ist_index = j; |
| 1776 | file_table[i].nb_streams = is->nb_streams; |
| 1777 | j += is->nb_streams; |
| 1778 | } |
| 1779 | nb_istreams = j; |
| 1780 | |
| 1781 | ist_table = av_mallocz(nb_istreams * sizeof(AVInputStream *)); |
| 1782 | if (!ist_table) |
| 1783 | goto fail; |
| 1784 | |
| 1785 | for(i=0;i<nb_istreams;i++) { |
| 1786 | ist = av_mallocz(sizeof(AVInputStream)); |
| 1787 | if (!ist) |
| 1788 | goto fail; |
| 1789 | ist_table[i] = ist; |
| 1790 | } |
| 1791 | j = 0; |
| 1792 | for(i=0;i<nb_input_files;i++) { |
| 1793 | is = input_files[i]; |
| 1794 | for(k=0;k<is->nb_streams;k++) { |
| 1795 | ist = ist_table[j++]; |
| 1796 | ist->st = is->streams[k]; |
| 1797 | ist->file_index = i; |
| 1798 | ist->index = k; |
| 1799 | ist->discard = 1; /* the stream is discarded by default |
| 1800 | (changed later) */ |
| 1801 | |
| 1802 | if (rate_emu) { |
| 1803 | ist->start = av_gettime(); |
| 1804 | } |
| 1805 | } |
| 1806 | } |
no test coverage detected