Exemple #1
0
    { NULL }
};

static const AVFilterPad vibrance_outputs[] = {
    {
        .name = "default",
        .type = AVMEDIA_TYPE_VIDEO,
    },
    { NULL }
};

#define OFFSET(x) offsetof(VibranceContext, x)
#define VF AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM

static const AVOption vibrance_options[] = {
    { "intensity", "set the intensity value",   OFFSET(intensity),  AV_OPT_TYPE_FLOAT, {.dbl=0},       -2,  2, VF },
    { "rbal", "set the red balance value",      OFFSET(balance[2]), AV_OPT_TYPE_FLOAT, {.dbl=1},      -10, 10, VF },
    { "gbal", "set the green balance value",    OFFSET(balance[0]), AV_OPT_TYPE_FLOAT, {.dbl=1},      -10, 10, VF },
    { "bbal", "set the blue balance value",     OFFSET(balance[1]), AV_OPT_TYPE_FLOAT, {.dbl=1},      -10, 10, VF },
    { "rlum", "set the red luma coefficient",   OFFSET(lcoeffs[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.072186}, 0,  1, VF },
    { "glum", "set the green luma coefficient", OFFSET(lcoeffs[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.715158}, 0,  1, VF },
    { "blum", "set the blue luma coefficient",  OFFSET(lcoeffs[1]), AV_OPT_TYPE_FLOAT, {.dbl=0.212656}, 0,  1, VF },
    { "alternate", "use alternate colors",      OFFSET(alternate),  AV_OPT_TYPE_BOOL,  {.i64=0},        0,  1, VF },
    { NULL }
};

AVFILTER_DEFINE_CLASS(vibrance);

AVFilter ff_vf_vibrance = {
    .name          = "vibrance",
    .description   = NULL_IF_CONFIG_SMALL("Boost or alter saturation."),
Exemple #2
0
    av_hash_final(c->hash, md5);
    for (i = 0; i < len; i++) {
        snprintf(buf + offset, 3, "%02"PRIx8, md5[i]);
        offset += 2;
    }
    buf[offset] = '\n';
    buf[offset+1] = 0;

    avio_write(s->pb, buf, strlen(buf));
    avio_flush(s->pb);
}

#define OFFSET(x) offsetof(struct MD5Context, x)
#define ENC AV_OPT_FLAG_ENCODING_PARAM
static const AVOption hash_options[] = {
    { "hash", "set hash to use", OFFSET(hash_name), AV_OPT_TYPE_STRING, {.str = "md5"}, 0, 0, ENC },
    { NULL },
};

static const AVClass md5enc_class = {
    .class_name = "hash encoder class",
    .item_name  = av_default_item_name,
    .option     = hash_options,
    .version    = LIBAVUTIL_VERSION_INT,
};

#if CONFIG_MD5_MUXER
static int write_header(struct AVFormatContext *s)
{
    struct MD5Context *c = s->priv_data;
    int res = av_hash_alloc(&c->hash, c->hash_name);
Exemple #3
0
    int delay_index;
    uint8_t **delayptrs;
    int max_samples, fade_out;
    int *samples;
    int64_t next_pts;

    void (*echo_samples)(struct AudioEchoContext *ctx, uint8_t **delayptrs,
                         uint8_t * const *src, uint8_t **dst,
                         int nb_samples, int channels);
} AudioEchoContext;

#define OFFSET(x) offsetof(AudioEchoContext, x)
#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM

static const AVOption aecho_options[] = {
    { "in_gain",  "set signal input gain",  OFFSET(in_gain),  AV_OPT_TYPE_FLOAT,  {.dbl=0.6}, 0, 1, A },
    { "out_gain", "set signal output gain", OFFSET(out_gain), AV_OPT_TYPE_FLOAT,  {.dbl=0.3}, 0, 1, A },
    { "delays",   "set list of signal delays", OFFSET(delays), AV_OPT_TYPE_STRING, {.str="1000"}, 0, 0, A },
    { "decays",   "set list of signal decays", OFFSET(decays), AV_OPT_TYPE_STRING, {.str="0.5"}, 0, 0, A },
    { NULL }
};

AVFILTER_DEFINE_CLASS(aecho);

static void count_items(char *item_str, int *nb_items)
{
    char *p;

    *nb_items = 1;
    for (p = item_str; *p; p++) {
        if (*p == '|')
Exemple #4
0
void peek_char1(CL_FORM *base)
{
	if(CL_TRUEP(ARG(1)))
	{
		if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 48))	/* T */
		{
			COPY(SYMVAL(Slisp, 59), ARG(1));	/* *TERMINAL-IO* */
		}
	}
	else
	{
		COPY(SYMVAL(Slisp, 60), ARG(1));	/* *STANDARD-INPUT* */
	}
	COPY(ARG(1), ARG(5));
	LOAD_NIL(ARG(6));
	LOAD_NIL(ARG(7));
	COPY(ARG(4), ARG(8));
	read_char1(ARG(5));
	if(CL_SYMBOLP(ARG(0)) && GET_SYMBOL(ARG(0)) == SYMBOL(Slisp, 48))	/* T */
	{
		M1_1:;
		if(CL_TRUEP(ARG(5)))
		{
		}
		else
		{
			goto RETURN1;
		}
		COPY(SYMVAL(Slisp, 454), ARG(6));	/* *READTABLE* */
		COPY(ARG(6), ARG(7));
		LOAD_SYMBOL(SYMBOL(Slisp, 420), ARG(8));	/* READTABLE */
		rt_struct_typep(ARG(7));
		if(CL_TRUEP(ARG(7)))
		{
			COPY(OFFSET(AR_BASE(GET_FORM(ARG(6))), 0 + 1), ARG(6));
		}
		else
		{
			COPY(SYMVAL(Slisp, 352), ARG(7));	/* NO_STRUCT */
			COPY(ARG(6), ARG(8));
			LOAD_SYMBOL(SYMBOL(Slisp, 420), ARG(9));	/* READTABLE */
			Ferror(ARG(7), 3);
		}
		if(CL_CHARP(ARG(5)))
		{
		}
		else
		{
			COPY(SYMVAL(Slisp, 58), ARG(7));	/* WRONG_TYPE */
			COPY(ARG(5), ARG(8));
			LOAD_SYMBOL(SYMBOL(Slisp, 18), ARG(9));	/* CHARACTER */
			Ferror(ARG(7), 3);
		}
		COPY(ARG(5), ARG(7));
		rt_char_code(ARG(7));
		LOAD_BOOL(CL_SMVECP(ARG(6)), ARG(8));
		if(CL_TRUEP(ARG(8)))
		{
			goto THEN1;
		}
		else
		{
			COPY(ARG(6), ARG(9));
			LOAD_SYMBOL(SYMBOL(Slisp, 150), ARG(10));	/* COMPLEX-VECTOR */
			rt_struct_typep(ARG(9));
		}
		if(CL_TRUEP(ARG(9)))
		{
			THEN1:;
		}
		else
		{
			COPY(SYMVAL(Slisp, 58), ARG(8));	/* WRONG_TYPE */
			COPY(ARG(6), ARG(9));
			LOAD_SYMBOL(SYMBOL(Slisp, 47), ARG(10));	/* VECTOR */
			Ferror(ARG(8), 3);
		}
		Frow_major_aref(ARG(6));
		if(CL_SYMBOLP(ARG(6)) && GET_SYMBOL(ARG(6)) == SYMBOL(Slisp, 462))	/* WHITESPACE */
		{
		}
		else
		{
			goto RETURN1;
		}
		COPY(ARG(1), ARG(6));
		COPY(ARG(4), ARG(7));
		COPY(ARG(6), ARG(8));
		LOAD_NIL(ARG(9));
		LOAD_NIL(ARG(10));
		COPY(ARG(7), ARG(11));
		read_char1(ARG(8));
		COPY(ARG(8), ARG(5));
		goto M1_1;
		RETURN1:;
	}
	else
	{
		if(CL_CHARP(ARG(0)))
		{
			M2_1:;
			if(CL_TRUEP(ARG(5)))
			{
			}
			else
			{
				goto RETURN2;
			}
			if(EQL(ARG(0), ARG(5)))
			{
			}
			else
			{
				goto RETURN2;
			}
			COPY(ARG(1), ARG(6));
			COPY(ARG(4), ARG(7));
			COPY(ARG(6), ARG(8));
			LOAD_NIL(ARG(9));
			LOAD_NIL(ARG(10));
			COPY(ARG(7), ARG(11));
			read_char1(ARG(8));
			COPY(ARG(8), ARG(5));
			goto M2_1;
			RETURN2:;
		}
	}
	if(CL_TRUEP(ARG(5)))
	{
	}
	else
	{
		if(CL_TRUEP(ARG(2)))
		{
			LOAD_SMSTR((CL_FORM *)&Kpeek_char1[0], ARG(6));	/* unexpected end of file */
			Ferror(ARG(6), 1);
		}
	}
	COPY(ARG(5), ARG(6));
	COPY(ARG(1), ARG(7));
	unread_char1(ARG(6));
	mv_count = 1;
	COPY(ARG(5), ARG(0));
}
Exemple #5
0
/**
 * @brief メモリ領域を解放する
 * @param[in] ptr  解放したいメモリ領域の先頭ポインタ
 * @param[in] type メモリ割り当て領域種別
 */
void SCC_MEM_Free(void *ptr, E_SCC_MEM_TYPE type)
{
	E_SC_RESULT ret = e_SC_RESULT_SUCCESS;
	MEM_CELL	*prevFree = NULL;		// 前スロット要素
	MEM_CELL	*nextFree = NULL;		// 次スロット要素
	MEM_CELL	*cur = NULL;			// 現在スロット位置
	MEM_ALLOCAREAINF *inf = NULL;
	SIZE		cellSize = 0;

	// パラメータチェック
	if (NULL == ptr) {
		SCC_LOG_ErrorPrint(SC_TAG_CC, "param error[ptr], " HERE);
		return;
	}
	if (CC_MEM_TYPE_END == type) {
		SCC_LOG_ErrorPrint(SC_TAG_CC, "param error[type], " HERE);
		return;
	}

	inf = &memMngList[type];
	if (NULL == inf->top) {
		// 該当タイプの領域全体が解放されている場合
		return;
	}

	// 排他制御開始
	ret = SCC_LockMutex(&mutexTable[type]);
	if (ret != e_SC_RESULT_SUCCESS) {
		SCC_LOG_ErrorPrint(SC_TAG_CC, "SCC_LockMutext error, " HERE);
		return;
	}

	// 解放対象のスロットアドレスを取得
	cur = OBJMEMCELL(ptr);

	cellSize = cur->size;

	/* 探索開始位置の設定
	 *   前回の解放時に使った際のポインタ位置を有効ならば使ってしまう。
	 *   そうすることによりフリーツリー探索を行う無駄な時間を少し省ける。
	 */
	nextFree = inf->topFreeList;
	if (NULL != inf->latestFree && inf->latestFree < cur) {
		// 前回キャッシュ位置が妥当な場合は使う
		nextFree = inf->latestFree;
	}

	while (NULL != nextFree && nextFree < cur) {
		// 次空き要素があり、次空き要素が未だcurを超過していない場合
		prevFree = nextFree;
		nextFree = nextFree->next;
	}

	// 次要素との後処理(連結処理)
	if (NULL != nextFree) {
		// 次空き要素が存在する場合
		if (OFFSET(cur, cur->size) == nextFree) {
			// 次空き要素と隣接する場合は連結する
			cur->size += nextFree->size;
			cur->next = nextFree->next;
		} else {
			// 次空き要素と隣接しない場合
			cur->next = nextFree;
		}
	} else {
		// 次空き要素が存在しない場合
		cur->next = NULL;
	}

	// キャッシュ設定
	inf->latestFree = cur;

	// 前要素との後処理(連結処理)
	if (NULL != prevFree) {
		if (OFFSET(prevFree, prevFree->size) == cur) {
			// 前の隣接空き要素と連結する
			prevFree->size += cur->size;
			prevFree->next = cur->next;
			// キャッシュはひとつ前に設定
			inf->latestFree = prevFree;
		} else {
			prevFree->next = cur;
		}
	} else {
		// 前空き要素がない場合、curはFreeListの先頭となる
		inf->topFreeList = cur;
		// キャッシュは不要なのでNULL設定 */
		inf->latestFree = NULL;
	}

	freeAreaSize[type] += cellSize;
	useAreaSize[type]  -= cellSize;
	SCC_LOG_DebugPrint(SC_TAG_CC, "[SMCCom]block%d free=%u, use=%u, " HERE, (type + 1), freeAreaSize[type], useAreaSize[type]);

	// 排他制御終了
	ret = SCC_UnLockMutex(&mutexTable[type]);
	if (ret != e_SC_RESULT_SUCCESS) {
		SCC_LOG_ErrorPrint(SC_TAG_CC, "SCC_UnLockMutex error, " HERE);
	}
}
Exemple #6
0
 * u-boot:/board/ti/am335x/mux.c
 *
 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */

#include <common.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/hardware.h>
#include <asm/arch/mux.h>
#include <asm/io.h>
#include <i2c.h>

static struct module_pin_mux uart0_pin_mux[] = {
	{OFFSET(uart0_rxd), (MODE(0) | PULLUDDIS | RXACTIVE)},	/* UART0_RXD */
	{OFFSET(uart0_txd), (MODE(0) | PULLUDDIS)},		/* UART0_TXD */
	{-1},
};

static struct module_pin_mux ddr_pin_mux[] = {
	{OFFSET(ddr_resetn), (MODE(0))},
	{OFFSET(ddr_csn0), (MODE(0) | PULLUP_EN)},
	{OFFSET(ddr_ck), (MODE(0))},
	{OFFSET(ddr_nck), (MODE(0))},
	{OFFSET(ddr_casn), (MODE(0) | PULLUP_EN)},
	{OFFSET(ddr_rasn), (MODE(0) | PULLUP_EN)},
	{OFFSET(ddr_wen), (MODE(0) | PULLUP_EN)},
	{OFFSET(ddr_ba0), (MODE(0) | PULLUP_EN)},
	{OFFSET(ddr_ba1), (MODE(0) | PULLUP_EN)},
	{OFFSET(ddr_ba2), (MODE(0) | PULLUP_EN)},
    int distance_cm;
    int distance_m;
    double dry, wet;
    int temp;

    unsigned delay;
    unsigned w_ptr;
    unsigned buf_size;
    AVFrame *delay_frame;
} CompensationDelayContext;

#define OFFSET(x) offsetof(CompensationDelayContext, x)
#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM

static const AVOption compensationdelay_options[] = {
    { "mm",   "set mm distance",    OFFSET(distance_mm), AV_OPT_TYPE_INT,    {.i64=0},    0,  10, A },
    { "cm",   "set cm distance",    OFFSET(distance_cm), AV_OPT_TYPE_INT,    {.i64=0},    0, 100, A },
    { "m",    "set meter distance", OFFSET(distance_m),  AV_OPT_TYPE_INT,    {.i64=0},    0, 100, A },
    { "dry",  "set dry amount",     OFFSET(dry),         AV_OPT_TYPE_DOUBLE, {.dbl=0},    0,   1, A },
    { "wet",  "set wet amount",     OFFSET(wet),         AV_OPT_TYPE_DOUBLE, {.dbl=1},    0,   1, A },
    { "temp", "set temperature °C", OFFSET(temp),        AV_OPT_TYPE_INT,    {.i64=20}, -50,  50, A },
    { NULL }
};

AVFILTER_DEFINE_CLASS(compensationdelay);

// The maximum distance for options
#define COMP_DELAY_MAX_DISTANCE            (100.0 * 100.0 + 100.0 * 1.0 + 1.0)
// The actual speed of sound in normal conditions
#define COMP_DELAY_SOUND_SPEED_KM_H(temp)  1.85325 * (643.95 * pow(((temp + 273.15) / 273.15), 0.5))
#define COMP_DELAY_SOUND_SPEED_CM_S(temp)  (COMP_DELAY_SOUND_SPEED_KM_H(temp) * (1000.0 * 100.0) /* cm/km */ / (60.0 * 60.0) /* s/h */)
Exemple #8
0
    FILE *stats_file;
    char *stats_file_str;
    int max[4], average_max;
    int is_rgb;
    uint8_t rgba_map[4];
    char comps[4];
    int nb_components;
    int planewidth[4];
    int planeheight[4];
} PSNRContext;

#define OFFSET(x) offsetof(PSNRContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM

static const AVOption psnr_options[] = {
    {"stats_file", "Set file where to store per-frame difference information", OFFSET(stats_file_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
    {"f",          "Set file where to store per-frame difference information", OFFSET(stats_file_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
    { NULL },
};

AVFILTER_DEFINE_CLASS(psnr);

static inline int pow2(int base)
{
    return base*base;
}

static inline double get_psnr(double mse, uint64_t nb_frames, int max)
{
    return 10.0 * log(pow2(max) / (mse / nb_frames)) / log(10.0);
}
Exemple #9
0
enum var_name {
    VAR_X, VAR_Y,
    VAR_W, VAR_H,
    VAR_TIME,
    VAR_SPEED, VAR_TEMPO, VAR_ORDER, VAR_PATTERN, VAR_ROW,
    VAR_VARS_NB
};

#define FF_MODPLUG_MAX_FILE_SIZE (100 * 1<<20) // 100M
#define FF_MODPLUG_DEF_FILE_SIZE (  5 * 1<<20) //   5M

#define OFFSET(x) offsetof(ModPlugContext, x)
#define D AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
    {"noise_reduction", "Enable noise reduction 0(off)-1(on)",  OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = 0}, 0,       1, D},
    {"reverb_depth",    "Reverb level 0(quiet)-100(loud)",      OFFSET(reverb_depth),    AV_OPT_TYPE_INT, {.i64 = 0}, 0,     100, D},
    {"reverb_delay",    "Reverb delay in ms, usually 40-200ms", OFFSET(reverb_delay),    AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, D},
    {"bass_amount",     "XBass level 0(quiet)-100(loud)",       OFFSET(bass_amount),     AV_OPT_TYPE_INT, {.i64 = 0}, 0,     100, D},
    {"bass_range",      "XBass cutoff in Hz 10-100",            OFFSET(bass_range),      AV_OPT_TYPE_INT, {.i64 = 0}, 0,     100, D},
    {"surround_depth",  "Surround level 0(quiet)-100(heavy)",   OFFSET(surround_depth),  AV_OPT_TYPE_INT, {.i64 = 0}, 0,     100, D},
    {"surround_delay",  "Surround delay in ms, usually 5-40ms", OFFSET(surround_delay),  AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, D},
    {"max_size",        "Max file size supported (in bytes). Default is 5MB. Set to 0 for no limit (not recommended)",
     OFFSET(max_size), AV_OPT_TYPE_INT, {.i64 = FF_MODPLUG_DEF_FILE_SIZE}, 0, FF_MODPLUG_MAX_FILE_SIZE, D},
    {"video_stream_expr", "Color formula",                                  OFFSET(color_eval),     AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, D},
    {"video_stream",      "Make demuxer output a video stream",             OFFSET(video_stream),   AV_OPT_TYPE_INT, {.i64 = 0},   0,   1, D},
    {"video_stream_w",    "Video stream width in char (one char = 8x8px)",  OFFSET(w),              AV_OPT_TYPE_INT, {.i64 = 30}, 20, 512, D},
    {"video_stream_h",    "Video stream height in char (one char = 8x8px)", OFFSET(h),              AV_OPT_TYPE_INT, {.i64 = 30}, 20, 512, D},
    {"video_stream_ptxt", "Print speed, tempo, order, ... in video stream", OFFSET(print_textinfo), AV_OPT_TYPE_INT, {.i64 = 1},   0,   1, D},
    {NULL},
};
Exemple #10
0
};

struct module_pin_mux {
	short reg_offset;
	unsigned char val;
};

/* Pad control register offset */
#define PAD_CTRL_BASE	0x800
#define OFFSET(x)	(unsigned int) (&((struct pad_signals *) \
				(PAD_CTRL_BASE))->x)

