Mercurial > mplayer.hg
annotate libmpcodecs/vf_softskip.c @ 36289:f3cad93ab011
Remove XSynchronize() call.
We don't want a permanent automatic synchronized request handling.
author | ib |
---|---|
date | Thu, 01 Aug 2013 17:22:37 +0000 |
parents | 7af3e6f901fd |
children |
rev | line source |
---|---|
30421
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
1 /* |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
2 * This file is part of MPlayer. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
3 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
7 * (at your option) any later version. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
8 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
12 * GNU General Public License for more details. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
13 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
17 */ |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
18 |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
19 #include <stdio.h> |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
20 #include <stdlib.h> |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
21 #include <string.h> |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
22 |
17012 | 23 #include "config.h" |
24 #include "mp_msg.h" | |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
25 |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
26 #include "img_format.h" |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
27 #include "mp_image.h" |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
28 #include "vf.h" |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
29 |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
30 struct vf_priv_s { |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
31 int skipflag; |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
32 }; |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
33 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
34 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
35 { |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
36 mp_image_t *dmpi; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25221
diff
changeset
|
37 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
38 if (vf->priv->skipflag) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
39 return vf->priv->skipflag = 0; |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
40 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
41 dmpi = vf_get_image(vf->next, mpi->imgfmt, |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
42 MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
43 vf_clone_mpi_attributes(dmpi, mpi); |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
44 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
45 dmpi->planes[0] = mpi->planes[0]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
46 dmpi->stride[0] = mpi->stride[0]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
47 if (dmpi->flags&MP_IMGFLAG_PLANAR) { |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
48 dmpi->planes[1] = mpi->planes[1]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
49 dmpi->stride[1] = mpi->stride[1]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
50 dmpi->planes[2] = mpi->planes[2]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
51 dmpi->stride[2] = mpi->stride[2]; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
52 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25221
diff
changeset
|
53 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
54 return vf_next_put_image(vf, dmpi, pts); |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
55 } |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
56 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
57 static int control(struct vf_instance *vf, int request, void* data) |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
58 { |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
59 switch (request) { |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
60 case VFCTRL_SKIP_NEXT_FRAME: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
61 vf->priv->skipflag = 1; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
62 return CONTROL_TRUE; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
63 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
64 return vf_next_control(vf, request, data); |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
65 } |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
66 |
24605
8a6f80593529
Disable unused query_format functions for now until they are
diego
parents:
23373
diff
changeset
|
67 #if 0 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
68 static int query_format(struct vf_instance *vf, unsigned int fmt) |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
69 { |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
70 /* FIXME - figure out which other formats work */ |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
71 switch (fmt) { |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
72 case IMGFMT_YV12: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
73 case IMGFMT_IYUV: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
74 case IMGFMT_I420: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
75 return vf_next_query_format(vf, fmt); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
76 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
77 return 0; |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
78 } |
24605
8a6f80593529
Disable unused query_format functions for now until they are
diego
parents:
23373
diff
changeset
|
79 #endif |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
80 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
81 static void uninit(struct vf_instance *vf) |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
82 { |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
83 free(vf->priv); |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
84 } |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
85 |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30633
diff
changeset
|
86 static int vf_open(vf_instance_t *vf, char *args) |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
87 { |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
88 vf->put_image = put_image; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
89 vf->control = control; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
90 vf->uninit = uninit; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
91 vf->priv = calloc(1, sizeof(struct vf_priv_s)); |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
92 return 1; |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
93 } |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
94 |
25221 | 95 const vf_info_t vf_info_softskip = { |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
96 "soft (post-filter) frame skipping for encoding", |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
97 "softskip", |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
98 "Rich Felker", |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
99 "", |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30633
diff
changeset
|
100 vf_open, |
12337
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
101 NULL |
6f1b4c989914
soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff
changeset
|
102 }; |