Mercurial > mplayer.hg
annotate libmpcodecs/vf_harddup.c @ 36062:d8c696db2948
Don't allow the message box to be user-resizable.
author | ib |
---|---|
date | Thu, 04 Apr 2013 18:27:52 +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 |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
19 #include <stdio.h> |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
20 #include <stdlib.h> |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
21 #include <string.h> |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
22 |
17012 | 23 #include "config.h" |
24 #include "mp_msg.h" | |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
25 |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
26 #include "img_format.h" |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
27 #include "mp_image.h" |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
28 #include "vf.h" |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
29 |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
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 mp_image_t *last_mpi; |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
32 }; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
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) |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
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; |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
37 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
38 vf->priv->last_mpi = mpi; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25221
diff
changeset
|
39 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
40 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
|
41 MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height); |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
42 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
43 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
|
44 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
|
45 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
|
46 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
|
47 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
|
48 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
|
49 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
|
50 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25221
diff
changeset
|
51 |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
52 return vf_next_put_image(vf, dmpi, pts); |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
53 } |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
54 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
55 static int control(struct vf_instance *vf, int request, void* data) |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
56 { |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
57 switch (request) { |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
58 case VFCTRL_DUPLICATE_FRAME: |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
59 if (!vf->priv->last_mpi) break; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
60 // This is a huge hack. We assume nothing |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
61 // has been called earlier in the filter chain |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
62 // since the last put_image. This is reasonable |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
63 // because we're handling a duplicate frame! |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
64 if (put_image(vf, vf->priv->last_mpi, MP_NOPTS_VALUE)) |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
65 return CONTROL_TRUE; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
66 break; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
67 } |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
68 return vf_next_control(vf, request, data); |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
69 } |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
70 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
71 static void uninit(struct vf_instance *vf) |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
72 { |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
73 free(vf->priv); |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
74 } |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
75 |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30633
diff
changeset
|
76 static int vf_open(vf_instance_t *vf, char *args) |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
77 { |
32702
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
78 vf->put_image = put_image; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
79 vf->control = control; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
80 vf->uninit = uninit; |
7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents:
30642
diff
changeset
|
81 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
|
82 return 1; |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
83 } |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
84 |
25221 | 85 const vf_info_t vf_info_harddup = { |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
86 "resubmit duplicate frames for encoding", |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
87 "harddup", |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
88 "Rich Felker", |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
89 "", |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30633
diff
changeset
|
90 vf_open, |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
91 NULL |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
92 }; |