/* piA-AM335x-PM base configuration for fixed and "most likely" fixed pin
 * configs. This includes I2C, SPI busses, MII */
static struct module_pin_mux pia335x_pm[] = {
	{ OFFSET(gpmc_ad0),         (M1 | PIN_INPUT_PULLUP) }, /* MMC1 D0 */
	{ OFFSET(gpmc_ad1),         (M1 | PIN_INPUT_PULLUP) }, /* MMC1 D1 */
	{ OFFSET(gpmc_ad2),         (M1 | PIN_INPUT_PULLUP) }, /* MMC1 D2*/
	{ OFFSET(gpmc_ad3),         (M1 | PIN_INPUT_PULLUP) }, /* MMC1 D3 */
	{ OFFSET(gpmc_ad4),         (M1 | PIN_INPUT_PULLUP) }, /* MMC1 D4 */
	{ OFFSET(gpmc_ad5),         (M1 | PIN_INPUT_PULLUP) }, /* MMC1 D5 */
	{ OFFSET(gpmc_ad6),         (M1 | PIN_INPUT_PULLUP) }, /* MMC1 D6 */
	{ OFFSET(gpmc_ad7),         (M1 | PIN_INPUT_PULLUP) }, /* MMC1 D7 */
	{ OFFSET(gpmc_ad8),         (M7 | PIN_INPUT) }, /* GPIO 0_22 */
	{ OFFSET(gpmc_ad9),         (M7 | PIN_INPUT) }, /* GPIO 0_23 */
	{ OFFSET(gpmc_ad10),        (M7 | PIN_INPUT) }, /* GPIO 0_26 */
	{ OFFSET(gpmc_ad11),        (M7 | PIN_INPUT) }, /* GPIO 0_27 */
	{ OFFSET(gpmc_ad12),        (M7 | PIN_INPUT) }, /* GPIO 1_12 */
	{ OFFSET(gpmc_ad13),        (M7 | PIN_INPUT) }, /* GPIO 1_13 */
	{ OFFSET(gpmc_ad14),        (M7 | PIN_INPUT) }, /* GPIO 1_14 */
	{ OFFSET(gpmc_ad15),        (M7 | PIN_INPUT) }, /* GPIO 1_15 */
Exemple #11
0
int main(void) {

    SetMode(MODE_3 | BG2_ENABLE);
    
    fillScreen(BLACK);
    
    drawImage3(0, 0, STARTSCREEN_WIDTH, STARTSCREEN_HEIGHT, &startScreen[0]);
    int i = 1;
    while(i) {
        if(keyDown(KEY_START)) {
            i = 0;
        }
    }
    
    fillScreen(BLACK);
    
    int x = 120;
    int y = 60;
    int d = 0;
    int t = 20;
    int m = 10;
    int s = 0;
    int p = 0;
    int c = 1;
    u16 color = WHITE;
    
    drawHollowRect(0,0,SCREEN_WIDTH-1, SCREEN_HEIGHT-10, color);
    setPixel(x,y,color);
    
    while(c) {
        
        // Reset
        if(keyDown(KEY_SELECT)) {
            c = 0;
            main();
        }
        
        // Set Direction
        if(keyDown(KEY_DOWN) && (d != 2)){
            d = 0;
        } else if(keyDown(KEY_RIGHT) && (d != 3)) {
            d = 1;
        } else if(keyDown(KEY_UP) && (d != 0)) {
            d = 2;
        } else if(keyDown(KEY_LEFT) && (d != 1)) {
            d = 3;
        }
        
        // Move snake
        if(d==0) {
            y++;
        } else if(d==1) {
            x++;
        } else if(d==2) {
            y--;
        } else if(d==3) {
            x--;
        }
        
        // Check for collisions
        if(videoBuffer[OFFSET(x,y)] != BLACK) {
            fillScreen(BLACK);
            drawImage3(0, 0, GAMEOVER_WIDTH, GAMEOVER_HEIGHT, &gameOver[0]);
            drawImage3(100, 70, RETRY_WIDTH, RETRY_HEIGHT, &retry[0]);
            int i = 1;
            while(i) {
                if(keyDown(KEY_START)) {
                    while(keyDown(KEY_START)) {
                        
                    }
                    i = 0;
                }
            }
            
            c = 0;
            main();
        }
        
        // Draw snake
        setPixel(x,y,color);
        delay(t);
        
        // Increase score
        s++;
        s = s%m;
        
        // Set Speed
        if(s == 0) {
            t--;
            m = m + m/3;
            drawRect(1 + p,152,2,6,WHITE);
            p = p + 4;
        }
        
        // Wait for V blank
        waitForVblank();
    }

    return 0;
}
Exemple #12
0
    double start_time;      ///< pts, in seconds, of the expected first frame

