亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ppm.c

?? mediastreamer2是開源的網絡傳輸媒體流的庫
?? C
字號:
/* * PPM Video Hook * Copyright (c) 2003 Charles Yates * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <sys/types.h>#include <sys/wait.h>#include <ctype.h>#include "framehook.h"#include "avformat.h"#include "swscale.h"#include "avstring.h"static int sws_flags = SWS_BICUBIC;/** Bi-directional pipe structure.*/typedef struct rwpipe{    int pid;    FILE *reader;    FILE *writer;}rwpipe;/** Create a bidirectional pipe for the given command.*/static rwpipe *rwpipe_open( int argc, char *argv[] ){    rwpipe *this = av_mallocz( sizeof( rwpipe ) );    if ( this != NULL )    {        int input[ 2 ];        int output[ 2 ];        pipe( input );        pipe( output );        this->pid = fork();        if ( this->pid == 0 )        {#define COMMAND_SIZE 10240            char *command = av_mallocz( COMMAND_SIZE );            int i;            strcpy( command, "" );            for ( i = 0; i < argc; i ++ )            {                av_strlcat( command, argv[ i ], COMMAND_SIZE );                av_strlcat( command, " ", COMMAND_SIZE );            }            dup2( output[ 0 ], STDIN_FILENO );            dup2( input[ 1 ], STDOUT_FILENO );            close( input[ 0 ] );            close( input[ 1 ] );            close( output[ 0 ] );            close( output[ 1 ] );            execl("/bin/sh", "sh", "-c", command, (char*)NULL );            _exit( 255 );        }        else        {            close( input[ 1 ] );            close( output[ 0 ] );            this->reader = fdopen( input[ 0 ], "r" );            this->writer = fdopen( output[ 1 ], "w" );        }    }    return this;}/** Read data from the pipe.*/static FILE *rwpipe_reader( rwpipe *this ){    if ( this != NULL )        return this->reader;    else        return NULL;}/** Write data to the pipe.*/static FILE *rwpipe_writer( rwpipe *this ){    if ( this != NULL )        return this->writer;    else        return NULL;}/* Read a number from the pipe - assumes PNM style headers.*/static int rwpipe_read_number( rwpipe *rw ){    int value = 0;    int c = 0;    FILE *in = rwpipe_reader( rw );    do    {        c = fgetc( in );        while( c != EOF && !isdigit( c ) && c != '#' )            c = fgetc( in );        if ( c == '#' )            while( c != EOF && c != '\n' )                c = fgetc( in );    }    while ( c != EOF && !isdigit( c ) );    while( c != EOF && isdigit( c ) )    {        value = value * 10 + ( c - '0' );        c = fgetc( in );    }    return value;}/** Read a PPM P6 header.*/static int rwpipe_read_ppm_header( rwpipe *rw, int *width, int *height ){    char line[ 3 ];    FILE *in = rwpipe_reader( rw );    int max;    fgets( line, 3, in );    if ( !strncmp( line, "P6", 2 ) )    {        *width = rwpipe_read_number( rw );        *height = rwpipe_read_number( rw );        max = rwpipe_read_number( rw );        return max != 255 || *width <= 0 || *height <= 0;    }    return 1;}/** Close the pipe and process.*/static void rwpipe_close( rwpipe *this ){    if ( this != NULL )    {        fclose( this->reader );        fclose( this->writer );        waitpid( this->pid, NULL, 0 );        av_free( this );    }}/** Context info for this vhook - stores the pipe and image buffers.*/typedef struct{    rwpipe *rw;    int size1;    char *buf1;    int size2;    char *buf2;    // This vhook first converts frame to RGB ...    struct SwsContext *toRGB_convert_ctx;    // ... then processes it via a PPM command pipe ...    // ... and finally converts back frame from RGB to initial format    struct SwsContext *fromRGB_convert_ctx;}ContextInfo;/** Initialise the context info for this vhook.*/int Configure(void **ctxp, int argc, char *argv[]){    if ( argc > 1 )    {        *ctxp = av_mallocz(sizeof(ContextInfo));        if ( ctxp != NULL && argc > 1 )        {            ContextInfo *info = (ContextInfo *)*ctxp;            info->rw = rwpipe_open( argc - 1, &argv[ 1 ] );            return 0;        }    }    return 1;}/** Process a frame.*/void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width, int height, int64_t pts){    int err = 0;    ContextInfo *ci = (ContextInfo *) ctx;    AVPicture picture1;    AVPicture picture2;    AVPicture *pict = picture;    int out_width;    int out_height;    int i;    uint8_t *ptr = NULL;    FILE *in = rwpipe_reader( ci->rw );    FILE *out = rwpipe_writer( ci->rw );    /* Check that we have a pipe to talk to. */    if ( in == NULL || out == NULL )        err = 1;    /* Convert to RGB24 if necessary */    if ( !err && pix_fmt != PIX_FMT_RGB24 )    {        int size = avpicture_get_size(PIX_FMT_RGB24, width, height);        if ( size != ci->size1 )        {            av_free( ci->buf1 );            ci->buf1 = av_malloc(size);            ci->size1 = size;            err = ci->buf1 == NULL;        }        if ( !err )        {            avpicture_fill(&picture1, ci->buf1, PIX_FMT_RGB24, width, height);            // if we already got a SWS context, let's realloc if is not re-useable            ci->toRGB_convert_ctx = sws_getCachedContext(ci->toRGB_convert_ctx,                                        width, height, pix_fmt,                                        width, height, PIX_FMT_RGB24,                                        sws_flags, NULL, NULL, NULL);            if (ci->toRGB_convert_ctx == NULL) {                av_log(NULL, AV_LOG_ERROR,                       "Cannot initialize the toRGB conversion context\n");                return;            }// img_convert parameters are          2 first destination, then 4 source// sws_scale   parameters are context, 4 first source,      then 2 destination            sws_scale(ci->toRGB_convert_ctx,                     picture->data, picture->linesize, 0, height,                     picture1.data, picture1.linesize);            pict = &picture1;        }    }    /* Write out the PPM */    if ( !err )    {        ptr = pict->data[ 0 ];        fprintf( out, "P6\n%d %d\n255\n", width, height );        for ( i = 0; !err && i < height; i ++ )        {            err = !fwrite( ptr, width * 3, 1, out );            ptr += pict->linesize[ 0 ];        }        if ( !err )            err = fflush( out );    }    /* Read the PPM returned. */    if ( !err && !rwpipe_read_ppm_header( ci->rw, &out_width, &out_height ) )    {        int size = avpicture_get_size(PIX_FMT_RGB24, out_width, out_height);        if ( size != ci->size2 )        {            av_free( ci->buf2 );            ci->buf2 = av_malloc(size);            ci->size2 = size;            err = ci->buf2 == NULL;        }        if ( !err )        {            avpicture_fill(&picture2, ci->buf2, PIX_FMT_RGB24, out_width, out_height);            ptr = picture2.data[ 0 ];            for ( i = 0; !err && i < out_height; i ++ )            {                err = !fread( ptr, out_width * 3, 1, in );                ptr += picture2.linesize[ 0 ];            }        }    }    /* Convert the returned PPM back to the input format */    if ( !err )    {        /* The out_width/out_height returned from the PPM         * filter won't necessarily be the same as width and height         * but it will be scaled anyway to width/height.         */        av_log(NULL, AV_LOG_DEBUG,                  "PPM vhook: Input dimensions: %d x %d Output dimensions: %d x %d\n",                  width, height, out_width, out_height);        ci->fromRGB_convert_ctx = sws_getCachedContext(ci->fromRGB_convert_ctx,                                        out_width, out_height, PIX_FMT_RGB24,                                        width,     height,     pix_fmt,                                        sws_flags, NULL, NULL, NULL);        if (ci->fromRGB_convert_ctx == NULL) {            av_log(NULL, AV_LOG_ERROR,                   "Cannot initialize the fromRGB conversion context\n");            return;        }// img_convert parameters are          2 first destination, then 4 source// sws_scale   parameters are context, 4 first source,      then 2 destination        sws_scale(ci->fromRGB_convert_ctx,                 picture2.data, picture2.linesize, 0, out_height,                 picture->data, picture->linesize);    }}/** Clean up the effect.*/void Release(void *ctx){    ContextInfo *ci;    ci = (ContextInfo *) ctx;    if (ctx)    {        rwpipe_close( ci->rw );        av_free( ci->buf1 );        av_free( ci->buf2 );        sws_freeContext(ci->toRGB_convert_ctx);        sws_freeContext(ci->fromRGB_convert_ctx);        av_free(ctx);    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕精品—区二区四季| 男人的j进女人的j一区| 日韩国产精品久久久久久亚洲| 极品尤物av久久免费看| 色婷婷av一区二区三区软件| 亚洲精品一区二区精华| 亚洲成在线观看| 色吧成人激情小说| 国产欧美1区2区3区| 蜜桃精品视频在线| 欧美日韩一区二区三区四区五区| 亚洲图片另类小说| 粉嫩一区二区三区在线看| 日韩三级在线观看| 亚洲电影视频在线| 在线欧美小视频| 亚洲色图欧美在线| av中文字幕不卡| 亚洲国产精品成人综合| 国产精品一区免费视频| 欧美成人一区二区三区| 日韩电影在线免费看| 欧美日韩你懂得| 亚洲mv大片欧洲mv大片精品| 色婷婷亚洲精品| 亚洲精品国产无天堂网2021 | 日本精品一区二区三区高清| 中文字幕欧美激情一区| 国产经典欧美精品| 国产精品久久久久久亚洲毛片| 国产成人av电影在线| 国产精品视频免费看| www.欧美精品一二区| 亚洲欧美日韩国产另类专区| 色偷偷成人一区二区三区91| 亚洲人成网站影音先锋播放| 91亚洲永久精品| 亚洲精品少妇30p| 在线影院国内精品| 五月婷婷久久综合| 日韩精品一区二区三区视频| 国内精品在线播放| 欧美国产精品中文字幕| k8久久久一区二区三区| 一区二区三区小说| 91精品福利在线一区二区三区 | 国产成人在线色| 国产精品久久久久久久久免费樱桃| proumb性欧美在线观看| 亚洲成人在线免费| 日韩精品一区二区三区三区免费 | 中文字幕中文字幕在线一区| 99精品久久99久久久久| 亚洲一区二区av在线| 日韩女优av电影在线观看| 激情综合色综合久久| 国产精品超碰97尤物18| 欧美美女网站色| 国产精品99久久不卡二区| 亚洲少妇屁股交4| 91精品国产乱码| 99精品视频免费在线观看| 奇米影视7777精品一区二区| 中文字幕精品在线不卡| 欧美色综合久久| 国产精品 日产精品 欧美精品| 亚洲男人天堂一区| 亚洲精品在线免费播放| 色综合咪咪久久| 国产一区二区在线视频| 亚洲免费av在线| 久久久777精品电影网影网 | 91色porny在线视频| 美女视频一区二区三区| 亚洲女同女同女同女同女同69| 日韩视频永久免费| 在线亚洲一区观看| 国产成人av在线影院| 亚洲高清久久久| 国产日产欧美一区| 欧美一区二区视频网站| 成人国产亚洲欧美成人综合网| 亚洲成av人影院| 一区在线播放视频| 国产日韩av一区| 日韩欧美成人一区二区| 欧美三区在线视频| 色综合天天综合给合国产| 精品一区二区三区欧美| 午夜精品视频一区| 伊人性伊人情综合网| 国产午夜精品在线观看| 欧美videos中文字幕| 欧美精品九九99久久| 在线免费观看日韩欧美| 不卡高清视频专区| 国产黄色精品视频| 精久久久久久久久久久| 日韩高清不卡在线| 亚洲成人资源在线| 亚洲一区二区三区四区五区中文 | 久久精品亚洲精品国产欧美kt∨ | 欧美丝袜丝交足nylons| 99久久精品费精品国产一区二区| 国产激情视频一区二区在线观看 | 欧洲精品一区二区| 色综合天天在线| 91福利国产成人精品照片| 91在线视频免费91| av电影一区二区| 91香蕉视频mp4| 一本色道综合亚洲| 欧美亚洲丝袜传媒另类| 欧美视频日韩视频在线观看| 欧美亚洲综合另类| 欧美日韩情趣电影| 欧美一二三在线| 欧美mv和日韩mv的网站| 欧美zozo另类异族| 国产日韩精品一区| 国产精品国产三级国产三级人妇| 亚洲欧洲日韩女同| 亚洲国产精品久久久男人的天堂 | 精品精品国产高清a毛片牛牛 | 色噜噜狠狠成人中文综合| 色94色欧美sute亚洲线路二| 欧美伊人久久久久久久久影院| 欧美二区乱c少妇| 精品美女一区二区| 国产欧美日韩久久| 18成人在线观看| 日韩精品视频网| 国产精品一线二线三线| 99精品久久久久久| 欧美久久久久久久久| 久久一区二区三区四区| 国产精品嫩草久久久久| 亚洲综合色在线| 国产一区二区三区香蕉 | 国产成人午夜精品影院观看视频 | 亚洲成人激情综合网| 麻豆高清免费国产一区| 从欧美一区二区三区| 欧美日韩中文字幕一区| 亚洲精品一区二区三区福利| 亚洲色图欧美在线| 久久99精品视频| 不卡一卡二卡三乱码免费网站| 欧美乱熟臀69xxxxxx| 国产婷婷色一区二区三区四区 | 一区二区三区四区亚洲| 免费一区二区视频| 91麻豆精品一区二区三区| 欧美精品丝袜久久久中文字幕| 国产日韩三级在线| 亚洲成a天堂v人片| 国产不卡视频在线播放| 欧美欧美欧美欧美首页| 国产精品网曝门| 美腿丝袜亚洲色图| 91激情五月电影| 国产午夜亚洲精品午夜鲁丝片| 水野朝阳av一区二区三区| 成人午夜电影久久影院| 91精品国产综合久久久久久久 | 91黄视频在线观看| 日本一区二区在线不卡| 日韩国产精品久久| 在线观看91视频| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 欧美在线一区二区三区| 国产欧美一区视频| 麻豆成人免费电影| 欧美精品精品一区| 亚洲一线二线三线视频| 91丨porny丨户外露出| 国产亚洲一二三区| 精品一区二区三区久久| 欧美日韩一级视频| 亚洲综合色成人| 在线中文字幕一区| 亚洲黄色av一区| 成+人+亚洲+综合天堂| 日本一区免费视频| 国产成人福利片| 国产欧美一区二区精品久导航 | 欧美日韩视频在线一区二区| 亚洲丝袜美腿综合| 99综合影院在线| 国产免费观看久久| 成人av综合一区| 中文字幕免费不卡在线| 成人亚洲一区二区一| 日本一区二区三区久久久久久久久不 | 亚洲视频免费观看| 一本久道久久综合中文字幕| 亚洲日本电影在线| 在线一区二区观看| 视频一区二区中文字幕| 日韩欧美美女一区二区三区|