Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Side by Side Diff: source/patched-ffmpeg-mt/libavfilter/vsrc_buffer.c

Issue 4533003: patched ffmpeg nov 2 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2008 Vitor Sessak 2 * Copyright (c) 2008 Vitor Sessak
3 * 3 *
4 * This file is part of FFmpeg. 4 * This file is part of FFmpeg.
5 * 5 *
6 * FFmpeg is free software; you can redistribute it and/or 6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public 7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version. 9 * version 2.1 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 15 matching lines...) Expand all
26 #include "avfilter.h" 26 #include "avfilter.h"
27 #include "vsrc_buffer.h" 27 #include "vsrc_buffer.h"
28 #include "libavcore/imgutils.h" 28 #include "libavcore/imgutils.h"
29 29
30 typedef struct { 30 typedef struct {
31 int64_t pts; 31 int64_t pts;
32 AVFrame frame; 32 AVFrame frame;
33 int has_frame; 33 int has_frame;
34 int h, w; 34 int h, w;
35 enum PixelFormat pix_fmt; 35 enum PixelFormat pix_fmt;
36 AVRational time_base; ///< time_base to set in the output link
36 AVRational pixel_aspect; 37 AVRational pixel_aspect;
37 } BufferSourceContext; 38 } BufferSourceContext;
38 39
39 int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, 40 int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame,
40 int64_t pts, AVRational pixel_aspect) 41 int64_t pts, AVRational pixel_aspect)
41 { 42 {
42 BufferSourceContext *c = buffer_filter->priv; 43 BufferSourceContext *c = buffer_filter->priv;
43 44
44 if (c->has_frame) { 45 if (c->has_frame) {
45 av_log(buffer_filter, AV_LOG_ERROR, 46 av_log(buffer_filter, AV_LOG_ERROR,
(...skipping 13 matching lines...) Expand all
59 60
60 return 0; 61 return 0;
61 } 62 }
62 63
63 static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) 64 static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
64 { 65 {
65 BufferSourceContext *c = ctx->priv; 66 BufferSourceContext *c = ctx->priv;
66 char pix_fmt_str[128]; 67 char pix_fmt_str[128];
67 int n = 0; 68 int n = 0;
68 69
69 if (!args || (n = sscanf(args, "%d:%d:%127s", &c->w, &c->h, pix_fmt_str)) != 3) { 70 if (!args ||
70 av_log(ctx, AV_LOG_ERROR, "Expected 3 arguments, but only %d found in '% s'\n", n, args ? args : ""); 71 (n = sscanf(args, "%d:%d:%127[^:]:%d:%d", &c->w, &c->h, pix_fmt_str, &c- >time_base.num, &c->time_base.den)) != 5) {
72 av_log(ctx, AV_LOG_ERROR, "Expected 5 arguments, but only %d found in '% s'\n", n, args);
71 return AVERROR(EINVAL); 73 return AVERROR(EINVAL);
72 } 74 }
73 if ((c->pix_fmt = av_get_pix_fmt(pix_fmt_str)) == PIX_FMT_NONE) { 75 if ((c->pix_fmt = av_get_pix_fmt(pix_fmt_str)) == PIX_FMT_NONE) {
74 char *tail; 76 char *tail;
75 c->pix_fmt = strtol(pix_fmt_str, &tail, 10); 77 c->pix_fmt = strtol(pix_fmt_str, &tail, 10);
76 if (*tail || c->pix_fmt < 0 || c->pix_fmt >= PIX_FMT_NB) { 78 if (*tail || c->pix_fmt < 0 || c->pix_fmt >= PIX_FMT_NB) {
77 av_log(ctx, AV_LOG_ERROR, "Invalid pixel format string '%s'\n", pix_ fmt_str); 79 av_log(ctx, AV_LOG_ERROR, "Invalid pixel format string '%s'\n", pix_ fmt_str);
78 return AVERROR(EINVAL); 80 return AVERROR(EINVAL);
79 } 81 }
80 } 82 }
(...skipping 10 matching lines...) Expand all
91 avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); 93 avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
92 return 0; 94 return 0;
93 } 95 }
94 96
95 static int config_props(AVFilterLink *link) 97 static int config_props(AVFilterLink *link)
96 { 98 {
97 BufferSourceContext *c = link->src->priv; 99 BufferSourceContext *c = link->src->priv;
98 100
99 link->w = c->w; 101 link->w = c->w;
100 link->h = c->h; 102 link->h = c->h;
103 link->time_base = c->time_base;
101 104
102 return 0; 105 return 0;
103 } 106 }
104 107
105 static int request_frame(AVFilterLink *link) 108 static int request_frame(AVFilterLink *link)
106 { 109 {
107 BufferSourceContext *c = link->src->priv; 110 BufferSourceContext *c = link->src->priv;
108 AVFilterBufferRef *picref; 111 AVFilterBufferRef *picref;
109 112
110 if (!c->has_frame) { 113 if (!c->has_frame) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 .init = init, 155 .init = init,
153 156
154 .inputs = (AVFilterPad[]) {{ .name = NULL }}, 157 .inputs = (AVFilterPad[]) {{ .name = NULL }},
155 .outputs = (AVFilterPad[]) {{ .name = "default", 158 .outputs = (AVFilterPad[]) {{ .name = "default",
156 .type = AVMEDIA_TYPE_VIDEO, 159 .type = AVMEDIA_TYPE_VIDEO,
157 .request_frame = request_frame, 160 .request_frame = request_frame,
158 .poll_frame = poll_frame, 161 .poll_frame = poll_frame,
159 .config_props = config_props, }, 162 .config_props = config_props, },
160 { .name = NULL}}, 163 { .name = NULL}},
161 }; 164 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698