Mercurial > mplayer.hg
annotate libmpcodecs/vf_harddup.c @ 32245:f0cbf9ca48bc
Generate dependency information for netstream and vivodump as well.
author | diego |
---|---|
date | Mon, 20 Sep 2010 20:48:35 +0000 |
parents | a972c1a4a012 |
children | 7af3e6f901fd |
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 { |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
31 mp_image_t *last_mpi; |
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 { |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
36 mp_image_t *dmpi; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
37 |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
38 vf->priv->last_mpi = mpi; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25221
diff
changeset
|
39 |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
40 dmpi = vf_get_image(vf->next, mpi->imgfmt, |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
41 MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height); |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
42 |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
43 dmpi->planes[0] = mpi->planes[0]; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
44 dmpi->stride[0] = mpi->stride[0]; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
45 if (dmpi->flags&MP_IMGFLAG_PLANAR) { |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
46 dmpi->planes[1] = mpi->planes[1]; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
47 dmpi->stride[1] = mpi->stride[1]; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
48 dmpi->planes[2] = mpi->planes[2]; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
49 dmpi->stride[2] = mpi->stride[2]; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
50 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25221
diff
changeset
|
51 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
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 { |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
57 switch (request) { |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
58 case VFCTRL_DUPLICATE_FRAME: |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
59 if (!vf->priv->last_mpi) break; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
60 // This is a huge hack. We assume nothing |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
61 // has been called earlier in the filter chain |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
62 // since the last put_image. This is reasonable |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
63 // because we're handling a duplicate frame! |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
64 if (put_image(vf, vf->priv->last_mpi, MP_NOPTS_VALUE)) |
12334
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
65 return CONTROL_TRUE; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
66 break; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
67 } |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
68 return vf_next_control(vf, request, data); |
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 { |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
73 free(vf->priv); |
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 { |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
78 vf->put_image = put_image; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
79 vf->control = control; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
80 vf->uninit = uninit; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
81 vf->priv = calloc(1, sizeof(struct vf_priv_s)); |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
82 return 1; |
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 }; |