~ubuntu-branches/ubuntu/saucy/x264/saucy-updates

« back to all changes in this revision

Viewing changes to input/ffms.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-19 07:28:39 UTC
  • mfrom: (12.1.11 experimental)
  • Revision ID: package-import@ubuntu.com-20120119072839-0vj6g40ky09d9nru
Tags: 2:0.120.2127+gitf33c8cb-2ubuntu1
* Merge from Debian, remaining changes:
  - build against libgpac-dev to enable .mp4 output

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
    return 0;
66
66
}
67
67
 
 
68
/* handle the deprecated jpeg pixel formats */
 
69
static int handle_jpeg( int csp, int *fullrange )
 
70
{
 
71
    switch( csp )
 
72
    {
 
73
        case PIX_FMT_YUVJ420P: *fullrange = 1; return PIX_FMT_YUV420P;
 
74
        case PIX_FMT_YUVJ422P: *fullrange = 1; return PIX_FMT_YUV422P;
 
75
        case PIX_FMT_YUVJ444P: *fullrange = 1; return PIX_FMT_YUV444P;
 
76
        default:                               return csp;
 
77
    }
 
78
}
 
79
 
68
80
static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, cli_input_opt_t *opt )
69
81
{
70
82
    ffms_hnd_t *h = calloc( 1, sizeof(ffms_hnd_t) );
119
131
    const FFMS_Frame *frame = FFMS_GetFrame( h->video_source, 0, &e );
120
132
    FAIL_IF_ERROR( !frame, "could not read frame 0\n" )
121
133
 
 
134
    info->fullrange  = 0;
122
135
    info->width      = frame->EncodedWidth;
123
136
    info->height     = frame->EncodedHeight;
124
 
    info->csp        = frame->EncodedPixelFormat | X264_CSP_OTHER;
 
137
    info->csp        = handle_jpeg( frame->EncodedPixelFormat, &info->fullrange ) | X264_CSP_OTHER;
125
138
    info->interlaced = frame->InterlacedFrame;
126
139
    info->tff        = frame->TopFieldFirst;
 
140
    info->fullrange |= frame->ColorRange == FFMS_CR_JPEG;
127
141
 
128
142
    /* ffms timestamps are in milliseconds. ffms also uses int64_ts for timebase,
129
143
     * so we need to reduce large timebases to prevent overflow */