FreeRDP
tsmf_ffmpeg.c File Reference
#include <freerdp/config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winpr/crt.h>
#include <freerdp/channels/log.h>
#include <freerdp/client/tsmf.h>
#include <libavcodec/avcodec.h>
#include <libavutil/common.h>
#include <libavutil/cpu.h>
#include <libavutil/imgutils.h>
#include "tsmf_constants.h"
#include "tsmf_decoder.h"
#include "tsmf_audio.h"

Macros

#define AVMEDIA_TYPE_VIDEO   0
 
#define AVMEDIA_TYPE_AUDIO   1
 
#define MAX_AUDIO_FRAME_SIZE   AVCODEC_MAX_AUDIO_FRAME_SIZE
 
#define AV_CODEC_ID_VC1   CODEC_ID_VC1
 
#define AV_CODEC_ID_WMAV2   CODEC_ID_WMAV2
 
#define AV_CODEC_ID_WMAPRO   CODEC_ID_WMAPRO
 
#define AV_CODEC_ID_MP3   CODEC_ID_MP3
 
#define AV_CODEC_ID_MP2   CODEC_ID_MP2
 
#define AV_CODEC_ID_MPEG2VIDEO   CODEC_ID_MPEG2VIDEO
 
#define AV_CODEC_ID_WMV3   CODEC_ID_WMV3
 
#define AV_CODEC_ID_AAC   CODEC_ID_AAC
 
#define AV_CODEC_ID_H264   CODEC_ID_H264
 
#define AV_CODEC_ID_AC3   CODEC_ID_AC3
 
#define AV_PIX_FMT_YUV420P   PIX_FMT_YUV420P
 

Functions

static BOOL tsmf_ffmpeg_init_context (ITSMFDecoder *decoder)
 
static BOOL tsmf_ffmpeg_init_video_stream (ITSMFDecoder *decoder, const TS_AM_MEDIA_TYPE *media_type)
 
static BOOL tsmf_ffmpeg_init_audio_stream (ITSMFDecoder *decoder, const TS_AM_MEDIA_TYPE *media_type)
 
static BOOL tsmf_ffmpeg_init_stream (ITSMFDecoder *decoder, const TS_AM_MEDIA_TYPE *media_type)
 
static BOOL tsmf_ffmpeg_prepare (ITSMFDecoder *decoder)
 
static BOOL tsmf_ffmpeg_set_format (ITSMFDecoder *decoder, TS_AM_MEDIA_TYPE *media_type)
 
static BOOL tsmf_ffmpeg_decode_video (ITSMFDecoder *decoder, const BYTE *data, UINT32 data_size, UINT32 extensions)
 
static BOOL tsmf_ffmpeg_decode_audio (ITSMFDecoder *decoder, const BYTE *data, UINT32 data_size, UINT32 extensions)
 
static BOOL tsmf_ffmpeg_decode (ITSMFDecoder *decoder, const BYTE *data, UINT32 data_size, UINT32 extensions)
 
static BYTEtsmf_ffmpeg_get_decoded_data (ITSMFDecoder *decoder, UINT32 *size)
 
static UINT32 tsmf_ffmpeg_get_decoded_format (ITSMFDecoder *decoder)
 
static BOOL tsmf_ffmpeg_get_decoded_dimension (ITSMFDecoder *decoder, UINT32 *width, UINT32 *height)
 
static void tsmf_ffmpeg_free (ITSMFDecoder *decoder)
 
static BOOL CALLBACK InitializeAvCodecs (PINIT_ONCE once, PVOID param, PVOID *context)
 
 WINPR_ASSERT (sptr)
 
 WLog_DBG (TAG, "TSMFDecoderEntry FFMPEG")
 
 if (!decoder) return ERROR_OUTOFMEMORY
 

Variables

static INIT_ONCE g_Initialized = INIT_ONCE_STATIC_INIT
 
sptr = NULL
 
TSMFFFmpegDecoder * decoder = NULL
 
decoder iface SetFormat = tsmf_ffmpeg_set_format
 
decoder iface Decode = tsmf_ffmpeg_decode
 
decoder iface GetDecodedData = tsmf_ffmpeg_get_decoded_data
 
decoder iface GetDecodedFormat = tsmf_ffmpeg_get_decoded_format
 
decoder iface GetDecodedDimension = tsmf_ffmpeg_get_decoded_dimension
 
decoder iface Free = tsmf_ffmpeg_free
 
return CHANNEL_RC_OK
 

Macro Definition Documentation

◆ AV_CODEC_ID_AAC

#define AV_CODEC_ID_AAC   CODEC_ID_AAC

◆ AV_CODEC_ID_AC3

#define AV_CODEC_ID_AC3   CODEC_ID_AC3

◆ AV_CODEC_ID_H264

#define AV_CODEC_ID_H264   CODEC_ID_H264

◆ AV_CODEC_ID_MP2

#define AV_CODEC_ID_MP2   CODEC_ID_MP2

◆ AV_CODEC_ID_MP3

#define AV_CODEC_ID_MP3   CODEC_ID_MP3

◆ AV_CODEC_ID_MPEG2VIDEO

#define AV_CODEC_ID_MPEG2VIDEO   CODEC_ID_MPEG2VIDEO

◆ AV_CODEC_ID_VC1

#define AV_CODEC_ID_VC1   CODEC_ID_VC1

