| 2764 | } |
| 2765 | |
| 2766 | static void print_sdp(void) |
| 2767 | { |
| 2768 | char sdp[16384]; |
| 2769 | int i; |
| 2770 | int j; |
| 2771 | AVIOContext *sdp_pb; |
| 2772 | AVFormatContext **avc; |
| 2773 | |
| 2774 | for (i = 0; i < nb_output_files; i++) { |
| 2775 | if (!output_files[i]->header_written) |
| 2776 | return; |
| 2777 | } |
| 2778 | |
| 2779 | avc = av_malloc_array(nb_output_files, sizeof(*avc)); |
| 2780 | if (!avc) |
| 2781 | exit_program(1); |
| 2782 | for (i = 0, j = 0; i < nb_output_files; i++) { |
| 2783 | if (!strcmp(output_files[i]->ctx->oformat->name, "rtp")) { |
| 2784 | avc[j] = output_files[i]->ctx; |
| 2785 | j++; |
| 2786 | } |
| 2787 | } |
| 2788 | |
| 2789 | if (!j) |
| 2790 | goto fail; |
| 2791 | |
| 2792 | av_sdp_create(avc, j, sdp, sizeof(sdp)); |
| 2793 | |
| 2794 | if (!sdp_filename) { |
| 2795 | printf("SDP:\n%s\n", sdp); |
| 2796 | fflush(stdout); |
| 2797 | } else { |
| 2798 | if (avio_open2(&sdp_pb, sdp_filename, AVIO_FLAG_WRITE, &int_cb, NULL) < 0) { |
| 2799 | av_log(NULL, AV_LOG_ERROR, "Failed to open sdp file '%s'\n", sdp_filename); |
| 2800 | } else { |
| 2801 | avio_printf(sdp_pb, "SDP:\n%s", sdp); |
| 2802 | avio_closep(&sdp_pb); |
| 2803 | av_freep(&sdp_filename); |
| 2804 | } |
| 2805 | } |
| 2806 | |
| 2807 | fail: |
| 2808 | av_freep(&avc); |
| 2809 | } |
| 2810 | |
| 2811 | static const HWAccel *get_hwaccel(enum AVPixelFormat pix_fmt) |
| 2812 | { |
no test coverage detected