Statistics
| Branch: | Revision:

ffmpeg / vhook / null.c @ 26b4bb70

History | View | Annotate | Download (2.02 KB)

1
/*
2
 * Null Video Hook 
3
 * Copyright (c) 2002 Philip Gladstone
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Lesser General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Lesser General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Lesser General Public
16
 * License along with this library; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 */
19
#include <stdio.h>
20

    
21
#include "framehook.h"
22

    
23
typedef struct {
24
    int dummy;
25
} ContextInfo;
26

    
27

    
28
int Configure(void **ctxp, int argc, char *argv[])
29
{
30
    fprintf(stderr, "Called with argc=%d\n", argc);
31

    
32
    *ctxp = av_mallocz(sizeof(ContextInfo));
33
    return 0;
34
}
35

    
36
void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width, int height, INT64 pts)
37
{
38
    ContextInfo *ci = (ContextInfo *) ctx;
39
    char *buf = 0;
40
    AVPicture picture1;
41
    AVPicture *pict = picture;
42

    
43
    (void) ci;
44

    
45
    if (pix_fmt != PIX_FMT_RGB24) {
46
        int size;
47

    
48
        size = avpicture_get_size(PIX_FMT_RGB24, width, height);
49
        buf = av_malloc(size);
50

    
51
        avpicture_fill(&picture1, buf, PIX_FMT_RGB24, width, height);
52
        if (img_convert(&picture1, PIX_FMT_RGB24, 
53
                        picture, pix_fmt, width, height) < 0) {
54
            av_free(buf);
55
            return;
56
        }
57
        pict = &picture1;
58
    }
59

    
60
    /* Insert filter code here */
61

    
62
    if (pix_fmt != PIX_FMT_RGB24) {
63
        if (img_convert(picture, pix_fmt, 
64
                        &picture1, PIX_FMT_RGB24, width, height) < 0) {
65
        }
66
    }
67

    
68
    av_free(buf);
69
}
70

    
71
/* To ensure correct typing */
72
FrameHookConfigureFn ConfigureFn = Configure;
73
FrameHookProcessFn ProcessFn = Process;