| @@ -202,6 +202,8 @@ typedef struct OutputFilterPriv { · 201 unmodified lines |
| 202 | int width, height; | 202 | int width, height; |
| 203 | int sample_rate; | 203 | int sample_rate; |
| 204 | AVChannelLayout ch_layout; | 204 | AVChannelLayout ch_layout; |
| | 205 | enum AVColorSpace color_space; |
| | 206 | enum AVColorRange color_range; |
| 205 | | 207 | |
| 206 | // time base in which the output is sent to our downstream | 208 | // time base in which the output is sent to our downstream |
| 207 | // does not need to match the filtersink's timebase | 209 | // does not need to match the filtersink's timebase |
| @@ -220,6 +222,8 @@ typedef struct OutputFilterPriv { · 12 unmodified lines |
| 220 | const int *formats; | 222 | const int *formats; |
| 221 | const AVChannelLayout *ch_layouts; | 223 | const AVChannelLayout *ch_layouts; |
| 222 | const int *sample_rates; | 224 | const int *sample_rates; |
| | 225 | const enum AVColorSpace *color_spaces; |
| | 226 | const enum AVColorRange *color_ranges; |
| 223 | | 227 | |
| 224 | AVRational enc_timebase; | 228 | AVRational enc_timebase; |
| 225 | int64_t trim_start_us; | 229 | int64_t trim_start_us; |
| @@ -395,6 +399,12 @@ DEF_CHOOSE_FORMAT(sample_fmts, enum AVSampleFormat, format, formats, · 169 unmodified lines |
| 395 | DEF_CHOOSE_FORMAT(sample_rates, int, sample_rate, sample_rates, 0, | 399 | DEF_CHOOSE_FORMAT(sample_rates, int, sample_rate, sample_rates, 0, |
| 396 | "%d", ) | 400 | "%d", ) |
| 397 | | 401 | |
| | 402 | DEF_CHOOSE_FORMAT(color_spaces, enum AVColorSpace, color_space, color_spaces, |
| | 403 | AVCOL_SPC_UNSPECIFIED, "%s", av_color_space_name); |
| | 404 | |
| | 405 | DEF_CHOOSE_FORMAT(color_ranges, enum AVColorRange, color_range, color_ranges, |
| | 406 | AVCOL_RANGE_UNSPECIFIED, "%s", av_color_range_name); |
| | 407 | |
| 398 | static void choose_channel_layouts(OutputFilterPriv *ofp, AVBPrint *bprint) | 408 | static void choose_channel_layouts(OutputFilterPriv *ofp, AVBPrint *bprint) |
| 399 | { | 409 | { |
| 400 | if (av_channel_layout_check(&ofp->ch_layout)) { | 410 | if (av_channel_layout_check(&ofp->ch_layout)) { |
| @@ -639,6 +649,8 @@ static OutputFilter *ofilter_alloc(FilterGraph *fg, enum AVMediaType type) · 238 unmodified lines |
| 639 | ofilter->graph = fg; | 649 | ofilter->graph = fg; |
| 640 | ofilter->type = type; | 650 | ofilter->type = type; |
| 641 | ofp->format = -1; | 651 | ofp->format = -1; |
| | 652 | ofp->color_space = AVCOL_SPC_UNSPECIFIED; |
| | 653 | ofp->color_range = AVCOL_RANGE_UNSPECIFIED; |
| 642 | ofp->index = fg->nb_outputs - 1; | 654 | ofp->index = fg->nb_outputs - 1; |
| 643 | | 655 | |
| 644 | snprintf(ofp->log_name, sizeof(ofp->log_name), "%co%d", | 656 | snprintf(ofp->log_name, sizeof(ofp->log_name), "%co%d", |
| @@ -822,6 +834,16 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost, · 177 unmodified lines |
| 822 | } else | 834 | } else |
| 823 | ofp->formats = opts->formats; | 835 | ofp->formats = opts->formats; |
| 824 | | 836 | |
| | 837 | if (opts->color_space != AVCOL_SPC_UNSPECIFIED) |
| | 838 | ofp->color_space = opts->color_space; |
| | 839 | else |
| | 840 | ofp->color_spaces = opts->color_spaces; |
| | 841 | |
| | 842 | if (opts->color_range != AVCOL_RANGE_UNSPECIFIED) |
| | 843 | ofp->color_range = opts->color_range; |
| | 844 | else |
| | 845 | ofp->color_ranges = opts->color_ranges; |
| | 846 | |
| 825 | fgp->disable_conversions |= !!(ofp->flags & OFILTER_FLAG_DISABLE_CONVERT); | 847 | fgp->disable_conversions |= !!(ofp->flags & OFILTER_FLAG_DISABLE_CONVERT); |
| 826 | | 848 | |
| 827 | ofp->fps.last_frame = av_frame_alloc(); | 849 | ofp->fps.last_frame = av_frame_alloc(); |
| @@ -1485,6 +1507,8 @@ static int configure_output_video_filter(FilterGraph *fg, AVFilterGraph *graph, · 657 unmodified lines |
| 1485 | ofp->format != AV_PIX_FMT_NONE || !ofp->formats); | 1507 | ofp->format != AV_PIX_FMT_NONE || !ofp->formats); |
| 1486 | av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED); | 1508 | av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED); |
| 1487 | choose_pix_fmts(ofp, &bprint); | 1509 | choose_pix_fmts(ofp, &bprint); |
| | 1510 | choose_color_spaces(ofp, &bprint); |
| | 1511 | choose_color_ranges(ofp, &bprint); |
| 1488 | if (!av_bprint_is_complete(&bprint)) | 1512 | if (!av_bprint_is_complete(&bprint)) |
| 1489 | return AVERROR(ENOMEM); | 1513 | return AVERROR(ENOMEM); |
| 1490 | | 1514 | |
| @@ -1907,6 +1931,8 @@ static int configure_filtergraph(FilterGraph *fg, FilterGraphThread *fgt) · 416 unmodified lines |
| 1907 | | 1931 | |
| 1908 | ofp->width = av_buffersink_get_w(sink); | 1932 | ofp->width = av_buffersink_get_w(sink); |
| 1909 | ofp->height = av_buffersink_get_h(sink); | 1933 | ofp->height = av_buffersink_get_h(sink); |
| | 1934 | ofp->color_space = av_buffersink_get_colorspace(sink); |
| | 1935 | ofp->color_range = av_buffersink_get_color_range(sink); |
| 1910 | | 1936 | |
| 1911 | // If the timing parameters are not locked yet, get the tentative values | 1937 | // If the timing parameters are not locked yet, get the tentative values |
| 1912 | // here but don't lock them. They will only be used if no output frames | 1938 | // here but don't lock them. They will only be used if no output frames |