◆ AV_CODEC_ID_WMAPRO

#define AV_CODEC_ID_WMAPRO   CODEC_ID_WMAPRO

◆ AV_CODEC_ID_WMAV2

#define AV_CODEC_ID_WMAV2   CODEC_ID_WMAV2

◆ AV_CODEC_ID_WMV3

#define AV_CODEC_ID_WMV3   CODEC_ID_WMV3

◆ AV_PIX_FMT_YUV420P

#define AV_PIX_FMT_YUV420P   PIX_FMT_YUV420P

◆ AVMEDIA_TYPE_AUDIO

#define AVMEDIA_TYPE_AUDIO   1

◆ AVMEDIA_TYPE_VIDEO

#define AVMEDIA_TYPE_VIDEO   0

FreeRDP: A Remote Desktop Protocol Implementation Video Redirection Virtual Channel - FFmpeg Decoder

Copyright 2010-2011 Vic Lee

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

◆ MAX_AUDIO_FRAME_SIZE

#define MAX_AUDIO_FRAME_SIZE   AVCODEC_MAX_AUDIO_FRAME_SIZE

Function Documentation

◆ if()

if ( decoder)

◆ InitializeAvCodecs()

static BOOL CALLBACK InitializeAvCodecs ( PINIT_ONCE  once,
PVOID  param,
PVOID *  context 
)
static

◆ tsmf_ffmpeg_decode()

static BOOL tsmf_ffmpeg_decode ( ITSMFDecoder *  decoder,
const BYTE data,
UINT32  data_size,
UINT32  extensions 
)
static
Here is the call graph for this function:

◆ tsmf_ffmpeg_decode_audio()

static BOOL tsmf_ffmpeg_decode_audio ( ITSMFDecoder *  decoder,
const BYTE data,
UINT32  data_size,
UINT32  extensions 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tsmf_ffmpeg_decode_video()

static BOOL tsmf_ffmpeg_decode_video ( ITSMFDecoder *  decoder,
const BYTE data,
UINT32  data_size,
UINT32  extensions 
)
static
Here is the caller graph for this function:

◆ tsmf_ffmpeg_free()

static void tsmf_ffmpeg_free ( ITSMFDecoder *  decoder)
static

◆ tsmf_ffmpeg_get_decoded_data()

static BYTE* tsmf_ffmpeg_get_decoded_data ( ITSMFDecoder *  decoder,
UINT32 *  size 
)
static

◆ tsmf_ffmpeg_get_decoded_dimension()

static BOOL tsmf_ffmpeg_get_decoded_dimension ( ITSMFDecoder *  decoder,
UINT32 *  width,
UINT32 *  height 
)
static

◆ tsmf_ffmpeg_get_decoded_format()

static UINT32 tsmf_ffmpeg_get_decoded_format ( ITSMFDecoder *  decoder)
static

◆ tsmf_ffmpeg_init_audio_stream()

static BOOL tsmf_ffmpeg_init_audio_stream ( ITSMFDecoder *  decoder,
const TS_AM_MEDIA_TYPE media_type 
)
static
Here is the caller graph for this function:

◆ tsmf_ffmpeg_init_context()

static BOOL tsmf_ffmpeg_init_context ( ITSMFDecoder *  decoder)
static
Here is the caller graph for this function:

◆ tsmf_ffmpeg_init_stream()

static BOOL tsmf_ffmpeg_init_stream ( ITSMFDecoder *  decoder,
const TS_AM_MEDIA_TYPE media_type 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tsmf_ffmpeg_init_video_stream()

static BOOL tsmf_ffmpeg_init_video_stream ( ITSMFDecoder *  decoder,
const TS_AM_MEDIA_TYPE media_type 
)
static
Here is the caller graph for this function:

◆ tsmf_ffmpeg_prepare()

static BOOL tsmf_ffmpeg_prepare ( ITSMFDecoder *  decoder)
static
Here is the caller graph for this function:

◆ tsmf_ffmpeg_set_format()

static BOOL tsmf_ffmpeg_set_format ( ITSMFDecoder *  decoder,
TS_AM_MEDIA_TYPE media_type 
)
static
Here is the call graph for this function:

◆ WINPR_ASSERT()

WINPR_ASSERT ( sptr  )
Here is the caller graph for this function:

◆ WLog_DBG()

WLog_DBG ( TAG  ,
"TSMFDecoderEntry FFMPEG"   
)

Variable Documentation

◆ CHANNEL_RC_OK

return CHANNEL_RC_OK

◆ Decode

decoder iface Decode = tsmf_ffmpeg_decode

◆ decoder

decoder = NULL

◆ Free

decoder iface Free = tsmf_ffmpeg_free

◆ g_Initialized

InitOnceExecuteOnce & g_Initialized = INIT_ONCE_STATIC_INIT
static

◆ GetDecodedData

decoder iface GetDecodedData = tsmf_ffmpeg_get_decoded_data

◆ GetDecodedDimension

decoder iface GetDecodedDimension = tsmf_ffmpeg_get_decoded_dimension

◆ GetDecodedFormat

decoder iface GetDecodedFormat = tsmf_ffmpeg_get_decoded_format

◆ SetFormat

decoder iface SetFormat = tsmf_ffmpeg_set_format

◆ sptr

* sptr = NULL