Statistics
| Branch: | Revision:

ffmpeg / libavcodec / opts.c @ 628d601b

History | View | Annotate | Download (2.52 KB)

1
/*
2
 * LGPL
3
 */
4

    
5
/*
6
 * typical parsed command line:
7
 * msmpeg4:bitrate=720000:qmax=16
8
 *
9
 */
10

    
11
#include "avcodec.h"
12

    
13
/*
14
 * possible extension - use for decoder options
15
 *                    - for given codec names filter only correct
16
 *                      options given (could be passed with 'str')
17
 */
18

    
19
/**
20
 * \param avctx  where to store parsed results
21
 * \param str    string with options for parsing
22
 * \param config allocated avc_config_t for external parsing
23
 *               i.e. external program might learn about all available
24
 *               options for given codec
25
 **/
26
void avcodec_getopt(AVCodecContext* avctx, char* str, avc_config_t** config)
27
{
28
    AVCodecContext avctx_tmp;
29
    AVCodecContext* ctx = (avctx) ? avctx : &avctx_tmp;
30
    static const char* class_h263 = ",msmpeg4,";
31
    //"huffyuv,wmv1,msmpeg4v2,msmpeg4,mpeg4,mpeg1,mpeg1video,mjpeg,rv10,h263,h263p"
32

    
33
    avc_config_t cnf[] =
34
    {
35
        // FIXME: sorted by importance!!!
36
        // expert option should follow more common ones
37
        {
38
            "bitrate", "desired video bitrate",
39
            FF_CONF_TYPE_INT, &ctx->bit_rate, 4, 240000000, 800000, NULL, class_h263
40
        }, {
41
            "vhq", "very high quality",
42
            FF_CONF_TYPE_FLAG, &ctx->flags, 0, CODEC_FLAG_HQ, 0, NULL, class_h263
43
        }, {
44
            "ratetol", "number of bits the bitstream is allowed to diverge from the reference"
45
            "the reference can be CBR (for CBR pass1) or VBR (for pass2)",
46
            FF_CONF_TYPE_INT, &ctx->bit_rate_tolerance, 4, 240000000, 8000, NULL, class_h263
47
        }, {
48
            "qmin", "minimum quantizer", FF_CONF_TYPE_INT, &ctx->qmin, 1, 31, 2, NULL, class_h263
49
        }, {
50
            "qmax", "maximum qunatizer", FF_CONF_TYPE_INT, &ctx->qmax, 1, 31, 31, NULL, class_h263
51
        }, {
52
            "rc_eq", "rate control equation",
53
            FF_CONF_TYPE_STRING, &ctx->rc_eq, 0, 0, 0, "tex^qComp" /* FILLME options */, class_h263
54
        }, {
55
            "rc_minrate", "rate control minimum bitrate",
56
            FF_CONF_TYPE_INT, &ctx->rc_min_rate, 4, 24000000, 0, NULL, class_h263
57
        }, {
58
            "rc_maxrate", "rate control maximum bitrate",
59
            FF_CONF_TYPE_INT, &ctx->rc_max_rate, 4, 24000000, 0, NULL, class_h263
60
        }, {
61
            "psnr", "calculate PSNR of compressed frames",
62
            FF_CONF_TYPE_FLAG, &ctx->flags, 0, CODEC_FLAG_PSNR, 0, NULL, class_h263
63
        }, {
64
            "rc_override", "ratecontrol override (=startframe,endframe,qscale,quality_factor)",
65
            FF_CONF_TYPE_RCOVERIDE, &ctx->rc_override, 0, 0, 0, NULL, class_h263
66
        },
67

    
68
        { NULL, NULL, 0, NULL, 0, 0, 0, NULL, NULL }
69
    };
70

    
71
    if (config)
72
    {
73
        *config = malloc(sizeof(cnf));
74
        if (*config)
75
            memcpy(*config, cnf, sizeof(cnf));
76
    }
77
}