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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tutorial02.java

?? ffmpeg開發(fā)指南
?? JAVA
字號:
## An ffmpeg and SDL TutorialPage 1 2 3 4 5 6 7 8 End Prev Home Next  Printable version Text version## Tutorial 02: Outputting to the ScreenCode: tutorial02.c### SDL and VideoTo draw to the screen, we're going to use SDL. SDL stands for Simple DirectLayer, and is an excellent library for multimedia, is cross-platform, and isused in several projects. You can get the library at the official website oryou can download the development package for your operating system if there isone. You'll need the libraries to compile the code for this tutorial (and forthe rest of them, too). SDL has many methods for drawing images to the screen, and it has one inparticular that is meant for displaying movies on the screen - what it calls aYUV overlay. YUV (technically not YUV but YCbCr) *** A note: **There is agreat deal of annoyance from some people at the convention of calling "YCbCr""YUV". Generally speaking, YUV is an analog format and YCbCr is a digitalformat. ffmpeg and SDL both refer to YCbCr as YUV in their code and macros. isa way of storing raw image data like RGB. Roughly speaking, Y is thebrightness (or "luma") component, and U and V are the color components. (It'smore complicated than RGB because some of the color information is discarded,and you might have only 1 U and V sample for every 2 Y samples.) SDL's YUVoverlay takes in a raw array of YUV data and displays it. It accepts 4different kinds of YUV formats, but YV12 is the fastest. There is another YUVformat called YUV420P that is the same as YV12, except the U and V arrays areswitched. The 420 means it is subsampled at a ratio of 4:2:0, basicallymeaning there is 1 color sample for every 4 luma samples, so the colorinformation is quartered. This is a good way of saving bandwidth, as the humaneye does not percieve this change. The "P" in the name means that the formatis "planar" -- simply meaning that the Y, U, and V components are in separatearrays. ffmpeg can convert images to YUV420P, with the added bonus that manyvideo streams are in that format already, or are easily converted to thatformat. So our current plan is to replace the SaveFrame() function from Tutorial 1,and instead output our frame to the screen. But first we have to start byseeing how to use the SDL Library. First we have to include the libraries andinitalize SDL:             #include <SDL.h>    #include <SDL_thread.h>        if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER)) {      fprintf(stderr, "Could not initialize SDL - %s\n", SDL_GetError());      exit(1);    }    SDL_Init() essentially tells the library what features we're going to use.SDL_GetError(), of course, is a handy debugging function. ### Creating a DisplayNow we need a place on the screen to put stuff. The basic area for displayingimages with SDL is called a **surface**:             SDL_Surface *screen;        screen = SDL_SetVideoMode(pCodecCtx->width, pCodecCtx->height, 0, 0);    if(!screen) {      fprintf(stderr, "SDL: could not set video mode - exiting\n");      exit(1);    }    This sets up a screen with the given width and height. The next option is thebit depth of the screen - 0 is a special value that means "same as the currentdisplay". (This does not work on OS X; see source.) Now we create a YUV overlay on that screen so we can input video to it:             SDL_Overlay     *bmp;        bmp = SDL_CreateYUVOverlay(pCodecCtx->width, pCodecCtx->height,                               SDL_YV12_OVERLAY, screen);    As we said before, we are using YV12 to display the image. ### Displaying the ImageWell that was simple enough! Now we just need to display the image. Let's goall the way down to where we had our finished frame. We can get rid of allthat stuff we had for the RGB frame, and we're going to replace theSaveFrame() with our display code. To display the image, we're going to makean AVPicture struct and set its data pointers and linesize to our YUV overlay:              if(frameFinished) {        SDL_LockYUVOverlay(bmp);            AVPicture pict;        pict.data[0] = bmp->pixels[0];        pict.data[1] = bmp->pixels[2];        pict.data[2] = bmp->pixels[1];            pict.linesize[0] = bmp->pitches[0];        pict.linesize[1] = bmp->pitches[2];        pict.linesize[2] = bmp->pitches[1];            // Convert the image into YUV format that SDL uses        img_convert(&pict, PIX_FMT_YUV420P,                        (AVPicture *)pFrame, pCodecCtx->pix_fmt,                 pCodecCtx->width, pCodecCtx->height);                SDL_UnlockYUVOverlay(bmp);      }        First, we lock the overlay because we are going to be writing to it. This is agood habit to get into so you don't have problems later. The AVPicture struct,as shown before, has a data pointer that is an array of 4 pointers. Since weare dealing with YUV420P here, we only have 3 channels, and therefore only 3sets of data. Other formats might have a fourth pointer for an alpha channelor something. linesize is what it sounds like. The analogous structures in ourYUV overlay are the pixels and pitches variables. ("pitches" is the term SDLuses to refer to the width of a given line of data.) So what we do is pointthe three arrays of pict.data at our overlay, so when we write to pict, we'reactually writing into our overlay, which of course already has the necessaryspace allocated. Similarly, we get the linesize information directly from ouroverlay. We change the conversion format to PIX_FMT_YUV420P, and we useimg_convert just like before. ### Drawing the ImageBut we still need to tell SDL to actually show the data we've given it. Wealso pass this function a rectangle that says where the movie should go andwhat width and height it should be scaled to. This way, SDL does the scalingfor us, and it can be assisted by your graphics processor for faster scaling:            SDL_Rect rect;          if(frameFinished) {        /* ... code ... */        // Convert the image into YUV format that SDL uses        img_convert(&pict, PIX_FMT_YUV420P,                        (AVPicture *)pFrame, pCodecCtx->pix_fmt,                 pCodecCtx->width, pCodecCtx->height);                SDL_UnlockYUVOverlay(bmp);    	rect.x = 0;    	rect.y = 0;    	rect.w = pCodecCtx->width;    	rect.h = pCodecCtx->height;    	SDL_DisplayYUVOverlay(bmp, &rect);      }    Now our video is displayed! Let's take this time to show you another feature of SDL: its event system. SDLis set up so that when you type, or move the mouse in the SDL application, orsend it a signal, it generates an **event**. Your program then checks forthese events if it wants to handle user input. Your program can also make upevents to send the SDL event system. This is especially useful whenmultithread programming with SDL, which we'll see in Tutorial 4. In ourprogram, we're going to poll for events right after we finish processing apacket. For now, we're just going to handle the SDL_QUIT event so we can exit:            SDL_Event       event;            av_free_packet(&packet);        SDL_PollEvent(&event);        switch(event.type) {        case SDL_QUIT:          SDL_Quit();          exit(0);          break;        default:          break;        }    And there we go! Get rid of all the old cruft, and you're ready to compile. Ifyou are using Linux or a variant, the best way to compile using the SDL libsis this:             gcc -o tutorial02 tutorial02.c -lavutil -lavformat -lavcodec -lz -lm \    `sdl-config --cflags --libs`    sdl-config just prints out the proper flags for gcc to include the SDLlibraries properly. You may need to do something different to get it tocompile on your system; please check the SDL documentation for your system.Once it compiles, go ahead and run it. What happens when you run this program? The video is going crazy! In fact,we're just displaying all the video frames as fast as we can extract them fromthe movie file. We don't have any code right now for figuring out _when_ weneed to display video. Eventually (in Tutorial 5), we'll get around to syncingthe video. But first we're missing something even more important: sound! _**>>** Playing Sound_* * *Function Reference  Data Referenceemail:dranger at gmail dot comBack to dranger.comThis work is licensed under the Creative Commons Attribution-Share Alike 2.5License. To view a copy of this license, visithttp://creativecommons.org/licenses/by-sa/2.5/ or send a letter to CreativeCommons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.    Code examples are based off of FFplay, Copyright (c) 2003 Fabrice Bellard, anda tutorial by Martin Bohme. 

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美怡红院视频| 成人免费毛片a| 色婷婷av久久久久久久| 精品日产卡一卡二卡麻豆| 一区二区三区在线看| 国产黄色精品网站| 欧美一区二区视频观看视频| 中文字幕一区二区在线观看 | 欧美精品一区二区三区一线天视频| 亚洲精品水蜜桃| 高清免费成人av| 精品国产91洋老外米糕| 婷婷中文字幕一区三区| 波波电影院一区二区三区| 精品久久久久99| 日韩电影一二三区| 欧美三级韩国三级日本三斤 | 欧美男男青年gay1069videost | 日本一区二区电影| 看电影不卡的网站| 欧美日韩一区三区四区| 亚洲色图清纯唯美| 高清av一区二区| 久久精品人人爽人人爽| 激情综合色丁香一区二区| 欧美高清hd18日本| 亚洲一区二区av在线| 色综合咪咪久久| 国产日产精品一区| 国产精品911| 久久久国产一区二区三区四区小说 | 欧美最猛性xxxxx直播| 国产精品日产欧美久久久久| 国产成人午夜精品影院观看视频| 精品人伦一区二区色婷婷| 日韩极品在线观看| 3751色影院一区二区三区| 图片区小说区区亚洲影院| 欧美日韩精品久久久| 亚洲成人777| 欧美日韩激情一区| 日韩极品在线观看| 日韩一区二区在线看片| 美日韩一区二区| 精品欧美一区二区在线观看| 精品在线你懂的| 久久久国产精品午夜一区ai换脸| 欧美一区二区三区在线看 | 精品粉嫩超白一线天av| 精品一区二区三区在线观看 | 欧美老女人在线| 五月婷婷久久综合| 337p亚洲精品色噜噜| 久久超碰97人人做人人爱| 久久中文娱乐网| 国产成人综合自拍| 欧美激情中文不卡| 99免费精品在线观看| 亚洲老司机在线| 欧美美女bb生活片| 美女视频免费一区| 国产日韩精品视频一区| av激情亚洲男人天堂| 一区二区三区精品久久久| 欧美午夜精品久久久久久孕妇| 五月婷婷色综合| 2023国产精品| 成人av网站在线观看| 一区二区三区精品视频| 91精品国产全国免费观看| 精品伊人久久久久7777人| 国产色综合久久| 色一情一乱一乱一91av| 日韩经典中文字幕一区| 久久毛片高清国产| 色哟哟国产精品免费观看| 天天综合网天天综合色| 久久久久久久久久久久久久久99| 成人av影视在线观看| 亚洲成人中文在线| 日韩精品中文字幕在线不卡尤物 | 天天操天天综合网| 久久综合av免费| 一本到三区不卡视频| 美女国产一区二区三区| 中文av一区二区| 欧美日韩免费不卡视频一区二区三区| 久久爱www久久做| 亚洲婷婷国产精品电影人久久| 884aa四虎影成人精品一区| 狠狠色综合色综合网络| 亚洲人午夜精品天堂一二香蕉| 69av一区二区三区| av一二三不卡影片| 日韩专区在线视频| 日本一区二区三区视频视频| 欧美色图片你懂的| 国产精品一二一区| 香蕉成人伊视频在线观看| 久久久www成人免费无遮挡大片| 在线观看91视频| 国产美女一区二区| 亚洲综合清纯丝袜自拍| 国产亚洲欧美一级| 欧美精品日韩综合在线| 不卡的av在线播放| 久久se精品一区二区| 一区二区三区中文字幕电影| 26uuu久久综合| 欧美日韩久久不卡| 99久久婷婷国产综合精品| 美女www一区二区| 亚洲一区二区三区精品在线| 欧美激情综合五月色丁香小说| 欧美精品少妇一区二区三区| 99国产精品视频免费观看| 久久99精品久久久久婷婷| 亚洲尤物视频在线| 中文字幕在线播放不卡一区| 精品区一区二区| 7777精品伊人久久久大香线蕉 | 国产激情偷乱视频一区二区三区| 亚洲第一久久影院| 综合精品久久久| 久久综合狠狠综合久久激情| 在线视频一区二区三| 高清久久久久久| 国内精品久久久久影院一蜜桃| 亚洲高清久久久| 亚洲视频 欧洲视频| 国产婷婷一区二区| 精品三级在线观看| 色香蕉成人二区免费| 不卡在线视频中文字幕| 久99久精品视频免费观看| 日韩高清在线一区| 亚洲一区二区三区爽爽爽爽爽| 国产精品婷婷午夜在线观看| 日韩一级在线观看| 欧美三级电影网站| 欧美偷拍一区二区| 日本高清免费不卡视频| 91视频免费观看| www.久久精品| 成人黄色小视频| 高清av一区二区| 粉嫩av亚洲一区二区图片| 国产精品一二三在| 国产成人在线电影| 国产精品12区| 高清av一区二区| 成人免费的视频| 国产99久久久精品| 国产99久久久国产精品免费看| 国产精品一级黄| 国产成人av电影在线| 国产精华液一区二区三区| 国产乱子伦视频一区二区三区 | 黑人巨大精品欧美一区| 久久激情五月婷婷| 狠狠色伊人亚洲综合成人| 国产自产高清不卡| 国产乱人伦偷精品视频免下载 | 免费成人在线观看视频| 另类专区欧美蜜桃臀第一页| 蜜桃91丨九色丨蝌蚪91桃色| 另类小说欧美激情| 国产精品一区免费视频| 成人午夜电影小说| av电影一区二区| 欧美亚洲国产怡红院影院| 欧美亚洲高清一区| 91精品免费观看| 久久综合九色综合97婷婷| 国产调教视频一区| 亚洲天堂2014| 亚洲aaa精品| 极品少妇一区二区三区精品视频| 国产一区二区在线影院| 不卡一区中文字幕| 在线观看网站黄不卡| 91精品国产黑色紧身裤美女| 精品国产髙清在线看国产毛片| 国产色综合一区| 亚洲激情综合网| 青青草国产成人av片免费| 国产一区视频在线看| heyzo一本久久综合| 欧美写真视频网站| 日韩欧美在线不卡| 久久久久久久网| 亚洲精品国产无天堂网2021| 亚洲成av人片在线观看无码| 久久精品国产澳门| www.亚洲色图.com| 欧美伦理视频网站| 久久精品一二三| 亚洲一区二区偷拍精品| 精品一区二区免费| aaa亚洲精品|