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

手机网站建设的教程视频教程天津 app开发公司

手机网站建设的教程视频教程,天津 app开发公司,windows优化大师的特点,网站建设和维护面试题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.yayakq.cn/news/927720/

相关文章:

  • 广州网站建设新科分公司河南省住房城乡建设厅
  • 网站建设的空间是什么新氧网站头图怎么做的
  • 怎样做自己的摄影网站网站 动画 怎么做的
  • pc端和移动端的网站网站优化北京多少钱
  • 网站运营风险分析自媒体平台排名前十
  • 物理组简介 网站建设订阅号可以做网站吗
  • 导游网站如何建设的域名注册的网站都有哪些
  • 手机网站判断跳转代码工程承包
  • 建设宠物店网站携wordpress
  • 网站速度提升有人免费有片视频吗
  • 广州华茂建设工程有限公司 网站wordpress主题 可爱
  • iis6添加网站建筑人才网招聘网官网
  • 建设银行网站个人客户编程 朋友 做网站
  • 百度网站收录提交搭建网站复杂吗
  • 不注册公司可以做网站吗营销技巧培训ppt
  • 网站编程技术网页升级紧急通知在线
  • 企业如何做好网站建设创建全国文明城市宣传栏
  • 网站建设政务新媒体外贸跨境电商平台有哪些
  • 企业网站开发 语言 收录平顶山网站建设
  • 做淘客网站注意事项设计做兼职最好的网站
  • 关于科技园区建设文章的网站wordpress 单栏主题
  • 餐饮网站建设思路网站建设安全方案
  • 河北seo网站设计百度seo优化及推广
  • 如何建立自己网站视频教程中国建设银行广东分行网站
  • 建设部统计快报网站椒江建设网保障性阳光工程网站
  • 营销型网站可以吗做水果网站平台
  • 网站扫二维码怎么做网站的功能和特色
  • 交互网站wordpress可以装多少会员数据
  • 珠海市网站建设哪家好动漫设计需要什么学历
  • icp备案和网站不符网站上传文件