    AVRational framerate;   ///< target framerate
    char *fps;              ///< a string describing target framerate

    /* statistics */
    int frames_in;             ///< number of frames on input
    int frames_out;            ///< number of frames on output
    int dup;                   ///< number of frames duplicated
    int drop;                  ///< number of framed dropped
} FPSContext;

#define OFFSET(x) offsetof(FPSContext, x)
#define V AV_OPT_FLAG_VIDEO_PARAM
static const AVOption options[] = {
    { "fps", "A string describing desired output framerate", OFFSET(fps), AV_OPT_TYPE_STRING, { .str = "25" }, .flags = V },
    { "start_time", "Assume the first PTS should be this value.", OFFSET(start_time), AV_OPT_TYPE_DOUBLE, { .dbl = DBL_MAX}, -DBL_MAX, DBL_MAX, V },
    { NULL },
};

static const AVClass class = {
    .class_name = "FPS filter",
    .item_name  = av_default_item_name,
    .option     = options,
    .version    = LIBAVUTIL_VERSION_INT,
};

static av_cold int init(AVFilterContext *ctx)
{
    FPSContext *s = ctx->priv;
    int ret;
Exemple #13
0
/*
 * Big_insert
 *
 * You need to do an insert and the key/data pair is too big
 *
 * Returns:
 * 0 ==> OK
 *-1 ==> ERROR
 */
extern int
__big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
{
    register uint16 *p;
    uint key_size, n, val_size;
    uint16 space, move_bytes, off;
    char *cp, *key_data, *val_data;

    cp = bufp->page; /* Character pointer of p. */
    p = (uint16 *)cp;

    key_data = (char *)key->data;
    key_size = key->size;
    val_data = (char *)val->data;
    val_size = val->size;

    /* First move the Key */
    for (space = FREESPACE(p) - BIGOVERHEAD; key_size;
         space = FREESPACE(p) - BIGOVERHEAD) {
        move_bytes = PR_MIN(space, key_size);
        off = OFFSET(p) - move_bytes;
        memmove(cp + off, key_data, move_bytes);
        key_size -= move_bytes;
        key_data += move_bytes;
        n = p[0];
        p[++n] = off;
        p[0] = ++n;
        FREESPACE(p) = off - PAGE_META(n);
        OFFSET(p) = off;
        p[n] = PARTIAL_KEY;
        bufp = __add_ovflpage(hashp, bufp);
        if (!bufp)
            return (-1);
        n = p[0];
        if (!key_size) {
            if (FREESPACE(p)) {
                move_bytes = PR_MIN(FREESPACE(p), val_size);
                off = OFFSET(p) - move_bytes;
                p[n] = off;
                memmove(cp + off, val_data, move_bytes);
                val_data += move_bytes;
                val_size -= move_bytes;
                p[n - 2] = FULL_KEY_DATA;
                FREESPACE(p) = FREESPACE(p) - move_bytes;
                OFFSET(p) = off;
            }
            else
                p[n - 2] = FULL_KEY;
        }
        p = (uint16 *)bufp->page;
        cp = bufp->page;
        bufp->flags |= BUF_MOD;
    }

    /* Now move the data */
    for (space = FREESPACE(p) - BIGOVERHEAD; val_size;
         space = FREESPACE(p) - BIGOVERHEAD) {
        move_bytes = PR_MIN(space, val_size);
        /*
         * Here's the hack to make sure that if the data ends on the
         * same page as the key ends, FREESPACE is at least one.
         */
        if (space == val_size && val_size == val->size)
            move_bytes--;
        off = OFFSET(p) - move_bytes;
        memmove(cp + off, val_data, move_bytes);
        val_size -= move_bytes;
        val_data += move_bytes;
        n = p[0];
        p[++n] = off;
        p[0] = ++n;
        FREESPACE(p) = off - PAGE_META(n);
        OFFSET(p) = off;
        if (val_size) {
            p[n] = FULL_KEY;
            bufp = __add_ovflpage(hashp, bufp);
            if (!bufp)
                return (-1);
            cp = bufp->page;
            p = (uint16 *)cp;
        }
        else
            p[n] = FULL_KEY_DATA;
        bufp->flags |= BUF_MOD;
    }
    return (0);
}
Exemple #14
0
void foo(void)
{
	OFFSET(IA32_SIGCONTEXT_ax, sigcontext, ax);
	OFFSET(IA32_SIGCONTEXT_bx, sigcontext, bx);
	OFFSET(IA32_SIGCONTEXT_cx, sigcontext, cx);
	OFFSET(IA32_SIGCONTEXT_dx, sigcontext, dx);
	OFFSET(IA32_SIGCONTEXT_si, sigcontext, si);
	OFFSET(IA32_SIGCONTEXT_di, sigcontext, di);
	OFFSET(IA32_SIGCONTEXT_bp, sigcontext, bp);
	OFFSET(IA32_SIGCONTEXT_sp, sigcontext, sp);
	OFFSET(IA32_SIGCONTEXT_ip, sigcontext, ip);
	BLANK();

	OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
	OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
	OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
	OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
	OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
	OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
	OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
	BLANK();

	OFFSET(TI_sysenter_return, thread_info, sysenter_return);
	OFFSET(TI_cpu, thread_info, cpu);
	BLANK();

	OFFSET(PT_EBX, pt_regs, bx);
	OFFSET(PT_ECX, pt_regs, cx);
	OFFSET(PT_EDX, pt_regs, dx);
	OFFSET(PT_ESI, pt_regs, si);
	OFFSET(PT_EDI, pt_regs, di);
	OFFSET(PT_EBP, pt_regs, bp);
	OFFSET(PT_EAX, pt_regs, ax);
	OFFSET(PT_DS,  pt_regs, ds);
	OFFSET(PT_ES,  pt_regs, es);
	OFFSET(PT_FS,  pt_regs, fs);
	OFFSET(PT_GS,  pt_regs, gs);
	OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
	OFFSET(PT_EIP, pt_regs, ip);
	OFFSET(PT_CS,  pt_regs, cs);
	OFFSET(PT_EFLAGS, pt_regs, flags);
	OFFSET(PT_OLDESP, pt_regs, sp);
	OFFSET(PT_OLDSS,  pt_regs, ss);
	BLANK();

	OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
	BLANK();

	OFFSET(saved_context_gdt_desc, saved_context, gdt_desc);
	BLANK();

	/* Offset from the sysenter stack to tss.sp0 */
	DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
		 sizeof(struct tss_struct));

#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST) || defined(CONFIG_LGUEST_MODULE)
	BLANK();
	OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
	OFFSET(LGUEST_DATA_irq_pending, lguest_data, irq_pending);

	BLANK();
	OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
	OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
	OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
	OFFSET(LGUEST_PAGES_host_sp, lguest_pages, state.host_sp);
	OFFSET(LGUEST_PAGES_guest_gdt_desc, lguest_pages,state.guest_gdt_desc);
	OFFSET(LGUEST_PAGES_guest_idt_desc, lguest_pages,state.guest_idt_desc);
	OFFSET(LGUEST_PAGES_guest_gdt, lguest_pages, state.guest_gdt);
	OFFSET(LGUEST_PAGES_regs_trapnum, lguest_pages, regs.trapnum);
	OFFSET(LGUEST_PAGES_regs_errcode, lguest_pages, regs.errcode);
	OFFSET(LGUEST_PAGES_regs, lguest_pages, regs);
#endif
	BLANK();
	DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
	DEFINE(NR_syscalls, sizeof(syscalls));
}
Exemple #15
0
/*
 * Returns:
 *  0 => OK
 * -1 => error
 */
