Statistics
| Branch: | Revision:

ffmpeg / vhook / null.c @ 5509bffa

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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
 */
19
#include <stdio.h>
20

    
21
#include "framehook.h"
22

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

    
27
void Release(void *ctx)
28
{
29
    ContextInfo *ci;
30
    ci = (ContextInfo *) ctx;
31

    
32
    if (ctx)
33
        av_free(ctx);
34
}
35

    
36
int Configure(void **ctxp, int argc, char *argv[])
37
{
38
    fprintf(stderr, "Called with argc=%d\n", argc);
39

    
40
    *ctxp = av_mallocz(sizeof(ContextInfo));
41
    return 0;
42
}
43

    
44
void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width, int height, int64_t pts)
45
{
46
    ContextInfo *ci = (ContextInfo *) ctx;
47
    char *buf = 0;
48
    AVPicture picture1;
49
    AVPicture *pict = picture;
50

    
51
    (void) ci;
52

    
53
    if (pix_fmt != PIX_FMT_RGB24) {
54
        int size;
55

    
56
        size = avpicture_get_size(PIX_FMT_RGB24, width, height);
57
        buf = av_malloc(size);
58

    
59
        avpicture_fill(&picture1, buf, PIX_FMT_RGB24, width, height);
60
        if (img_convert(&picture1, PIX_FMT_RGB24,
61
                        picture, pix_fmt, width, height) < 0) {
62
            av_free(buf);
63
            return;
64
        }
65
        pict = &picture1;
66
    }
67

    
68
    /* Insert filter code here */
69

    
70
    if (pix_fmt != PIX_FMT_RGB24) {
71
        if (img_convert(picture, pix_fmt,
72
                        &picture1, PIX_FMT_RGB24, width, height) < 0) {
73
        }
74
    }
75

    
76
    av_free(buf);
77
}
78