網頁

2016年5月17日 星期二

使用硬體解碼,顯示時間

const char *const vlc_args[] = {
"-I=dummy",
"--vout=dummy",
"--network-caching=5000",
"--sout=#transcode{avcodec-hw=dxva2,acodec=g711,vcodec=h264,soverlay,sfilter=marq{marquee=%Y/%m/%d %H:%M:%S.%l,x=10,y=50}}:rtp{sdp=rtsp://:8554/ch1}", "--sout-all", "--sout-keep",
"--verbose=2",
"--file-logging", logFile,
};
int vlc_argc = sizeof(vlc_args) / sizeof(vlc_args[0]);
vlcInstance = libvlc_new(vlc_argc, vlc_args);
const char *psz_mrl = "rtsp://169.254.1.168:554/live2.sdp";
media = libvlc_media_new_location(vlcInstance, psz_mrl);
mp = libvlc_media_player_new_from_media(media);

libvlc_media_release(media);
libvlc_media_player_play(mp);


vi ../modules/stream_out/transcode/transcode.c 
#define HW_TEXT N_("Hardware decoding")
#define HW_LONGTEXT N_("This allows hardware decoding when available.")
    add_string( SOUT_CFG_PREFIX "avcodec-hw", NULL, HW_TEXT,
              HW_LONGTEXT, true )
static const char *const ppsz_sout_options[] = {
    "venc", "vcodec", "vb",
    "scale", "fps", "width", "height", "vfilter", "deinterlace",
    "deinterlace-module", "threads", "aenc", "acodec", "ab", "alang",
    "afilter", "samplerate", "channels", "senc", "scodec", "soverlay",
    "sfilter", "osd", "high-priority", "maxwidth", "maxheight",
    "avcodec-hw", NULL
};
static int Open( vlc_object_t *p_this )
{
    config_ChainParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
                   p_stream->p_cfg );

    char *pAvcodecHw = var_GetString(p_stream, SOUT_CFG_PREFIX"avcodec-hw");
    msg_Dbg(p_stream, "transcode.Open avcodec-hw = %s NNN", pAvcodecHw);
    if (pAvcodecHw) {
        var_Create(p_stream, "avcodec-hw", VLC_VAR_STRING);
        var_SetString(p_stream, "avcodec-hw", pAvcodecHw);
    }
}

沒有留言:

張貼留言