int
__big_split(HTAB *hashp,
    BUFHEAD *op,	/* Pointer to where to put keys that go in old bucket */
    BUFHEAD *np,	/* Pointer to new bucket page */
    BUFHEAD *big_keyp,	/* Pointer to first page containing the big key/data */
    int addr,		/* Address of big_keyp */
    u_int32_t obucket,	/* Old Bucket */
    SPLIT_RETURN *ret)
{
	BUFHEAD *bp, *tmpp;
	DBT key, val;
	u_int32_t change;
	u_int16_t free_space, n, off, *tp;

	bp = big_keyp;

	/* Now figure out where the big key/data goes */
	if (__big_keydata(hashp, big_keyp, &key, &val, 0))
		return (-1);
	change = (__call_hash(hashp, key.data, key.size) != obucket);

	if ((ret->next_addr = __find_last_page(hashp, &big_keyp))) {
		if (!(ret->nextp =
		    __get_buf(hashp, ret->next_addr, big_keyp, 0)))
			return (-1);
	} else
		ret->nextp = NULL;

	/* Now make one of np/op point to the big key/data pair */
#ifdef DEBUG
	assert(np->ovfl == NULL);
#endif
	if (change)
		tmpp = np;
	else
		tmpp = op;

	tmpp->flags |= BUF_MOD;
#ifdef DEBUG1
	(void)fprintf(stderr,
	    "BIG_SPLIT: %d->ovfl was %d is now %d\n", tmpp->addr,
	    (tmpp->ovfl ? tmpp->ovfl->addr : 0), (bp ? bp->addr : 0));
#endif
	tmpp->ovfl = bp;	/* one of op/np point to big_keyp */
	tp = (u_int16_t *)tmpp->page;
#ifdef DEBUG
	assert(FREESPACE(tp) >= OVFLSIZE);
#endif
	n = tp[0];
	off = OFFSET(tp);
	free_space = FREESPACE(tp);
	tp[++n] = (u_int16_t)addr;
	tp[++n] = OVFLPAGE;
	tp[0] = n;
	OFFSET(tp) = off;
	FREESPACE(tp) = free_space - OVFLSIZE;

	/*
	 * Finally, set the new and old return values. BIG_KEYP contains a
	 * pointer to the last page of the big key_data pair. Make sure that
	 * big_keyp has no following page (2 elements) or create an empty
	 * following page.
	 */

	ret->newp = np;
	ret->oldp = op;

	tp = (u_int16_t *)big_keyp->page;
	big_keyp->flags |= BUF_MOD;
	if (tp[0] > 2) {
		/*
		 * There may be either one or two offsets on this page.  If
		 * there is one, then the overflow page is linked on normally
		 * and tp[4] is OVFLPAGE.  If there are two, tp[4] contains
		 * the second offset and needs to get stuffed in after the
		 * next overflow page is added.
		 */
		n = tp[4];
		free_space = FREESPACE(tp);
		off = OFFSET(tp);
		tp[0] -= 2;
		FREESPACE(tp) = free_space + OVFLSIZE;
		OFFSET(tp) = off;
		tmpp = __add_ovflpage(hashp, big_keyp);
		if (!tmpp)
			return (-1);
		tp[4] = n;
	} else
		tmpp = big_keyp;

	if (change)
		ret->newp = tmpp;
	else
		ret->oldp = tmpp;
	return (0);
}
Exemple #16
0
    uint8_t inbuffer [BLOCKSIZE*MAX_BUFFER_BLOCKS],
            outbuffer[BLOCKSIZE*MAX_BUFFER_BLOCKS];
    uint8_t *outptr;
    int indata, indata_used, outdata;
    int eof;
    uint8_t *key;
    int keylen;
    uint8_t *iv;
    int ivlen;
    struct AVAES *aes;
} CryptoContext;

