annotate libmpcodecs/vf_harddup.c @ 24525:53efefaa5774

Install man pages in $(PREFIX)/share/man instead of $(PREFIX)/man in order to better comply with the FHS.
author diego
date Sun, 16 Sep 2007 17:48:20 +0000
parents cbc7ab25255e
children 00fff9a3b735
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12334
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
1 #include <stdio.h>
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
2 #include <stdlib.h>
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
3 #include <string.h>
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
4
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 12336
diff changeset
5 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 12336
diff changeset
6 #include "mp_msg.h"
12334
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
7
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
8 #include "img_format.h"
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
9 #include "mp_image.h"
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
10 #include "vf.h"
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
11
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
12 struct vf_priv_s {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
13 mp_image_t *last_mpi;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
14 };
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
15
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17012
diff changeset
16 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
12334
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
17 {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
18 mp_image_t *dmpi;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
19
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
20 vf->priv->last_mpi = mpi;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
21
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
22 dmpi = vf_get_image(vf->next, mpi->imgfmt,
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
23 MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height);
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
24
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
25 dmpi->planes[0] = mpi->planes[0];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
26 dmpi->stride[0] = mpi->stride[0];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
27 if (dmpi->flags&MP_IMGFLAG_PLANAR) {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
28 dmpi->planes[1] = mpi->planes[1];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
29 dmpi->stride[1] = mpi->stride[1];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
30 dmpi->planes[2] = mpi->planes[2];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
31 dmpi->stride[2] = mpi->stride[2];
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
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17012
diff changeset
34 return vf_next_put_image(vf, dmpi, 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
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
37 static int control(struct vf_instance_s* vf, int request, void* data)
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
38 {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
39 switch (request) {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
40 case VFCTRL_DUPLICATE_FRAME:
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
41 if (!vf->priv->last_mpi) break;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
42 // This is a huge hack. We assume nothing
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
43 // has been called earlier in the filter chain
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
44 // since the last put_image. This is reasonable
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
45 // 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
46 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
47 return CONTROL_TRUE;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
48 break;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
49 }
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
50 return vf_next_control(vf, request, data);
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
51 }
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
52
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
53 static void uninit(struct vf_instance_s* vf)
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
54 {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
55 free(vf->priv);
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
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
58 static int open(vf_instance_t *vf, char* args)
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
59 {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
60 vf->put_image = put_image;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
61 vf->control = control;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
62 vf->uninit = uninit;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
63 vf->priv = calloc(1, sizeof(struct vf_priv_s));
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
64 return 1;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
65 }
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
66
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
67 vf_info_t vf_info_harddup = {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
68 "resubmit duplicate frames for encoding",
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
69 "harddup",
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
70 "Rich Felker",
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
71 "",
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
72 open,
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
73 NULL
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
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
76