* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdint.h>
+
#include "avconv.h"
#include "libavfilter/avfilter.h"
#define DEF_CHOOSE_FORMAT(type, var, supported_list, none, get_name) \
static char *choose_ ## var ## s(OutputStream *ost) \
{ \
- if (ost->st->codec->var != none) { \
- get_name(ost->st->codec->var); \
+ if (ost->enc_ctx->var != none) { \
+ get_name(ost->enc_ctx->var); \
return av_strdup(name); \
} else if (ost->enc && ost->enc->supported_list) { \
const type *p; \
/* find the first unused stream of corresponding type */
for (i = 0; i < nb_input_streams; i++) {
ist = input_streams[i];
- if (ist->st->codec->codec_type == type && ist->discard)
+ if (ist->dec_ctx->codec_type == type && ist->discard)
break;
}
if (i == nb_input_streams) {
av_log(NULL, AV_LOG_FATAL, "Cannot find a matching stream for "
- "unlabeled input pad %d on filter %s", in->pad_idx,
+ "unlabeled input pad %d on filter %s\n", in->pad_idx,
in->filter_ctx->name);
exit(1);
}
char *pix_fmts;
OutputStream *ost = ofilter->ost;
OutputFile *of = output_files[ost->file_index];
- AVCodecContext *codec = ost->st->codec;
+ AVCodecContext *codec = ost->enc_ctx;
AVFilterContext *last_filter = out->filter_ctx;
int pad_idx = out->pad_idx;
int ret;
AVFilterContext *filter;
snprintf(name, sizeof(name), "pixel format for output stream %d:%d",
ost->file_index, ost->index);
- if ((ret = avfilter_graph_create_filter(&filter,
- avfilter_get_by_name("format"),
- "format", pix_fmts, NULL,
- fg->graph)) < 0)
+ ret = avfilter_graph_create_filter(&filter,
+ avfilter_get_by_name("format"),
+ "format", pix_fmts, NULL, fg->graph);
+ av_freep(&pix_fmts);
+ if (ret < 0)
return ret;
if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
return ret;
last_filter = filter;
pad_idx = 0;
- av_freep(&pix_fmts);
}
if (ost->frame_rate.num) {
{
OutputStream *ost = ofilter->ost;
OutputFile *of = output_files[ost->file_index];
- AVCodecContext *codec = ost->st->codec;
+ AVCodecContext *codec = ost->enc_ctx;
AVFilterContext *last_filter = out->filter_ctx;
int pad_idx = out->pad_idx;
char *sample_fmts, *sample_rates, *channel_layouts;
sar = ist->st->sample_aspect_ratio.num ?
ist->st->sample_aspect_ratio :
- ist->st->codec->sample_aspect_ratio;
- snprintf(args, sizeof(args), "%d:%d:%d:%d:%d:%d:%d", ist->st->codec->width,
- ist->st->codec->height, ist->st->codec->pix_fmt,
+ ist->dec_ctx->sample_aspect_ratio;
+ snprintf(args, sizeof(args), "%d:%d:%d:%d:%d:%d:%d", ist->dec_ctx->width,
+ ist->dec_ctx->height,
+ ist->hwaccel_retrieve_data ? ist->hwaccel_retrieved_pix_fmt : ist->dec_ctx->pix_fmt,
tb.num, tb.den, sar.num, sar.den);
snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index,
ist->file_index, ist->st->index);
snprintf(name, sizeof(name), "trim for input stream %d:%d",
ist->file_index, ist->st->index);
ret = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) ?
- AV_NOPTS_VALUE : 0, INT64_MAX, &last_filter, &pad_idx, name);
+ AV_NOPTS_VALUE : 0, f->recording_time, &last_filter, &pad_idx, name);
if (ret < 0)
return ret;
snprintf(args, sizeof(args), "time_base=%d/%d:sample_rate=%d:sample_fmt=%s"
":channel_layout=0x%"PRIx64,
- 1, ist->st->codec->sample_rate,
- ist->st->codec->sample_rate,
- av_get_sample_fmt_name(ist->st->codec->sample_fmt),
- ist->st->codec->channel_layout);
+ 1, ist->dec_ctx->sample_rate,
+ ist->dec_ctx->sample_rate,
+ av_get_sample_fmt_name(ist->dec_ctx->sample_fmt),
+ ist->dec_ctx->channel_layout);
snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index,
ist->file_index, ist->st->index);
snprintf(name, sizeof(name), "trim for input stream %d:%d",
ist->file_index, ist->st->index);
ret = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) ?
- AV_NOPTS_VALUE : 0, INT64_MAX, &last_filter, &pad_idx, name);
+ AV_NOPTS_VALUE : 0, f->recording_time, &last_filter, &pad_idx, name);
if (ret < 0)
return ret;