#define OFFSET(x) offsetof(CryptoContext, x)
#define D AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
    {"key", "AES decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, .flags = D },
    {"iv",  "AES decryption initialization vector", OFFSET(iv), AV_OPT_TYPE_BINARY, .flags = D },
    { NULL }
};

static const AVClass crypto_class = {
    .class_name     = "crypto",
    .item_name      = av_default_item_name,
    .option         = options,
    .version        = LIBAVUTIL_VERSION_INT,
};

static int crypto_open(URLContext *h, const char *uri, int flags)
{
    const char *nested_url;
    int ret = 0;
Exemple #17
0
/*
 * Big_insert
 *
 * You need to do an insert and the key/data pair is too big
 *
 * Returns:
 * 0 ==> OK
 *-1 ==> ERROR
 */
int
__big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
{
	u_int16_t *p;
	int key_size, n, val_size;
	u_int16_t space, move_bytes, off;
	char *cp, *key_data, *val_data;

	cp = bufp->page;		/* Character pointer of p. */
	p = (u_int16_t *)cp;

	key_data = (char *)key->data;
	key_size = key->size;
	val_data = (char *)val->data;
	val_size = val->size;

	/* First move the Key */
	for (space = FREESPACE(p) - BIGOVERHEAD; key_size;
	    space = FREESPACE(p) - BIGOVERHEAD) {
		move_bytes = MIN(space, key_size);
		off = OFFSET(p) - move_bytes;
		memmove(cp + off, key_data, move_bytes);
		key_size -= move_bytes;
		key_data += move_bytes;
		n = p[0];
		p[++n] = off;
		p[0] = ++n;
		FREESPACE(p) = off - PAGE_META(n);
		OFFSET(p) = off;
		p[n] = PARTIAL_KEY;
		bufp = __add_ovflpage(hashp, bufp);
		if (!bufp)
			return (-1);
		n = p[0];
		if (!key_size) {
			space = FREESPACE(p);
			if (space) {
				move_bytes = MIN(space, val_size);
				/*
				 * If the data would fit exactly in the
				 * remaining space, we must overflow it to the
				 * next page; otherwise the invariant that the
				 * data must end on a page with FREESPACE
				 * non-zero would fail.
				 */
				if (space == val_size && val_size == val->size)
					goto toolarge;
				off = OFFSET(p) - move_bytes;
				memmove(cp + off, val_data, move_bytes);
				val_data += move_bytes;
				val_size -= move_bytes;
				p[n] = off;
				p[n - 2] = FULL_KEY_DATA;
				FREESPACE(p) = FREESPACE(p) - move_bytes;
				OFFSET(p) = off;
			} else {
			toolarge:
				p[n - 2] = FULL_KEY;
			}
		}
		p = (u_int16_t *)bufp->page;
		cp = bufp->page;
		bufp->flags |= BUF_MOD;
	}

	/* Now move the data */
	for (space = FREESPACE(p) - BIGOVERHEAD; val_size;
	    space = FREESPACE(p) - BIGOVERHEAD) {
		move_bytes = MIN(space, val_size);
		/*
		 * Here's the hack to make sure that if the data ends on the
		 * same page as the key ends, FREESPACE is at least one.
		 */
		if (space == val_size && val_size == val->size)
			move_bytes--;
		off = OFFSET(p) - move_bytes;
		memmove(cp + off, val_data, move_bytes);
		val_size -= move_bytes;
		val_data += move_bytes;
		n = p[0];
		p[++n] = off;
		p[0] = ++n;
		FREESPACE(p) = off - PAGE_META(n);
		OFFSET(p) = off;
		if (val_size) {
			p[n] = FULL_KEY;
			bufp = __add_ovflpage(hashp, bufp);
			if (!bufp)
				return (-1);
			cp = bufp->page;
			p = (u_int16_t *)cp;
		} else
			p[n] = FULL_KEY_DATA;
		bufp->flags |= BUF_MOD;
	}
	return (0);
}
#define BW_7         (0x01)
#define BW_8         (0x02)
#define BW_1_7       (0x03)

/**
  @brief Sony silicon tuner setting for each broadcasting system.
         These values are optimized for Sony demodulators.
         The user have to change these values if other demodulators are used.
         Please check Sony silicon tuner application note for detail.
*/
static const sony_ascot2e_adjust_param_t g_param_table[SONY_ASCOT2E_TV_SYSTEM_NUM] = {
    /*
    IF_OUT_SEL   MIX_OLL    IF_BPF_GC          BW_OFFSET         RF_OLDET
      |   AGC_SEL |   RF_GAIN |    FIF_OFFSET   |          BW      |   IF_BPF_F0
      |     |     |     |     |     |           |           |      |     |       */
    {AUTO, AUTO, 0x02, AUTO, 0x03, OFFSET(0),  OFFSET(0),  BW_6,  0x09, 0x00}, /**< SONY_ASCOT2E_TV_SYSTEM_UNKNOWN */
    /* Analog */
    {AUTO, AUTO, 0x02, AUTO, 0x03, OFFSET(0),  OFFSET(0),  BW_6,  0x09, 0x00}, /**< SONY_ASCOT2E_ATV_MN_EIAJ   (System-M (Japan)) */
    {AUTO, AUTO, 0x02, AUTO, 0x03, OFFSET(0),  OFFSET(0),  BW_6,  0x09, 0x00}, /**< SONY_ASCOT2E_ATV_MN_SAP    (System-M (US)) */
    {AUTO, AUTO, 0x02, AUTO, 0x03, OFFSET(3),  OFFSET(0),  BW_6,  0x09, 0x00}, /**< SONY_ASCOT2E_ATV_MN_A2     (System-M (Korea)) */
    {AUTO, AUTO, 0x02, AUTO, 0x03, OFFSET(11), OFFSET(8),  BW_7,  0x09, 0x00}, /**< SONY_ASCOT2E_ATV_BG        (System-B/G) */
    {AUTO, AUTO, 0x02, AUTO, 0x03, OFFSET(2),  OFFSET(0),  BW_8,  0x09, 0x00}, /**< SONY_ASCOT2E_ATV_I         (System-I) */
    {AUTO, AUTO, 0x02, AUTO, 0x03, OFFSET(2),  OFFSET(0),  BW_8,  0x09, 0x00}, /**< SONY_ASCOT2E_ATV_DK        (System-D/K) */
    {AUTO, AUTO, 0x05, AUTO, 0x01, OFFSET(2),  OFFSET(0),  BW_8,  0x0A, 0x00}, /**< SONY_ASCOT2E_ATV_L         (System-L) */
    {AUTO, AUTO, 0x05, AUTO, 0x01, OFFSET(-1), OFFSET(7),  BW_8,  0x0A, 0x00}, /**< SONY_ASCOT2E_ATV_L_DASH    (System-L DASH) */
    /* Digital */
    {AUTO, AUTO, 0x03, AUTO, 0x06, OFFSET(-6), OFFSET(-6), BW_6,  0x0B, 0x00}, /**< SONY_ASCOT2E_DTV_8VSB      (ATSC 8VSB) */
    {AUTO, AUTO, 0x03, AUTO, 0x06, OFFSET(-6), OFFSET(-6), BW_6,  0x0B, 0x00}, /**< SONY_ASCOT2E_DTV_QAM       (US QAM) */
    {AUTO, AUTO, 0x03, AUTO, 0x06, OFFSET(-9), OFFSET(-7), BW_6,  0x0B, 0x00}, /**< SONY_ASCOT2E_DTV_ISDBT_6   (ISDB-T 6MHzBW) */
    {AUTO, AUTO, 0x03, AUTO, 0x06, OFFSET(-7), OFFSET(-5), BW_7,  0x0B, 0x00}, /**< SONY_ASCOT2E_DTV_ISDBT_7   (ISDB-T 7MHzBW) */
    {AUTO, AUTO, 0x03, AUTO, 0x06, OFFSET(-5), OFFSET(-3), BW_8,  0x0B, 0x00}, /**< SONY_ASCOT2E_DTV_ISDBT_8   (ISDB-T 8MHzBW) */
    /* could not find filter corresponding to prev */
    if (prev && !f)
        return NULL;

    /* find next filter with specific options */
    while ((f = avfilter_next(f)))
        if (f->priv_class)
            return f->priv_class;

    return NULL;
}

#define OFFSET(x) offsetof(AVFilterContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM
static const AVOption avfilter_options[] = {
    { "thread_type", "Allowed thread types", OFFSET(thread_type), AV_OPT_TYPE_FLAGS,
        { .i64 = AVFILTER_THREAD_SLICE }, 0, INT_MAX, FLAGS, "thread_type" },
        { "slice", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVFILTER_THREAD_SLICE }, .unit = "thread_type" },
    { "enable", "set enable expression", OFFSET(enable_str), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
    { NULL },
};

static const AVClass avfilter_class = {
    .class_name = "AVFilter",
    .item_name  = default_filter_name,
    .version    = LIBAVUTIL_VERSION_INT,
    .category   = AV_CLASS_CATEGORY_FILTER,
    .child_next = filter_child_next,
    .child_class_next = filter_child_class_next,
    .option           = avfilter_options,
};
Exemple #20
0
/*
 * mux.c
 *
 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */

#include <common.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/mux.h>
#include "board.h"

static struct module_pin_mux rmii1_pin_mux[] = {
    {OFFSET(mii1_txen), MODE(1)},			/* RMII1_TXEN */
    {OFFSET(mii1_txd1), MODE(1)},			/* RMII1_TD1 */
    {OFFSET(mii1_txd0), MODE(1)},			/* RMII1_TD0 */
    {OFFSET(mii1_rxd1), MODE(1) | RXACTIVE},	/* RMII1_RD1 */
    {OFFSET(mii1_rxd0), MODE(1) | RXACTIVE},	/* RMII1_RD0 */
    {OFFSET(mii1_rxdv), MODE(1) | RXACTIVE},	/* RMII1_RXDV */
    {OFFSET(mii1_crs), MODE(1) | RXACTIVE},		/* RMII1_CRS_DV */
    {OFFSET(mii1_rxerr), MODE(1) | RXACTIVE},	/* RMII1_RXERR */
    {OFFSET(rmii1_refclk), MODE(0) | RXACTIVE},	/* RMII1_refclk */
    {-1},
};

static struct module_pin_mux rgmii1_pin_mux[] = {
    {OFFSET(mii1_txen), MODE(2)},			/* RGMII1_TCTL */
    {OFFSET(mii1_rxdv), MODE(2) | RXACTIVE},	/* RGMII1_RCTL */
    {OFFSET(mii1_txd3), MODE(2)},			/* RGMII1_TD3 */
    {OFFSET(mii1_txd2), MODE(2)},			/* RGMII1_TD2 */
Exemple #21
0
#include <float.h>

#define  C30DB  M_SQRT2
#define  C15DB  1.189207115
#define C__0DB  1.0
#define C_15DB  0.840896415
#define C_30DB  M_SQRT1_2
#define C_45DB  0.594603558
#define C_60DB  0.5

#define OFFSET(x) offsetof(SwrContext,x)
#define PARAM AV_OPT_FLAG_AUDIO_PARAM

static const AVOption options[]={
{"ich"                  , "set input channel count"     , OFFSET(user_in_ch_count  ), AV_OPT_TYPE_INT, {.i64=0                    }, 0      , SWR_CH_MAX, PARAM},
{"in_channel_count"     , "set input channel count"     , OFFSET(user_in_ch_count  ), AV_OPT_TYPE_INT, {.i64=0                    }, 0      , SWR_CH_MAX, PARAM},
{"och"                  , "set output channel count"    , OFFSET(user_out_ch_count ), AV_OPT_TYPE_INT, {.i64=0                    }, 0      , SWR_CH_MAX, PARAM},
{"out_channel_count"    , "set output channel count"    , OFFSET(user_out_ch_count ), AV_OPT_TYPE_INT, {.i64=0                    }, 0      , SWR_CH_MAX, PARAM},
{"uch"                  , "set used channel count"      , OFFSET(user_used_ch_count), AV_OPT_TYPE_INT, {.i64=0                    }, 0      , SWR_CH_MAX, PARAM},
{"used_channel_count"   , "set used channel count"      , OFFSET(user_used_ch_count), AV_OPT_TYPE_INT, {.i64=0                    }, 0      , SWR_CH_MAX, PARAM},
{"isr"                  , "set input sample rate"       , OFFSET( in_sample_rate), AV_OPT_TYPE_INT  , {.i64=0                     }, 0      , INT_MAX   , PARAM},
{"in_sample_rate"       , "set input sample rate"       , OFFSET( in_sample_rate), AV_OPT_TYPE_INT  , {.i64=0                     }, 0      , INT_MAX   , PARAM},
{"osr"                  , "set output sample rate"      , OFFSET(out_sample_rate), AV_OPT_TYPE_INT  , {.i64=0                     }, 0      , INT_MAX   , PARAM},
{"out_sample_rate"      , "set output sample rate"      , OFFSET(out_sample_rate), AV_OPT_TYPE_INT  , {.i64=0                     }, 0      , INT_MAX   , PARAM},
{"isf"                  , "set input sample format"     , OFFSET( in_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1   , INT_MAX, PARAM},
{"in_sample_fmt"        , "set input sample format"     , OFFSET( in_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1   , INT_MAX, PARAM},
{"osf"                  , "set output sample format"    , OFFSET(out_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1   , INT_MAX, PARAM},
{"out_sample_fmt"       , "set output sample format"    , OFFSET(out_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1   , INT_MAX, PARAM},
{"tsf"                  , "set internal sample format"  , OFFSET(user_int_sample_fmt), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1   , INT_MAX, PARAM},
{"internal_sample_fmt"  , "set internal sample format"  , OFFSET(user_int_sample_fmt), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1   , INT_MAX, PARAM},
Exemple #22
0
    if (s->source_hdc)
        ReleaseDC(s->hwnd, s->source_hdc);
    if (s->dest_hdc)
        DeleteDC(s->dest_hdc);
    if (s->hbmp)
        DeleteObject(s->hbmp);
    if (s->source_hdc)
        DeleteDC(s->source_hdc);

    return 0;
}

#define OFFSET(x) offsetof(struct gdigrab, x)
#define DEC AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
    { "draw_mouse", "draw the mouse pointer", OFFSET(draw_mouse), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, DEC },
    { "show_region", "draw border around capture area", OFFSET(show_region), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC },
    { "framerate", "set video frame rate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "ntsc"}, 0, 0, DEC },
    { "video_size", "set video frame size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, DEC },
    { "offset_x", "capture area x offset", OFFSET(offset_x), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, DEC },
    { "offset_y", "capture area y offset", OFFSET(offset_y), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, DEC },
    { NULL },
};

static const AVClass gdigrab_class = {
    .class_name = "GDIgrab indev",
    .item_name  = av_default_item_name,
    .option     = options,
    .version    = LIBAVUTIL_VERSION_INT,
};
Exemple #23
0
/**
 * @brief メモリ領域を割り当てる
 * @param[in] size:割り当てたい要求サイズ
 *			仮に要求サイズが0でも最低限のブロックサイズは割り当てる
 * @param[in] type:メモリ割り当て領域種別
 * @note 実際に確保する領域は、(指定サイズ + 管理領域のサイズ(4~8バイト))の合計サイズとなる。
 */
void *SCC_MEM_Alloc(SIZE size, E_SCC_MEM_TYPE type)
{
	E_SC_RESULT ret = e_SC_RESULT_SUCCESS;
	SCC_MUTEX	*mutex = NULL;
	MEM_CELL *next = NULL;			// 次の領域のポインタ */
	MEM_CELL *cur = NULL;			// 現在領域のポインタ */
	MEM_CELL **curPtr = NULL;		// 上記curへのポインタ */
	MEM_ALLOCAREAINF *inf = NULL;
	SIZE cellSize = size;			// セルに割り当て予定のサイズ

	// パラメータチェック
	if (0 == size) {
		SCC_LOG_ErrorPrint(SC_TAG_CC, "param error[size], " HERE);
		return (NULL);
	}
	if (CC_MEM_TYPE_END == type) {
		SCC_LOG_ErrorPrint(SC_TAG_CC, "param error[type], " HERE);
		return (NULL);
	}

	inf = &memMngList[type];
	if (NULL == inf->top) {
		// 該当するメモリバンク未割当なので0を返却する
		SCC_LOG_ErrorPrint(SC_TAG_CC, "UnInitialize, " HERE);
		return (NULL);
	}

	// 排他制御開始
	mutex = &mutexTable[type];
	ret = SCC_LockMutex(mutex);
	if (ret != e_SC_RESULT_SUCCESS) {
		SCC_LOG_ErrorPrint(SC_TAG_CC, "SCC_LockMutext error, " HERE);
		return (NULL);
	}

	// ヘッダサイズ分を取る
	cellSize += MEM_HDR_SIZE;

	/* 最低限4バイト境界にアラインメント
	 * 特にブロック境界にはアラインしていないので、
	 * 必要に応じて適切な境界にアラインすること
	 */
	cellSize = (cellSize + sizeof(INT32) - 1) & ~(sizeof(INT32) - 1);

	// ファーストフィットとFreeList形式を使用する
	curPtr = &inf->topFreeList;
	cur = *curPtr;

	// フィットするセルを探索
	while (NULL != cur) {
		if (cellSize <= cur->size) {
			// 割当可能セル発見
			break;
		}

		// 次セルへ移動
		curPtr = &cur->next;
		cur = *curPtr;
	}

	if (NULL == cur) {
		// 空き領域が見つからなかった場合
		SCC_LOG_ErrorPrint(SC_TAG_CC, "alloc err. memory full, type=%d size=%d, " HERE, type, size);
		// 排他制御終了
		ret = SCC_UnLockMutex(mutex);
		if (ret != e_SC_RESULT_SUCCESS) {
			SCC_LOG_ErrorPrint(SC_TAG_CC, "SCC_UnLockMutex error, " HERE);
		}
		return (NULL);
	}

	if (cur->size >= cellSize + sizeof(MEM_CELL)) {
		// 必要な領域は得られたが、大きいので分割する
		next = (MEM_CELL*)OFFSET(cur, cellSize);
		next->size = cur->size - cellSize;
		next->next = cur->next;
		cur->size = cellSize;
		cur->next = next;
	}

	// ツリーに次の領域のポインタを設定する
	*curPtr = cur->next;

	// 割り当て領域がフリーツリーキャッシュだったら、キャッシュクリア
	if (cur == inf->latestFree) {
		inf->latestFree = NULL;
	}

	freeAreaSize[type] -= cellSize;
	useAreaSize[type]  += cellSize;
	SCC_LOG_DebugPrint(SC_TAG_CC, "[SMCCom]block%d free=%u, use=%u, " HERE, (type + 1), freeAreaSize[type], useAreaSize[type]);

	// 排他制御終了
	ret = SCC_UnLockMutex(&mutexTable[type]);
	if (ret != e_SC_RESULT_SUCCESS) {
		SCC_LOG_ErrorPrint(SC_TAG_CC, "SCC_UnLockMutex error, " HERE);
	}

	return MEMCELLOBJ(cur);
}
Exemple #24
0
 char *strrchr( const char *s, int c )
#endif
/*********************************************/
{
    RISC_DATA_LOCALREF;
    UINT                *result = NULL;
    CHAR_TYPE           *result2 = NULL;
    UINT                *dw = ROUND(s); // round down to dword
    UINT                mask, dword, cdword, tmpdword;
    size_t              len = 0;
    int                 offset = OFFSET(s);
#ifdef __WIDECHAR__
    UINT                cShl16;
#else
    UINT                cShl8, cShl16, cShl24;
#endif

#ifdef __WIDECHAR__
    if( offset % 2 )
        return( __simple_wcsrchr( s, c ) );
#endif

    /*** If searching for '\0', use different technique ***/
    if( c == NULLCHAR )
        return( (CHAR_TYPE*)s + __F_NAME(strlen,wcslen)( s ) );

    /*** Initialize locals ***/
    c &= CHR1MASK;
#ifdef __WIDECHAR__
    cShl16 = c << 16;
    cdword = cShl16 | c;
#else
    cShl8 = c << 8;
    cShl16 = c << 16;
    cShl24 = c << 24;
    cdword = cShl24 | cShl16 | cShl8 | c;
#endif
    dword = *dw;

    /*** Scan any bytes up to a 4-byte alignment ***/
    if( OFFSET_GOT_NIL(dword,offset) ) { /* there is a null char in the first word */
        tmpdword = SKIP_CHRS(dword,offset/CHARSIZE) ^ cdword;
        if( GOT_NIL(tmpdword) ) {   /* c is in the first word */
#ifdef __WIDECHAR__
            if( offset == 0 ) {     /* no odd alignments */
                tmpdword = CHR1(dword);
                if( tmpdword == c ) {
                    result2 = (CHAR_TYPE*)s;
                } else if( tmpdword == 0 ) {
                    return( NULL );
                }
                len++;
            }
#else
            switch( offset ) {
              case 0:
                tmpdword = CHR1(dword);
                if( tmpdword == c ) {
                    result2 = (CHAR_TYPE*)s;
                } else if( tmpdword == 0 ) {
                    return( NULL );
                }
                len++;
                /* fall through */
              case 1:
                tmpdword = CHR2(dword);
                if( tmpdword == cShl8 ) {
                    result2 = (CHAR_TYPE*)s+len;
                } else if( tmpdword == 0 ) {
                    return( result2 );
                }
                len++;
                /* fall through */
              case 2:
                tmpdword = CHR3(dword);
                if( tmpdword == cShl16 ) {
                    return (CHAR_TYPE*)s+len;
                } else {
                    return( result2 );
                }
            }
#endif
        }
        return( result2 );
    } else {
        tmpdword = SKIP_CHRS(dword,offset/CHARSIZE) ^ cdword;
        if( GOT_NIL(tmpdword) ) { // c is in the first word
            result = dw;
            mask = SKIP_CHRS_MASKS(offset/CHARSIZE);
        }
    }

    /*** Scan in aligned 4-byte groups ***/
    for( ;; ) {
        dword = *(++dw);
        if( GOT_NIL(dword) )
            break;
        tmpdword = dword ^ cdword;
        if( GOT_NIL(tmpdword)) {
            result = dw;
            mask = SKIP_CHRS_MASKS(0);
        }

        dword = *(++dw);
        if( GOT_NIL(dword) )
            break;
        tmpdword = dword ^ cdword;
        if( GOT_NIL(tmpdword)) {
            result = dw;
            mask = SKIP_CHRS_MASKS(0);
        }
    }

    /*** Scan the last byte(s) in the string ***/

    /* we have a null char somewhere in the last dword */
#ifdef __WIDECHAR__
    if( CHR1(dword) ) { // first char in the dword is not null
        if( CHR1(dword) == c ) {
            return( (CHAR_TYPE*)dw );
        }
    }
#else
    if( CHR1(dword) ) { // first char in the dword is not null
        if( CHR2(dword) ) { // second char in the dword is not null
            if( CHR3(dword) ) { // third char in the dword is not null
                if ( ( CHR3(dword) ) == cShl16 ) {
                    return( ((char *)dw) + 2 );
                } else if ( ( CHR2(dword) ) == cShl8 ) {
                    return( ((char *)dw) + 1 );
                } else if ( ( CHR1(dword) ) == c ) {
                    return( (char *)dw );
                }
            } else {
                if ( ( CHR2(dword) ) == cShl8 ) {
                     return ((char *)dw)+1;
                } else if ( ( CHR1(dword) ) == c ) {
                     return( (char *)dw );
                }
            }
        } else {
            if ( ( CHR1(dword) ) == c ) {
                return( (char *)dw );
            }
        }
    }
#endif

    if( result != NULL ) { // we found a dword with c
        dword = *result;
        dword &= mask;
#ifdef __WIDECHAR__
        if( CHR2(dword) == cShl16 ) {
            return( ((CHAR_TYPE*)result) + 1 );
        }
#else
        if( CHR4(dword) == cShl24 ) {
            return( ((CHAR_TYPE*)result) + 3 );
        } else if( CHR3(dword) == cShl16 ) {
            return( ((CHAR_TYPE*)result) + 2 );
        } else if( CHR2(dword) == cShl8 ) {
            return( ((CHAR_TYPE*)result) + 1 );
        }
#endif
    }
    return( (CHAR_TYPE*)result );
}
        const AVOption *o;

        if (ofmt->priv_class && (o = av_opt_find(&ofmt->priv_class, name, unit, opt_flags, search_flags)))
            return o;
    }
    return NULL;
}

#define OFFSET(x) offsetof(AVFormatContext,x)
#define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C
//these names are too long to be readable
#define E AV_OPT_FLAG_ENCODING_PARAM
#define D AV_OPT_FLAG_DECODING_PARAM

static const AVOption options[]={
{"probesize", "set probing size", OFFSET(probesize), FF_OPT_TYPE_INT, {.dbl = 5000000 }, 32, INT_MAX, D},
{"muxrate", "set mux rate", OFFSET(mux_rate), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E},
{"packetsize", "set packet size", OFFSET(packet_size), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E},
{"fflags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, INT_MIN, INT_MAX, D|E, "fflags"},
{"ignidx", "ignore index", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_IGNIDX }, INT_MIN, INT_MAX, D, "fflags"},
{"genpts", "generate pts", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_GENPTS }, INT_MIN, INT_MAX, D, "fflags"},
{"nofillin", "do not fill in missing values that can be exactly calculated", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_NOFILLIN }, INT_MIN, INT_MAX, D, "fflags"},
{"noparse", "disable AVParsers, this needs nofillin too", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_NOPARSE }, INT_MIN, INT_MAX, D, "fflags"},
{"igndts", "ignore dts", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_IGNDTS }, INT_MIN, INT_MAX, D, "fflags"},
#if FF_API_FLAG_RTP_HINT
{"rtphint", "add rtp hinting (deprecated, use the -movflags rtphint option instead)", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_RTP_HINT }, INT_MIN, INT_MAX, E, "fflags"},
#endif
{"sortdts", "try to interleave outputted packets by dts", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_SORT_DTS }, INT_MIN, INT_MAX, D, "fflags"},
{"keepside", "dont merge side data", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_KEEP_SIDE_DATA }, INT_MIN, INT_MAX, D, "fflags"},
{"latm", "enable RTP MP4A-LATM payload", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_MP4A_LATM }, INT_MIN, INT_MAX, E, "fflags"},
{"analyzeduration", "how many microseconds are analyzed to estimate duration", OFFSET(max_analyze_duration), FF_OPT_TYPE_INT, {.dbl = 5*AV_TIME_BASE }, 0, INT_MAX, D},
Exemple #26
0
    int planeheight[4];

    struct FFBufQueue q;
    void *data[4][SIZE];
    int linesize[4][SIZE];
    int size, mid;
    int available;

    int (*filter_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
} ATADenoiseContext;

