History

Support filters and decoders that dont support negative linesizes. This patch is based on work by stefano.

Originally committed as revision 26108 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Niedermayer committed 15 years ago

Commit 0ccabee1 parent 9e99f844 files · +15 −6Browse files

Unified · Split

4 files
  1. ffplay.c +3 −0
  2. libavfilter/avfilter.c +7 −4
  3. libavfilter/avfilter.h +1 −0
  4. libavfilter/vf_vflip.c +4 −2
ffplay.c+3−0
@@ -1616,6 +1616,9 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic) · 1615 unmodified lines
16161616 int i, w, h, stride[4];
16171617 unsigned edge;
16181618
1619+ if (codec->codec->capabilities & CODEC_CAP_NEG_LINESIZES)
1620+ perms |= AV_PERM_NEG_LINESIZES;
1621+
16191622 if(pic->buffer_hints & FF_BUFFER_HINTS_VALID) {
16201623 if(pic->buffer_hints & FF_BUFFER_HINTS_READABLE) perms |= AV_PERM_READ;
16211624 if(pic->buffer_hints & FF_BUFFER_HINTS_PRESERVE) perms |= AV_PERM_PRESERVE;
libavfilter/avfilter.c+7−4
@@ -197,12 +197,13 @@ int avfilter_config_links(AVFilterContext *filter) · 196 unmodified lines
197197
198198 char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms)
199199 {
200− snprintf(buf, buf_size, "%s%s%s%s%s",
200+ snprintf(buf, buf_size, "%s%s%s%s%s%s",
201201 perms & AV_PERM_READ ? "r" : "",
202202 perms & AV_PERM_WRITE ? "w" : "",
203203 perms & AV_PERM_PRESERVE ? "p" : "",
204204 perms & AV_PERM_REUSE ? "u" : "",
205− perms & AV_PERM_REUSE2 ? "U" : "");
205+ perms & AV_PERM_REUSE2 ? "U" : "",
206+ perms & AV_PERM_NEG_LINESIZES ? "n" : "");
206207 return buf;
207208 }
208209
@@ -360,15 +361,17 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) · 151 unmodified lines
360361 {
361362 void (*start_frame)(AVFilterLink *, AVFilterBufferRef *);
362363 AVFilterPad *dst = link->dstpad;
364+ int perms = picref->perms;
363365
364366 FF_DPRINTF_START(NULL, start_frame); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " "); ff_dprintf_ref(NULL, picref, 1);
365367
366368 if (!(start_frame = dst->start_frame))
367369 start_frame = avfilter_default_start_frame;
368370
371+ if (picref->linesize[0] < 0)
372+ perms |= AV_PERM_NEG_LINESIZES;
369373 /* prepare to copy the picture if it has insufficient permissions */
370− if ((dst->min_perms & picref->perms) != dst->min_perms ||
371− dst->rej_perms & picref->perms) {
374+ if ((dst->min_perms & perms) != dst->min_perms || dst->rej_perms & perms) {
372375 av_log(link->dst, AV_LOG_DEBUG,
373376 "frame copy needed (have perms %x, need %x, reject %x)\n",
374377 picref->perms,
libavfilter/avfilter.h+1−0
@@ -87,6 +87,7 @@ typedef struct AVFilterBuffer { · 86 unmodified lines
8787 #define AV_PERM_PRESERVE 0x04 ///< nobody else can overwrite the buffer
8888 #define AV_PERM_REUSE 0x08 ///< can output the buffer multiple times, with the same contents each time
8989 #define AV_PERM_REUSE2 0x10 ///< can output the buffer multiple times, modified each time
90+#define AV_PERM_NEG_LINESIZES 0x20 ///< the buffer requested can have negative linesizes
9091
9192 /**
9293 * Audio specific properties in a reference to an AVFilterBuffer. Since
libavfilter/vf_vflip.c+4−2
@@ -43,11 +43,13 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms, · 42 unmodified lines
4343 int w, int h)
4444 {
4545 FlipContext *flip = link->dst->priv;
46+ AVFilterBufferRef *picref;
4647 int i;
4748
48− AVFilterBufferRef *picref = avfilter_get_video_buffer(link->dst->outputs[0],
49− perms, w, h);
49+ if (!(perms & AV_PERM_NEG_LINESIZES))
50+ return avfilter_default_get_video_buffer(link, perms, w, h);
5051
52+ picref = avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
5153 for (i = 0; i < 4; i ++) {
5254 int vsub = i == 1 || i == 2 ? flip->vsub : 0;
5355

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t