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

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

?? tutorial07.java

?? ffmpeg開發指南
?? JAVA
字號:
## An ffmpeg and SDL TutorialPage 1 2 3 4 5 6 7 8 End Prev Home Next  Printable version Text version## Tutorial 07: SeekingCode: tutorial07.c### Handling the seek commandNow we're going to add some seeking capabilities to our player, because it'sreally annoying when you can't rewind a movie. Plus, this will show you howeasy the av_seek_frame function is to use. We're going to make the left and right arrows go back and forth in the movieby a little and the up and down arrows a lot, where "a little" is 10 seconds,and "a lot" is 60 seconds. So we need to set up our main loop so it catchesthe keystrokes. However, when we do get a keystroke, we can't callav_seek_frame directly. We have to do that in our main decode loop, thedecode_thread loop. So instead, we're going to add some values to the bigstruct that will contain the new position to seek to and some seeking flags:               int             seek_req;      int             seek_flags;      int64_t         seek_pos;    Now we need to set up our main loop to catch the key presses:               for(;;) {        double incr, pos;            SDL_WaitEvent(&event);        switch(event.type) {        case SDL_KEYDOWN:          switch(event.key.keysym.sym) {          case SDLK_LEFT:    	incr = -10.0;    	goto do_seek;          case SDLK_RIGHT:    	incr = 10.0;    	goto do_seek;          case SDLK_UP:    	incr = 60.0;    	goto do_seek;          case SDLK_DOWN:    	incr = -60.0;    	goto do_seek;          do_seek:    	if(global_video_state) {    	  pos = get_master_clock(global_video_state);    	  pos += incr;    	  stream_seek(global_video_state,                           (int64_t)(pos * AV_TIME_BASE), incr);    	}    	break;          default:    	break;          }          break;    To detect keypresses, we first look and see if we get an SDL_KEYDOWN event.Then we check and see which key got hit using event.key.keysym.sym. Once weknow which way we want to seek, we calculate the new time by adding theincrement to the value from our new get_master_clock function. Then we call astream_seek function to set the seek_pos, etc., values. We convert our newtime to avcodec's internal timestamp unit. Recall that timestamps in streamsare measured in frames rather than seconds, with the formula seconds = frames* time_base (fps). avcodec defaults to a value of 1,000,000 fps (so a pos of 2seconds will be timestamp of 2000000). We'll see why we need to convert thisvalue later. Here's our stream_seek function. Notice we set a flag if we are goingbackwards:             void stream_seek(VideoState *is, int64_t pos, int rel) {          if(!is->seek_req) {        is->seek_pos = pos;        is->seek_flags = rel < 0 ? AVSEEK_FLAG_BACKWARD : 0;        is->seek_req = 1;      }    }    Now let's go over to our decode_thread where we will actually perform ourseek. You'll notice in the source files that we've marked an area "seek stuffgoes here". Well, we're going to put it there now. Seeking centers around the av_seek_frame function. This function takes aformat context, a stream, a timestamp, and a set of flags as an argument. Thefunction will seek to the timestamp you give it. The unit of the timestamp isthe time_base of the stream you pass the function. _However_, you do not haveto pass it a stream (indicated by passing a value of -1). If you do that, thetime_base will be in avcodec's internal timestamp unit, or 1000000fps. This iswhy we multiplied our position by AV_TIME_BASE when we set seek_pos. However, sometimes you can (rarely) run into problems with some files if youpass av_seek_frame -1 for a stream, so we're going to pick the first stream inour file and pass it to av_seek_frame. Don't forget we have to rescale ourtimestamp to be in the new unit too.             if(is->seek_req) {      int stream_index= -1;      int64_t seek_target = is->seek_pos;          if     (is->videoStream >= 0) stream_index = is->videoStream;      else if(is->audioStream >= 0) stream_index = is->audioStream;          if(stream_index>=0){        seek_target= av_rescale_q(seek_target, AV_TIME_BASE_Q,                          pFormatCtx->streams[stream_index]->time_base);      }      if(av_seek_frame(is->pFormatCtx, stream_index,                         seek_target, is->seek_flags) < 0) {        fprintf(stderr, "%s: error while seeking\n",                is->pFormatCtx->filename);      } else {         /* handle packet queues... more later... */        av_rescale_q(a,b,c) is a function that will rescale a timestamp from one baseto another. It basically computes a*b/c but this function is required becausethat calculation could overflow. AV_TIME_BASE_Q is the fractional version ofAV_TIME_BASE. They're quite different: AV_TIME_BASE * time_in_seconds =avcodec_timestamp and AV_TIME_BASE_Q * avcodec_timestamp = time_in_seconds(but note that AV_TIME_BASE_Q is actually an AVRational object, so you have touse special q functions in avcodec to handle it). ### Flushing our buffersSo we've set our seek correctly, but we aren't finished quite yet. Rememberthat we have a queue set up to accumulate packets. Now that we're in adifferent place, we have to flush that queue or the movie ain't gonna seek!Not only that, but avcodec has its own internal buffers that need to beflushed too by each thread. To do this, we need to first write a function to clear our packet queue. Then,we need to have some way of instructing the audio and video thread that theyneed to flush avcodec's internal buffers. We can do this by putting a specialpacket on the queue after we flush it, and when they detect that specialpacket, they'll just flush their buffers. Let's start with the flush function. It's really quite simple, so I'll justshow you the code:             static void packet_queue_flush(PacketQueue *q) {      AVPacketList *pkt, *pkt1;          SDL_LockMutex(q->mutex);      for(pkt = q->first_pkt; pkt != NULL; pkt = pkt1) {        pkt1 = pkt->next;        av_free_packet(&pkt->pkt);        av_freep(&pkt);      }      q->last_pkt = NULL;      q->first_pkt = NULL;      q->nb_packets = 0;      q->size = 0;      SDL_UnlockMutex(q->mutex);    }    Now that the queue is flushed, let's put on our "flush packet." But firstwe're going to want to define what that is and create it:             AVPacket flush_pkt;        main() {      ...      av_init_packet(&flush_pkt);      flush_pkt.data = "FLUSH";      ...    }    Now we put this packet on the queue:               } else {        if(is->audioStream >= 0) {          packet_queue_flush(&is->audioq);          packet_queue_put(&is->audioq, &flush_pkt);        }        if(is->videoStream >= 0) {          packet_queue_flush(&is->videoq);          packet_queue_put(&is->videoq, &flush_pkt);        }      }      is->seek_req = 0;    }    (This code snippet also continues the code snippet above for decode_thread.)We also need to change packet_queue_put so that we don't duplicate the specialflush packet:             int packet_queue_put(PacketQueue *q, AVPacket *pkt) {          AVPacketList *pkt1;      if(pkt != &flush_pkt && av_dup_packet(pkt) < 0) {        return -1;      }    And then in the audio thread and the video thread, we put this call toavcodec_flush_buffers immediately after packet_queue_get:                 if(packet_queue_get(&is->audioq, pkt, 1) < 0) {          return -1;        }        if(packet->data == flush_pkt.data) {          avcodec_flush_buffers(is->audio_st->codec);          continue;        }    The above code snippet is exactly the same for the video thread, with "audio"being replaced by "video". That's it! Go ahead and compile your player:             gcc -o tutorial07 tutorial07.c -lavutil -lavformat -lavcodec -lz-lm`sdl-config --cflags --libs`    Try it out! We're almost done; next time we only have one little change tomake, and that's to check out a small sampling of the software scaling thatffmpeg provides. _**>>** Software scaling_* * *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. 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕在线不卡一区| 欧美一区二区在线不卡| 久久丁香综合五月国产三级网站| 亚洲精品中文在线影院| 日韩精品一区二| 狠狠色丁香九九婷婷综合五月| 亚洲一区二区在线播放相泽| 亚洲欧洲国产日韩| ㊣最新国产の精品bt伙计久久| 337p粉嫩大胆色噜噜噜噜亚洲 | 国产乱码精品一区二区三| 丝瓜av网站精品一区二区| 亚洲自拍与偷拍| 午夜视频在线观看一区二区三区| 亚洲精选视频免费看| 国产精品福利一区| 亚洲精品日韩综合观看成人91| 亚洲免费色视频| 亚洲成人www| 久久精品国产成人一区二区三区 | 亚洲精品一区二区三区福利| 精品国产乱码久久久久久牛牛 | www.久久久久久久久| 国产一区二区三区观看| 大尺度一区二区| 色噜噜狠狠色综合欧洲selulu| 91久久免费观看| 欧美精品乱人伦久久久久久| 精品国产一区二区三区四区四 | 欧美日韩成人在线| 91精品国产综合久久久久久漫画| 精品国产成人系列| 亚洲精品视频在线| 久久99国产精品尤物| 国产激情一区二区三区四区| 色偷偷88欧美精品久久久| 欧美电视剧在线看免费| 亚洲欧洲三级电影| 免费看欧美女人艹b| jizzjizzjizz欧美| 日韩一区二区在线播放| 亚洲美女视频一区| 99re6这里只有精品视频在线观看| 9人人澡人人爽人人精品| 51精品视频一区二区三区| 久久精品日韩一区二区三区| 亚洲影院理伦片| www.亚洲在线| 久久精品日产第一区二区三区高清版| 亚洲乱码国产乱码精品精小说| 免费观看在线综合| 91成人免费在线| 中文字幕亚洲区| 国产高清久久久久| 日韩精品一区二| 日本不卡不码高清免费观看| 色av成人天堂桃色av| 欧美激情自拍偷拍| 精品中文字幕一区二区| 欧美日韩亚州综合| 亚洲男人的天堂在线观看| 国产精品一级在线| 精品欧美一区二区在线观看| 亚洲一区影音先锋| 日本电影欧美片| 中文字幕亚洲一区二区av在线| 国产精品一区二区黑丝| 欧美不卡在线视频| 婷婷久久综合九色综合伊人色| 96av麻豆蜜桃一区二区| 自拍视频在线观看一区二区| 国产乱对白刺激视频不卡| 日韩一级免费一区| 久久不见久久见免费视频1 | 久久国产精品免费| 欧美夫妻性生活| 亚洲成a人片综合在线| 欧洲视频一区二区| 亚洲国产精品麻豆| 欧美在线影院一区二区| 夜色激情一区二区| 欧美日韩在线不卡| 午夜精品视频在线观看| 欧美日韩黄色影视| 国产传媒日韩欧美成人| www国产成人| 成人午夜视频在线观看| 中文字幕免费观看一区| 成人免费电影视频| 日韩一区有码在线| 91久久香蕉国产日韩欧美9色| 亚洲黄色在线视频| 欧美高清性hdvideosex| 精品在线一区二区| 中文字幕免费观看一区| 99re成人精品视频| 亚洲成人一二三| 日韩女优av电影| 成人网在线免费视频| 一区二区三区四区在线| 欧美日韩黄色影视| 国产精品一区二区91| 亚洲美女屁股眼交| 精品少妇一区二区三区在线视频| 国产一区二区三区| 亚洲欧美日本韩国| 日韩一区二区三区av| 高清视频一区二区| 午夜不卡av免费| 国产欧美一区二区精品性色 | 欧美日韩一区二区在线观看| 婷婷综合五月天| 国产性做久久久久久| 在线观看亚洲一区| 国产一区二区精品久久| 亚洲免费av观看| 国产网红主播福利一区二区| 国产日韩欧美激情| 欧美日韩在线观看一区二区 | 波多野结衣91| 美女www一区二区| 亚洲日本免费电影| 精品国产一区二区三区忘忧草| 色一情一伦一子一伦一区| 久久不见久久见免费视频7| 亚洲素人一区二区| 精品久久人人做人人爽| 欧美日韩一区二区三区不卡| 国产真实乱偷精品视频免| 一级特黄大欧美久久久| 欧美高清在线视频| 日韩精品一区二区三区视频播放| 一本久久综合亚洲鲁鲁五月天| 精品亚洲成a人| 天涯成人国产亚洲精品一区av| 中文字幕精品—区二区四季| 日韩欧美的一区| 欧美日韩国产欧美日美国产精品| 97se亚洲国产综合自在线观| 国产一区二区三区最好精华液| 午夜欧美在线一二页| 亚洲欧美一区二区不卡| 欧美激情综合网| 国产亚洲综合性久久久影院| 欧美精品aⅴ在线视频| 欧美视频一区二| 欧美最新大片在线看| 色久优优欧美色久优优| 91浏览器在线视频| 97久久久精品综合88久久| 东方欧美亚洲色图在线| 成人a免费在线看| 成人18视频日本| 99re这里只有精品6| 91亚洲国产成人精品一区二区三| 丰满放荡岳乱妇91ww| 丁香另类激情小说| eeuss鲁片一区二区三区| 国产精品99久久久久久久vr| 欧美在线视频全部完| 99国内精品久久| 一本高清dvd不卡在线观看| youjizz久久| 日本福利一区二区| 欧美三级欧美一级| 欧美一a一片一级一片| 欧美伦理电影网| 欧美xxx久久| 国产亚洲1区2区3区| 国产精品久久久久久久久免费丝袜 | a亚洲天堂av| 99国产精品久久久久久久久久久| 国产一区二区中文字幕| 波多野结衣中文字幕一区| 成人av网在线| 在线视频国内自拍亚洲视频| 欧美精品第1页| 337p粉嫩大胆色噜噜噜噜亚洲| 国产女主播视频一区二区| 国产精品理伦片| 午夜欧美一区二区三区在线播放| 日本欧美在线观看| 国产69精品久久777的优势| 欧美日本在线看| 7799精品视频| 久久久久九九视频| 亚洲手机成人高清视频| 日韩精品久久理论片| 懂色中文一区二区在线播放| 在线观看日韩电影| 欧美xxxx老人做受| 亚洲视频在线一区观看| 成人国产精品免费| 欧美高清视频不卡网| 国产精品伦一区二区三级视频| 亚洲成av人片在线观看| 国产凹凸在线观看一区二区| 欧美另类久久久品| 一区二区中文字幕在线| 韩国精品免费视频|