#define OFFSET(x) offsetof(ATADenoiseContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM

static const AVOption atadenoise_options[] = {
    { "0a", "set threshold A for 1st plane", OFFSET(fthra[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.02}, 0, 0.3, FLAGS },
    { "0b", "set threshold B for 1st plane", OFFSET(fthrb[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.04}, 0, 5.0, FLAGS },
    { "1a", "set threshold A for 2nd plane", OFFSET(fthra[1]), AV_OPT_TYPE_FLOAT, {.dbl=0.02}, 0, 0.3, FLAGS },
    { "1b", "set threshold B for 2nd plane", OFFSET(fthrb[1]), AV_OPT_TYPE_FLOAT, {.dbl=0.04}, 0, 5.0, FLAGS },
    { "2a", "set threshold A for 3rd plane", OFFSET(fthra[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.02}, 0, 0.3, FLAGS },
    { "2b", "set threshold B for 3rd plane", OFFSET(fthrb[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.04}, 0, 5.0, FLAGS },
    { "s",  "set how many frames to use",    OFFSET(size),     AV_OPT_TYPE_INT,   {.i64=33},   5, SIZE, FLAGS },
    { NULL }
};

AVFILTER_DEFINE_CLASS(atadenoise);

static int query_formats(AVFilterContext *ctx)
{
    static const enum AVPixelFormat pixel_fmts[] = {
        AV_PIX_FMT_GRAY8,
Exemple #27
0
int main(void)
{
	OFFSET(S_X0, pt_regs, regs[0]);
	OFFSET(S_X1, pt_regs, regs[1]);
	OFFSET(S_X2, pt_regs, regs[2]);
	OFFSET(S_X3, pt_regs, regs[3]);
	OFFSET(S_X4, pt_regs, regs[4]);
	OFFSET(S_X5, pt_regs, regs[5]);
	OFFSET(S_X6, pt_regs, regs[6]);
	OFFSET(S_X7, pt_regs, regs[7]);
	OFFSET(S_LR, pt_regs, regs[30]);
	OFFSET(S_SP, pt_regs, sp);
	OFFSET(S_PC, pt_regs, pc);
	OFFSET(S_PSTATE, pt_regs, pstate);
	OFFSET(S_ORIG_X0, pt_regs, orig_x0);
	OFFSET(S_SYSCALLNO, pt_regs, syscallno);
	DEFINE(S_FRAME_SIZE, sizeof(struct pt_regs));
	return 0;
}
Exemple #28
0
/*
 * Called when bufp's page  contains a partial key (index should be 1)
 *
 * All pages in the big key/data pair except bufp are freed.  We cannot
 * free bufp because the page pointing to it is lost and we can't get rid
 * of its pointer.
 *
 * Returns:
 * 0 => OK
 *-1 => ERROR
 */
int
__big_delete(HTAB *hashp, BUFHEAD *bufp)
{
	BUFHEAD *last_bfp, *rbufp;
	u_int16_t *bp, pageno;
	int key_done, n;

	rbufp = bufp;
	last_bfp = NULL;
	bp = (u_int16_t *)bufp->page;
	pageno = 0;
	key_done = 0;

	while (!key_done || (bp[2] != FULL_KEY_DATA)) {
		if (bp[2] == FULL_KEY || bp[2] == FULL_KEY_DATA)
			key_done = 1;

		/*
		 * If there is freespace left on a FULL_KEY_DATA page, then
		 * the data is short and fits entirely on this page, and this
		 * is the last page.
		 */
		if (bp[2] == FULL_KEY_DATA && FREESPACE(bp))
			break;
		pageno = bp[bp[0] - 1];
		rbufp->flags |= BUF_MOD;
		rbufp = __get_buf(hashp, pageno, rbufp, 0);
		if (last_bfp)
			__free_ovflpage(hashp, last_bfp);
		last_bfp = rbufp;
		if (!rbufp)
			return (-1);		/* Error. */
		bp = (u_int16_t *)rbufp->page;
	}

	/*
	 * If we get here then rbufp points to the last page of the big
	 * key/data pair.  Bufp points to the first one -- it should now be
	 * empty pointing to the next page after this pair.  Can't free it
	 * because we don't have the page pointing to it.
	 */

	/* This is information from the last page of the pair. */
	n = bp[0];
	pageno = bp[n - 1];

	/* Now, bp is the first page of the pair. */
	bp = (u_int16_t *)bufp->page;
	if (n > 2) {
		/* There is an overflow page. */
		bp[1] = pageno;
		bp[2] = OVFLPAGE;
		bufp->ovfl = rbufp->ovfl;
	} else
		/* This is the last page. */
		bufp->ovfl = NULL;
	n -= 2;
	bp[0] = n;
	FREESPACE(bp) = hashp->BSIZE - PAGE_META(n);
	OFFSET(bp) = hashp->BSIZE;

	bufp->flags |= BUF_MOD;
	if (rbufp)
		__free_ovflpage(hashp, rbufp);
	if (last_bfp && last_bfp != rbufp)
		__free_ovflpage(hashp, last_bfp);

	hashp->NKEYS--;
	return (0);
}
Exemple #29
0
    rt->client_id[off] = '\0';

    /* http context is now initialized */
    rt->initialized = 1;
    return 0;

fail:
    rtmp_http_close(h);
    return ret;
}

#define OFFSET(x) offsetof(RTMP_HTTPContext, x)
#define DEC AV_OPT_FLAG_DECODING_PARAM

static const AVOption ffrtmphttp_options[] = {
    {"ffrtmphttp_tls", "Use a HTTPS tunneling connection (RTMPTS).", OFFSET(tls), AV_OPT_TYPE_INT, {0}, 0, 1, DEC},
    { NULL },
};

static const AVClass ffrtmphttp_class = {
    .class_name = "ffrtmphttp",
    .item_name  = av_default_item_name,
    .option     = ffrtmphttp_options,
    .version    = LIBAVUTIL_VERSION_INT,
};

URLProtocol ff_ffrtmphttp_protocol = {
    .name           = "ffrtmphttp",
    .url_open       = rtmp_http_open,
    .url_read       = rtmp_http_read,
    .url_write      = rtmp_http_write,
Exemple #30
0
        return "NULL";
}

static void *urlcontext_child_next(void *obj, void *prev)
{
    URLContext *h = obj;
    if (!prev && h->priv_data && h->prot->priv_data_class)
        return h->priv_data;
    return NULL;
}

#define OFFSET(x) offsetof(URLContext,x)
#define E AV_OPT_FLAG_ENCODING_PARAM
#define D AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
    {"protocol_whitelist", "List of protocols that are allowed to be used", OFFSET(protocol_whitelist), AV_OPT_TYPE_STRING, { .str = NULL },  CHAR_MIN, CHAR_MAX, D },
    {"protocol_blacklist", "List of protocols that are not allowed to be used", OFFSET(protocol_blacklist), AV_OPT_TYPE_STRING, { .str = NULL },  CHAR_MIN, CHAR_MAX, D },
    { NULL }
};

const AVClass ffurl_context_class = {
    .class_name       = "URLContext",
    .item_name        = urlcontext_to_name,
    .option           = options,
    .version          = LIBAVUTIL_VERSION_INT,
    .child_next       = urlcontext_child_next,
    .child_class_next = ff_urlcontext_child_class_next,
};
/*@}*/

static int url_alloc_for_protocol(URLContext **puc, const URLProtocol *up,