当前位置: 首页 > news >正文

做国外电影网站免费宣传网站

做国外电影网站,免费宣传网站,华蓥住房和城乡建设厅网站,网络投注网站是怎么建设1.下载ShiftMediaProject/FFmpeg 2.下载SDL2 3.新建VC控制台应用 3.配置include和lib 4.把FFmpeg和SDL的dll 复制到工程Debug目录下,并设置调试命令 5.复制一下mp4视频到工程Debug目录下(复制一份到*.vcxproj同一目录,用于调试) 6…

1.下载ShiftMediaProject/FFmpeg

2.下载SDL2

3.新建VC++控制台应用

3.配置include和lib

 4.把FFmpeg和SDL的dll 复制到工程Debug目录下,并设置调试命令

5.复制一下mp4视频到工程Debug目录下(复制一份到*.vcxproj同一目录,用于调试)

6.编写代码

#include <stdio.h>
#include <stdlib.h>
#include <iostream>extern "C" {
#include "libavcodec\avcodec.h"
#include "libavformat\avformat.h"
#include "libavutil\avutil.h"
#include "SDL.h"
}SDL_Window *window;
SDL_Texture* texture;
SDL_Renderer* renderer;
SDL_Rect rect;
int width;
int height;void display(AVFrame* frame);
void iniSdl();#undef main
int main()
{int ret = -1;AVFormatContext* ctx = avformat_alloc_context();ret = avformat_open_input(&ctx, "my.mp4", NULL, NULL);ret = avformat_find_stream_info(ctx, NULL);int videoindex = -1;for (int i = 0; i < ctx->nb_streams; i++){if (ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO){videoindex = i;break;}}const AVCodec* codec = avcodec_find_decoder(ctx->streams[videoindex]->codecpar->codec_id);AVCodecContext* avcc = avcodec_alloc_context3(codec);ret = avcodec_parameters_to_context(avcc, ctx->streams[videoindex]->codecpar);ret = avcodec_open2(avcc, codec, NULL);width = avcc->width;height = avcc->height;rect.x = 0;rect.y = 0;rect.h = height;rect.w = width;iniSdl();AVFrame* frame = av_frame_alloc();AVPacket* packet = av_packet_alloc();while (true){ret = av_read_frame(ctx, packet);if (ret >=0){if (packet->stream_index == videoindex){ret = avcodec_send_packet(avcc, packet);while (ret >= 0){ret = avcodec_receive_frame(avcc, frame);if (ret >= 0){display(frame);av_frame_unref(frame);}else{av_frame_unref(frame);break;}}}			}else{av_packet_unref(packet);break;}}SDL_DestroyWindow(window);std::cout << "finish\n";
}void display(AVFrame* frame)
{SDL_UpdateYUVTexture(texture, &rect, frame->data[0], frame->linesize[0], frame->data[1], frame->linesize[1], frame->data[2], frame->linesize[2]);SDL_RenderClear(renderer);SDL_RenderCopy(renderer, texture, NULL, NULL);SDL_RenderPresent(renderer);
}void iniSdl()
{SDL_Init(SDL_INIT_VIDEO);window = SDL_CreateWindow("test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_RESIZABLE);renderer = SDL_CreateRenderer(window, -1, 0);texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_IYUV, SDL_TEXTUREACCESS_STREAMING, width, height);
}

http://www.hrbkazy.com/news/16114.html

相关文章:

  • 自己做的网站 能收索么网络销售培训学校
  • 金融投资网站建设刷赞业务推广网站
  • 城市宣传网站建设方案app推广拉新一手渠道代理
  • 日本真人做爰直播网站淘宝seo是指什么
  • 网页源码怎么做网站网络营销方法有什么
  • 魔兽做宏网站拼多多女装关键词排名
  • 做个自己的网站需要多少钱手机如何创建网站
  • wordpress主题 demo博客seo教程
  • 公司禁用网站怎么做百度竞价投放
  • wordpress打开文章单页面网站如何优化
  • 网上订餐网站模板灰色行业推广平台网站
  • 做相亲网站的红娘累吗网址注册
  • wordpress系统管理密码忘记北京seo人员
  • 做株洲网站需要多少钱热点新闻事件
  • 东道设计是4a公司吗优化模型数学建模
  • html5 网站建设白度指数
  • 北京网站设计公司兴田德润放心seo千享科技
  • 响应式网站微博视频org域名注册
  • 平台网站建设源码杭州网站建设网页制作
  • 做外贸要做什么网站新的seo网站优化排名 网站
  • 怎么做查询网站网站seo分析常用的工具是
  • 体育网站的制作哪里可以做我想接app纯注册推广单
  • 网站建设有限公司海淀网站建设公司
  • 网站建设及营销方案免费做做网站
  • 自己做的网站怎样让百度搜到win优化大师官网
  • 怎么在阿里云建立网站百度指数购买
  • 网站外链接自己可以怎么做的女装标题优化关键词
  • 教人做美食的网站关键词工具有哪些
  • dedecms口腔医院类网站模板 织梦网站模板免费网络营销软件
  • 导航网站设计方案如何在百度提交自己的网站